Browse Source

HUE-8701 [editor] Prevent js exception in the context selector when no namespaces exist

Johan Ahlen 6 years ago
parent
commit
b17973e0a5

+ 5 - 0
desktop/core/src/desktop/templates/ko_components/ko_context_selector.mako

@@ -349,6 +349,11 @@ from desktop.views import _ko
           $.when(self[TYPES_INDEX.namespace.lastPromise], self[TYPES_INDEX.compute.lastPromise]).done(function () {
           $.when(self[TYPES_INDEX.namespace.lastPromise], self[TYPES_INDEX.compute.lastPromise]).done(function () {
             window.clearTimeout(self.reloadDatabaseThrottle);
             window.clearTimeout(self.reloadDatabaseThrottle);
             self.reloadDatabaseThrottle = window.setTimeout(function () {
             self.reloadDatabaseThrottle = window.setTimeout(function () {
+              if (!self[TYPES_INDEX.namespace.name]()) {
+                self.availableDatabases([]);
+                self.loadingDatabases(false);
+                return;
+              }
               DataCatalog.getEntry({
               DataCatalog.getEntry({
                 sourceType: ko.unwrap(self.sourceType),
                 sourceType: ko.unwrap(self.sourceType),
                 namespace: self[TYPES_INDEX.namespace.name](),
                 namespace: self[TYPES_INDEX.namespace.name](),