incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [14/27] git commit: Refactor of search results ui checkin
Date Thu, 10 Jul 2014 16:51:00 GMT
Refactor of search results ui checkin


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

Branch: refs/heads/apache-blur-0.2
Commit: 87bc5b5b947180d9ef4a30382b133e4792d4d3ec
Parents: fc0e03f
Author: Chris Rohr <rohr.chris@gmail.com>
Authored: Thu Jul 10 11:52:16 2014 -0400
Committer: Chris Rohr <rohr.chris@gmail.com>
Committed: Thu Jul 10 11:53:03 2014 -0400

----------------------------------------------------------------------
 .../src/main/webapp/js/blurconsole.fake.js      |   13 +-
 .../src/main/webapp/js/blurconsole.search.js    |   72 +-
 .../main/webapp/less/blurconsole.search.less    |    6 +
 blur-console/src/main/webapp/less/colors.less   |    2 +-
 ...console.61acc2e50a17def66e4d21f44aeb5c7f.css | 6481 ++++++++++++++++++
 ...console.bfe9062c877a3904cde5eaa94c865433.css | 6476 -----------------
 ...console.c5f364360c1d856c03b37938cec9b663.css | 6481 ++++++++++++++++++
 .../src/main/webapp/public/css/blurconsole.css  |   11 +-
 ...ole.css.85b4970e6cc85ff19b38ea3992343cc9.map |    1 -
 ...ole.css.db643f2fc2dc56a029b94937c9325b71.map |    1 +
 .../main/webapp/public/css/blurconsole.css.map  |    2 +-
 blur-console/src/main/webapp/public/index.html  |    4 +-
 ...rconsole.2386c8f423ff1369e4d7b407401ca2b4.js |   27 -
 ...rconsole.b72cf041e6f5a5d41dae8c6a8b7c6255.js |   27 +
 .../src/main/webapp/public/js/blurconsole.js    |    6 +-
 ...sole.js.5d6d0f5d275efec38fb4d1729a38c5dc.map |    1 +
 ...sole.js.d5898caf0c8a8e22f30591d3c774457f.map |    1 -
 .../main/webapp/public/js/blurconsole.js.map    |    2 +-
 18 files changed, 13090 insertions(+), 6524 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/87bc5b5b/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 c6bb79c..887b9b7 100644
