Repository: incubator-blur Updated Branches: refs/heads/apache-blur-0.2 79786acad -> dd91c9218
jshint style 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/dd91c921 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/dd91c921 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/dd91c921 Branch: refs/heads/apache-blur-0.2 Commit: dd91c9218a24748faf3bdedb70f39b4f5dd4651c Parents: 79786ac Author: Chris Rohr <[email protected]> Authored: Tue Jul 8 17:17:05 2014 -0400 Committer: Chris Rohr <[email protected]> Committed: Tue Jul 8 17:17:05 2014 -0400 ---------------------------------------------------------------------- blur-console/src/main/webapp/.jshintrc | 2 +- .../src/main/webapp/js/blurconsole.fake.js | 2 +- .../src/main/webapp/js/blurconsole.queries.js | 364 +++++++++---------- .../src/main/webapp/js/blurconsole.search.js | 2 +- .../src/main/webapp/js/blurconsole.shell.js | 14 +- .../src/main/webapp/js/blurconsole.tables.js | 4 +- .../src/main/webapp/js/blurconsole.utils.js | 2 +- 7 files changed, 195 insertions(+), 195 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dd91c921/blur-console/src/main/webapp/.jshintrc ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/.jshintrc b/blur-console/src/main/webapp/.jshintrc index abc9b0a..c9d0f8f 100644 --- a/blur-console/src/main/webapp/.jshintrc +++ b/blur-console/src/main/webapp/.jshintrc @@ -7,7 +7,7 @@ "curly": true, "eqeqeq": true, "immed": true, - "indent": 4, + "indent": 2, "latedef": true, "newcap": true, "noarg": true, http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dd91c921/blur-console/src/main/webapp/js/blurconsole.fake.js ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/js/blurconsole.fake.js b/blur-console/src/main/webapp/js/blurconsole.fake.js index b1ef6c4..6400345 100644 --- a/blur-console/src/main/webapp/js/blurconsole.fake.js +++ b/blur-console/src/main/webapp/js/blurconsole.fake.js @@ -244,7 +244,7 @@ blurconsole.fake = (function() { for (var rowRecordColIndex=0; rowRecordColIndex < cols; rowRecordColIndex++) { row['col'+rowRecordColIndex] = _randomString(); } - results[fam][rowIndex]['records'].push(row); + results[fam][rowIndex].records.push(row); } } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dd91c921/blur-console/src/main/webapp/js/blurconsole.queries.js ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/js/blurconsole.queries.js b/blur-console/src/main/webapp/js/blurconsole.queries.js index f010821..42614b1 100644 --- a/blur-console/src/main/webapp/js/blurconsole.queries.js +++ b/blur-console/src/main/webapp/js/blurconsole.queries.js @@ -19,201 +19,201 @@ under the License. /*jshint laxbreak: true */ /*global blurconsole:false */ 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') - }; - } + '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 _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 _unregisterPageEvents() { + if(jqueryMap.$tableHolder) { + jqueryMap.$tableHolder.off(); } - - function _waitForData() { - var clusters = blurconsole.model.tables.getClusters(); - if(clusters && clusters.length > 0) { - _drawTableList(); - _drawQueries(); + } + + 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 + ' <i class="glyphicon glyphicon-exclamation-sign" data-table="' + table.name + '" style="display:none"></i></a>'; + }); + panelContent += '</div>'; } else { - setTimeout(_waitForData, 100); + 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>'); } - //----------------------------- 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 _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>'); } + } - 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 _updateActivityIndicators() { + var clusters = blurconsole.model.tables.getClusters(); - 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 + ' <i class="glyphicon glyphicon-exclamation-sign" data-table="' + table.name + '" style="display:none"></i></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>'); - } - } + $.each(clusters, function(i, cluster) { + var clusterHasActivity = false, + tables = blurconsole.model.tables.getEnabledTables(cluster); - function _drawQueries() { - if(stateMap.currentTable) { - jqueryMap.$queryHolder.html(blurconsole.browserUtils.table(configMap.queryDef, blurconsole.model.queries.queriesForTable(stateMap.currentTable, stateMap.currentSort, stateMap.currentFilter))); + $.each(tables, function(i, table){ + if (blurconsole.model.queries.tableHasActivity(table.name)) { + clusterHasActivity = true; + $('i[data-table="' + table.name + '"]').show(); } else { - jqueryMap.$queryHolder.html('<div class="alert alert-info">Select a table on the left to see the current queries</div>'); + $('i[data-table="' + table.name + '"]').hide(); } - } + }); + }); + } - function _updateActivityIndicators() { - var clusters = blurconsole.model.tables.getClusters(); - - $.each(clusters, function(i, cluster) { - var clusterHasActivity = false, - tables = blurconsole.model.tables.getEnabledTables(cluster); - - $.each(tables, function(i, table){ - if (blurconsole.model.queries.tableHasActivity(table.name)) { - clusterHasActivity = true; - $('i[data-table="' + table.name + '"]').show(); - } else { - $('i[data-table="' + table.name + '"]').hide(); - } - }); - }); - } - - //-------------------------- Public API --------------------------------- - - function initModule($container) { - $container.load(configMap.view, function() { - stateMap.$container = $container; - _setJqueryMap(); - $.gevent.subscribe(jqueryMap.$container, 'queries-updated', function() { - _drawQueries(); - _updateActivityIndicators(); - }); - $.gevent.subscribe(jqueryMap.$container, 'tables-updated', _drawTableList); - _registerPageEvents(); - _waitForData(); - }); - return true; - } + //-------------------------- Public API --------------------------------- - function unloadModule() { - $.gevent.unsubscribe(jqueryMap.$container, 'queries-updated'); - $.gevent.unsubscribe(jqueryMap.$container, 'tables-updated'); - _unregisterPageEvents(); - } - return { - initModule: initModule, - unloadModule: unloadModule - }; + function initModule($container) { + $container.load(configMap.view, function() { + stateMap.$container = $container; + _setJqueryMap(); + $.gevent.subscribe(jqueryMap.$container, 'queries-updated', function() { + _drawQueries(); + _updateActivityIndicators(); + }); + $.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/dd91c921/blur-console/src/main/webapp/js/blurconsole.search.js ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/js/blurconsole.search.js b/blur-console/src/main/webapp/js/blurconsole.search.js index 7274549..6263c18 100644 --- a/blur-console/src/main/webapp/js/blurconsole.search.js +++ b/blur-console/src/main/webapp/js/blurconsole.search.js @@ -205,7 +205,7 @@ blurconsole.search = (function () { } } - function _getColList(row) { + function _getColList(row) { var cols = blurconsole.utils.reject(blurconsole.utils.keys(row), function(i) { return i === 'recordid'; }); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dd91c921/blur-console/src/main/webapp/js/blurconsole.shell.js ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/js/blurconsole.shell.js b/blur-console/src/main/webapp/js/blurconsole.shell.js index 6c80b7c..6651d20 100644 --- a/blur-console/src/main/webapp/js/blurconsole.shell.js +++ b/blur-console/src/main/webapp/js/blurconsole.shell.js @@ -43,7 +43,7 @@ blurconsole.shell = (function () { jqueryMap = {}; //---------------------------- Private Methods ------------------------- - function _setJqueryMap() { + function _setJqueryMap() { var $container = stateMap.$container; jqueryMap = { $container : $container, @@ -51,11 +51,11 @@ blurconsole.shell = (function () { }; } - function _copyAnchorMap() { + function _copyAnchorMap() { return $.extend( true, {}, stateMap.anchorMap ); } - function _switchView( tab ) { + function _switchView( tab ) { if (stateMap.currentTab !== tab) { for ( var i = 0; i < configMap.allTabs.length; i++ ) { if (blurconsole[configMap.allTabs[i]]) { @@ -75,12 +75,12 @@ blurconsole.shell = (function () { } //---------------------------- Event Handlers and DOM Methods ---------- - function _onHashChange() { + function _onHashChange() { var anchorMapPrevious = _copyAnchorMap(), anchorMapProposed; try { - anchorMapProposed = $.uriAnchor.makeAnchorMap(); - } catch ( error ) { + anchorMapProposed = $.uriAnchor.makeAnchorMap(); + } catch ( error ) { $.uriAnchor.setAnchor( anchorMapPrevious, null, true ); return false; } @@ -107,7 +107,7 @@ blurconsole.shell = (function () { return false; } - function _onClickTab(evt) { + function _onClickTab(evt) { var target = $(evt.currentTarget); changeAnchorPart({ tab : target.attr('href').split('=')[1] http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dd91c921/blur-console/src/main/webapp/js/blurconsole.tables.js ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/js/blurconsole.tables.js b/blur-console/src/main/webapp/js/blurconsole.tables.js index e78c250..a18128e 100644 --- a/blur-console/src/main/webapp/js/blurconsole.tables.js +++ b/blur-console/src/main/webapp/js/blurconsole.tables.js @@ -69,7 +69,7 @@ blurconsole.tables = (function () { } } - function _registerPageEvents() { + function _registerPageEvents() { // Tab control jqueryMap.$tableInfoHolder.on('click', 'ul.nav a', function(e) { e.preventDefault(); @@ -200,7 +200,7 @@ blurconsole.tables = (function () { } //-------------------------- Public API ------------------------------ - function unloadModule() { + function unloadModule() { $.gevent.unsubscribe(jqueryMap.$container, 'tables-updated'); $.gevent.unsubscribe(jqueryMap.$container, 'queries-updated'); _unregisterPageEvents(); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dd91c921/blur-console/src/main/webapp/js/blurconsole.utils.js ---------------------------------------------------------------------- diff --git a/blur-console/src/main/webapp/js/blurconsole.utils.js b/blur-console/src/main/webapp/js/blurconsole.utils.js index d3a3043..3bebaeb 100644 --- a/blur-console/src/main/webapp/js/blurconsole.utils.js +++ b/blur-console/src/main/webapp/js/blurconsole.utils.js @@ -27,7 +27,7 @@ blurconsole.utils = (function(){ return initial; } - var accumulator = initial == null ? collection[0] : initial; + var accumulator = initial === null ? collection[0] : initial; $.each(collection, function(idx, item) { accumulator = block(accumulator, item); });
