mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Unify angular auto-migration code (#63915)
This commit is contained in:
@@ -85,7 +85,9 @@ it('handles a default datasource in a template variable', async () => {
|
||||
],
|
||||
},
|
||||
};
|
||||
const dashboardModel = new DashboardModel(dashboard, {}, () => dashboard.templating.list);
|
||||
const dashboardModel = new DashboardModel(dashboard, undefined, {
|
||||
getVariablesFromState: () => dashboard.templating.list,
|
||||
});
|
||||
const exporter = new DashboardExporter();
|
||||
const exported: any = await exporter.makeExportable(dashboardModel);
|
||||
expect(exported.templating.list[0].datasource.uid).toBe('${DS_GFDB}');
|
||||
@@ -105,7 +107,9 @@ it('If a panel queries has no datasource prop ignore it', async () => {
|
||||
},
|
||||
],
|
||||
};
|
||||
const dashboardModel = new DashboardModel(dashboard, {}, () => []);
|
||||
const dashboardModel = new DashboardModel(dashboard, undefined, {
|
||||
getVariablesFromState: () => [],
|
||||
});
|
||||
const exporter = new DashboardExporter();
|
||||
const exported: any = await exporter.makeExportable(dashboardModel);
|
||||
expect(exported.panels[0].datasource).toEqual({ uid: '${DS_OTHER}', type: 'other' });
|
||||
@@ -230,7 +234,13 @@ describe('given dashboard with repeated panels', () => {
|
||||
info: { version: '1.1.2' },
|
||||
} as PanelPluginMeta;
|
||||
|
||||
dash = new DashboardModel(dash, {}, () => dash.templating.list);
|
||||
dash = new DashboardModel(
|
||||
dash,
|
||||
{},
|
||||
{
|
||||
getVariablesFromState: () => dash.templating.list,
|
||||
}
|
||||
);
|
||||
|
||||
// init library panels
|
||||
dash.getPanelById(17).initLibraryPanel({
|
||||
|
||||
Reference in New Issue
Block a user