Răsfoiți Sursa

HUE-4598 [editor] Empty table list sometimes the first time

Johan Ahlen 9 ani în urmă
părinte
comite
9b21a3d

+ 11 - 11
desktop/core/src/desktop/static/desktop/js/assist/assistDbEntry.js

@@ -192,6 +192,8 @@
     var successCallback = function(data) {
       self.entries([]);
       self.hasErrors(false);
+      self.loading(false);
+
       var newEntries = [];
       if (typeof data.tables_meta !== "undefined") {
         newEntries = $.map(data.tables_meta, function(table) {
@@ -274,21 +276,19 @@
         }
       }
 
-      self.loading(false);
+
       if (data.type === 'array' || data.type === 'map') {
         self.entries(newEntries);
         self.entries()[0].open(true);
-        return;
+      } else {
+        newEntries.sort(function (a, b) {
+          if (a.definition.isColumn && b.definition.isColumn) {
+            return 0;
+          }
+          return a.definition.name.localeCompare(b.definition.name);
+        });
+        self.entries(newEntries);
       }
-
-      newEntries.sort(function (a, b) {
-        if (a.definition.isColumn && b.definition.isColumn) {
-          return 0;
-        }
-        return a.definition.name.localeCompare(b.definition.name);
-      });
-
-      self.entries(newEntries);
       if (typeof callback === 'function') {
         callback();
       }

+ 2 - 2
desktop/core/src/desktop/templates/assist.mako

@@ -785,13 +785,13 @@ from metadata.conf import has_navigator
       <div><label class="checkbox inline-block margin-left-5"><input type="checkbox" data-bind="checked: filter.showTables" />Tables</label><label class="checkbox inline-block margin-left-10"><input type="checkbox" data-bind="checked: filter.showViews" />Views</label></div>
       <div><input id="searchInput" class="clearable" type="text" placeholder="${ _('Table name...') }" style="width:90%;" data-bind="hasFocus: editingSearch, clearable: filter.query, value: filter.query, valueUpdate: 'afterkeydown'"/></div>
     </div>
-    <div class="assist-flex-fill assist-db-scrollable" data-bind="visible: ! hasErrors() && ! loading() && ! $parent.loading()" style="display: none;">
+    <div class="assist-flex-fill assist-db-scrollable" data-bind="visible: ! hasErrors() && ! loading()" style="display: none;">
       <!-- ko template: 'assist-db-entries' --><!-- /ko -->
     </div>
     <div class="assist-flex-fill" data-bind="visible: loading() || $parent.loading()" style="display: none;">
       <!-- ko hueSpinner: { spin: loading, center: true, size: 'large' } --><!-- /ko -->
     </div>
-    <div class="assist-flex-fill" data-bind="visible: hasErrors() && ! loading() && ! $parent.loading()" style="display: none;">
+    <div class="assist-flex-fill" data-bind="visible: hasErrors() && ! loading()" style="display: none;">
       <span class="assist-errors">${ _('Error loading tables.') }</span>
     </div>
   </script>