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

Bug 2000473: Monitoring dashboards: Fix clearing variables when changing dashboard #9969

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions frontend/public/actions/ui.ts
Expand Up @@ -26,7 +26,6 @@ export enum ActionType {
SetActiveNamespace = 'setActiveNamespace',
SetCreateProjectMessage = 'setCreateProjectMessage',
SetCurrentLocation = 'setCurrentLocation',
MonitoringDashboardsClearVariables = 'monitoringDashboardsClearVariables',
MonitoringDashboardsPatchVariable = 'monitoringDashboardsPatchVariable',
MonitoringDashboardsPatchAllVariables = 'monitoringDashboardsPatchAllVariables',
MonitoringDashboardsSetEndTime = 'monitoringDashboardsSetEndTime',
Expand Down Expand Up @@ -299,8 +298,6 @@ export const updateOverviewLabels = (labels: string[]) =>
action(ActionType.UpdateOverviewLabels, { labels });
export const updateOverviewFilterValue = (value: string) =>
action(ActionType.UpdateOverviewFilterValue, { value });
export const monitoringDashboardsClearVariables = () =>
action(ActionType.MonitoringDashboardsClearVariables);
export const monitoringDashboardsPatchVariable = (key: string, patch: any, perspective: string) =>
action(ActionType.MonitoringDashboardsPatchVariable, { key, patch, perspective });
export const monitoringDashboardsPatchAllVariables = (variables: any, perspective: string) =>
Expand Down Expand Up @@ -335,7 +332,7 @@ export const monitoringLoaded = (
});
export const monitoringErrored = (
key: 'alerts' | 'silences' | 'notificationAlerts' | 'devAlerts',
loadError: any,
loadError: Error,
perspective = 'admin',
) =>
action(ActionType.SetMonitoringData, {
Expand Down Expand Up @@ -416,7 +413,6 @@ const uiActions = {
updateOverviewSelectedGroup,
updateOverviewLabels,
updateOverviewFilterValue,
monitoringDashboardsClearVariables,
monitoringDashboardsPatchVariable,
monitoringDashboardsPatchAllVariables,
monitoringDashboardsSetEndTime,
Expand Down
7 changes: 4 additions & 3 deletions frontend/public/components/monitoring/dashboards/index.tsx
Expand Up @@ -648,6 +648,10 @@ const MonitoringDashboardsPage: React.FC<MonitoringDashboardsPageProps> = ({ mat
}
}
if (newBoard !== board) {
if (getQueryArgument('dashboard') !== newBoard) {
history.replace(url);
}

const allVariables = getAllVariables(boards, newBoard, namespace);
dispatch(monitoringDashboardsPatchAllVariables(allVariables, activePerspective));

Expand All @@ -666,9 +670,6 @@ const MonitoringDashboardsPage: React.FC<MonitoringDashboardsPageProps> = ({ mat
);

setBoard(newBoard);
if (getQueryArgument('dashboard') !== newBoard) {
history.replace(url);
}
}
},
[activePerspective, board, boards, dispatch, namespace],
Expand Down
3 changes: 0 additions & 3 deletions frontend/public/reducers/ui.ts
Expand Up @@ -142,9 +142,6 @@ export default (state: UIState, action: UIAction): UIState => {
case ActionType.SetUser:
return state.set('user', action.payload.user);

case ActionType.MonitoringDashboardsClearVariables:
return state.setIn(['monitoringDashboards', 'variables'], ImmutableMap());

case ActionType.MonitoringDashboardsPatchVariable:
return state.mergeIn(
['monitoringDashboards', action.payload.perspective, 'variables', action.payload.key],
Expand Down