Sfoglia il codice sorgente

HUE-3786 [editor] Search box and foreach binding in the snippet DB list dropdown

Enrico Berti 9 anni fa
parent
commit
edbbaf1c84

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

@@ -84,7 +84,7 @@ ${ assist.assistPanel() }
     <!-- ko if: editingTable -->
       <!-- ko with: table -->
       <li class="editable-breadcrumb-input">
-        <input type="text" data-bind="hivechooser: {data: name, database: $parent.name, skipColumns: true, onChange: function(val){ $parent.setTableByName(val); $parent.editingTable(false); }}" autocomplete="off" />
+        <input type="text" data-bind="hivechooser: {data: name, database: $parent.name, skipColumns: true, searchEverywhere: true, onChange: function(val){ $parent.setTableByName(val); $parent.editingTable(false); }}" autocomplete="off" />
       </li>
       <!-- /ko -->
     <!-- /ko -->

+ 11 - 3
desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js

@@ -34,7 +34,8 @@
         smartTooltipThreshold: 10, // needs 10 up/down or click actions and no tab to activate the smart tooltip
         showOnFocus: false,
         startingPath: '',
-        rewriteVal: false
+        rewriteVal: false,
+        searchEverywhere: false
       };
 
   function Plugin(element, options) {
@@ -136,8 +137,15 @@
           $("#jHueGenericAutocomplete ul li").show();
           if (path != ""){
             $("#jHueGenericAutocomplete ul li").each(function () {
-              if ($(this).text().trim().indexOf(path) != 0) {
-                $(this).hide();
+              if (_this.options.searchEverywhere){
+                if ($(this).text().trim().toLowerCase().indexOf(path.toLowerCase()) == -1) {
+                  $(this).hide();
+                }
+              }
+              else {
+                if ($(this).text().trim().indexOf(path) != 0) {
+                  $(this).hide();
+                }
               }
             });
           }

+ 2 - 1
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -2192,7 +2192,8 @@
           skipColumns: options.skipColumns,
           startingPath: options.database + '.',
           rewriteVal: true,
-          onPathChange: options.onChange
+          onPathChange: options.onChange,
+          searchEverywhere : options.searchEverywhere || false
         });
       }
       else {