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