diff --git a/backend/src/appenlight/static/js/appenlight.js b/backend/src/appenlight/static/js/appenlight.js index 6bd66e9..c223d0a 100644 --- a/backend/src/appenlight/static/js/appenlight.js +++ b/backend/src/appenlight/static/js/appenlight.js @@ -8859,10 +8859,12 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte $location.search('timespan', vm.timeSpan.key); $location.search('graphtype', vm.graphType.selected); stateHolder.resource = vm.resource; + if (vm.resource){ $cookies.putObject('resource', vm.resource, {expires:new Date(3000, 1, 1)}); } + vm.refreshData(); }; vm.refreshData = function () { @@ -8878,7 +8880,7 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte vm.refreshData(); }; - var intervalId = $interval(function () { + vm.intervalId = $interval(function () { if (_.contains(['30m', "1h"], vm.timeSpan.key)) { // don't do anything if window is unfocused if(document.hidden === true){ @@ -9065,6 +9067,10 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte ); }; + $scope.$on('$destroy',function(){ + $interval.cancel(vm.intervalId); + }); + if (stateHolder.AeUser.applications.length){ vm.show_dashboard = true; vm.determineStartState(); diff --git a/frontend/src/controllers/front_dashboard.js b/frontend/src/controllers/front_dashboard.js index 7529a82..6f0b962 100644 --- a/frontend/src/controllers/front_dashboard.js +++ b/frontend/src/controllers/front_dashboard.js @@ -444,10 +444,12 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte $location.search('timespan', vm.timeSpan.key); $location.search('graphtype', vm.graphType.selected); stateHolder.resource = vm.resource; + if (vm.resource){ $cookies.putObject('resource', vm.resource, {expires:new Date(3000, 1, 1)}); } + vm.refreshData(); }; vm.refreshData = function () { @@ -463,7 +465,7 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte vm.refreshData(); }; - var intervalId = $interval(function () { + vm.intervalId = $interval(function () { if (_.contains(['30m', "1h"], vm.timeSpan.key)) { // don't do anything if window is unfocused if(document.hidden === true){ @@ -650,6 +652,10 @@ function IndexDashboardController($rootScope, $scope, $location, $cookies, $inte ); }; + $scope.$on('$destroy',function(){ + $interval.cancel(vm.intervalId); + }); + if (stateHolder.AeUser.applications.length){ vm.show_dashboard = true; vm.determineStartState();