HBASE-13718 added columns schema to table description in web view

Summary:
 * added a new table "Table Schema" on the table description page
 * per column, list all the key/values on the column description

Test Plan:
 * mvn test # and wait..
 * create a new table using hbase shell:
   * create 'mytesttable', {NAME=>'CF1'}, {NAME=>'CF2'}
 * open http://localhost:16010/table.jsp?name=mytesttable
 * check the "Table Schema" appears and lists the columns correctly

Reviewers: eclark, vicka.dudin

Differential Revision: https://reviews.facebook.net/D38649

Signed-off-by: Elliott Clark <eclark@apache.org>
This commit is contained in:
Joao Girao 2015-05-28 17:07:25 -07:00 committed by Elliott Clark
parent 4aa7209826
commit d16d3afb60
1 changed files with 39 additions and 0 deletions

View File

@ -21,6 +21,8 @@
import="static org.apache.commons.lang.StringEscapeUtils.escapeXml"
import="java.util.TreeMap"
import="java.util.Map"
import="java.util.Set"
import="java.util.Collection"
import="org.apache.hadoop.conf.Configuration"
import="org.apache.hadoop.hbase.client.HTable"
import="org.apache.hadoop.hbase.client.Admin"
@ -35,6 +37,7 @@
import="org.apache.hadoop.hbase.util.FSUtils"
import="org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState"
import="org.apache.hadoop.hbase.TableName"
import="org.apache.hadoop.hbase.HColumnDescriptor"
import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
import="org.apache.hadoop.hbase.HBaseConfiguration" %>
<%
@ -237,6 +240,42 @@ if ( fqtn != null ) {
</tr>
<% } %>
</table>
<h2>Table Schema</h2>
<table class="table table-striped">
<tr>
<th>Column Name</th>
<th></th>
</tr>
<%
Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies();
for (HColumnDescriptor family: families) {
%>
<tr>
<td><%= family.getNameAsString() %></td>
<td>
<table class="table table-striped">
<tr>
<th>Property</th>
<th>Value</th>
</tr>
<%
Map<Bytes, Bytes> familyValues = family.getValues();
for (Bytes familyKey: familyValues.keySet()) {
%>
<tr>
<td>
<%= familyKey %>
</td>
<td>
<%= familyValues.get(familyKey) %>
</td>
</tr>
<% } %>
</table>
</td>
</tr>
<% } %>
</table>
<%
Map<ServerName, Integer> regDistribution = new TreeMap<ServerName, Integer>();
Map<HRegionInfo, ServerName> regions = table.getRegionLocations();