mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Fixes issue with dashboard starting with auto refresh set (#93756)
This commit is contained in:
parent
b68d9630fb
commit
57ab354139
@ -280,7 +280,7 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back
|
|||||||
],
|
],
|
||||||
"preload": false,
|
"preload": false,
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
"schemaVersion": 39,
|
"schemaVersion": 40,
|
||||||
"tags": [
|
"tags": [
|
||||||
"templating",
|
"templating",
|
||||||
"gdev",
|
"gdev",
|
||||||
@ -548,7 +548,7 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
|
|||||||
],
|
],
|
||||||
"preload": false,
|
"preload": false,
|
||||||
"refresh": "5m",
|
"refresh": "5m",
|
||||||
"schemaVersion": 39,
|
"schemaVersion": 40,
|
||||||
"tags": [
|
"tags": [
|
||||||
"tag1",
|
"tag1",
|
||||||
"tag2",
|
"tag2",
|
||||||
@ -906,7 +906,7 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
|
|||||||
],
|
],
|
||||||
"preload": false,
|
"preload": false,
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
"schemaVersion": 39,
|
"schemaVersion": 40,
|
||||||
"tags": [
|
"tags": [
|
||||||
"gdev",
|
"gdev",
|
||||||
"graph-ng",
|
"graph-ng",
|
||||||
|
@ -2413,6 +2413,21 @@ describe('when migrating table cell display mode to cell options', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when migrating variable refresh to on dashboard load', () => {
|
||||||
|
let model: DashboardModel;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
model = new DashboardModel({
|
||||||
|
//@ts-ignore
|
||||||
|
refresh: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should migrate to empty string', () => {
|
||||||
|
expect(model.refresh).toBe('');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function createRow(options: any, panelDescriptions: any[]) {
|
function createRow(options: any, panelDescriptions: any[]) {
|
||||||
const PANEL_HEIGHT_STEP = GRID_CELL_HEIGHT + GRID_CELL_VMARGIN;
|
const PANEL_HEIGHT_STEP = GRID_CELL_HEIGHT + GRID_CELL_VMARGIN;
|
||||||
const { collapse, showTitle, title, repeat, repeatIteration } = options;
|
const { collapse, showTitle, title, repeat, repeatIteration } = options;
|
||||||
|
@ -81,7 +81,7 @@ type PanelSchemeUpgradeHandler = (panel: PanelModel) => PanelModel;
|
|||||||
* kinds/dashboard/dashboard_kind.cue
|
* kinds/dashboard/dashboard_kind.cue
|
||||||
* Example PR: #87712
|
* Example PR: #87712
|
||||||
*/
|
*/
|
||||||
export const DASHBOARD_SCHEMA_VERSION = 39;
|
export const DASHBOARD_SCHEMA_VERSION = 40;
|
||||||
export class DashboardMigrator {
|
export class DashboardMigrator {
|
||||||
dashboard: DashboardModel;
|
dashboard: DashboardModel;
|
||||||
|
|
||||||
@ -904,6 +904,13 @@ export class DashboardMigrator {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldVersion < 40) {
|
||||||
|
// In old ashboards refresh property can be a boolean
|
||||||
|
if (typeof this.dashboard.refresh !== 'string') {
|
||||||
|
this.dashboard.refresh = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -==- Add migration here -==-
|
* -==- Add migration here -==-
|
||||||
* Your migration should go below the previous
|
* Your migration should go below the previous
|
||||||
|
Loading…
Reference in New Issue
Block a user