mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 00:39:00 +08:00
fix: api call on apply button
This commit is contained in:
parent
e3c4bfce52
commit
e0a7002a29
@ -17,6 +17,7 @@ import {
|
|||||||
SaveDashboard,
|
SaveDashboard,
|
||||||
SaveDashboardProps,
|
SaveDashboardProps,
|
||||||
} from 'store/actions/dashboard/saveDashboard';
|
} from 'store/actions/dashboard/saveDashboard';
|
||||||
|
import { UpdateQuery, UpdateQueryProps } from 'store/actions/dashboard/updateQuery';
|
||||||
import { AppState } from 'store/reducers';
|
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';
|
||||||
@ -39,6 +40,7 @@ const NewWidget = ({
|
|||||||
applySettingsToPanel,
|
applySettingsToPanel,
|
||||||
saveSettingOfPanel,
|
saveSettingOfPanel,
|
||||||
getQueryResults,
|
getQueryResults,
|
||||||
|
updateQuery
|
||||||
}: Props): JSX.Element => {
|
}: Props): JSX.Element => {
|
||||||
const { dashboards } = useSelector<AppState, DashboardReducer>(
|
const { dashboards } = useSelector<AppState, DashboardReducer>(
|
||||||
(state) => state.dashboards,
|
(state) => state.dashboards,
|
||||||
@ -120,7 +122,16 @@ const NewWidget = ({
|
|||||||
dashboardId,
|
dashboardId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onClickApplyHandler = useCallback(() => {
|
const onClickApplyHandler = () => {
|
||||||
|
selectedWidget?.query.forEach((element, index) => {
|
||||||
|
updateQuery({
|
||||||
|
widgetId: selectedWidget?.id || '',
|
||||||
|
query: element.query || '',
|
||||||
|
legend: element.legend || '',
|
||||||
|
currentIndex: index
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
applySettingsToPanel({
|
applySettingsToPanel({
|
||||||
description,
|
description,
|
||||||
isStacked: stacked,
|
isStacked: stacked,
|
||||||
@ -130,16 +141,7 @@ const NewWidget = ({
|
|||||||
title,
|
title,
|
||||||
widgetId: selectedWidget?.id || '',
|
widgetId: selectedWidget?.id || '',
|
||||||
});
|
});
|
||||||
}, [
|
}
|
||||||
applySettingsToPanel,
|
|
||||||
description,
|
|
||||||
opacity,
|
|
||||||
selectedTime,
|
|
||||||
selectedWidget?.id,
|
|
||||||
selectedNullZeroValue,
|
|
||||||
stacked,
|
|
||||||
title,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const onClickDiscardHandler = useCallback(() => {
|
const onClickDiscardHandler = useCallback(() => {
|
||||||
push(generatePath(ROUTES.DASHBOARD, { dashboardId }));
|
push(generatePath(ROUTES.DASHBOARD, { dashboardId }));
|
||||||
@ -220,6 +222,9 @@ interface DispatchProps {
|
|||||||
getQueryResults: (
|
getQueryResults: (
|
||||||
props: GetQueryResultsProps,
|
props: GetQueryResultsProps,
|
||||||
) => (dispatch: Dispatch<AppActions>) => void;
|
) => (dispatch: Dispatch<AppActions>) => void;
|
||||||
|
updateQuery: (
|
||||||
|
props: UpdateQueryProps,
|
||||||
|
) => (dispatch: Dispatch<AppActions>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = (
|
const mapDispatchToProps = (
|
||||||
@ -228,6 +233,7 @@ const mapDispatchToProps = (
|
|||||||
applySettingsToPanel: bindActionCreators(ApplySettingsToPanel, dispatch),
|
applySettingsToPanel: bindActionCreators(ApplySettingsToPanel, dispatch),
|
||||||
saveSettingOfPanel: bindActionCreators(SaveDashboard, dispatch),
|
saveSettingOfPanel: bindActionCreators(SaveDashboard, dispatch),
|
||||||
getQueryResults: bindActionCreators(GetQueryResults, dispatch),
|
getQueryResults: bindActionCreators(GetQueryResults, dispatch),
|
||||||
|
updateQuery: bindActionCreators(UpdateQuery, dispatch)
|
||||||
});
|
});
|
||||||
|
|
||||||
type Props = DispatchProps & NewWidgetProps;
|
type Props = DispatchProps & NewWidgetProps;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user