Browse Source

Adding the view and database icon in the left and right assist

ayush.goyal 4 years ago
parent
commit
e18249376f

+ 18 - 0
desktop/core/src/desktop/js/ko/components/contextPopover/dataCatalogContext.js

@@ -27,6 +27,24 @@ class DataCatalogContext {
     self.popover = options.popover;
     self.catalogEntry = ko.observable(options.catalogEntry);
 
+    self.parentIsView = ko.observable(false);
+    const checkIfParentIsView = catalogEntry => {
+      if (!catalogEntry) {
+        self.parentIsView(false);
+        return;
+      }
+      catalogEntry
+        .getParent()
+        .then(parentEntry => {
+          self.parentIsView(parentEntry.isView());
+        })
+        .catch(() => {
+          self.parentIsView(false);
+        });
+    };
+    checkIfParentIsView(self.catalogEntry());
+    self.catalogEntry.subscribe(checkIfParentIsView);
+
     self.loading = ko.observable(false);
     self.hasErrors = ko.observable(false);
     self.activePromises = [];

+ 1 - 1
desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js

@@ -275,7 +275,7 @@ const SUPPORT_TEMPLATES = `
 
   <script type="text/html" id="context-catalog-entry-title">
     <div class="hue-popover-title">
-      <i class="hue-popover-title-icon fa muted" data-bind="css: catalogEntry() && catalogEntry().isView() ? 'fa-eye' : (catalogEntry().isModel() ? 'fa-puzzle-piece' : 'fa-table')"></i>
+      <i class="hue-popover-title-icon fa muted" data-bind="css: catalogEntry() && (catalogEntry().isView() || parentIsView()) ? 'fa-eye' : (catalogEntry().isDatabase() ? 'fa-database' : (catalogEntry().isModel() ? 'fa-puzzle-piece' : 'fa-table'))"></i>
       <span class="hue-popover-title-text" data-bind="foreach: breadCrumbs">
         <!-- ko ifnot: isActive --><div><a href="javascript: void(0);" data-bind="click: makeActive, text: name"></a>.</div><!-- /ko -->
         <!-- ko if: isActive -->