mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 00:16:07 +08:00
fix(UI): latest timestamp bug is resolved (#494)
fix(UI): latest timestamp bug is resolved (#494)
This commit is contained in:
parent
0f39643a56
commit
7f800c94ae
@ -21,6 +21,7 @@ import { AppState } from 'store/reducers';
|
|||||||
import AppActions from 'types/actions';
|
import AppActions from 'types/actions';
|
||||||
import { GlobalTime } from 'types/actions/globalTime';
|
import { GlobalTime } from 'types/actions/globalTime';
|
||||||
import DashboardReducer from 'types/reducer/dashboards';
|
import DashboardReducer from 'types/reducer/dashboards';
|
||||||
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
|
|
||||||
import LeftContainer from './LeftContainer';
|
import LeftContainer from './LeftContainer';
|
||||||
import RightContainer from './RightContainer';
|
import RightContainer from './RightContainer';
|
||||||
@ -42,9 +43,10 @@ const NewWidget = ({
|
|||||||
const { dashboards } = useSelector<AppState, DashboardReducer>(
|
const { dashboards } = useSelector<AppState, DashboardReducer>(
|
||||||
(state) => state.dashboards,
|
(state) => state.dashboards,
|
||||||
);
|
);
|
||||||
const { maxTime, minTime } = useSelector<AppState, GlobalTime>(
|
const { maxTime, minTime, selectedTime: globalSelectedInterval } = useSelector<
|
||||||
(state) => state.globalTime,
|
AppState,
|
||||||
);
|
GlobalReducer
|
||||||
|
>((state) => state.globalTime);
|
||||||
|
|
||||||
const [selectedDashboard] = dashboards;
|
const [selectedDashboard] = dashboards;
|
||||||
|
|
||||||
@ -146,12 +148,11 @@ const NewWidget = ({
|
|||||||
const getQueryResult = useCallback(() => {
|
const getQueryResult = useCallback(() => {
|
||||||
if (selectedWidget?.id.length !== 0) {
|
if (selectedWidget?.id.length !== 0) {
|
||||||
getQueryResults({
|
getQueryResults({
|
||||||
maxTime,
|
|
||||||
minTime,
|
|
||||||
query: selectedWidget?.query || [],
|
query: selectedWidget?.query || [],
|
||||||
selectedTime: selectedTime.enum,
|
selectedTime: selectedTime.enum,
|
||||||
widgetId: selectedWidget?.id || '',
|
widgetId: selectedWidget?.id || '',
|
||||||
graphType: selectedGraph,
|
graphType: selectedGraph,
|
||||||
|
globalSelectedInterval,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
|
@ -3,10 +3,13 @@ import { AxiosError } from 'axios';
|
|||||||
import { ITEMS } from 'container/NewDashboard/ComponentsSlider/menuItems';
|
import { ITEMS } from 'container/NewDashboard/ComponentsSlider/menuItems';
|
||||||
import { timePreferenceType } from 'container/NewWidget/RightContainer/timeItems';
|
import { timePreferenceType } from 'container/NewWidget/RightContainer/timeItems';
|
||||||
import GetMaxMinTime from 'lib/getMaxMinTime';
|
import GetMaxMinTime from 'lib/getMaxMinTime';
|
||||||
|
import GetMinMax from 'lib/getMinMax';
|
||||||
import GetStartAndEndTime from 'lib/getStartAndEndTime';
|
import GetStartAndEndTime from 'lib/getStartAndEndTime';
|
||||||
import { Dispatch } from 'redux';
|
import { Dispatch } from 'redux';
|
||||||
import AppActions from 'types/actions';
|
import AppActions from 'types/actions';
|
||||||
import { Query } from 'types/api/dashboard/getAll';
|
import { Query } from 'types/api/dashboard/getAll';
|
||||||
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
|
import store from 'store';
|
||||||
|
|
||||||
export const GetQueryResults = (
|
export const GetQueryResults = (
|
||||||
props: GetQueryResultsProps,
|
props: GetQueryResultsProps,
|
||||||
@ -15,10 +18,17 @@ export const GetQueryResults = (
|
|||||||
try {
|
try {
|
||||||
const queryData = props.query;
|
const queryData = props.query;
|
||||||
|
|
||||||
|
const { globalTime } = store.getState();
|
||||||
|
|
||||||
|
const minMax = GetMinMax(props.globalSelectedInterval, [
|
||||||
|
globalTime.minTime / 1000000,
|
||||||
|
globalTime.maxTime / 1000000,
|
||||||
|
]);
|
||||||
|
|
||||||
const getMaxMinTime = GetMaxMinTime({
|
const getMaxMinTime = GetMaxMinTime({
|
||||||
graphType: props.graphType,
|
graphType: props.graphType,
|
||||||
maxTime: props.maxTime,
|
maxTime: minMax.maxTime,
|
||||||
minTime: props.minTime,
|
minTime: minMax.minTime,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { end, start } = GetStartAndEndTime({
|
const { end, start } = GetStartAndEndTime({
|
||||||
@ -92,8 +102,7 @@ export const GetQueryResults = (
|
|||||||
export interface GetQueryResultsProps {
|
export interface GetQueryResultsProps {
|
||||||
widgetId: string;
|
widgetId: string;
|
||||||
selectedTime: timePreferenceType;
|
selectedTime: timePreferenceType;
|
||||||
maxTime: number;
|
|
||||||
minTime: number;
|
|
||||||
query: Query[];
|
query: Query[];
|
||||||
graphType: ITEMS;
|
graphType: ITEMS;
|
||||||
|
globalSelectedInterval: GlobalReducer['selectedTime'];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user