incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaven...@apache.org
Subject [9/9] git commit: BLUR-362 format table row/record counts and query results with commas
Date Fri, 15 Aug 2014 04:04:07 GMT
BLUR-362 format table row/record counts and query results with commas


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

Branch: refs/heads/master
Commit: ab1a6cac85a0ec8070aa0398ac1e22cca08ddb2b
Parents: a2a9943
Author: Andrew Avenoso <andrew.va@gmail.com>
Authored: Fri Aug 15 00:03:13 2014 -0400
Committer: Andrew Avenoso <andrew.va@gmail.com>
Committed: Fri Aug 15 00:03:13 2014 -0400

----------------------------------------------------------------------
 .../src/main/webapp/js/blurconsole.b_utils.js   |  9 +++++--
 .../src/main/webapp/js/blurconsole.fake.js      |  2 +-
 .../src/main/webapp/js/blurconsole.model.js     |  6 ++++-
 .../src/main/webapp/js/blurconsole.search.js    |  4 +--
 .../src/main/webapp/js/blurconsole.tables.js    |  4 +--
 .../src/main/webapp/js/blurconsole.utils.js     | 12 +++++++--
 blur-console/src/main/webapp/public/index.html  |  2 +-
 ...rconsole.2a826151959859ac6ba1bdd17da01ee1.js | 27 --------------------
 ...rconsole.a8f3746a0720a51832c01a94032c39ec.js | 27 ++++++++++++++++++++
 ...rconsole.dafc5660ee546fc3f9427794e4e541f5.js | 27 ++++++++++++++++++++
 .../src/main/webapp/public/js/blurconsole.js    |  8 +++---
 ...sole.js.435b285e3a48f6da71fd4aa79ce0185c.map |  1 +
 ...sole.js.581ce85b04ad8d3441a0a291e9a3aac4.map |  1 -
 .../main/webapp/public/js/blurconsole.js.map    |  2 +-
 14 files changed, 88 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/blur-console/src/main/webapp/js/blurconsole.b_utils.js
