incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject git commit: Final round of code cleanup
Date Fri, 30 May 2014 16:31:52 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/console-v2 1a3b2660b -> 899e47d2c


Final round of code cleanup


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

Branch: refs/heads/console-v2
Commit: 899e47d2c63876306b54f8fb54cd9ec9e20b5cf0
Parents: 1a3b266
Author: chrisrohr <rohr.chris@gmail.com>
Authored: Fri May 30 16:30:54 2014 +0000
Committer: chrisrohr <rohr.chris@gmail.com>
Committed: Fri May 30 16:30:54 2014 +0000

----------------------------------------------------------------------
 .../blur-console/src/main/webapp/Gruntfile.js   |   2 +-
 .../src/main/webapp/js/blurconsole.queries.js   | 347 ++++++++++---------
 .../src/main/webapp/js/blurconsole.schema.js    |  70 ++--
 .../src/main/webapp/js/blurconsole.search.js    | 172 +++++----
 .../src/main/webapp/js/blurconsole.shell.js     | 132 ++++---
 .../src/main/webapp/js/blurconsole.tables.js    | 172 ++++-----
 .../src/main/webapp/js/blurconsole.utils.js     |  28 +-
 7 files changed, 463 insertions(+), 460 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/Gruntfile.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/Gruntfile.js b/contrib/blur-console/src/main/webapp/Gruntfile.js
