incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [41/50] [abbrv] git commit: make charts resize immediately
Date Sat, 31 May 2014 14:22:14 GMT
make charts resize immediately

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/f0f344d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/f0f344d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/f0f344d6

Branch: refs/heads/apache-blur-0.2
Commit: f0f344d68cd9792b9b79ef9fbed06e84977f7647
Parents: 9abdbb0
Author: Andrew Avenoso <andrew.va@gmail.com>
Authored: Thu May 29 13:46:17 2014 -0400
Committer: Chris Rohr <rohr.chris@gmail.com>
Committed: Thu May 29 15:57:56 2014 -0400

----------------------------------------------------------------------
 .../src/main/webapp/js/blurconsole.dashboard.js | 54 +++++++++-----------
 1 file changed, 24 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f0f344d6/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 029c948..15a2b8f 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.dashboard.js
@@ -55,9 +55,9 @@ blurconsole.dashboard = (function () {
 			controllerNodes: 'chart'
 		},
 		jqueryMap = {},
-		setJqueryMap, initModule, unloadModule, updateNodeCharts, adjustChartSize,
+		setJqueryMap, initModule, unloadModule, updateNodeCharts, adjustChartsSizes, adjustChartSize,
 		loadZkPieChart,	loadControllerPieChart, loadShardsPieChart, loadTableColumnChart, loadQueryPerfLineChart,
-		buildNodeTable, checkForSlowQueries;
+		buildNodeTable, checkForSlowQueries, updateAllCharts;
 
 	setJqueryMap = function() {
 		var $container = stateMap.$container;
@@ -80,6 +80,12 @@ blurconsole.dashboard = (function () {
 		$.gevent.unsubscribe(jqueryMap.$container, 'queries-updated');
 	};
 
+	updateAllCharts = function() {
+		updateNodeCharts();
+		loadTableColumnChart();
+		loadQueryPerfLineChart();
+	};
+
 	updateNodeCharts = function() {
 		if (blurconsole.model.nodes.isDataLoaded()) {
 			loadZkPieChart();
@@ -180,20 +186,22 @@ blurconsole.dashboard = (function () {
 		return $(table);
 	};
 
-	adjustChartSize = function() {
-		var size, shardCharts;
-
-		size = jqueryMap.$zkChartHolder.parent()[0].clientWidth - 150;
-		jqueryMap.$zkChartHolder.css({
+	adjustChartSize = function(holder) {
+		var size;
+		size = jqueryMap[holder].parent()[0].clientWidth - 150;
+		jqueryMap[holder].css({
 			'height' : size,
 			'width' : size
 		});
+	};
 
-		size = jqueryMap.$controllerChartHolder.parent()[0].clientWidth - 150;
-		jqueryMap.$controllerChartHolder.css({
-			'height' : size,
-			'width' : size
-		});
+	adjustChartsSizes = function() {
+		var size, shardCharts;
+
+		adjustChartSize('$zkChartHolder');
+		adjustChartSize('$controllerChartHolder');
+		adjustChartSize('$tableChartHolder');
+		adjustChartSize('$queryLoadChartHolder');
 
 		size = jqueryMap.$shardChartHolder.parent()[0].clientWidth - 150;
 		shardCharts = jqueryMap.$shardChartHolder.find('.shardClusterChartHolder');
@@ -203,18 +211,7 @@ blurconsole.dashboard = (function () {
 				'width' : size
 			});
 		});
-
-		size = jqueryMap.$tableChartHolder.parent()[0].clientWidth - 150;
-		jqueryMap.$tableChartHolder.css({
-			'height' : size,
-			'width' : size
-		});
-
-		size = jqueryMap.$queryLoadChartHolder.parent()[0].clientWidth - 150;
-		jqueryMap.$queryLoadChartHolder.css({
-			'height' : size,
-			'width' : size
-		});
+		updateAllCharts();
 	};
 
 	checkForSlowQueries = function() {
@@ -229,15 +226,13 @@ blurconsole.dashboard = (function () {
 		$container.load ( configMap.view, function() {
 			stateMap.$container = $container;
 			setJqueryMap();
-			updateNodeCharts();
-			loadTableColumnChart();
-			loadQueryPerfLineChart();
+			updateAllCharts();
 			checkForSlowQueries();
 			$.gevent.subscribe(jqueryMap.$container, 'node-status-updated', updateNodeCharts);
 			$.gevent.subscribe(jqueryMap.$container, 'tables-updated', loadTableColumnChart);
 			$.gevent.subscribe(jqueryMap.$container, 'query-perf-updated', loadQueryPerfLineChart);
 			$.gevent.subscribe(jqueryMap.$container, 'queries-updated', checkForSlowQueries);
-			adjustChartSize();
+			adjustChartsSizes();
 			$(document).on('click', '.swapper-trigger', function() {
 			    console.log(this);
 				var parent = $(this).closest('div.swapper-parent');
@@ -248,9 +243,8 @@ blurconsole.dashboard = (function () {
 				chart.toggleClass('hidden');
 				info.toggleClass('hidden');
 			});
-			
 		});
-		$(window).resize(adjustChartSize);
+		$(window).resize(adjustChartsSizes);
 		return true;
 	};
 


Mime
View raw message