--- a/blur-console/src/main/webapp/js/blurconsole.fake.js
+++ b/blur-console/src/main/webapp/js/blurconsole.fake.js
@@ -216,6 +216,17 @@ blurconsole.fake = (function() {
 
     var fams = args.families, results = {}, total = (fams !== null && fams.indexOf('rowid')
>= 0) ? 1 : _randomNumber(1000);
 
+    if (fams === null || fams.length === 0) {
+      $.each(tableList.tables, function(i, t) {
+        if (t.name === table) {
+          var tFams = t.families;
+          tFams.sort();
+          fams = [tFams[0]];
+          return false;
+        }
+      });
+    }
+
     if (fams !== null) {
       $.each(fams, function(i, fam){
         var cols = _randomNumber(30, true), toFetch = (fams !== null && fams.indexOf('rowid')
>= 0)? 1 : args.fetch;
@@ -253,8 +264,6 @@ blurconsole.fake = (function() {
 
     if (fams.indexOf('rowid') >= 0) {
       _sendCallback(callback, { total: total, results: results, families: fams });
-    } else if (fams === null || fams.length === 0) {
-      _sendCallback(callback, { total: total });
     } else {
       _sendCallback(callback, { families: fams, results: results, total: total });
     }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/87bc5b5b/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 38d8a32..6e04c55 100644
--- a/blur-console/src/main/webapp/js/blurconsole.search.js
+++ b/blur-console/src/main/webapp/js/blurconsole.search.js
@@ -177,6 +177,7 @@ blurconsole.search = (function () {
       }
     });
     jqueryMap.$resultsHolder.on('shown.bs.collapse', '.panel-collapse:not(.loaded)', _getMoreData);
+    jqueryMap.$resultsHolder.on('shown.bs.tab', 'a[data-toggle="tab"]:not(.loaded)', _getMoreData);
     jqueryMap.$resultsHolder.on('click', '.nextPage', _getMoreData);
     jqueryMap.$optionsTrigger.popover({
       html: true,
@@ -191,6 +192,7 @@ blurconsole.search = (function () {
     jqueryMap.$tableField.on('change', function(evt) {
       stateMap.$currentTable = $(evt.currentTarget).val();
     });
+    jqueryMap.$resultsHolder.on('click', 'a.fetchRow', _fetchRow);
   }
 
   function _unregisterPageEvents() {
@@ -199,6 +201,7 @@ blurconsole.search = (function () {
       jqueryMap.$queryField.typeahead('destroy');
       jqueryMap.$queryField.off('keyup');
       jqueryMap.$resultsHolder.off('shown.bs.collapse');
+      jqueryMap.$resultsHolder.off('shown.bs.tab');
       jqueryMap.$resultsHolder.off('click');
       jqueryMap.$optionsTrigger.popover('destroy');
       jqueryMap.$optionsTrigger.off('shown.bs.popover');
@@ -287,11 +290,26 @@ blurconsole.search = (function () {
         user: stateMap.$userOption
       }
     });
+
+    if (stateMap.$currentQuery.indexOf('rowid:') >= 0) {
+      stateMap.$currentDisplay = 'fetch';
+    } else {
+      stateMap.$currentDisplay = 'search';
+    }
+
     _drawResultHolders();
     jqueryMap.$countHolder.html('');
     blurconsole.model.search.runSearch(stateMap.$currentQuery, stateMap.$currentTable, {start:
0, fetch: 10, rowRecordOption: stateMap.$rowRecordOption, securityUser: stateMap.$userOption});
   }
 
+  function _fetchRow(evt) {
+    var rowid = $(evt.currentTarget).attr('href');
+
+    jqueryMap.$queryField.val('rowid:' + rowid);
+    _sendSearch();
+    return false;
+  }
+
   function _getMoreData(evt) {
     var family = $(evt.currentTarget).attr('href') ? $(evt.currentTarget).attr('href').substring(1)
: $(evt.currentTarget).attr('id');
     blurconsole.model.search.loadMoreResults(family);
@@ -322,7 +340,15 @@ blurconsole.search = (function () {
   }
 
   function _drawResultHolders() {
-    var familyMarkup = '', parsedFamilies = blurconsole.utils.findFamilies(stateMap.$currentQuery);
+    if (stateMap.$currentDisplay === 'fetch') {
+      _drawFetchHolder();
+    } else {
+      _drawSearchHolder();
+    }
+  }
+
+  function _drawSearchHolder() {
+    var familyMarkup = '<ul class="nav nav-tabs">', parsedFamilies = blurconsole.utils.findFamilies(stateMap.$currentQuery);
 
     jqueryMap.$resultsHolder.html('');
 
@@ -337,9 +363,36 @@ blurconsole.search = (function () {
 
     $.each(sortedFamilies, function(i, fam) {
       var famId = blurconsole.browserUtils.cleanId(fam);
+      familyMarkup += '<li class="' + (i === 0 ? 'active' : '') + '"><a href="#'
+ famId + '" data-toggle="tab" data-fam="#' + famId + '">' + fam + '</a></li>';
+    });
+
+    familyMarkup += '</ul><div class="tab-content">';
+
+    $.each(sortedFamilies, function(i, fam) {
+      var famId = blurconsole.browserUtils.cleanId(fam);
+      familyMarkup += '<div class="clearfix tab-pane ' + (i === 0 ? 'active' : '') + '"
id="' + famId + '"><img src="img/ajax-loader.gif"></div>';
+    });
+
+    familyMarkup += '</div>';
+
+    jqueryMap.$resultsHolder.html(familyMarkup);
+  }
+
+  function _drawFetchHolder() {
+    var familyMarkup = '';
+
+    jqueryMap.$resultsHolder.html('');
+
+    // Redraw families
+    var allFamilies = blurconsole.model.tables.getFamilies(stateMap.$currentTable);
+
+    allFamilies.sort();
+
+    $.each(allFamilies, function(i, fam) {
+      var famId = blurconsole.browserUtils.cleanId(fam);
       familyMarkup += '<div class="panel panel-default"><div class="panel-heading">';
       familyMarkup += '<h4 class="panel-title" data-toggle="collapse" data-parent="#results"
data-target="#' + famId + '">' + fam + '</h4></div>';
-      familyMarkup += '<div id="' + famId + '" class="panel-collapse collapse' + (parsedFamilies.indexOf(fam)
>= 0 ? ' in' : '') + '">';
+      familyMarkup += '<div id="' + famId + '" class="panel-collapse collapse">';
       familyMarkup += '<div class="panel-body"><img src="img/ajax-loader.gif"></div></div></div>';
     });
 
@@ -355,7 +408,7 @@ blurconsole.search = (function () {
       $.each(families, function(i, fam) {
         var famResults = results[fam],
           famId = '#' + blurconsole.browserUtils.cleanId(fam),
-          famHolder = $(famId + ' .panel-body');
+          famHolder = stateMap.$currentDisplay === 'fetch' ? $(famId + ' .panel-body') :
$(famId);
 
         if (typeof famResults === 'undefined' || famResults.length === 0) {
           famHolder.html('<div class="alert alert-info">No Data Found</div>');
@@ -396,7 +449,7 @@ blurconsole.search = (function () {
 
             $.each(famResults, function(r, row) {
               table += '<table class="table table-condensed table-hover table-bordered"><thead>';
-              table += '<tr class="row-separator"><th colspan="' + (cols.length
=== 0 ? 1 : cols.length) + '">' + (r+1) + '. <strong>rowid:</strong> ' + row.rowid
+ ' (<em>' + (row.records === null ? 0 : row.records.length) + ' records</em>)</th></tr>';
+              table += '<tr class="row-separator"><th colspan="' + (cols.length
=== 0 ? 1 : cols.length) + '">' + (r+1) + '. <strong>rowid:</strong> <a
href="' + row.rowid + '" class="fetchRow">' + row.rowid + '</a> (<em>' + (row.records
=== null ? 0 : row.records.length) + ' records</em>)</th></tr>';
               table += '<tr>';
               $.each(cols, function(i, col) {
                 table += '<th>' + col + '</th>';
@@ -424,8 +477,15 @@ blurconsole.search = (function () {
 
           famHolder.html(table);
         }
-        if (!$(famId).hasClass('loaded')) {
-          $(famId).addClass('loaded');
+
+        if (stateMap.$currentDisplay === 'fetch') {
+          if (!$(famId).hasClass('loaded')) {
+            $(famId).addClass('loaded');
+          }
+        } else {
+          if (!$('a[data-fam="' + famId + '"]').hasClass('loaded')) {
+            $('a[data-fam="' + famId + '"]').addClass('loaded');
+          }
         }
       });
     }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/87bc5b5b/blur-console/src/main/webapp/less/blurconsole.search.less
----------------------------------------------------------------------
diff --git a/blur-console/src/main/webapp/less/blurconsole.search.less b/blur-console/src/main/webapp/less/blurconsole.search.less
index 305f2ba..7eb079e 100644
--- a/blur-console/src/main/webapp/less/blurconsole.search.less
+++ b/blur-console/src/main/webapp/less/blurconsole.search.less
@@ -30,6 +30,12 @@ under the License.
   .panel-collapse {
     padding: 5px;
   }
+
+  .tab-content {
+    padding: 5px;
+    border-left: 1px solid @nav-tabs-border-color;
+    border-bottom: 1px solid @nav-tabs-border-color;
+  }
 }
 
 #resultCount {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/87bc5b5b/blur-console/src/main/webapp/less/colors.less
----------------------------------------------------------------------
diff --git a/blur-console/src/main/webapp/less/colors.less b/blur-console/src/main/webapp/less/colors.less
index 9e11784..b6f104f 100644
--- a/blur-console/src/main/webapp/less/colors.less
+++ b/blur-console/src/main/webapp/less/colors.less
@@ -33,7 +33,7 @@ under the License.
 @sidebar-color: @silver;
 @sidebar-background-hover: @white;
 @sidebar-color-hover: @black;
-@search-row-background: @dusty-gray;
+@search-row-background: @silver;
 @typeahead-tint: @silver-chalice;
 @typeahead-background: @white;
 @typeahead-border: @silver;


Mime
View raw message