incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaven...@apache.org
Subject [7/7] git commit: Fixed BLUR-409 show tables even if one is in error state
Date Thu, 05 Mar 2015 17:41:20 GMT
Fixed BLUR-409 show tables even if one is in error state


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

Branch: refs/heads/master
Commit: 26099b184761369b1846d99f9db84a8eb7f22782
Parents: 59013d5
Author: Andrew Avenoso <andrew.va@gmail.com>
Authored: Thu Mar 5 12:40:51 2015 -0500
Committer: Andrew Avenoso <andrew.va@gmail.com>
Committed: Thu Mar 5 12:40:51 2015 -0500

----------------------------------------------------------------------
 .../org/apache/blur/console/util/TableUtil.java | 34 +++++++++++---------
 .../src/main/webapp/js/blurconsole.model.js     |  8 ++---
 .../src/main/webapp/js/blurconsole.tables.js    | 24 ++++++++++----
 blur-console/src/main/webapp/public/index.html  |  2 +-
 ...rconsole.192655f13c0102b988a33cd4ee77ad62.js | 28 ++++++++++++++++
 ...rconsole.bf22d8bd6668e1750b42d3b4ef9a6458.js | 28 ----------------
 .../src/main/webapp/public/js/blurconsole.js    |  6 ++--
 ...sole.js.9ed166b6815e57bc1c2dcff1152ecd40.map |  1 -
 ...sole.js.d573e28d39f5ab7738c08ed6fd66a45d.map |  1 +
 .../main/webapp/public/js/blurconsole.js.map    |  2 +-
 10 files changed, 72 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/26099b18/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
----------------------------------------------------------------------
diff --git a/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java b/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
index 40fd612..213c707 100644
--- a/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
+++ b/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
@@ -40,23 +40,27 @@ public class TableUtil {
       List<String> tables = client.tableListByCluster(cluster);
       for (String table : tables) {
         Map<String, Object> tableInfo = new HashMap<String, Object>();
-        TableDescriptor descriptor = client.describe(table);
-
         tableInfo.put("cluster", cluster);
         tableInfo.put("name", table);
-        tableInfo.put("enabled", descriptor.isEnabled());
-
-        if (descriptor.isEnabled()) {
-          TableStats stats = client.tableStats(table);
-          tableInfo.put("rows", stats.getRowCount());
-          tableInfo.put("records", stats.getRecordCount());
-
-          Schema schema = client.schema(table);
-          tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet()));
-        } else {
-          tableInfo.put("rows", "?");
-          tableInfo.put("records", "?");
-          tableInfo.put("families", new ArrayList<String>());
+        try {
+          TableDescriptor descriptor = client.describe(table);
+          tableInfo.put("enabled", descriptor.isEnabled());
+          tableInfo.put("readonly", descriptor.isReadOnly());
+  
+          if (descriptor.isEnabled()) {
+            TableStats stats = client.tableStats(table);
+            tableInfo.put("rows", stats.getRowCount());
+            tableInfo.put("records", stats.getRecordCount());
+  
+            Schema schema = client.schema(table);
+            tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet()));
+          } else {
+            tableInfo.put("rows", "?");
+            tableInfo.put("records", "?");
+            tableInfo.put("families", new ArrayList<String>());
+          }
+        } catch(Exception e) {
+          tableInfo.put("error", e.getMessage());
         }
 
         summaries.add(tableInfo);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/26099b18/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 c235217..c42511c 100644
--- a/blur-console/src/main/webapp/js/blurconsole.model.js
+++ b/blur-console/src/main/webapp/js/blurconsole.model.js
@@ -52,11 +52,7 @@ 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(table);
         }
       });
 
@@ -68,7 +64,7 @@ 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(table);
         }
       });
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/26099b18/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 21606bc..c5ebd55 100644
--- a/blur-console/src/main/webapp/js/blurconsole.tables.js
+++ b/blur-console/src/main/webapp/js/blurconsole.tables.js
@@ -22,15 +22,25 @@ under the License.
 blurconsole.tables = (function () {
   'use strict';
 
+  function _tableName(row) {
+    var activityIndicator = '';
+    var errorIndicator = '';
+    if(row.enabled) {
+      activityIndicator = ' <i class="glyphicon glyphicon-exclamation-sign" data-table="'
+ row.name + '" style="display:none" title="Activity detected"></i>';
+    }
+    console.log(row);
+    if(row.error) {
+      errorIndicator = ' <i class="glyphicon glyphicon-ban-circle" title="'+row.error+'"></i>';
+    }
+    return row.name + activityIndicator + errorIndicator;
+  }
     //------------------------ Configuration and State ----------------------
   var configMap = {
     view : 'views/tables.tpl.html',
     enabledDef : [
-      {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', format:'number'},
-      {label:'Record Count', key: 'recordCount', format:'number'},
+      {label:'Table Name', key: _tableName},
+      {label:'Row Count', key: 'rows', format:'number'},
+      {label:'Record Count', key: 'records', 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> ';
@@ -42,7 +52,7 @@ blurconsole.tables = (function () {
       }}
     ],
     disabledDef : [
-      {label:'Table Name', key:'name'},
+      {label:'Table Name', key:_tableName},
       {label:'Actions', key: function(row) {
         var actions = '', table = row.name;
         if(blurconsole.auth.hasRole('manager')) {
@@ -56,7 +66,7 @@ blurconsole.tables = (function () {
   stateMap = { $container : null },
   jqueryMap = {};
 
-    //----------------------------- Private Methods ----------------------------
+  //----------------------------- Private Methods ---------------------------
   function _setJqueryMap() {
     var $container = stateMap.$container;
     jqueryMap = {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/26099b18/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 5b46cbc..125b010 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.bf22d8bd6668e1750b42d3b4ef9a6458.js"></script>
+    <script src="js/blurconsole.192655f13c0102b988a33cd4ee77ad62.js"></script>
     <script src="service/config.js"></script>
     <script type="text/javascript">
       $(function () { blurconsole.initModule( $('#blurconsole') ); });


Mime
View raw message