Browse Source

HUE-3902 [sentry] Provide * to select all the collections or configs

Enrico Berti 9 years ago
parent
commit
ca9965d

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

@@ -657,7 +657,12 @@ var Assist = function (vm, initial) {
       self.updatePathProperty(self.growingTree(), obj.path(), "isExpanded", obj.isExpanded());
     }
 
-    self.path(obj.path());
+    if (vm.component() === 'solr' && obj.path() !== '' && obj.path().indexOf('.') == -1) {
+      self.path(obj.path() + '.*');
+    }
+    else {
+      self.path(obj.path());
+    }
     $(document).trigger("changed.path");
 
     if (self.getTreeAdditionalDataForPath(obj.path()).loaded){
@@ -782,6 +787,10 @@ var Assist = function (vm, initial) {
   self.fetchAuthorizablesPath = function (optionalPath, loadCallback) {
     var _originalPath = typeof optionalPath != "undefined" ? optionalPath : self.path();
 
+    if (vm.component() === 'solr' && _originalPath.indexOf('.*') > -1) {
+      _originalPath = _originalPath.split('.')[0];
+    }
+
     if (_originalPath.split(".").length < 4) {
       self.isLoadingTree(true);
 

+ 22 - 8
desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js

@@ -260,16 +260,27 @@
             }
           }
 
-          if (! _isSkipColumns){
+          var firstSolrCollection = false;
+          var firstSolrConfig = false;
+
+          if (!_isSkipColumns) {
             $(_iterable).each(function (cnt, item) {
               if (_this.options.serverType == "SOLR") {
+                if (item.isCollection && !firstSolrCollection) {
+                  _currentFiles.push('<li class="hiveAutocompleteItem" data-value="collections.*" title="collections.*"><i class="fa fa-search-plus"></i> collections.*</li>');
+                  firstSolrCollection = true;
+                }
                 if (item.isConfig) {
-                  _ico = 'fa-cogs';
+                  _ico = 'fa-cog';
+                  if (!firstSolrConfig) {
+                    _currentFiles.push('<li class="hiveAutocompleteItem" data-value="configs.*" title="configs.*"><i class="fa fa-cogs"></i> configs.*</li>');
+                    firstSolrConfig = true;
+                  }
                 }
-                _currentFiles.push('<li class="hiveAutocompleteItem" data-value="' + item.name + '" title="' + item.name + '"><i class="fa '+ _ico +'"></i> ' + item.name + '</li>');
+                _currentFiles.push('<li class="hiveAutocompleteItem" data-value="' + item.name + '" title="' + item.name + '"><i class="fa ' + _ico + '"></i> ' + item.name + '</li>');
               }
               else {
-                _currentFiles.push('<li class="hiveAutocompleteItem" data-value="' + item + '" title="' + item + '"><i class="fa '+ _ico +'"></i> ' + item + '</li>');
+                _currentFiles.push('<li class="hiveAutocompleteItem" data-value="' + item + '" title="' + item + '"><i class="fa ' + _ico + '"></i> ' + item + '</li>');
               }
             });
 
@@ -281,20 +292,23 @@
               var item = $(this).text().trim();
               var path = autocompleteUrl.substring(BASE_PATH.length);
 
-              if ($(this).html().indexOf("search") > -1 || $(this).html().indexOf("cogs") > -1) {
-                if ($(this).html().indexOf("search") > -1){
+              if ($(this).html().indexOf("search") > -1 || $(this).html().indexOf("cog") > -1) {
+                if ($(this).html().indexOf("search") > -1 && $(this).html().indexOf("search-plus") == -1) {
                   _el.val("collections." + item);
                 }
-                else {
+                else if ($(this).html().indexOf("cog") > -1 && $(this).html().indexOf("cogs") == -1) {
                   _el.val("configs." + item);
                 }
+                else {
+                  _el.val(item);
+                }
                 _this.options.onPathChange(_el.val());
                 $("#jHueGenericAutocomplete").hide();
                 _hiveAutocompleteSelectedIndex = -1;
                 _this.options.onEnter(_el);
               }
 
-              if ($(this).html().indexOf("database") > -1){
+              if ($(this).html().indexOf("database") > -1) {
                 _el.val(item + ".");
                 _this.options.onPathChange(_el.val());
                 showAutocomplete();