Bläddra i källkod

[metastore] Knockoutify the properties tab

Johan Ahlen 10 år sedan
förälder
incheckning
76bdcbd

+ 14 - 1
apps/metastore/src/metastore/static/metastore/css/metastore.css

@@ -93,6 +93,7 @@ h2.card-heading {
   margin-bottom: 10px;
 }
 
+.empty-header-col,
 .metastore-main h4 {
   font-weight: bold;
   color: #999;
@@ -105,4 +106,16 @@ h2.card-heading {
 
 .tile {
   margin-bottom: 20px;
-}
+}
+
+.properties-table {
+  width: 100%;
+}
+
+.properties-table td {
+  padding-top: 5px;
+}
+
+.property-name {
+  padding-left: 10px;
+}

+ 17 - 17
apps/metastore/src/metastore/templates/metastore.mako

@@ -568,24 +568,24 @@ ${ assist.assistPanel() }
 </script>
 
 <script type="text/html" id="metastore-properties-tab">
-  <table class="table table-striped table-condensed">
-    <thead>
-    <tr>
-      <th>${ _('Name') }</th>
-      <th>${ _('Value') }</th>
-      <th>${ _('Comment') }</th>
-    </tr>
-    </thead>
-    <tbody>
-      ##           % for prop in table.properties:
-##             <tr>
-##               <td>${ smart_unicode(prop['col_name']) }</td>
-##               <td>${ smart_unicode(prop['data_type']) if prop['data_type'] else '' }</td>
-##               <td>${ smart_unicode(prop['comment']) if prop['comment'] else '' }&nbsp;</td>
-##             </tr>
-##           % endfor
-        </tbody>
+  <!-- ko with: tableDetails -->
+  <table class="properties-table">
+    <tbody data-bind="foreach: properties">
+      <!-- ko if: col_name.indexOf('#') === 0 -->
+      <tr>
+        <td colspan="3"><h4 data-bind="text: col_name.substring(1)"></h4></td>
+      </tr>
+      <!-- /ko -->
+      <!-- ko ifnot: col_name.indexOf('#') === 0 -->
+      <tr>
+        <td class="property-name" data-bind="text: col_name || '&nbsp;'"></td>
+        <td data-bind="text: data_type || '&nbsp;'"></td>
+        <td data-bind="text: comment || '&nbsp;'"></td>
+      </tr>
+      <!-- /ko -->
+    </tbody>
   </table>
+  <!-- /ko -->
 </script>
 
 <script type="text/html" id="metastore-describe-table">