Changes to unsaved changes service to ignore repeated panels and rows, #1888

This commit is contained in:
Torkel Ödegaard 2015-04-28 12:02:39 +02:00
parent 5768f10769
commit f6a61c1ec5
2 changed files with 23 additions and 3 deletions

View File

@ -85,9 +85,6 @@ function (angular, _) {
panel = copy.panels[i];
panel.id = this.dashboard.getNextPanelId();
}
} else {
// update reused instance
}
copy.repeat = null;

View File

@ -81,6 +81,26 @@ function(angular, _, config) {
});
};
this.cleanDashboardFromRepeatedPanelsAndRows = function(dash) {
dash.rows = _.filter(dash.rows, function(row) {
if (row.repeatRowId) {
console.log('filtering out row');
return false;
}
row.panels = _.filter(row.panels, function(panel) {
if (panel.repeatPanelId) {
return false;
}
// remove scopedVars
panel.scopedVars = null;
return true;
});
return true;
});
};
this.has_unsaved_changes = function() {
if (!self.original) {
return false;
@ -106,6 +126,9 @@ function(angular, _, config) {
}
});
this.cleanDashboardFromRepeatedPanelsAndRows(current);
this.cleanDashboardFromRepeatedPanelsAndRows(original);
// ignore some panel and row stuff
current.forEachPanel(function(panel, panelIndex, row, rowIndex) {
var originalRow = original.rows[rowIndex];