mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard: Clear current dashboard when moving away from dashboard (#66538)
This commit is contained in:
@@ -50,14 +50,11 @@ export class DashboardSrv {
|
|||||||
return new DashboardModel(dashboard, meta);
|
return new DashboardModel(dashboard, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrent(dashboard: DashboardModel) {
|
setCurrent(dashboard: DashboardModel | undefined) {
|
||||||
this.dashboard = dashboard;
|
this.dashboard = dashboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrent(): DashboardModel | undefined {
|
getCurrent(): DashboardModel | undefined {
|
||||||
if (!this.dashboard) {
|
|
||||||
console.warn('Calling getDashboardSrv().getCurrent() without calling getDashboardSrv().setCurrent() first.');
|
|
||||||
}
|
|
||||||
return this.dashboard;
|
return this.dashboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { DashboardAcl, DashboardAclUpdateDTO, NewDashboardAclItem, PermissionLev
|
|||||||
|
|
||||||
import { loadPluginDashboards } from '../../plugins/admin/state/actions';
|
import { loadPluginDashboards } from '../../plugins/admin/state/actions';
|
||||||
import { cancelVariables } from '../../variables/state/actions';
|
import { cancelVariables } from '../../variables/state/actions';
|
||||||
|
import { getDashboardSrv } from '../services/DashboardSrv';
|
||||||
import { getTimeSrv } from '../services/TimeSrv';
|
import { getTimeSrv } from '../services/TimeSrv';
|
||||||
|
|
||||||
import { cleanUpDashboard, loadDashboardPermissions } from './reducers';
|
import { cleanUpDashboard, loadDashboardPermissions } from './reducers';
|
||||||
@@ -124,10 +125,12 @@ export const cleanUpDashboardAndVariables = (): ThunkResult<void> => (dispatch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTimeSrv().stopAutoRefresh();
|
getTimeSrv().stopAutoRefresh();
|
||||||
|
|
||||||
dispatch(cleanUpDashboard());
|
dispatch(cleanUpDashboard());
|
||||||
dispatch(removeAllPanels());
|
dispatch(removeAllPanels());
|
||||||
|
|
||||||
dashboardWatcher.leave();
|
dashboardWatcher.leave();
|
||||||
|
|
||||||
|
getDashboardSrv().setCurrent(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateTimeZoneDashboard =
|
export const updateTimeZoneDashboard =
|
||||||
|
|||||||
Reference in New Issue
Block a user