Dashboard Settings: Fix TimeZone dropdown doesn't change the timezone (#35680)

* Use redux action to update dashboard.timezone
* Added unit test

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
This commit is contained in:
Maria Alexandra
2021-06-16 08:31:16 +02:00
committed by GitHub
parent 7a9d8e4230
commit 182b03aa8f
3 changed files with 97 additions and 2 deletions

View File

@@ -11,12 +11,14 @@ import {
} from './reducers';
import { notifyApp } from 'app/core/actions';
import { loadPanelPlugin } from 'app/features/plugins/state/actions';
import { updateTimeZoneForSession } from 'app/features/profile/state/reducers';
// Types
import { DashboardAcl, DashboardAclUpdateDTO, NewDashboardAclItem, PermissionLevel, ThunkResult } from 'app/types';
import { PanelModel } from './PanelModel';
import { cancelVariables } from '../../variables/state/actions';
import { getPanelPluginNotFound } from '../dashgrid/PanelPluginError';
import { getTimeSrv } from '../services/TimeSrv';
import { TimeZone } from '@grafana/data';
export function getDashboardPermissions(id: number): ThunkResult<void> {
return async (dispatch) => {
@@ -181,3 +183,8 @@ export const cleanUpDashboardAndVariables = (): ThunkResult<void> => (dispatch,
dispatch(cleanUpDashboard());
dispatch(cancelVariables());
};
export const updateTimeZoneDashboard = (timeZone: TimeZone): ThunkResult<void> => (dispatch) => {
dispatch(updateTimeZoneForSession(timeZone));
getTimeSrv().refreshDashboard();
};