fix: ignore row clones in schema migration

pull/10211/head
Torkel Ödegaard 8 years ago
parent fcca36a256
commit ff89531849
  1. 4
      public/app/features/dashboard/dashboard_migration.ts
  2. 16
      public/app/features/dashboard/specs/dashboard_migration.jest.ts

@ -387,6 +387,10 @@ export class DashboardMigrator {
const showRows = _.some(old.rows, (row) => row.collapse || row.showTitle || row.repeat);
for (let row of old.rows) {
if (row.repeatIteration) {
continue;
}
let height: any = row.height || DEFAULT_ROW_HEIGHT;
const rowGridHeight = getGridHeight(height);

@ -337,12 +337,24 @@ describe('DashboardModel', function() {
expect(dashboard.panels[2].repeat).toBeUndefined();
expect(dashboard.panels[3].repeat).toBeUndefined();
});
it('should ignore repeated row', function() {
model.rows = [
createRow({showTitle: true, title: "Row1", height: 8, repeat: "server"}, [[6]]),
createRow({showTitle: true, title: "Row2", height: 8, repeatIteration: 12313, repeatRowId: 1}, [[6]]),
];
let dashboard = new DashboardModel(model);
expect(dashboard.panels[0].repeat).toBe("server");
expect(dashboard.panels.length).toBe(2);
});
});
});
function createRow(options, panelDescriptions: any[]) {
const PANEL_HEIGHT_STEP = GRID_CELL_HEIGHT + GRID_CELL_VMARGIN;
let {collapse, height, showTitle, title, repeat} = options;
let {collapse, height, showTitle, title, repeat, repeatIteration} = options;
height = height * PANEL_HEIGHT_STEP;
let panels = [];
_.each(panelDescriptions, panelDesc => {
@ -352,7 +364,7 @@ function createRow(options, panelDescriptions: any[]) {
}
panels.push(panel);
});
let row = {collapse, height, showTitle, title, panels, repeat};
let row = {collapse, height, showTitle, title, panels, repeat, repeatIteration};
return row;
}

Loading…
Cancel
Save