Pārlūkot izejas kodu

[security] Added link to HDFS file for table

Enrico Berti 11 gadi atpakaļ
vecāks
revīzija
93124f2f9a

+ 1 - 0
apps/beeswax/src/beeswax/api.py

@@ -94,6 +94,7 @@ def autocomplete(request, database=None, table=None):
       response['tables'] = db.get_tables(database=database)
     else:
       t = db.get_table(database, table)
+      response['hdfs_link'] = t.hdfs_link
       response['columns'] = [column.name for column in t.cols]
       response['extended_columns'] = massage_columns_for_json(t.cols)
   except TTransportException, tx:

+ 2 - 1
apps/security/src/security/templates/hive.mako

@@ -419,7 +419,8 @@ ${ layout.menubar(section='hive') }
 
 <%def name="withPrivilegesPullRight()">
   <div class="pull-right">
-    <i class="fa fa-shield" data-bind="visible: withPrivileges()" style="color: #338bb8" title="${ _('Has some privileges') }"></i>
+    <i class="fa fa-shield" data-bind="visible: withPrivileges()" style="color: #338bb8" title="${ _('Has some privileges') }"></i>&nbsp;
+    <i class="fa fa-file-o muted" data-bind="click: $root.assist.showHdfs ,visible: isTable()"></i>
   </div>
 </%def>
 

+ 9 - 0
apps/security/static/js/hive.ko.js

@@ -518,6 +518,15 @@ var Assist = function (vm, initial) {
     self.setPath(obj, true);
   }
 
+  self.showHdfs = function (obj, e) {
+    e.preventDefault();
+    e.stopPropagation();
+    e.stopImmediatePropagation();
+    self.fetchHivePath(obj.path(), function(data){
+      location.href = "/security/hdfs#" + data.hdfs_link.substring("/filebrowser/view".length);
+    });
+  }
+
   self.getCheckedItems = function (leaf, checked) {
     if (leaf == null){
       leaf = self.growingTree();