Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: global time is updated #2013

Merged
merged 30 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7aa947c
feat: global time is updated
palashgdev Jan 10, 2023
b6f52c0
Merge branch 'develop' into 1915
palashgdev Jan 10, 2023
47be0b2
Merge branch 'develop' into 1915
palashgdev Jan 11, 2023
fcd2724
fix: logs updating the global time is updated for min and max time
palashgdev Jan 11, 2023
9e1a7ae
Merge branch 'develop' into 1915
palashgdev Jan 13, 2023
450b8fc
chore: logs is updated
palashgdev Jan 15, 2023
4473bbf
Merge branch 'develop' into 1915
palashgdev Jan 15, 2023
57b249f
Merge branch 'develop' into 1915
palashgdev Jan 16, 2023
e235061
Merge branch 'develop' into 1915
palashgdev Jan 16, 2023
e952819
Merge branch 'develop' into 1915
palashgdev Jan 19, 2023
c9e8845
chore: removed duplicate action triggerance
palashgdev Jan 19, 2023
db82268
feat: onTagFilter is updated
palashgdev Jan 19, 2023
e90552d
chore: updated the restricted config
palashgdev Jan 19, 2023
650c453
Merge branch 'develop' into 1915
palashgdev Jan 20, 2023
e2b6c17
feat: global time is updated over logs
palashgdev Jan 22, 2023
d8f145e
Merge branch 'develop' into 1915
palashgdev Jan 23, 2023
b16d8c0
Merge branch 'develop' into 1915
palashgdev Jan 23, 2023
05309f5
Merge branch 'develop' into 1915
palashgdev Jan 23, 2023
fa0439e
Merge branch 'develop' into 1915
palashgdev Jan 24, 2023
4d5d849
Merge branch 'develop' into 1915
srikanthccv Jan 25, 2023
56f1205
Merge branch 'develop' into 1915
palashgdev Jan 25, 2023
085eaf4
Merge branch 'develop' into 1915
makeavish Jan 25, 2023
ae27b0a
Merge branch 'develop' into 1915
palashgdev Jan 31, 2023
6f40dcc
chore: global time is handled
palashgdev Jan 31, 2023
9e6b0ff
chore: color is updated
palashgdev Jan 31, 2023
d676de5
Merge branch 'develop' into 1915
palashgdev Jan 31, 2023
470bf0d
Merge branch 'develop' into 1915
palashgdev Jan 31, 2023
3e7d4cd
Merge branch 'develop' into 1915
palashgdev Feb 1, 2023
5644bb9
Merge branch 'develop' into 1915
makeavish Feb 1, 2023
860bebf
Merge branch 'develop' into 1915
palashgdev Feb 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion frontend/src/container/LogControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
RightOutlined,
} from '@ant-design/icons';
import { Button, Divider, Select } from 'antd';
import { getMinMax } from 'container/TopNav/AutoRefresh/config';
import React, { memo, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
Expand All @@ -13,6 +14,7 @@ import {
RESET_ID_START_AND_END,
SET_LOG_LINES_PER_PAGE,
} from 'types/actions/logs';
import { GlobalReducer } from 'types/reducer/globalTime';
import { ILogsReducer } from 'types/reducer/logs';

import { ITEMS_PER_PAGE_OPTIONS } from './config';
Expand All @@ -28,29 +30,72 @@ function LogControls(): JSX.Element | null {
isLoadingAggregate,
logs,
} = useSelector<AppState, ILogsReducer>((state) => state.logs);
const globalTime = useSelector<AppState, GlobalReducer>(
(state) => state.globalTime,
);
const dispatch = useDispatch();

const handleLogLinesPerPageChange = (e: number): void => {
const { maxTime, minTime } = getMinMax(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
);

dispatch({
type: SET_LOG_LINES_PER_PAGE,
payload: e,
payload: {
logLinesPerPage: e,
maxTime,
minTime,
},
});
};

const handleGoToLatest = (): void => {
const { maxTime, minTime } = getMinMax(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
);

dispatch({
type: RESET_ID_START_AND_END,
payload: {
maxTime,
minTime,
},
});
};

const handleNavigatePrevious = (): void => {
const { maxTime, minTime } = getMinMax(
globalTime.selectedTime,
palashgdev marked this conversation as resolved.
Show resolved Hide resolved
globalTime.minTime,
globalTime.maxTime,
);

dispatch({
type: GET_PREVIOUS_LOG_LINES,
payload: {
maxTime,
minTime,
},
});
};
const handleNavigateNext = (): void => {
const { maxTime, minTime } = getMinMax(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
);

dispatch({
type: GET_NEXT_LOG_LINES,
payload: {
minTime,
maxTime,
},
});
};

Expand Down
16 changes: 11 additions & 5 deletions frontend/src/container/LogsSearchFilter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Input, InputRef, Popover } from 'antd';
import { getMinMax } from 'container/TopNav/AutoRefresh/config';
import useUrlQuery from 'hooks/useUrlQuery';
import getStep from 'lib/getStep';
import { debounce } from 'lodash-es';
Expand Down Expand Up @@ -45,7 +46,7 @@ function SearchFilter({
AppState,
ILogsReducer
>((state) => state.logs);
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
const globalTime = useSelector<AppState, GlobalReducer>(
(state) => state.globalTime,
);
const dispatch = useDispatch<Dispatch<AppActions>>();
Expand Down Expand Up @@ -86,6 +87,12 @@ function SearchFilter({
0,
);
} else {
const { maxTime, minTime } = getMinMax(
globalTime.selectedTime,
globalTime.minTime,
globalTime.maxTime,
);

getLogs({
q: customQuery,
limit: logLinesPerPage,
Expand Down Expand Up @@ -117,8 +124,7 @@ function SearchFilter({
idStart,
liveTail,
logLinesPerPage,
maxTime,
minTime,
globalTime,
],
);

Expand All @@ -145,12 +151,12 @@ function SearchFilter({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
urlQueryString,
maxTime,
minTime,
idEnd,
idStart,
logLinesPerPage,
dispatch,
globalTime.maxTime,
globalTime.minTime,
]);

return (
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/store/reducers/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import {
UPDATE_AUTO_REFRESH_INTERVAL,
UPDATE_TIME_INTERVAL,
} from 'types/actions/globalTime';
import {
GET_NEXT_LOG_LINES,
GET_PREVIOUS_LOG_LINES,
RESET_ID_START_AND_END,
SET_LOG_LINES_PER_PAGE,
} from 'types/actions/logs';
import { GlobalReducer } from 'types/reducer/globalTime';

const intitalState: GlobalReducer = {
Expand Down Expand Up @@ -53,6 +59,17 @@ const globalTimeReducer = (
};
}

case GET_NEXT_LOG_LINES:
case GET_PREVIOUS_LOG_LINES:
case RESET_ID_START_AND_END:
case SET_LOG_LINES_PER_PAGE: {
return {
...state,
maxTime: action.payload.maxTime,
minTime: action.payload.minTime,
};
}

default:
return state;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/reducers/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const LogsReducer = (
case SET_LOG_LINES_PER_PAGE: {
return {
...state,
logLinesPerPage: action.payload,
logLinesPerPage: action.payload.logsLinesPerPage,
};
}

Expand Down
13 changes: 12 additions & 1 deletion frontend/src/types/actions/globalTime.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Time } from 'container/TopNav/DateTimeSelection/config';

import {
NextLogsLines,
PreviousLogsLines,
ResetIdStartAndEnd,
SetLogsLinesPerPage,
} from './logs';

export const UPDATE_TIME_INTERVAL = 'UPDATE_TIME_INTERVAL';
export const GLOBAL_TIME_LOADING_START = 'GLOBAL_TIME_LOADING_START';
export const UPDATE_AUTO_REFRESH_DISABLED = 'UPDATE_AUTO_REFRESH_DISABLED';
Expand Down Expand Up @@ -37,4 +44,8 @@ export type GlobalTimeAction =
| UpdateTimeInterval
| GlobalTimeLoading
| UpdateAutoRefreshDisabled
| UpdateAutoRefreshInterval;
| UpdateAutoRefreshInterval
| NextLogsLines
| PreviousLogsLines
| ResetIdStartAndEnd
| SetLogsLinesPerPage;
11 changes: 10 additions & 1 deletion frontend/src/types/actions/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { TLogsLiveTailState } from 'types/api/logs/liveTail';
import { ILog } from 'types/api/logs/log';
import { ILogsAggregate } from 'types/api/logs/logAggregate';

import { GlobalTime } from './globalTime';

// export const GET_SERVICE_LIST_SUCCESS = 'GET_SERVICE_LIST_SUCCESS';
// export const GET_SERVICE_LIST_LOADING_START = 'GET_SERVICE_LIST_LOADING_START';
// export const GET_SERVICE_LIST_ERROR = 'GET_SERVICE_LIST_ERROR';
Expand Down Expand Up @@ -75,17 +77,24 @@ export interface UpdateLogs {
}
export interface SetLogsLinesPerPage {
type: typeof SET_LOG_LINES_PER_PAGE;
payload: number;
payload: {
logsLinesPerPage: number;
minTime: GlobalTime['minTime'];
maxTime: GlobalTime['maxTime'];
};
}

export interface PreviousLogsLines {
type: typeof GET_PREVIOUS_LOG_LINES;
payload: GlobalTime;
}
export interface NextLogsLines {
type: typeof GET_NEXT_LOG_LINES;
payload: GlobalTime;
}
export interface ResetIdStartAndEnd {
type: typeof RESET_ID_START_AND_END;
payload: GlobalTime;
}
export interface SetLoading {
type: typeof SET_LOADING;
Expand Down