Mark new dashboards as dirty (#10542)

This commit is contained in:
Stacey Gammon 2017-02-24 09:27:08 -05:00 committed by GitHub
parent ef314f8e9f
commit 9b7cb0de25

View file

@ -90,7 +90,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
let stateMonitor;
const $state = $scope.state = new AppState(stateDefaults);
const $uiState = $scope.uiState = $state.makeStateful('uiState');
const $appStatus = $scope.appStatus = this.appStatus = {};
const $appStatus = $scope.appStatus = this.appStatus = { dirty: !dash.id };
$scope.$watchCollection('state.options', function (newVal, oldVal) {
if (!angular.equals(newVal, oldVal)) $state.save();
@ -122,7 +122,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
// watch for state changes and update the appStatus.dirty value
stateMonitor = stateMonitorFactory.create($state, stateDefaults);
stateMonitor.onChange((status) => {
$appStatus.dirty = status.dirty;
$appStatus.dirty = status.dirty || !dash.id;
});
$scope.$on('$destroy', () => {