Browse Source

HUE-5316 [assist] Fix context popover for views

Johan Ahlen 9 years ago
parent
commit
5e7748c

+ 15 - 1
desktop/core/src/desktop/static/desktop/js/assist/assistDbEntry.js

@@ -155,10 +155,24 @@ var AssistDbEntry = (function () {
       offset.left += positionAdjustment.left;
       offset.top += positionAdjustment.top;
     }
+
+    var type;
+    if (self.definition.isColumn) {
+      type = 'column';
+    } else if (self.definition.isComplex) {
+      type = 'complex';
+    } else if (self.definition.isTable) {
+      type = 'table';
+    } else if (self.definition.isView) {
+      type = 'view';
+    } else {
+      type = 'database';
+    }
+
     self.statsVisible(true);
     huePubSub.publish('sql.context.popover.show', {
       data: {
-        type: self.definition.isColumn ? 'column' : (self.definition.isComplex ? 'complex' : (self.definition.isTable ? 'table' : 'database')),
+        type: type,
         identifierChain: $.map(self.getHierarchy(), function (name) { return { name: name }})
       },
       orientation: 'right',

+ 5 - 0
desktop/core/src/desktop/templates/sql_context_popover.mako

@@ -1185,6 +1185,7 @@ from metadata.conf import has_navigator
         self.isFunction = params.data.type === 'function';
         self.isHdfs = params.data.type === 'hdfs';
         self.isAsterisk = params.data.type === 'asterisk';
+        self.isView = params.data.type === 'view';
 
         if (self.isDatabase) {
           self.contents = new DatabaseContextTabs(self.data, self.sourceType);
@@ -1194,6 +1195,10 @@ from metadata.conf import has_navigator
           self.contents = new TableAndColumnContextTabs(self.data, self.sourceType, self.defaultDatabase, false, false);
           self.title = self.data.identifierChain[self.data.identifierChain.length - 1].name;
           self.iconClass = 'fa-table'
+        } else if (self.isView) {
+          self.contents = new TableAndColumnContextTabs(self.data, self.sourceType, self.defaultDatabase, false, false);
+          self.title = self.data.identifierChain[self.data.identifierChain.length - 1].name;
+          self.iconClass = 'fa-eye'
         } else if (self.isComplex) {
           self.contents = new TableAndColumnContextTabs(self.data, self.sourceType, self.defaultDatabase, false, true);
           self.title = self.data.identifierChain[self.data.identifierChain.length - 1].name;