Przeglądaj źródła

HUE-6451 [editor] Show qualified names for tables and views in the sql context popover title

Johan Ahlen 8 lat temu
rodzic
commit
b4c3ee1

+ 8 - 3
desktop/core/src/desktop/templates/sql_context_popover.mako

@@ -280,7 +280,7 @@ from metadata.conf import has_navigator
     <div class="hue-popover" data-bind="css: orientationClass, style: { 'left': left() + 'px', 'top': top() + 'px', 'width': width() + 'px', height: height() + 'px' }, resizable: { containment: 'document', handles: resizeHelper.resizableHandles, start: resizeHelper.resizeStart, stop: resizeHelper.resizeStop, resize: resizeHelper.resize }">
       <div class="hue-popover-arrow" data-bind="style: { 'margin-left': leftAdjust() + 'px',  'margin-top': topAdjust() + 'px' }"></div>
       <div class="hue-popover-title" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 30px;">
-        <i class="fa muted" data-bind="css: iconClass" style="margin-top: 3px"></i> <span data-bind="text: title"></span>
+        <i class="fa muted" data-bind="css: iconClass" style="margin-top: 3px"></i> <span style="padding-left: 4px;" data-bind="text: title"></span>
         <div style="position: absolute; right: 6px; top: 8px;">
           <a class="pointer inactive-action" data-bind="visible: pinEnabled, click: pin"><i class="fa fa-fw fa-thumb-tack"></i></a>
           <a class="pointer inactive-action" data-bind="click: close"><i class="fa fa-fw fa-times"></i></a>
@@ -1159,17 +1159,22 @@ from metadata.conf import has_navigator
 
         self.pinEnabled = params.pinEnabled && !self.isFunction && !self.isAsterisk && !self.isHdfs;
 
+        if (self.isTable || self.isView) {
+          self.title = $.map(self.data.identifierChain, function (identifier) { return identifier.name; }).join('.');
+          if (self.title.indexOf('.') === -1) {
+            self.title = self.defaultDatabase + '.' + self.title;
+          }
+        }
+
         if (self.isDatabase) {
           self.contents = new DatabaseContextTabs(self.data, self.sourceType, self.defaultDatabase);
           self.title = self.data.identifierChain[self.data.identifierChain.length - 1].name;
           self.iconClass = 'fa-database';
         } else if (self.isTable) {
           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);