Bläddra i källkod

HUE-9191 [ui] Make sure entries are loaded when clicking on the key in the context popover

Johan Ahlen 5 år sedan
förälder
incheckning
56a5529c34

+ 19 - 0
desktop/core/src/desktop/js/catalog/dataCatalogEntry.js

@@ -361,6 +361,25 @@ class DataCatalogEntry {
     }
   }
 
+  /**
+   * Gets the parent entry, rejected if there's no parent.
+   *
+   * @return {Promise}
+   */
+  getParent() {
+    if (!this.path.length) {
+      return $.Deferred()
+        .reject()
+        .promise();
+    }
+
+    return this.dataCatalog.getEntry({
+      namespace: this.namespace,
+      compute: this.compute,
+      path: this.path.slice(0, this.path.length - 1)
+    });
+  }
+
   /**
    * Get the children of the catalog entry, columns for a table entry etc.
    *

+ 10 - 1
desktop/core/src/desktop/js/ko/components/assist/ko.assistKey.js

@@ -80,7 +80,16 @@ class AssistKey {
       })
       .then(entry => {
         if (this.onForeignKeyClick) {
-          this.onForeignKeyClick(entry);
+          // Ensure definition is loaded
+          if (!entry.definition) {
+            entry.getParent().then(parentEntry => {
+              parentEntry.getChildren().then(() => {
+                this.onForeignKeyClick(entry);
+              });
+            });
+          } else {
+            this.onForeignKeyClick(entry);
+          }
         } else {
           huePubSub.publish(ASSIST_DB_HIGHLIGHT_EVENT, entry);
         }