Browse Source

[sentry] Added showAuthorizable for Solr

Enrico Berti 9 years ago
parent
commit
a12a978

+ 1 - 1
apps/security/src/security/api/sentry.py

@@ -85,7 +85,7 @@ def _fetch_collections(request):
   if not item:
     return {"databases": ["collections", "configs"]}
   elif item and name:
-    return {"hdfs_link": "/indexer/#edit/%s" % name, "extended_columns": [], "columns": [], "partition_keys": []}
+    return {"authorizable_link": "/indexer/#edit/%s" % name, "extended_columns": [], "columns": [], "partition_keys": []}
   elif item == 'collections':
     return {"tables_meta": [{"comment": None, "type": "Table", "name": col} for col in api.collections2()]}
   elif item == 'configs':

+ 2 - 2
apps/security/src/security/static/security/js/hive.ko.js

@@ -642,12 +642,12 @@ var Assist = function (vm, initial) {
     self.setPath(obj, true);
   }
 
-  self.showHdfs = function (obj, e) {
+  self.showAuthorizable = 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);
+      location.href = "/security/hdfs#" + data.authorizable_link.substring("/filebrowser/view=".length);
     });
   }
 

+ 9 - 4
apps/security/src/security/static/security/js/sentry.ko.js

@@ -699,12 +699,17 @@ var Assist = function (vm, initial) {
     self.setPath(obj, true);
   }
 
-  self.showHdfs = function (obj, e) {
+  self.showAuthorizable = function (obj, e) {
     e.preventDefault();
     e.stopPropagation();
     e.stopImmediatePropagation();
-    self.fetchAuthorizablesPath(obj.path(), function(data){
-      location.href = "/security/hdfs#" + data.hdfs_link.substring("/filebrowser/view=".length);
+    self.fetchAuthorizablesPath(obj.path(), function (data) {
+      if (vm.component() === 'solr') {
+        location.href = data.authorizable_link;
+      }
+      else {
+        location.href = "/security/hdfs#" + data.authorizable_link.substring("/filebrowser/view=".length);
+      }
     });
   }
 
@@ -860,7 +865,7 @@ var Assist = function (vm, initial) {
 }
 
 
-var HiveViewModel = function (initial) {
+var SentryViewModel = function (initial) {
   var self = this;
 
   self.isLoadingRoles = ko.observable(false);

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

@@ -540,7 +540,7 @@ ${ layout.menubar(section='hive1') }
 <%def name="withPrivilegesPullRight()">
   <div class="pull-right">
     <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>
+    <i class="fa fa-file-o muted" data-bind="click: $root.assist.showAuthorizable ,visible: isTable()"></i>
   </div>
 </%def>
 

+ 2 - 2
apps/security/src/security/templates/sentry.mako

@@ -565,7 +565,7 @@ ${ layout.menubar(section=component) }
 <%def name="withPrivilegesPullRight()">
   <div class="pull-right">
     <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>
+    <i class="fa fa-file-o muted" data-bind="click: $root.assist.showAuthorizable ,visible: isTable()"></i>
   </div>
 </%def>
 
@@ -599,7 +599,7 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
       }
     }
 
-    var viewModel = new HiveViewModel(${ initial | n,unicode });
+    var viewModel = new SentryViewModel(${ initial | n,unicode });
     ko.applyBindings(viewModel);
 
     $(document).ready(function () {