eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hdenduk...@apache.org
Subject [2/4] incubator-eagle git commit: EAGLE-176 Metric dashboard UI keep api refresh after page switch clean the interval after page on $scope-destroy
Date Sat, 05 Mar 2016 01:53:22 GMT
EAGLE-176 Metric dashboard UI keep api refresh after page switch
clean the interval after page on $scope-destroy

https://issues.apache.org/jira/browse/EAGLE-176

Author: @zombiej
Reviewer: @qingwen220

Closes #106


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/7bc5d9a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/7bc5d9a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/7bc5d9a6

Branch: refs/heads/branch-0.3.0
Commit: 7bc5d9a65bc53aa1019eac380c3acfdd17976619
Parents: 6f4fb5c
Author: jiljiang <jiljiang@ebay.com>
Authored: Mon Feb 29 14:43:47 2016 +0800
Committer: jiljiang <jiljiang@ebay.com>
Committed: Mon Feb 29 14:43:47 2016 +0800

----------------------------------------------------------------------
 .../src/main/webapp/app/public/feature/metrics/controller.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bc5d9a6/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js b/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
index eecd732..eb1bfb0 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
@@ -36,6 +36,7 @@
 	feature.controller('dashboard', function(PageConfig, $scope, $http, $q, UI, Site, Authorization,
Application, Entities) {
 		var _siteApp = Site.currentSiteApplication();
 		var _druidConfig = _siteApp.configObj.druid;
+		var _refreshInterval;
 
 		var _menu_newChart;
 
@@ -389,9 +390,14 @@
 			}, 0);
 		};
 
-		setInterval(function() {
+		_refreshInterval = setInterval(function() {
 			if(!$scope.dashboardReady) return;
 			$scope.chartRefresh(true);
 		}, 1000 * 30);
+
+		// ====================== Clean Up ======================
+		$scope.$on('$destroy', function() {
+			clearInterval(_refreshInterval);
+		});
 	});
 })();
\ No newline at end of file


Mime
View raw message