mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 03:35:52 +08:00
fix: logs time is fixed (#1772)
* fix: logs parsing is fixed * fix: start and end time is updated
This commit is contained in:
parent
7e590f4bfb
commit
5ae9557293
@ -1,3 +1,7 @@
|
||||
import GetMinMax, { GetMinMaxPayload } from 'lib/getMinMax';
|
||||
|
||||
import { Time } from '../DateTimeSelection/config';
|
||||
|
||||
export const options: IOptions[] = [
|
||||
{
|
||||
label: 'off',
|
||||
@ -61,3 +65,12 @@ export interface IOptions {
|
||||
key: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export const getMinMax = (
|
||||
selectedTime: Time,
|
||||
minTime: number,
|
||||
maxTime: number,
|
||||
): GetMinMaxPayload =>
|
||||
selectedTime !== 'custom'
|
||||
? GetMinMax(selectedTime)
|
||||
: GetMinMax(selectedTime, [minTime, maxTime]);
|
||||
|
@ -12,7 +12,6 @@ import { CheckboxChangeEvent } from 'antd/lib/checkbox';
|
||||
import get from 'api/browser/localstorage/get';
|
||||
import set from 'api/browser/localstorage/set';
|
||||
import { DASHBOARD_TIME_IN_DURATION } from 'constants/app';
|
||||
import dayjs from 'dayjs';
|
||||
import useUrlQuery from 'hooks/useUrlQuery';
|
||||
import _omit from 'lodash-es/omit';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
@ -28,21 +27,19 @@ import {
|
||||
} from 'types/actions/globalTime';
|
||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||
|
||||
import { options } from './config';
|
||||
import { getMinMax, options } from './config';
|
||||
import { ButtonContainer, Container } from './styles';
|
||||
|
||||
function AutoRefresh({ disabled = false }: AutoRefreshProps): JSX.Element {
|
||||
const {
|
||||
minTime: initialMinTime,
|
||||
selectedTime,
|
||||
isAutoRefreshDisabled,
|
||||
} = useSelector<AppState, GlobalReducer>((state) => state.globalTime);
|
||||
const globalTime = useSelector<AppState, GlobalReducer>(
|
||||
(state) => state.globalTime,
|
||||
);
|
||||
const { pathname } = useLocation();
|
||||
|
||||
const isDisabled = useMemo(() => disabled || isAutoRefreshDisabled, [
|
||||
isAutoRefreshDisabled,
|
||||
disabled,
|
||||
]);
|
||||
const isDisabled = useMemo(
|
||||
() => disabled || globalTime.isAutoRefreshDisabled,
|
||||
[globalTime.isAutoRefreshDisabled, disabled],
|
||||
);
|
||||
|
||||
const localStorageData = JSON.parse(get(DASHBOARD_TIME_IN_DURATION) || '{}');
|
||||
|
||||
@ -89,14 +86,18 @@ function AutoRefresh({ disabled = false }: AutoRefreshProps): JSX.Element {
|
||||
}
|
||||
|
||||
if (selectedOption !== 'off' && selectedValue) {
|
||||
const min = initialMinTime / 1000000;
|
||||
const { maxTime, minTime } = getMinMax(
|
||||
globalTime.selectedTime,
|
||||
globalTime.minTime,
|
||||
globalTime.maxTime,
|
||||
);
|
||||
|
||||
dispatch({
|
||||
type: UPDATE_TIME_INTERVAL,
|
||||
payload: {
|
||||
maxTime: dayjs().valueOf() * 1000000,
|
||||
minTime: dayjs(min).subtract(selectedValue, 'second').valueOf() * 1000000,
|
||||
selectedTime,
|
||||
maxTime,
|
||||
minTime,
|
||||
selectedTime: globalTime.selectedTime,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ const GetMinMax = (
|
||||
};
|
||||
};
|
||||
|
||||
interface GetMinMaxPayload {
|
||||
export interface GetMinMaxPayload {
|
||||
minTime: GlobalReducer['minTime'];
|
||||
maxTime: GlobalReducer['maxTime'];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user