mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard: Fix iteration property change triggering unsaved changes warning (#51272)
This commit is contained in:
@@ -105,7 +105,6 @@ export class DashboardModel implements TimeModel {
|
||||
// ------------------
|
||||
|
||||
// repeat process cycles
|
||||
iteration?: number;
|
||||
declare meta: DashboardMeta;
|
||||
events: EventBusExtended;
|
||||
|
||||
@@ -507,13 +506,10 @@ export class DashboardModel implements TimeModel {
|
||||
return;
|
||||
}
|
||||
|
||||
this.iteration = (this.iteration || new Date().getTime()) + 1;
|
||||
// cleanup scopedVars
|
||||
deleteScopeVars(this.panels);
|
||||
|
||||
const panelsToRemove = this.panels.filter(
|
||||
(p) => (!p.repeat || p.repeatedByRow) && p.repeatPanelId && p.repeatIteration !== this.iteration
|
||||
);
|
||||
const panelsToRemove = this.panels.filter((p) => (!p.repeat || p.repeatedByRow) && p.repeatPanelId);
|
||||
|
||||
// remove panels
|
||||
pull(this.panels, ...panelsToRemove);
|
||||
@@ -528,8 +524,6 @@ export class DashboardModel implements TimeModel {
|
||||
|
||||
this.cleanUpRepeats();
|
||||
|
||||
this.iteration = (this.iteration || new Date().getTime()) + 1;
|
||||
|
||||
for (let i = 0; i < this.panels.length; i++) {
|
||||
const panel = this.panels[i];
|
||||
if (panel.repeat) {
|
||||
@@ -584,7 +578,6 @@ export class DashboardModel implements TimeModel {
|
||||
// insert after source panel + value index
|
||||
this.panels.splice(sourcePanelIndex + valueIndex, 0, clone);
|
||||
|
||||
clone.repeatIteration = this.iteration;
|
||||
clone.repeatPanelId = sourcePanel.id;
|
||||
clone.repeat = undefined;
|
||||
|
||||
@@ -747,12 +740,13 @@ export class DashboardModel implements TimeModel {
|
||||
updateRepeatedPanelIds(panel: PanelModel, repeatedByRow?: boolean) {
|
||||
panel.repeatPanelId = panel.id;
|
||||
panel.id = this.getNextPanelId();
|
||||
panel.repeatIteration = this.iteration;
|
||||
|
||||
if (repeatedByRow) {
|
||||
panel.repeatedByRow = true;
|
||||
} else {
|
||||
panel.repeat = undefined;
|
||||
}
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
@@ -827,9 +821,11 @@ export class DashboardModel implements TimeModel {
|
||||
delete newPanel.repeatIteration;
|
||||
delete newPanel.repeatPanelId;
|
||||
delete newPanel.scopedVars;
|
||||
|
||||
if (newPanel.alert) {
|
||||
delete newPanel.thresholds;
|
||||
}
|
||||
|
||||
delete newPanel.alert;
|
||||
|
||||
// does it fit to the right?
|
||||
|
||||
Reference in New Issue
Block a user