----------------------------------------------------------------------
diff --git a/blur-console/src/main/webapp/js/blurconsole.b_utils.js b/blur-console/src/main/webapp/js/blurconsole.b_utils.js
index 554df7b..2cd2c0e 100644
--- a/blur-console/src/main/webapp/js/blurconsole.b_utils.js
+++ b/blur-console/src/main/webapp/js/blurconsole.b_utils.js
@@ -39,11 +39,16 @@ blurconsole.browserUtils = (function(){
         tableMarkup += '<tr>';
         $.each(def, function(ic, col) {
           tableMarkup += '<td>';
+          var val;
           if ($.isFunction(col.key)) {
-            tableMarkup += col.key(row);
+            val = col.key(row);
           } else {
-            tableMarkup += row[col.key];
+            val = row[col.key];
           }
+          if(col.format === 'number') {
+            val = blurconsole.utils.formatNumber(val);
+          }
+          tableMarkup += val;
           tableMarkup += '</td>';
         });
         tableMarkup += '</tr>';

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/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 03e4cdb..6c8e11e 100644
--- a/blur-console/src/main/webapp/js/blurconsole.fake.js
+++ b/blur-console/src/main/webapp/js/blurconsole.fake.js
@@ -214,7 +214,7 @@ blurconsole.fake = (function() {
   function sendSearch(query, table, args, callback) {
     console.log('sending fake search [' + query + '] on table [' + table + ']');
 
-    var fams = args.families, results = {}, total = (fams !== null && fams.indexOf('rowid')
>= 0) ? 1 : _randomNumber(1000);
+    var fams = args.families, results = {}, total = (fams !== null && fams.indexOf('rowid')
>= 0) ? 1 : _randomNumber(5000);
 
     if (fams === null || fams.length === 0) {
       $.each(tableList.tables, function(i, t) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/blur-console/src/main/webapp/js/blurconsole.model.js
----------------------------------------------------------------------
diff --git a/blur-console/src/main/webapp/js/blurconsole.model.js b/blur-console/src/main/webapp/js/blurconsole.model.js
index 0bf5071..7998ac6 100644
--- a/blur-console/src/main/webapp/js/blurconsole.model.js
+++ b/blur-console/src/main/webapp/js/blurconsole.model.js
@@ -52,7 +52,11 @@ blurconsole.model = (function() {
 
       $.each(stateMap.currentTables, function(idx, table) {
         if (table.cluster === cluster && table.enabled) {
-          data.push({name:table.name, rowCount:table.rows, recordCount:table.records});
+          data.push({
+            name:table.name,
+            rowCount:table.rows,
+            recordCount:table.records
+          });
         }
       });
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/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 1af0664..098f15d 100644
--- a/blur-console/src/main/webapp/js/blurconsole.search.js
+++ b/blur-console/src/main/webapp/js/blurconsole.search.js
@@ -244,7 +244,7 @@ blurconsole.search = (function () {
     var user = $('#user');
     if (user.length > 0) {
       var names = blurconsole.auth.getSecurityNames();
-      if(names == null || names.length <= 1) {
+      if(names === null || names.length <= 1) {
         user.closest('.form-group').remove();
       } else {
         user.append('<option value=""></option>');
@@ -400,7 +400,7 @@ blurconsole.search = (function () {
 
   function _drawResults(evt, families) {
     var results = blurconsole.model.search.getResults();
-    jqueryMap.$countHolder.html('<small>Found ' + blurconsole.model.search.getTotal()
+ ' total results</small>');
+    jqueryMap.$countHolder.html('<small>Found ' + blurconsole.utils.formatNumber(blurconsole.model.search.getTotal())
+ ' total results</small>');
     //jqueryMap.$facetTrigger.show();
 
     if (typeof families !== 'undefined' && families !== null) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/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 fb65ff3..ff1a06e 100644
--- a/blur-console/src/main/webapp/js/blurconsole.tables.js
+++ b/blur-console/src/main/webapp/js/blurconsole.tables.js
@@ -29,8 +29,8 @@ blurconsole.tables = (function () {
       {label:'Table Name', key: function(row){
         return row.name + ' <i class="glyphicon glyphicon-exclamation-sign" data-table="'
+ row.name + '" style="display:none" title="Activity detected"></i>';
       }},
-      {label:'Row Count', key: 'rowCount'},
-      {label:'Record Count', key: 'recordCount'},
+      {label:'Row Count', key: 'rowCount', format:'number'},
+      {label:'Record Count', key: 'recordCount', format:'number'},
       {label:'Actions', key: function(row) {
         var actions = '', table = row.name;
         actions += '<a href="#" class="schemaTrigger btn btn-default" data-name="' + table
+ '"><i class="glyphicon glyphicon-list-alt"></i> Schema</a> ';

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/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 3bebaeb..38dd3e9 100644
--- a/blur-console/src/main/webapp/js/blurconsole.utils.js
+++ b/blur-console/src/main/webapp/js/blurconsole.utils.js
@@ -17,7 +17,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
-/*global blurconsole:false */
+/*global blurconsole:false, Intl:false */
 blurconsole.utils = (function(){
   'use strict';
     
@@ -35,6 +35,13 @@ blurconsole.utils = (function(){
     return accumulator;
   }
 
+  function formatNumber(num){
+    if(typeof Intl !== 'undefined' && typeof Intl.NumberFormat !== 'undefined') {
+      num = Intl.NumberFormat().format(num);
+    }
+    return num;
+  }
+
   function unique(collection, sort) {
     var uniqueList = [];
 
@@ -91,6 +98,7 @@ blurconsole.utils = (function(){
     equals: equals,
     keys: keys,
     findFamilies: findFamilies,
-    reject: reject
+    reject: reject,
+    formatNumber: formatNumber
   };
 }());
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab1a6cac/blur-console/src/main/webapp/public/index.html
----------------------------------------------------------------------
diff --git a/blur-console/src/main/webapp/public/index.html b/blur-console/src/main/webapp/public/index.html
index 528e9d2..ffd74f4 100644
--- a/blur-console/src/main/webapp/public/index.html
+++ b/blur-console/src/main/webapp/public/index.html
@@ -64,7 +64,7 @@ under the License.
       </ul>
     </nav>
     <div id="blurconsole"></div>
-    <script src="js/blurconsole.2a826151959859ac6ba1bdd17da01ee1.js"></script>
+    <script src="js/blurconsole.dafc5660ee546fc3f9427794e4e541f5.js"></script>
     <script src="/service/config.js"></script>
     <script type="text/javascript">
       $(function () { blurconsole.initModule( $('#blurconsole') ); });


Mime
View raw message