Commit e461fe919b0c9b8975983f11dee4e5f61777518d
1 parent
0e605379
UI: Cleanup dashboard preserved states.
Showing
3 changed files
with
16 additions
and
1 deletions
@@ -264,6 +264,10 @@ export default function DashboardController(types, utils, dashboardUtils, widget | @@ -264,6 +264,10 @@ export default function DashboardController(types, utils, dashboardUtils, widget | ||
264 | } | 264 | } |
265 | }); | 265 | }); |
266 | 266 | ||
267 | + $scope.$on("$destroy", function () { | ||
268 | + vm.dashboardCtx.stateController.cleanupPreservedStates(); | ||
269 | + }); | ||
270 | + | ||
267 | loadDashboard(); | 271 | loadDashboard(); |
268 | 272 | ||
269 | function loadWidgetLibrary() { | 273 | function loadWidgetLibrary() { |
@@ -54,6 +54,10 @@ export default function StatesComponent($compile, $templateCache, $controller, s | @@ -54,6 +54,10 @@ export default function StatesComponent($compile, $templateCache, $controller, s | ||
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | + stateController.cleanupPreservedStates = function() { | ||
58 | + statesControllerService.cleanupPreservedStates(); | ||
59 | + } | ||
60 | + | ||
57 | stateController.navigatePrevState = function(index) { | 61 | stateController.navigatePrevState = function(index) { |
58 | if (scope.statesController) { | 62 | if (scope.statesController) { |
59 | scope.statesController.navigatePrevState(index); | 63 | scope.statesController.navigatePrevState(index); |
@@ -42,7 +42,8 @@ export default function StatesControllerService() { | @@ -42,7 +42,8 @@ export default function StatesControllerService() { | ||
42 | getStateControllers: getStateControllers, | 42 | getStateControllers: getStateControllers, |
43 | getStateController: getStateController, | 43 | getStateController: getStateController, |
44 | preserveStateControllerState: preserveStateControllerState, | 44 | preserveStateControllerState: preserveStateControllerState, |
45 | - withdrawStateControllerState: withdrawStateControllerState | 45 | + withdrawStateControllerState: withdrawStateControllerState, |
46 | + cleanupPreservedStates: cleanupPreservedStates | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | return service; | 49 | return service; |
@@ -69,4 +70,10 @@ export default function StatesControllerService() { | @@ -69,4 +70,10 @@ export default function StatesControllerService() { | ||
69 | return state; | 70 | return state; |
70 | } | 71 | } |
71 | 72 | ||
73 | + function cleanupPreservedStates() { | ||
74 | + for (var id in statesControllers) { | ||
75 | + statesControllers[id].state = null; | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
72 | } | 79 | } |