incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [6/6] git commit: show online zookeepers and controllers on dashboard
Date Thu, 29 May 2014 19:59:29 GMT
show online zookeepers and controllers on dashboard

Signed-off-by: Chris Rohr <rohr.chris@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/22ac33f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/22ac33f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/22ac33f4

Branch: refs/heads/console-v2
Commit: 22ac33f48a7ba20e66ad5480f58fe7f210857456
Parents: e6c2eb2
Author: Andrew Avenoso <andrew.va@gmail.com>
Authored: Thu May 29 14:57:01 2014 -0400
Committer: Chris Rohr <rohr.chris@gmail.com>
Committed: Thu May 29 15:57:57 2014 -0400

----------------------------------------------------------------------
 .../src/main/webapp/js/blurconsole.dashboard.js | 20 ++++++++----
 .../src/main/webapp/js/blurconsole.model.js     | 33 ++++++++++++++------
 2 files changed, 38 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/22ac33f4/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js b/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js
index 68cf79c..965d151 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js
@@ -96,12 +96,12 @@ blurconsole.dashboard = (function () {
 
 	loadZkPieChart = function() {
 		$.plot(jqueryMap.$zkChartHolder, blurconsole.model.metrics.getZookeeperChartData(), configMap.pieOptions);
-		jqueryMap.$zkInfoHolder.html(buildNodeTable(blurconsole.model.nodes.getOfflineZookeeperNodes()));
+		jqueryMap.$zkInfoHolder.html(buildNodeTable(blurconsole.model.nodes.getOnlineZookeeperNodes(),
blurconsole.model.nodes.getOfflineZookeeperNodes()));
 	};
 
 	loadControllerPieChart = function() {
 		$.plot(jqueryMap.$controllerChartHolder, blurconsole.model.metrics.getControllerChartData(),
configMap.pieOptions);
-		jqueryMap.$controllerInfoHolder.html(buildNodeTable(blurconsole.model.nodes.getOfflineControllerNodes()));
+		jqueryMap.$controllerInfoHolder.html(buildNodeTable(blurconsole.model.nodes.getOnlineControllerNodes(),
blurconsole.model.nodes.getOfflineControllerNodes()));
 	};
 
 	loadShardsPieChart = function() {
@@ -135,7 +135,7 @@ blurconsole.dashboard = (function () {
 				}
 
 				$.plot(clusterHolder, clusterData, configMap.pieOptions);
-				clusterInfo.html(buildNodeTable(blurconsole.model.nodes.getOfflineShardNodes(cluster)));
+				clusterInfo.html(buildNodeTable([], blurconsole.model.nodes.getOfflineShardNodes(cluster)));
 			}
 		});
 	};
@@ -173,16 +173,24 @@ blurconsole.dashboard = (function () {
 		});
 	};
 
-	buildNodeTable = function(data) {
+	buildNodeTable = function(online, offline) {
 		var table = '<table class="table table-condensed"><thead><tr><th>Offline
Node</th></tr></thead><tbody>';
-		if (data.length === 0) {
+		if (offline.length === 0) {
 			table += '<tr><td>Everything is Online!</td></tr>';
 		} else {
-			$.each(data, function(idx, node) {
+			$.each(offline, function(idx, node) {
 				table += '<tr><td>' + node + '</td></tr>';
 			});
 		}
 		table += '</tbody></table>';
+
+		if (online.length > 0) {
+			table += '<table class="table table-condensed"><thead><tr><th>Online
Node</th></tr></thead><tbody>';
+			$.each(online, function(idx, node) {
+				table += '<tr><td>' + node + '</td></tr>';
+			});
+			table += '</tbody></table>';
+		}
 		return $(table);
 	};
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/22ac33f4/contrib/blur-console/src/main/webapp/js/blurconsole.model.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.model.js b/contrib/blur-console/src/main/webapp/js/blurconsole.model.js
index 31ed564..1ac6882 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.model.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.model.js
@@ -134,35 +134,50 @@ blurconsole.model = (function() {
 	}());
 
 	nodes = (function() {
-		var getOfflineZookeeperNodes, getOfflineControllerNodes, getOfflineShardNodes, isDataLoaded;
+		var getOnlineZookeeperNodes = function() {
+			return stateMap.nodeMap.zookeepers.online;
+		};
 
-		getOfflineZookeeperNodes = function() {
+		var getOfflineZookeeperNodes = function() {
 			return stateMap.nodeMap.zookeepers.offline;
 		};
 
-		getOfflineControllerNodes = function() {
+		var getOnlineControllerNodes = function() {
+			return stateMap.nodeMap.controllers.online;
+		};
+
+		var getOfflineControllerNodes = function() {
 			return stateMap.nodeMap.controllers.offline;
 		};
 
-		getOfflineShardNodes = function(clusterName) {
+		var _getClusterData = function(clusterName) {
 			var clusterData = $.grep(stateMap.nodeMap.clusters, function(cluster) {
 				return cluster.name === clusterName;
 			});
+			return clusterData.length > 0 ? clusterData[0] : null;
+		};
 
-			if (clusterData.length > 0) {
-				return clusterData[0].offline;
-			}
-			return [];
+		var getOfflineShardNodes = function(clusterName) {
+			var clusterData = _getClusterData(clusterName);
+			return clusterData ? clusterData.offline : [];
 		};
 
-		isDataLoaded = function() {
+		var getOnlineShardNodes = function(clusterName) {
+			var clusterData = _getClusterData(clusterName);
+			return clusterData ? clusterData.online : [];
+		};
+
+		var isDataLoaded = function() {
 			return stateMap.nodeMap !== null;
 		};
 
 		return {
+			getOnlineZookeeperNodes : getOnlineZookeeperNodes,
 			getOfflineZookeeperNodes : getOfflineZookeeperNodes,
 			getOfflineControllerNodes : getOfflineControllerNodes,
+			getOnlineControllerNodes : getOnlineControllerNodes,
 			getOfflineShardNodes : getOfflineShardNodes,
+			getOnlineShardNodes : getOnlineShardNodes,
 			isDataLoaded : isDataLoaded
 		};
 	}());


Mime
View raw message