UI: Cleanup dashboard preserved states.

This commit is contained in:
Igor Kulikov 2017-09-08 10:48:06 +03:00
parent 0e60537955
commit e461fe919b
3 changed files with 16 additions and 1 deletions

View File

@ -264,6 +264,10 @@ export default function DashboardController(types, utils, dashboardUtils, widget
}
});
$scope.$on("$destroy", function () {
vm.dashboardCtx.stateController.cleanupPreservedStates();
});
loadDashboard();
function loadWidgetLibrary() {

View File

@ -54,6 +54,10 @@ export default function StatesComponent($compile, $templateCache, $controller, s
}
}
stateController.cleanupPreservedStates = function() {
statesControllerService.cleanupPreservedStates();
}
stateController.navigatePrevState = function(index) {
if (scope.statesController) {
scope.statesController.navigatePrevState(index);

View File

@ -42,7 +42,8 @@ export default function StatesControllerService() {
getStateControllers: getStateControllers,
getStateController: getStateController,
preserveStateControllerState: preserveStateControllerState,
withdrawStateControllerState: withdrawStateControllerState
withdrawStateControllerState: withdrawStateControllerState,
cleanupPreservedStates: cleanupPreservedStates
};
return service;
@ -69,4 +70,10 @@ export default function StatesControllerService() {
return state;
}
function cleanupPreservedStates() {
for (var id in statesControllers) {
statesControllers[id].state = null;
}
}
}