mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Dashboard: Use preferred timezone on create (#89833)
* Dashboard: Use preferred timezone on create * Add test
This commit is contained in:
parent
92ad6c71d1
commit
df15678455
@ -44,6 +44,11 @@ jest.mock('@grafana/runtime', () => ({
|
||||
featureToggles: {
|
||||
newDashboardWithFiltersAndGroupBy: false,
|
||||
},
|
||||
bootData: {
|
||||
user: {
|
||||
timezone: 'Africa/Abidjan',
|
||||
},
|
||||
},
|
||||
},
|
||||
getDataSourceSrv: () => ({
|
||||
get: (): Promise<DataSourceApi> => {
|
||||
@ -72,5 +77,10 @@ describe('buildNewDashboardSaveModel', () => {
|
||||
expect(result.dashboard.templating?.list?.[0].type).toBe('adhoc');
|
||||
expect(result.dashboard.templating?.list?.[1].type).toBe('groupby');
|
||||
});
|
||||
|
||||
it("should set the new dashboard's timezone to the user's timezone", async () => {
|
||||
const result = await buildNewDashboardSaveModel();
|
||||
expect(result.dashboard.timezone).toEqual('Africa/Abidjan');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -46,6 +46,7 @@ export async function buildNewDashboardSaveModel(urlFolderUid?: string): Promise
|
||||
uid: '',
|
||||
title: 'New dashboard',
|
||||
panels: [],
|
||||
timezone: config.bootData.user?.timezone || defaultDashboard.timezone,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user