index 801082d..551762c 100644
--- a/contrib/blur-console/src/main/webapp/Gruntfile.js
+++ b/contrib/blur-console/src/main/webapp/Gruntfile.js
@@ -81,7 +81,7 @@ module.exports = function (grunt) {
                 jshintrc: true,
             },
             development: {
-                src: ['js/**/*\.js']
+                src: ['js/**/*\.js', '!js/utils/**/*\.js']
             },
             ci: {
                 src: ['js/**/*\.js'],

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/js/blurconsole.queries.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.queries.js b/contrib/blur-console/src/main/webapp/js/blurconsole.queries.js
index cfda508..9b3d6b0 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.queries.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.queries.js
@@ -18,174 +18,181 @@ under the License.
 */
 /*jshint laxbreak: true */
 /*global blurconsole:false */
-blurconsole.queries = (function () {
-	'use strict';
-	var configMap = {
-		view : 'views/queries.tpl.html',
-		states : ['Running', 'Interrupted', 'Complete', 'Back Pressure Interrupted'],
-		queryDef : [
-			{label:'User', key:'user'},
-			{label:'Query', key: 'query'},
-			{label:'Time Started', key: function(row){
-				var start = new Date(row.startTime);
-				return start.toTimeString(); //start.getHours() + ':' + start.getMinutes() + ':' + start.getSeconds();
-			}},
-			{label:'State', key: function(row) {
-				var stateInfo = configMap.states[row.state];
-
-				if (row.state === 0) {
-					stateInfo += ' <div class="badge badge-info">' + row.percent + '%</div>';
-				}
-				return stateInfo;
-			}},
-			{label:'Actions', key: function(row) {
-				var actions = '';
-				if (row.state === 0) {
-					actions += '<a href="#" class="cancelTrigger btn btn-danger" data-uuid="' + row.uuid
+ '" data-query="' + row.query + '" data-table="' + row.table + '"><i class="glyphicon
glyphicon-ban-circle"></i> Cancel</a> ';
-				}
-				return actions;
-			}}
-		],
-	},
-	stateMap = {
-		$container : null,
-		currentTable : null,
-		currentFilter : null,
-		currentSort : null
-	},
-	jqueryMap = {},
-	setJqueryMap, initModule, unloadModule, drawTableList, drawQueries, registerPageEvents,
unregisterPageEvents, waitForData;
-
-	setJqueryMap = function() {
-		var $container = stateMap.$container;
-		jqueryMap = {
-			$container : $container,
-			$tableHolder : $('#tableHolder'),
-			$queryHolder : $('#queryHolder'),
-			$filterHolder : $('#filterOptions'),
-			$filterText : $('#filterOptions .filterText')
-		};
-	};
-
-	registerPageEvents = function() {
-		jqueryMap.$tableHolder.on('click', '.list-group-item', function(){
-			stateMap.currentTable = $(this).attr('href');
-
-			$('.list-group-item', jqueryMap.$tableHolder).removeClass('active');
-			$('.list-group-item[href="' + stateMap.currentTable + '"]', jqueryMap.$tableHolder).addClass('active');
-			drawQueries();
-			return false;
-		});
-		jqueryMap.$queryHolder.on('click', 'a.cancelTrigger', function(){
-			var uuid = $(this).data('uuid'), query = $(this).data('query'), table = $(this).data('table');
-			var modalContent = blurconsole.browserUtils.modal('confirmDelete', 'Confirm Query Cancel',
'You are about to cancel the query [' + query + '].  Are you sure you want to do this?', [
-				{classes: 'btn-primary killQuery', label: 'Stop Query'},
-				{classes: 'btn-default cancel', label: 'Cancel', data: {dismiss:'modal'}}
-			], 'medium');
-
-			var modal = $(modalContent).modal().on('shown.bs.modal', function(e){
-				$(e.currentTarget).on('click', '.killQuery', function() {
-					blurconsole.model.queries.cancelQuery(table, uuid);
-					modal.modal('hide');
-				});
-			}).on('hidden.bs.modal', function(e) {
-				$(e.currentTarget).remove();
-			});
-			return false;
-		});
-
-		jqueryMap.$filterHolder.on('click', '.filterTrigger', function() {
-			var filterVal = jqueryMap.$filterText.val();
-
-			stateMap.currentFilter = filterVal;
-			drawQueries();
-		});
-	};
-
-	unregisterPageEvents = function() {
-		if (jqueryMap.$tableHolder) {
-			jqueryMap.$tableHolder.off();
-		}
-	};
-
-	drawTableList = function() {
-		var clusters = blurconsole.model.tables.getClusters();
-
-		if (clusters) {
-			jqueryMap.$tableHolder.html('');
-			clusters.sort();
-			$.each(clusters, function(i, cluster){
-				var panelContent, tables = blurconsole.model.tables.getEnabledTables(cluster);
-
-				panelContent =
-					'<div class="panel panel-default">'
-						+ '<div class="panel-heading">'
-							+ '<h3 class="panel-title">' + cluster + '</h3>'
-						+ '</div>'
-						+ '<div class="panel-body">';
-				if (tables.length > 0) {
-					tables.sort(function(a, b){ return a.name > b.name; });
-					panelContent += '<div class="list-group">';
-
-					$.each(tables, function(i, table){
-						panelContent += '<a href="' + table.name + '" class="list-group-item';
-						if (table.name === stateMap.currentTable) {
-							panelContent += ' active';
-							drawQueries();
-						}
-						panelContent += '">' + table.name + '</a>';
-					});
-
-					panelContent += '</div>';
-				} else {
-					panelContent += '<div class="alert alert-warning">There are not any enabled tables!</div>';
-				}
-				panelContent += '</div></div>';
-				jqueryMap.$tableHolder.append(panelContent);
-			});
-		} else {
-			jqueryMap.$tableHolder.html('<div class="alert alert-warning">There are no clusters
of tables!</div>');
-		}
-	};
-
-	drawQueries = function() {
-		if (stateMap.currentTable){
-			jqueryMap.$queryHolder.html(blurconsole.browserUtils.table(configMap.queryDef, blurconsole.model.queries.queriesForTable(stateMap.currentTable,
stateMap.currentSort, stateMap.currentFilter)));
-		} else {
-			jqueryMap.$queryHolder.html('<div class="alert alert-info">Select a table on the
left to see the current queries</div>');
-		}
-	};
-
-	waitForData = function() {
-		var clusters = blurconsole.model.tables.getClusters();
-		if (clusters && clusters.length > 0) {
-			drawTableList();
-			drawQueries();
-		} else {
-			setTimeout(waitForData, 100);
-		}
-	};
-
-	initModule = function($container) {
-		$container.load(configMap.view, function() {
-			stateMap.$container = $container;
-			setJqueryMap();
-			$.gevent.subscribe(jqueryMap.$container, 'queries-updated', drawQueries);
-			$.gevent.subscribe(jqueryMap.$container, 'tables-updated', drawTableList);
-			registerPageEvents();
-			waitForData();
-		});
-		return true;
-	};
-
-	unloadModule = function() {
-		$.gevent.unsubscribe(jqueryMap.$container, 'queries-updated');
-		$.gevent.unsubscribe(jqueryMap.$container, 'tables-updated');
-		unregisterPageEvents();
-	};
-
-	return {
-		initModule : initModule,
-		unloadModule : unloadModule
-	};
+blurconsole.queries = (function() {
+    'use strict';
+  
+    //------------------------ Configuration and State --------------------
+    var configMap = {
+        view: 'views/queries.tpl.html',
+        states: ['Running', 'Interrupted', 'Complete', 'Back Pressure Interrupted'],
+        queryDef: [
+            { label: 'User', key: 'user' },
+            { label: 'Query', key: 'query' },
+            { label: 'Time Started', key: function(row) {
+                var start = new Date(row.startTime);
+                return start.toTimeString(); //start.getHours() + ':' + start.getMinutes()
+ ':' + start.getSeconds();
+            } },
+            { label: 'State', key: function(row) {
+                var stateInfo = configMap.states[row.state];
+                if(row.state === 0) {
+                    stateInfo += ' <div class="badge badge-info">' + row.percent +
'%</div>';
+                }
+                return stateInfo;
+            } },
+            { label: 'Actions', key: function(row) {
+                var actions = '';
+                if(row.state === 0) {
+                    actions += '<a href="#" class="cancelTrigger btn btn-danger" data-uuid="'
+ row.uuid + '" data-query="' + row.query + '" data-table="' + row.table + '"><i class="glyphicon
glyphicon-ban-circle"></i> Cancel</a> ';
+                }
+                return actions;
+            } }
+        ],
+    },
+    stateMap = {
+        $container: null,
+        currentTable: null,
+        currentFilter: null,
+        currentSort: null
+    },
+    jqueryMap = {};
+  
+    //----------------------------------- Private methods ----------------------------
+
+    function _setJqueryMap() {
+        var $container = stateMap.$container;
+        jqueryMap = {
+            $container: $container,
+            $tableHolder: $('#tableHolder'),
+            $queryHolder: $('#queryHolder'),
+            $filterHolder: $('#filterOptions'),
+            $filterText: $('#filterOptions .filterText')
+        };
+    }
+
+    function _registerPageEvents() {
+        jqueryMap.$tableHolder.on('click', '.list-group-item', _showQueriesForTable);
+        jqueryMap.$queryHolder.on('click', 'a.cancelTrigger', _cancelSelectedQuery);
+        jqueryMap.$filterHolder.on('click', '.filterTrigger', _filterQueries);
+    }
+
+    function _unregisterPageEvents() {
+        if(jqueryMap.$tableHolder) {
+            jqueryMap.$tableHolder.off();
+        }
+    }
+
+    function _waitForData() {
+        var clusters = blurconsole.model.tables.getClusters();
+        if(clusters && clusters.length > 0) {
+            _drawTableList();
+            _drawQueries();
+        } else {
+            setTimeout(_waitForData, 100);
+        }
+    }
+    //----------------------------- Event Handlers and DOM Methods -----------------------------
+
+    function _showQueriesForTable(evt) {
+        stateMap.currentTable = $(evt.currentTarget).attr('href');
+        $('.list-group-item', jqueryMap.$tableHolder).removeClass('active');
+        $('.list-group-item[href="' + stateMap.currentTable + '"]', jqueryMap.$tableHolder).addClass('active');
+        _drawQueries();
+        return false;
+    }
+
+    function _cancelSelectedQuery(evt) {
+        var uuid = $(evt.currentTarget).data('uuid'),
+          query = $(evt.currentTarget).data('query'),
+          table = $(evt.currentTarget).data('table');
+        var modalContent = blurconsole.browserUtils.modal('confirmDelete', 'Confirm Query
Cancel', 'You are about to cancel the query [' + query + '].  Are you sure you want to do
this?', [{
+            classes: 'btn-primary killQuery',
+            label: 'Stop Query'
+        }, {
+            classes: 'btn-default cancel',
+            label: 'Cancel',
+            data: {
+                dismiss: 'modal'
+            }
+        }], 'medium');
+        var modal = $(modalContent).modal().on('shown.bs.modal', function(e) {
+            $(e.currentTarget).on('click', '.killQuery', function() {
+                blurconsole.model.queries.cancelQuery(table, uuid);
+                modal.modal('hide');
+            });
+        }).on('hidden.bs.modal', function(e) {
+            $(e.currentTarget).remove();
+        });
+        return false;
+    }
+
+    function _filterQueries() {
+        var filterVal = jqueryMap.$filterText.val();
+        stateMap.currentFilter = filterVal;
+        _drawQueries();
+    }
+
+    function _drawTableList() {
+        var clusters = blurconsole.model.tables.getClusters();
+        if(clusters) {
+            jqueryMap.$tableHolder.html('');
+            clusters.sort();
+            $.each(clusters, function(i, cluster) {
+                var panelContent, tables = blurconsole.model.tables.getEnabledTables(cluster);
+                panelContent = '<div class="panel panel-default">' + '<div class="panel-heading">'
+ '<h3 class="panel-title">' + cluster + '</h3>' + '</div>' + '<div class="panel-body">';
+                if(tables.length > 0) {
+                    tables.sort(function(a, b) {
+                        return a.name > b.name;
+                    });
+                    panelContent += '<div class="list-group">';
+                    $.each(tables, function(i, table) {
+                        panelContent += '<a href="' + table.name + '" class="list-group-item';
+                        if(table.name === stateMap.currentTable) {
+                            panelContent += ' active';
+                            _drawQueries();
+                        }
+                        panelContent += '">' + table.name + '</a>';
+                    });
+                    panelContent += '</div>';
+                } else {
+                    panelContent += '<div class="alert alert-warning">There are not
any enabled tables!</div>';
+                }
+                panelContent += '</div></div>';
+                jqueryMap.$tableHolder.append(panelContent);
+            });
+        } else {
+            jqueryMap.$tableHolder.html('<div class="alert alert-warning">There are
no clusters of tables!</div>');
+        }
+    }
+
+    function _drawQueries() {
+        if(stateMap.currentTable) {
+            jqueryMap.$queryHolder.html(blurconsole.browserUtils.table(configMap.queryDef,
blurconsole.model.queries.queriesForTable(stateMap.currentTable, stateMap.currentSort, stateMap.currentFilter)));
+        } else {
+            jqueryMap.$queryHolder.html('<div class="alert alert-info">Select a table
on the left to see the current queries</div>');
+        }
+    }
+  
+    //-------------------------- Public API ---------------------------------
+
+    function initModule($container) {
+        $container.load(configMap.view, function() {
+            stateMap.$container = $container;
+            _setJqueryMap();
+            $.gevent.subscribe(jqueryMap.$container, 'queries-updated', _drawQueries);
+            $.gevent.subscribe(jqueryMap.$container, 'tables-updated', _drawTableList);
+            _registerPageEvents();
+            _waitForData();
+        });
+        return true;
+    }
+
+    function unloadModule() {
+        $.gevent.unsubscribe(jqueryMap.$container, 'queries-updated');
+        $.gevent.unsubscribe(jqueryMap.$container, 'tables-updated');
+        _unregisterPageEvents();
+    }
+    return {
+        initModule: initModule,
+        unloadModule: unloadModule
+    };
 }());
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/js/blurconsole.schema.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.schema.js b/contrib/blur-console/src/main/webapp/js/blurconsole.schema.js
index bb6116b..3006cf0 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.schema.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.schema.js
@@ -21,6 +21,8 @@ under the License.
 /*global blurconsole:false */
 blurconsole.schema = (function () {
 	'use strict';
+    
+    //----------------------------- Configuration and State -------------------------
 	var
 		configMap = {
 			mainHtml: String()
@@ -54,20 +56,25 @@ blurconsole.schema = (function () {
 				+ '</div>'
 		},
 		stateMap = {},
-		jqueryMap = {},
-		initModule, showSchema, popupSchemaView, buildTreeSection, buildInfoSection, viewTerms,
findTerms, loadTerms, switchToSearch;
+		jqueryMap = {};
 
-	showSchema = function(event, table) {
+    //------------------------------ Private Methods -----------------------------------------------------
+    function _findTerms() {
+		blurconsole.model.tables.findTerms(stateMap.table, stateMap.termFamily, stateMap.termColumn,
jqueryMap.termSearch.val());
+	}
+    
+    //------------------------------ Event Handling and DOM Methods --------------------------------------
+	function _showSchema(event, table) {
 		stateMap.table = table;
 		stateMap.modalId = stateMap.table + '_modal';
-		blurconsole.model.tables.getSchema(stateMap.table, popupSchemaView);
-	};
+		blurconsole.model.tables.getSchema(stateMap.table, _popupSchemaView);
+	}
 
-	popupSchemaView = function(schema) {
+	function _popupSchemaView(schema) {
 		stateMap.schema = schema;
 		jqueryMap.contentHolder = $(configMap.mainHtml);
-		jqueryMap.contentHolder.find('.schemaList').html(buildTreeSection());
-		jqueryMap.contentHolder.find('.schemaColumnInfo').append(buildInfoSection());
+		jqueryMap.contentHolder.find('.schemaList').html(_buildTreeSection());
+		jqueryMap.contentHolder.find('.schemaColumnInfo').append(_buildInfoSection());
 
 		jqueryMap.modal = $(blurconsole.browserUtils.modal(stateMap.modalId, 'Schema Definition
for ' + stateMap.table, jqueryMap.contentHolder, null, 'large'));
 		jqueryMap.modal.modal()
@@ -91,12 +98,12 @@ blurconsole.schema = (function () {
 			jqueryMap.columnTermsSection.hide();
 			return false;
 		})
-		.on('click', 'a.termsTrigger', viewTerms)
-		.on('click', '.schemaColumnTerms button', findTerms)
-		.on('click', '.searchTrigger', switchToSearch);
-	};
+		.on('click', 'a.termsTrigger', _viewTerms)
+		.on('click', '.schemaColumnTerms button', _findTerms)
+		.on('click', '.searchTrigger', _switchToSearch);
+	}
 
-	buildTreeSection = function() {
+	function _buildTreeSection() {
 		var tree = '';
 		$.each(stateMap.schema, function(family, cols){
 			var famId = blurconsole.browserUtils.cleanId(family);
@@ -115,9 +122,9 @@ blurconsole.schema = (function () {
 			tree += '</ul></div></div></div>';
 		});
 		return tree;
-	};
+	}
 
-	buildInfoSection = function() {
+	function _buildInfoSection() {
 		var info = '';
 		$.each(stateMap.schema, function(family, cols){
 			var famId = blurconsole.browserUtils.cleanId(family);
@@ -139,48 +146,45 @@ blurconsole.schema = (function () {
 			});
 		});
 		return info;
-	};
+	}
 
-	viewTerms = function() {
+	function _viewTerms(evt) {
 		jqueryMap.termList.html('<div class="center-block"><img src="img/ajax-loader.gif"></div>');
 		jqueryMap.termSearch.val('');
 		jqueryMap.columnTermsSection.show();
-		var $this = $(this);
+		var $this = $(evt.currentTarget);
 
 		stateMap.termFamily = $this.data('fam');
 		stateMap.termColumn = $this.data('col');
 
 		jqueryMap.termSearchButton.trigger('click');
-	};
+	}
 
-	findTerms = function() {
-		blurconsole.model.tables.findTerms(stateMap.table, stateMap.termFamily, stateMap.termColumn,
jqueryMap.termSearch.val());
-	};
-
-	loadTerms = function() {
+	function _loadTerms() {
 		var terms = Array.prototype.slice.call(arguments, 1);
 		jqueryMap.termList.html('');
 		$.each(terms, function(i, term){
 			jqueryMap.termList.append('<li class="list-group-item">' + term + ' <span class="badge
badge-success searchTrigger" title="Search for this value" data-value="' + term + '" data-table="'
+ stateMap.table + '"><i class="glyphicon glyphicon-search"></i></span></li>');
 		});
-	};
+	}
 
-	switchToSearch = function(){
+	function _switchToSearch(evt){
 		blurconsole.shell.changeAnchorPart({
 			tab: 'search',
 			_tab: {
-				query: encodeURIComponent(stateMap.termFamily + '.' + stateMap.termColumn + ':' + $(this).data('value')),
-				table: $(this).data('table'),
+				query: encodeURIComponent(stateMap.termFamily + '.' + stateMap.termColumn + ':' + $(evt.currentTarget).data('value')),
+				table: $(evt.currentTarget).data('table'),
 				rr: 'rowrow'
 			}
 		});
 		jqueryMap.modal.modal('hide');
-	};
+	}
 
-	initModule = function() {
-		$.gevent.subscribe($(document), 'schema-show', showSchema);
-		$.gevent.subscribe($(document), 'terms-updated', loadTerms);
-	};
+    //----------------------------- Public API ----------------------------
+	function initModule() {
+		$.gevent.subscribe($(document), 'schema-show', _showSchema);
+		$.gevent.subscribe($(document), 'terms-updated', _loadTerms);
+	}
 
 	return {
 		initModule : initModule

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.search.js b/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
index 212ac02..fb2b03d 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
@@ -19,6 +19,8 @@ under the License.
 /*global blurconsole:false, confirm:false */
 blurconsole.search = (function () {
 	'use strict';
+    
+    //----------------------------- Configuration and State --------------------------------
 	var configMap = {
 		view : 'views/search.tpl.html',
 		superQueryMap: {
@@ -44,12 +46,10 @@ blurconsole.search = (function () {
 		$filter : null,
 		$rowRecordOption : 'rowrow'
 	},
-	jqueryMap = {},
-	setJqueryMap, initModule, unloadModule, drawResultHolders, drawResults, registerPageEvents,
unregisterPageEvents,
-	sendSearch, showOptions, reviewTables, loadTableList, getMoreData, fixPanelWidths, updateOptionPopover,
updateOptionDisplay,
-	persistOptions, getColList, popupFacetDialog;
-
-	setJqueryMap = function() {
+	jqueryMap = {};
+    
+    //----------------- Private Methods ----------------------------------
+	function _setJqueryMap() {
 		var $container = stateMap.$container;
 		jqueryMap = {
 			$container : $container,
@@ -62,12 +62,12 @@ blurconsole.search = (function () {
 			$countHolder : $('#resultCount'),
 			$facetTrigger : $('#facetTrigger')
 		};
-	};
+	}
 
-	registerPageEvents = function() {
-		$('#searchTrigger').on('click', sendSearch);
-		$('#results').on('shown.bs.collapse', '.panel-collapse:not(.loaded)', getMoreData);
-		$('#results').on('click', '.nextPage', getMoreData);
+	function _registerPageEvents() {
+		$('#searchTrigger').on('click', _sendSearch);
+		$('#results').on('shown.bs.collapse', '.panel-collapse:not(.loaded)', _getMoreData);
+		$('#results').on('click', '.nextPage', _getMoreData);
 		$('#searchOptionsTrigger').popover({
 			html: true,
 			placement: 'bottom',
@@ -75,12 +75,12 @@ blurconsole.search = (function () {
 			container: 'body',
 			content: configMap.optionsHtml
 		});
-		$('#searchOptionsTrigger').on('shown.bs.popover', updateOptionPopover);
-		$(document).on('change', '.popover select', persistOptions);
-		jqueryMap.$facetTrigger.on('click', popupFacetDialog);
-	};
+		$('#searchOptionsTrigger').on('shown.bs.popover', _updateOptionPopover);
+		$(document).on('change', '.popover select', _persistOptions);
+		jqueryMap.$facetTrigger.on('click', _popupFacetDialog);
+	}
 
-	unregisterPageEvents = function() {
+	function _unregisterPageEvents() {
 		$('#searchTrigger').off('click');
 		$('#results').off('shown.bs.collapse');
 		$('#results').off('click');
@@ -88,23 +88,37 @@ blurconsole.search = (function () {
 		$('#searchOptionsTrigger').off('shown.bs.popover');
 		$(document).off('change');
 		//jqueryMap.$facetTrigger.off('click');
-	};
+	}
+    
+    function _getColList(row) {
+		var cols = blurconsole.utils.reject(blurconsole.utils.keys(row), function(i) {
+			return i === 'recordid';
+		});
 
-	updateOptionDisplay = function() {
-		var displayText = '';
+		if (cols.length === 0) {
+			return [];
+		}
 
-		displayText += configMap.superQueryMap[stateMap.$rowRecordOption];
+		cols.sort();
 
+		cols = ['recordid'].concat(cols);
+		return cols;
+	}
+    
+    //------------------------------ Event Handlers and DOM Methods ---------------------
+	function _updateOptionDisplay() {
+		var displayText = '';
+		displayText += configMap.superQueryMap[stateMap.$rowRecordOption];
 		jqueryMap.$optionsDisplay.html(displayText);
-	};
+	}
 
-	updateOptionPopover = function() {
+	function _updateOptionPopover() {
 		if ($('#superQuery').length > 0) {
 			$('#superQuery').val(stateMap.$rowRecordOption);
 		}
-	};
+	}
 
-	persistOptions = function() {
+	function _persistOptions() {
 		var resendSearch = false;
 		if (jqueryMap.$resultsHolder.children().length > 0) {
 			if (confirm('You have existing results on the screen, changing the search options will
erase your results.  Continue?')) {
@@ -116,13 +130,13 @@ blurconsole.search = (function () {
 		}
 		stateMap.$rowRecordOption = $('#superQuery').val();
 		if (resendSearch) {
-			sendSearch();
+			_sendSearch();
 		}
-		updateOptionDisplay();
+		_updateOptionDisplay();
 		$('#searchOptionsTrigger').popover('hide');
-	};
+	}
 
-	sendSearch = function() {
+	function _sendSearch() {
 		stateMap.$currentTable = jqueryMap.$tableField.val();
 		stateMap.$currentQuery = jqueryMap.$queryField.val();
 
@@ -134,27 +148,21 @@ blurconsole.search = (function () {
 				rr: stateMap.$rowRecordOption
 			}
 		});
-
-		drawResultHolders();
-
+		_drawResultHolders();
 		blurconsole.model.search.runSearch(stateMap.$currentQuery, stateMap.$currentTable, {start:
0, fetch: 10, rowRecordOption: stateMap.$rowRecordOption});
-	};
+	}
 
-	getMoreData = function() {
-		var family = $(this).attr('href') ? $(this).attr('href').substring(1) : $(this).attr('id');
+	function _getMoreData(evt) {
+		var family = $(evt.currentTarget).attr('href') ? $(evt.currentTarget).attr('href').substring(1)
: $(evt.currentTarget).attr('id');
 		blurconsole.model.search.loadMoreResults(family);
 		return false;
-	};
+	}
 
-	showOptions = function() {
-
-	};
-
-	reviewTables = function() {
-		var tableFound = false, tableMap;
+	function _reviewTables() {
+		var tableFound = false;
 
 		if (stateMap.$currentTable) {
-			tableMap = blurconsole.model.tables.getAllEnabledTables();
+			var tableMap = blurconsole.model.tables.getAllEnabledTables();
 			$.each(tableMap, function(cluster, tables){
 				var tableList = $.map(tables, function(t){ return t.name; });
 				if (tableList.indexOf(stateMap.$currentTable) > -1) {
@@ -165,27 +173,27 @@ blurconsole.search = (function () {
 
 		if (tableFound) {
 			jqueryMap.$tableWarning.hide();
-			loadTableList();
+			_loadTableList();
 		} else if (stateMap.$currentTable) {
 			jqueryMap.$tableWarning.show();
 		} else {
-			loadTableList();
+			_loadTableList();
 		}
-	};
+	}
 
-	drawResultHolders = function() {
-		var familyMarkup = '', allFamilies, extraFamilies = [], parsedFamilies = blurconsole.utils.findFamilies(stateMap.$currentQuery),
sortedFamilies;
+	function _drawResultHolders() {
+		var familyMarkup = '', parsedFamilies = blurconsole.utils.findFamilies(stateMap.$currentQuery);
 
 		jqueryMap.$resultsHolder.html('');
 
 		// Redraw families
-		allFamilies = blurconsole.model.tables.getFamilies(stateMap.$currentTable);
-		extraFamilies = blurconsole.utils.reject(allFamilies, function(fam){ return parsedFamilies.indexOf(fam)
>= 0; });
+		var allFamilies = blurconsole.model.tables.getFamilies(stateMap.$currentTable);
+		var extraFamilies = blurconsole.utils.reject(allFamilies, function(fam){ return parsedFamilies.indexOf(fam)
>= 0; });
 
 		parsedFamilies.sort();
 		extraFamilies.sort();
 
-		sortedFamilies = parsedFamilies.concat(extraFamilies);
+		var sortedFamilies = parsedFamilies.concat(extraFamilies);
 
 		$.each(sortedFamilies, function(i, fam) {
 			var famId = blurconsole.browserUtils.cleanId(fam);
@@ -196,18 +204,18 @@ blurconsole.search = (function () {
 		});
 
 		jqueryMap.$resultsHolder.html(familyMarkup);
-		fixPanelWidths();
-	};
+		_fixPanelWidths();
+	}
 
-	fixPanelWidths = function() {
+	function _fixPanelWidths() {
 		var allPanels = jqueryMap.$resultsHolder.find('.panel-collapse');
 		if (allPanels.length > 0) {
 			var width = $(allPanels[0]).parent().width() - 30;
 			allPanels.width(width);
 		}
-	};
+	}
 
-	drawResults = function(evt, families) {
+	function _drawResults(evt, families) {
 		var results = blurconsole.model.search.getResults();
 		jqueryMap.$countHolder.html('<small>Found ' + blurconsole.model.search.getTotal()
+ ' total results</small>');
 		//jqueryMap.$facetTrigger.show();
@@ -225,7 +233,7 @@ blurconsole.search = (function () {
 				} else {
 					if (blurconsole.utils.keys(famResults[0]).indexOf('rowid') === -1 ) {
 						// Record results
-						cols = getColList(famResults[0]);
+						cols = _getColList(famResults[0]);
 
 						$.each(cols, function(i, col) {
 							table += '<th>' + col + '</th>';
@@ -242,7 +250,7 @@ blurconsole.search = (function () {
 						// Row results
 						$.each(famResults, function(i, row){
 							if (row.records.length > 0) {
-								var tmpCols = getColList(row.records[0]);
+								var tmpCols = _getColList(row.records[0]);
 								if (tmpCols.length > 0) {
 									cols = tmpCols;
 									return false;
@@ -284,26 +292,11 @@ blurconsole.search = (function () {
 					$(famId).addClass('loaded');
 				}
 			});
-			fixPanelWidths();
-		}
-	};
-
-	getColList = function(row) {
-		var cols = blurconsole.utils.reject(blurconsole.utils.keys(row), function(i) {
-			return i === 'recordid';
-		});
-
-		if (cols.length === 0) {
-			return [];
+			_fixPanelWidths();
 		}
+	}
 
-		cols.sort();
-
-		cols = ['recordid'].concat(cols);
-		return cols;
-	};
-
-	loadTableList = function() {
+	function _loadTableList() {
 		var tableMap = blurconsole.model.tables.getAllEnabledTables();
 
 		jqueryMap.$tableSelectorStatusOption.html('Loading Tables...');
@@ -323,21 +316,22 @@ blurconsole.search = (function () {
 		});
 
 		jqueryMap.$tableSelectorStatusOption.html('Choose Table');
-	};
+	}
 
-	popupFacetDialog = function() {
+	function _popupFacetDialog() {
 		jqueryMap.facetModal = $(blurconsole.browserUtils.modal('facetDialog', 'Facets for Current
Search', 'TBD', null, 'large'));
 		jqueryMap.facetModal.modal();
-	};
+	}
 
-	initModule = function($container) {
+    //--------------------------------- Public API ------------------------------------------
+	function initModule($container) {
 		$container.load(configMap.view, function() {
 			stateMap.$container = $container;
-			setJqueryMap();
-			$.gevent.subscribe(jqueryMap.$container, 'tables-updated', reviewTables);
-			$.gevent.subscribe(jqueryMap.$container, 'results-updated', drawResults);
-			registerPageEvents();
-			loadTableList();
+			_setJqueryMap();
+			$.gevent.subscribe(jqueryMap.$container, 'tables-updated', _reviewTables);
+			$.gevent.subscribe(jqueryMap.$container, 'results-updated', _drawResults);
+			_registerPageEvents();
+			_loadTableList();
 
 			var startupMap = $.uriAnchor.makeAnchorMap();
 
@@ -349,16 +343,16 @@ blurconsole.search = (function () {
 				stateMap.$rowRecordOption = startupMap._tab.rr;
 			}
 
-			updateOptionDisplay();
+			_updateOptionDisplay();
 			stateMap.loaded = true;
 		});
 		return true;
-	};
+	}
 
-	unloadModule = function() {
+	function unloadModule() {
 		$.gevent.unsubscribe(jqueryMap.$container, 'tables-updated');
-		unregisterPageEvents();
-	};
+		_unregisterPageEvents();
+	}
 
 	return {
 		initModule : initModule,

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/js/blurconsole.shell.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.shell.js b/contrib/blur-console/src/main/webapp/js/blurconsole.shell.js
index f1b450d..23ce5f4 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.shell.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.shell.js
@@ -25,6 +25,8 @@ under the License.
 /* global blurconsole:false, $:false */
 blurconsole.shell = (function () {
 	'use strict';
+    
+    //---------------------------- Configuration and State ----------------------------
 	var configMap = {
 		anchorSchemaMap : {
 			tab : { dashboard : true, tables : true, queries : true, search : true },
@@ -38,28 +40,24 @@ blurconsole.shell = (function () {
 		currentTab : null,
 		anchorMap  : {}
 	},
-	jqueryMap = {},
-	copyAnchorMap, setJqueryMap, switchView,
-	changeAnchorPart, onHashChange,
-	onClickTab, initModule;
-
-	copyAnchorMap = function () {
-		return $.extend( true, {}, stateMap.anchorMap );
-	};
-
-	setJqueryMap = function () {
+	jqueryMap = {};
+    
+    //---------------------------- Private Methods -------------------------
+    function _setJqueryMap() {
 		var $container = stateMap.$container;
 		jqueryMap = {
 			$container   : $container,
 			$sideNavTabs : $('.side-nav a')
 		};
-	};
-
-	switchView = function ( tab ) {
-		var i;
-
+	}
+    
+    function _copyAnchorMap() {
+		return $.extend( true, {}, stateMap.anchorMap );
+	}
+    
+    function _switchView( tab ) {
 		if (stateMap.currentTab !== tab) {
-			for ( i = 0; i < configMap.allTabs.length; i++ ) {
+			for ( var i = 0; i < configMap.allTabs.length; i++ ) {
 				if (blurconsole[configMap.allTabs[i]]) {
 					blurconsole[configMap.allTabs[i]].unloadModule();
 				}
@@ -74,63 +72,32 @@ blurconsole.shell = (function () {
 		}
 
 		return true;
-	};
-
-	changeAnchorPart = function ( argMap ) {
-		var anchorMapRevise = copyAnchorMap(),
-			boolReturn = true,
-			keyName, keyNameDep;
-
-		KEYVAL:
-		for ( keyName in argMap ) {
-			if ( argMap.hasOwnProperty( keyName ) ) {
-				if ( keyName.indexOf( '_' ) === 0 ) { continue KEYVAL; }
-				anchorMapRevise[keyName] = argMap[keyName];
-				keyNameDep = '_' + keyName;
-				if ( argMap[keyNameDep] ) {
-					anchorMapRevise[keyNameDep] = argMap[keyNameDep];
-				} else {
-					delete anchorMapRevise[keyNameDep];
-					delete anchorMapRevise['_s' + keyNameDep];
-				}
-			}
-		}
+	}
+    
+    //---------------------------- Event Handlers and DOM Methods ----------
+    function _onHashChange() {
+		var anchorMapPrevious = _copyAnchorMap(), anchorMapProposed;
 
 		try {
-			$.uriAnchor.setAnchor( anchorMapRevise );
-		} catch ( error ) {
-			$.uriAnchor.setAnchor( stateMap.anchorMap, null, true );
-			boolReturn = false;
-		}
-
-		return boolReturn;
-	};
-
-	onHashChange = function () {
-		var anchorMapPrevious = copyAnchorMap(),
-			anchorMapProposed,
-			_sTabPrevious, _sTabProposed,
-			sTabProposed;
-
-		try { anchorMapProposed = $.uriAnchor.makeAnchorMap(); }
-		catch ( error ) {
+            anchorMapProposed = $.uriAnchor.makeAnchorMap();
+        } catch ( error ) {
 			$.uriAnchor.setAnchor( anchorMapPrevious, null, true );
 			return false;
 		}
 
 		stateMap.anchorMap = anchorMapProposed;
 
-		_sTabPrevious = anchorMapPrevious._s_tab; // jshint ignore:line
-		_sTabProposed = anchorMapProposed._s_tab; // jshint ignore:line
+		var _sTabPrevious = anchorMapPrevious._s_tab; // jshint ignore:line
+		var _sTabProposed = anchorMapProposed._s_tab; // jshint ignore:line
 
 		if ( ! anchorMapPrevious || _sTabPrevious !== _sTabProposed ){
-			sTabProposed = anchorMapProposed.tab;
+			var sTabProposed = anchorMapProposed.tab;
 			switch ( sTabProposed ) {
 				case 'dashboard':
 				case 'tables':
 				case 'queries':
 				case 'search':
-					switchView( sTabProposed );
+					_switchView( sTabProposed );
 					break;
 				default:
 					$.uriAnchor.setAnchor( anchorMapPrevious, null, true );
@@ -138,19 +105,48 @@ blurconsole.shell = (function () {
 		}
 
 		return false;
-	};
-
-	onClickTab = function ( ) {
-		var target = $(this);
+	}
+    
+    function _onClickTab(evt) {
+		var target = $(evt.currentTarget);
 		changeAnchorPart({
 			tab : target.attr('href').split('=')[1]
 		});
 		return false;
-	};
+	}
+    
+    //---------------------------- Public API ------------------------------
+	function changeAnchorPart( argMap ) {
+		var anchorMapRevise = _copyAnchorMap(), boolReturn = true;
 
-	initModule = function( $container ) {
+		KEYVAL:
+		for ( var keyName in argMap ) {
+			if ( argMap.hasOwnProperty( keyName ) ) {
+				if ( keyName.indexOf( '_' ) === 0 ) { continue KEYVAL; }
+				anchorMapRevise[keyName] = argMap[keyName];
+				var keyNameDep = '_' + keyName;
+				if ( argMap[keyNameDep] ) {
+					anchorMapRevise[keyNameDep] = argMap[keyNameDep];
+				} else {
+					delete anchorMapRevise[keyNameDep];
+					delete anchorMapRevise['_s' + keyNameDep];
+				}
+			}
+		}
+
+		try {
+			$.uriAnchor.setAnchor( anchorMapRevise );
+		} catch ( error ) {
+			$.uriAnchor.setAnchor( stateMap.anchorMap, null, true );
+			boolReturn = false;
+		}
+
+		return boolReturn;
+	}
+
+	function initModule( $container ) {
 		stateMap.$container = $container;
-		setJqueryMap();
+		_setJqueryMap();
 
 		blurconsole.schema.initModule();
 		blurconsole.logging.initModule();
@@ -161,13 +157,13 @@ blurconsole.shell = (function () {
 
 		$('.side-nav li').tooltip();
 
-		jqueryMap.$sideNavTabs.click( onClickTab );
+		jqueryMap.$sideNavTabs.click( _onClickTab );
 
 		$.uriAnchor.configModule({
 			schema_map : configMap.anchorSchemaMap // jshint ignore:line
 		});
 
-		$(window).bind('hashchange', onHashChange).trigger('hashchange');
+		$(window).bind('hashchange', _onHashChange).trigger('hashchange');
 
 		var startupMap = $.uriAnchor.makeAnchorMap();
 
@@ -185,7 +181,7 @@ blurconsole.shell = (function () {
 				$('#view_logging_trigger .badge').html(errors.length);
 			}
 		});
-	};
+	}
 
 	return {
 		initModule: initModule,

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/js/blurconsole.tables.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.tables.js b/contrib/blur-console/src/main/webapp/js/blurconsole.tables.js
index cb2a6f4..2803e4c 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.tables.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.tables.js
@@ -21,6 +21,8 @@ under the License.
 /*global blurconsole:false */
 blurconsole.tables = (function () {
 	'use strict';
+    
+    //------------------------ Configuration and State ----------------------
 	var configMap = {
 		view : 'views/tables.tpl.html',
 		enabledDef : [
@@ -47,97 +49,27 @@ blurconsole.tables = (function () {
 		]
 	},
 	stateMap = { $container : null },
-	jqueryMap = {},
-	setJqueryMap, initModule, unloadModule, updateTableList, buildTabs, waitForData, registerPageEvents,
unregisterPageEvents, updateActivityIndicators;
+	jqueryMap = {};
 
-	setJqueryMap = function() {
+    //----------------------------- Private Methods ----------------------------
+	function _setJqueryMap() {
 		var $container = stateMap.$container;
 		jqueryMap = {
 			$container : $container,
 			$tableInfoHolder : $('#tableInfoHolder'),
 			$tables : {}
 		};
-	};
-
-	unloadModule = function() {
-		$.gevent.unsubscribe(jqueryMap.$container, 'tables-updated');
-		$.gevent.unsubscribe(jqueryMap.$container, 'queries-updated');
-		unregisterPageEvents();
-	};
-
-	initModule = function($container) {
-		$container.load(configMap.view, function() {
-			stateMap.$container = $container;
-			setJqueryMap();
-			$.gevent.subscribe(jqueryMap.$container, 'tables-updated', updateTableList);
-			$.gevent.subscribe(jqueryMap.$container, 'queries-updated', updateActivityIndicators);
-			waitForData();
-			registerPageEvents();
-		});
-		return true;
-	};
+	}
 
-	waitForData = function() {
+	function _waitForData() {
 		if (blurconsole.model.tables.getClusters().length > 0) {
-			buildTabs();
+			_buildTabs();
 		} else {
-			setTimeout(waitForData, 100);
-		}
-	};
-
-	buildTabs = function() {
-		var clusters, tabMarkup, paneMarkup, needsTabs;
-
-		clusters = blurconsole.model.tables.getClusters();
-		needsTabs = clusters.length > 1;
-
-		if (needsTabs) {
-			tabMarkup = '<ul class="nav nav-tabs">';
-			tabMarkup += $.map(clusters, function(cluster, idx) {
-				return '<li class="' + (idx === 0 ? 'active' : '') + '"><a href="#' + cluster
+ '_pane" data-toggle="tab">' + cluster + ' <i class="glyphicon glyphicon-exclamation-sign"
style="display:none" title="Activity detected"></i></a></li>';
-			}).join('');
-			tabMarkup += '</ul>';
-
-			jqueryMap.$tableInfoHolder.html($(tabMarkup));
+			setTimeout(_waitForData, 100);
 		}
-
-		paneMarkup = needsTabs ? '<div class="tab-content">' : '';
-		paneMarkup += $.map(clusters, function(cluster, idx) {
-			return '<div id="' + cluster + '_pane" class="tab-pane' + (idx === 0 ? ' active' :
'') + '"><h3>Enabled Tables</h3><div class="enabledSection"></div><h3>Disabled
Tables</h3><div class="disabledSection"></div></div>';
-		}).join('');
-		paneMarkup += needsTabs ? '</div>' : '';
-
-		if (needsTabs) {
-			jqueryMap.$tableInfoHolder.append(paneMarkup);
-		} else {
-			jqueryMap.$tableInfoHolder.html(paneMarkup);
-		}
-
-		$.each(clusters, function(idx, cluster){
-			var clusterPane = $('#' + cluster + '_pane');
-			clusterPane.find('.enabledSection').html(blurconsole.browserUtils.table(configMap.enabledDef,
blurconsole.model.tables.getEnabledTables(cluster)));
-			clusterPane.find('.disabledSection').html(blurconsole.browserUtils.table(configMap.disabledDef,
blurconsole.model.tables.getDisabledTables(cluster)));
-		});
-	};
-
-	updateTableList = function() {
-		var clusters = blurconsole.model.tables.getClusters();
-
-		$.each(clusters, function(idx, cluster) {
-			var clusterPane = $('#' + cluster + '_pane'), enabledSection, disabledSection;
-			enabledSection = clusterPane.find('.enabledSection');
-			disabledSection = clusterPane.find('.disabledSection');
-
-			if (enabledSection.length > 0) {
-				enabledSection.html(blurconsole.browserUtils.table(configMap.enabledDef, blurconsole.model.tables.getEnabledTables(cluster)));
-			}
-			if (disabledSection.length > 0) {
-				disabledSection.html(blurconsole.browserUtils.table(configMap.disabledDef, blurconsole.model.tables.getDisabledTables(cluster)));
-			}
-		});
-	};
-
-	registerPageEvents = function() {
+	}
+    
+    function _registerPageEvents() {
 		// Tab control
 		jqueryMap.$tableInfoHolder.on('click', 'ul.nav a', function(e) {
 			e.preventDefault();
@@ -184,15 +116,66 @@ blurconsole.tables = (function () {
 			});
 			return false;
 		});
-	};
+	}
 
-	unregisterPageEvents = function() {
+	function _unregisterPageEvents() {
 		if (jqueryMap.$tableInfoHolder) {
 			jqueryMap.$tableInfoHolder.off();
 		}
-	};
+	}
+    
+    //------------------------- Event Handling and DOM Methods ---------------------------
+	function _buildTabs() {
+		var clusters = blurconsole.model.tables.getClusters();
+		var needsTabs = clusters.length > 1;
+
+		if (needsTabs) {
+			var tabMarkup = '<ul class="nav nav-tabs">';
+			tabMarkup += $.map(clusters, function(cluster, idx) {
+				return '<li class="' + (idx === 0 ? 'active' : '') + '"><a href="#' + cluster
+ '_pane" data-toggle="tab">' + cluster + ' <i class="glyphicon glyphicon-exclamation-sign"
style="display:none" title="Activity detected"></i></a></li>';
+			}).join('');
+			tabMarkup += '</ul>';
+
+			jqueryMap.$tableInfoHolder.html($(tabMarkup));
+		}
+
+		var paneMarkup = needsTabs ? '<div class="tab-content">' : '';
+		paneMarkup += $.map(clusters, function(cluster, idx) {
+			return '<div id="' + cluster + '_pane" class="tab-pane' + (idx === 0 ? ' active' :
'') + '"><h3>Enabled Tables</h3><div class="enabledSection"></div><h3>Disabled
Tables</h3><div class="disabledSection"></div></div>';
+		}).join('');
+		paneMarkup += needsTabs ? '</div>' : '';
+
+		if (needsTabs) {
+			jqueryMap.$tableInfoHolder.append(paneMarkup);
+		} else {
+			jqueryMap.$tableInfoHolder.html(paneMarkup);
+		}
+
+		$.each(clusters, function(idx, cluster){
+			var clusterPane = $('#' + cluster + '_pane');
+			clusterPane.find('.enabledSection').html(blurconsole.browserUtils.table(configMap.enabledDef,
blurconsole.model.tables.getEnabledTables(cluster)));
+			clusterPane.find('.disabledSection').html(blurconsole.browserUtils.table(configMap.disabledDef,
blurconsole.model.tables.getDisabledTables(cluster)));
+		});
+	}
 
-	updateActivityIndicators = function() {
+	function _updateTableList() {
+		var clusters = blurconsole.model.tables.getClusters();
+
+		$.each(clusters, function(idx, cluster) {
+			var clusterPane = $('#' + cluster + '_pane'), enabledSection, disabledSection;
+			enabledSection = clusterPane.find('.enabledSection');
+			disabledSection = clusterPane.find('.disabledSection');
+
+			if (enabledSection.length > 0) {
+				enabledSection.html(blurconsole.browserUtils.table(configMap.enabledDef, blurconsole.model.tables.getEnabledTables(cluster)));
+			}
+			if (disabledSection.length > 0) {
+				disabledSection.html(blurconsole.browserUtils.table(configMap.disabledDef, blurconsole.model.tables.getDisabledTables(cluster)));
+			}
+		});
+	}
+	
+	function _updateActivityIndicators() {
 		var clusters = blurconsole.model.tables.getClusters();
 
 		$.each(clusters, function(i, cluster) {
@@ -214,7 +197,26 @@ blurconsole.tables = (function () {
 				$('a[href="#' + cluster +'_pane"] i').hide();
 			}
 		});
-	};
+	}
+    
+    //-------------------------- Public API ------------------------------
+    function unloadModule() {
+		$.gevent.unsubscribe(jqueryMap.$container, 'tables-updated');
+		$.gevent.unsubscribe(jqueryMap.$container, 'queries-updated');
+		_unregisterPageEvents();
+	}
+
+	function initModule($container) {
+		$container.load(configMap.view, function() {
+			stateMap.$container = $container;
+			_setJqueryMap();
+			$.gevent.subscribe(jqueryMap.$container, 'tables-updated', _updateTableList);
+			$.gevent.subscribe(jqueryMap.$container, 'queries-updated', _updateActivityIndicators);
+			_waitForData();
+			_registerPageEvents();
+		});
+		return true;
+	}
 
 	return {
 		initModule : initModule,

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/899e47d2/contrib/blur-console/src/main/webapp/js/blurconsole.utils.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.utils.js b/contrib/blur-console/src/main/webapp/js/blurconsole.utils.js
index f98939f..b2eeff8 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.utils.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.utils.js
@@ -20,9 +20,9 @@ under the License.
 /*global blurconsole:false */
 blurconsole.utils = (function(){
 	'use strict';
-	var inject, unique, equals, keys, findFamilies, reject;
-
-	inject = function(collection, initial, block) {
+    
+    //-------------------------- Public API ----------------------------
+	function inject(collection, initial, block) {
 		if (collection === null || collection.length === 0) {
 			return initial;
 		}
@@ -33,9 +33,9 @@ blurconsole.utils = (function(){
 		});
 
 		return accumulator;
-	};
+	}
 
-	unique = function(collection, sort) {
+	function unique(collection, sort) {
 		var uniqueList = [];
 
 		$.each(collection, function(idx, item){
@@ -49,17 +49,17 @@ blurconsole.utils = (function(){
 		}
 
 		return uniqueList;
-	};
+	}
 
-	equals = function(obj1, obj2) {
+	function equals(obj1, obj2) {
 		return JSON.stringify(obj1) === JSON.stringify(obj2);
-	};
+	}
 
-	keys = function(map) {
+	function keys(map) {
 		return $.map(map, function(v, key){ return key; });
-	};
+	}
 
-	findFamilies = function(query) {
+	function findFamilies(query) {
 		// Determine regex to find column families in lucene query
 		var matches = query.match(/[^ \(\)\+\-]+(\w+)\.\w+:/g);
 
@@ -72,9 +72,9 @@ blurconsole.utils = (function(){
 			families.push(match.split('.')[0]);
 		});
 		return families;
-	};
+	}
 
-	reject = function(collection, block) {
+	function reject(collection, block) {
 		var newArray = [];
 		$.each(collection, function(i, item){
 			if (!block(item)) {
@@ -82,7 +82,7 @@ blurconsole.utils = (function(){
 			}
 		});
 		return newArray;
-	};
+	}
 
 	return {
 		inject: inject,


Mime
View raw message