瀏覽代碼

[sentry] Introduced indexerPath

Enrico Berti 9 年之前
父節點
當前提交
7592cd5fe8

+ 18 - 1
apps/security/src/security/static/security/js/sentry.ko.js

@@ -136,6 +136,15 @@ var Privilege = function (vm, privilege) {
     owner: self
   });
 
+  self.indexerPath = ko.computed(function () {
+    if (self.authorizables()[1] && self.authorizables()[1]['type'] == 'TABLE') {
+      return '/indexer/#edit/' + self.authorizables()[1];
+    }
+    else {
+      return '/indexer/#manage';
+    }
+  });
+
   self.metastorePath = ko.computed(function() {
     var path = '';
 
@@ -433,6 +442,14 @@ var Assist = function (vm, initial) {
     var column = self.path().split(/[.]/)[2];
     return column ? column : null;
   });
+  self.indexerPath = ko.computed(function () {
+    if (self.table()) {
+      return '/indexer/#edit/' + self.table();
+    }
+    else {
+      return '/indexer/#manage';
+    }
+  });
   self.metastorePath = ko.computed(function(){
     if (self.column()) {
       return '/metastore/table/' + self.db() + "/" + self.table() + "#col=" + self.column();
@@ -708,7 +725,7 @@ var Assist = function (vm, initial) {
         location.href = data.authorizable_link;
       }
       else {
-        location.href = "/security/hdfs#" + data.authorizable_link.substring("/filebrowser/view=".length);
+        location.href = "/security/hdfs#" + data.hdfs_link.substring("/filebrowser/view=".length);
       }
     });
   }

+ 7 - 0
apps/security/src/security/templates/sentry.mako

@@ -190,9 +190,16 @@ ${ layout.menubar(section=component) }
               <div class="path-container">
                 <div class="input-append span12">
                   <input id="path" class="path" type="text" autocomplete="off" />
+                  <!-- ko if: $root.component() == 'solr' -->
+                  <a data-bind="attr: { href: $root.assist.indexerPath() }" target="_blank" title="${ _('Open in Indexer') }" class="btn btn-inverse">
+                    <i class="fa fa-external-link"></i>
+                  </a>
+                  <!-- /ko -->
+                  <!-- ko ifnot: $root.component() == 'solr' -->
                   <a data-bind="attr: { href: $root.assist.metastorePath() }" target="_blank" title="${ _('Open in Metastore Browser') }" class="btn btn-inverse">
                     <i class="fa fa-external-link"></i>
                   </a>
+                  <!-- /ko -->
                 </div>
                 <div class="clearfix"></div>
                 <div class="tree-toolbar">