Przeglądaj źródła

HUE-9441 [editor] Don't suggest empty database in the autocomplete

Johan Ahlen 5 lat temu
rodzic
commit
f00377a7eb

+ 1 - 4
desktop/core/src/desktop/js/catalog/dataCatalogEntry.js

@@ -224,10 +224,7 @@ class DataCatalogEntry {
     self.compute = options.compute;
     self.dataCatalog = options.dataCatalog;
 
-    self.path =
-      typeof options.path === 'string' && options.path
-        ? options.path.split('.')
-        : options.path || [];
+    self.path = typeof options.path === 'string' ? options.path.split('.') : options.path || [];
     self.name = self.path.length ? self.path[self.path.length - 1] : self.getConnector().id;
     self.isTemporary = options.isTemporary;
 

+ 14 - 12
desktop/core/src/desktop/js/sql/autocompleteResults.js

@@ -893,18 +893,20 @@ class AutocompleteResults {
 
       databasesDeferred.done(catalogEntries => {
         catalogEntries.forEach(dbEntry => {
-          databaseSuggestions.push({
-            value:
-              prefix +
-              sqlUtils.backTickIfNeeded(self.dialect(), dbEntry.name) +
-              (suggestDatabases.appendDot ? '.' : ''),
-            filterValue: dbEntry.name,
-            meta: META_I18n.database,
-            category: CATEGORIES.DATABASE,
-            popular: ko.observable(false),
-            hasCatalogEntry: true,
-            details: dbEntry
-          });
+          if (dbEntry.name !== '') {
+            databaseSuggestions.push({
+              value:
+                prefix +
+                sqlUtils.backTickIfNeeded(self.dialect(), dbEntry.name) +
+                (suggestDatabases.appendDot ? '.' : ''),
+              filterValue: dbEntry.name,
+              meta: META_I18n.database,
+              category: CATEGORIES.DATABASE,
+              popular: ko.observable(false),
+              hasCatalogEntry: true,
+              details: dbEntry
+            });
+          }
         });
         self.appendEntries(databaseSuggestions);
       });