Explorar o código

HUE-8758 [metastore] Add notion of table ML models

Similar to having non table entities like views etc.
Romain %!s(int64=5) %!d(string=hai) anos
pai
achega
114ac66b00

+ 1 - 0
desktop/core/src/desktop/js/apps/tableBrowser/metastoreTable.js

@@ -44,6 +44,7 @@ class MetastoreTable {
 
     // TODO: Check if enough or if we need to fetch additional details
     this.isView = ko.observable(this.catalogEntry.isView());
+    this.isModel = ko.observable(this.catalogEntry.isModel());
     this.viewSql = ko.observable();
 
     this.optimizerStats = ko.observable();

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

@@ -1349,6 +1349,21 @@ class DataCatalogEntry {
     );
   }
 
+  /**
+   * Returns true if the entry is a ML Model. It will be accurate once the source meta has been loaded.
+   *
+   * @return {boolean}
+   */
+  isModel() {
+    const self = this;
+    return (
+      self.path.length === 2 &&
+      self.definition &&
+      self.definition.type &&
+      self.definition.type.toLowerCase() === 'model'
+    );
+  }
+
   /**
    * Returns true if the entry is a column.
    *

+ 2 - 0
desktop/core/src/desktop/js/ko/components/assist/assistDbEntry.js

@@ -77,6 +77,8 @@ class AssistDbEntry {
         self.iconClass = 'fa-sitemap';
       } else if (self.catalogEntry.isView()) {
         self.iconClass = 'fa-eye';
+      } else if (self.catalogEntry.isModel()) {
+        self.iconClass = 'fa-puzzle-piece';
       } else {
         self.iconClass = 'fa-table';
       }