accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [1/7] accumulo git commit: ACCUMULO-1480 Added dropdown with namespaces
Date Thu, 10 Nov 2016 22:18:41 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master b5d7c1807 -> e2d21fc92


ACCUMULO-1480 Added dropdown with namespaces


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4a4ad694
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4a4ad694
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4a4ad694

Branch: refs/heads/master
Commit: 4a4ad69426f5c22f65f3e542ccc3b30e4cd409fa
Parents: 1351991
Author: Luis Tavarez <zeravat@outlook.com>
Authored: Fri Oct 21 15:10:14 2016 -0400
Committer: Luis Tavarez <zeravat@outlook.com>
Committed: Fri Oct 21 15:10:14 2016 -0400

----------------------------------------------------------------------
 .../monitor/servlets/TablesServlet.java         |  4 ++++
 .../org/apache/accumulo/monitor/util/Table.java | 22 ++++++++++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4a4ad694/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
index c1751d8..acb8c21 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.impl.Namespaces;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.impl.KeyExtent;
@@ -139,6 +140,9 @@ public class TablesServlet extends BasicServlet {
       tableList.addRow(row);
     }
 
+    SortedMap<String,String> namespaces = Namespaces.getNameToIdMap(Monitor.getContext().getInstance());
+    tableList.setNamespaces(namespaces);
+
     tableList.generate(req, sb);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4a4ad694/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
index e7bc30b..0d7d1e4 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.monitor.util;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.SortedMap;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -34,6 +35,8 @@ public class Table {
   private ArrayList<TableRow> rows;
   private boolean hasBegunAddingRows = false;
 
+  private SortedMap<String,String> namespaces;
+
   public Table(String tableName, String caption) {
     this(tableName, caption, null);
   }
@@ -179,6 +182,13 @@ public class Table {
     }
     if (showLegend && numLegends > 0)
       sb.append("</dl></div>\n");
+
+    if (namespaces != null) {
+      sb.append("<div class='left show'><dl>\n");
+      doDropdownMenu(sb, namespaces);
+      sb.append("</dl></div>\n");
+    }
+
     sb.append("</caption>\n");
     sb.append("<tr>");
     boolean first = true;
@@ -227,4 +237,16 @@ public class Table {
     sb.append("</tr>\n");
   }
 
+  private static void doDropdownMenu(StringBuilder sb, SortedMap<String,String> namespaces)
{
+    sb.append("<select>\n");
+    sb.append("<option value='All'>All</option>\n");
+    for (String key : namespaces.keySet()) {
+      sb.append("<option value=\"").append(key).append("\">").append(key).append("</option>\n");
+    }
+    sb.append("</select>\n");
+  }
+
+  public void setNamespaces(SortedMap<String,String> namespaces) {
+    this.namespaces = namespaces;
+  }
 }


Mime
View raw message