Эх сурвалжийг харах

HUE-8847 [catalog] Disable tags search for Atlas

Johan Ahlen 6 жил өмнө
parent
commit
dc6b419f84

+ 20 - 20
desktop/core/src/desktop/js/ko/components/ko.globalSearch.js

@@ -44,25 +44,7 @@ const TEMPLATE = `
     </div>
   </script>
   
-  <!-- ko component: {
-    name: 'inline-autocomplete',
-    params: {
-      hasFocus: searchHasFocus,
-      disableNavigation: true,
-      showMagnify: true,
-      facetDropDownVisible: facetDropDownVisible,
-      spin: loading,
-      placeHolder: '${I18n(
-        window.HAS_CATALOG ? 'Search data and saved documents...' : 'Search saved documents...'
-      )}',
-      querySpec: querySpec,
-      onClear: function () { selectedIndex(null); searchResultVisible(false); },
-      facets: ['type', 'tags', 'parentPath', 'originalName'],
-      knownFacetValues: knownFacetValues,
-      autocompleteFromEntries: autocompleteFromEntries,
-      triggerObservable: searchResultCategories
-    }
-  } --><!-- /ko -->
+  <!-- ko component: inlineAutocompleteComponent --><!-- /ko -->
   <!-- ko if: searchResultVisible()  -->
   <!-- ko if: !loading() && searchResultCategories().length === 0 && hasLoadedOnce() -->
   <div class="global-search-results global-search-empty" data-bind="onClickOutside: onResultClickOutside">
@@ -132,7 +114,7 @@ class GlobalSearch {
   constructor() {
     const self = this;
     self.knownFacetValues = ko.observable({
-      type: { field: 1, table: 1, view: 1, database: 1, partition: 1, document: 1 }
+      type: { field: -1, table: -1, view: -1, database: -1, partition: -1, document: -1 }
     });
     self.cancellablePromises = [];
 
@@ -159,6 +141,24 @@ class GlobalSearch {
 
     self.initializeFacetValues();
 
+    self.inlineAutocompleteComponent = {
+      name: 'inline-autocomplete',
+      params: {
+        hasFocus: self.searchHasFocus,
+        disableNavigation: true,
+        showMagnify: true,
+        facetDropDownVisible: self.facetDropDownVisible,
+        spin: loading,
+        placeHolder: I18n(window.HAS_CATALOG ? 'Search data and saved documents...' : 'Search saved documents...'),
+        querySpec: self.querySpec,
+        onClear: function () { self.selectedIndex(null); self.searchResultVisible(false); },
+        facets: window.HAS_CATALOG_TAGS ? ['type', 'tags', 'parentPath', 'originalName'] : ['type'],
+        knownFacetValues: self.knownFacetValues,
+        autocompleteFromEntries: self.autocompleteFromEntries,
+        triggerObservable: self.searchResultCategories
+      }
+    };
+
     self.selectedResult = ko
       .pureComputed(() => {
         if (self.selectedIndex()) {

+ 6 - 1
desktop/libs/metadata/src/metadata/catalog/atlas_client.py

@@ -121,8 +121,13 @@ class AtlasApi(Api):
         }
       }
 
-      # list_tags should return empty response for Atlas
       if (not query_s and facetFields and 'tags' in facetFields):
+        # Classification names from Atlas can contain spaces which doesn't work with the top search at the moment
+        # so for now we return an empty list
+
+        # classification_response = self._root.get('/v2/types/typedefs?type=classification')
+        # for classification_def in classification_response['classificationDefs']:
+        #   response['facets']['tags'][classification_def['name']] = 0
         return response
 
       query_s = (query_s.strip() if query_s else '') + '*'