mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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: {
|
featureToggles: {
|
||||||
newDashboardWithFiltersAndGroupBy: false,
|
newDashboardWithFiltersAndGroupBy: false,
|
||||||
},
|
},
|
||||||
|
bootData: {
|
||||||
|
user: {
|
||||||
|
timezone: 'Africa/Abidjan',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
getDataSourceSrv: () => ({
|
getDataSourceSrv: () => ({
|
||||||
get: (): Promise<DataSourceApi> => {
|
get: (): Promise<DataSourceApi> => {
|
||||||
@ -72,5 +77,10 @@ describe('buildNewDashboardSaveModel', () => {
|
|||||||
expect(result.dashboard.templating?.list?.[0].type).toBe('adhoc');
|
expect(result.dashboard.templating?.list?.[0].type).toBe('adhoc');
|
||||||
expect(result.dashboard.templating?.list?.[1].type).toBe('groupby');
|
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: '',
|
uid: '',
|
||||||
title: 'New dashboard',
|
title: 'New dashboard',
|
||||||
panels: [],
|
panels: [],
|
||||||
|
timezone: config.bootData.user?.timezone || defaultDashboard.timezone,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user