Răsfoiți Sursa

HUE-7694 [assist] Add show details to the collections name in left and right assist

Enrico Berti 8 ani în urmă
părinte
comite
9dcaf3a

+ 3 - 5
desktop/core/src/desktop/static/desktop/js/assist/assistDbEntry.js

@@ -205,7 +205,9 @@ var AssistDbEntry = (function () {
     }
 
     var type;
-    if (self.definition.isColumn) {
+    if (self.definition.isColumn && self.sourceType === 'solr') {
+      type = 'collection';
+    } else if (self.definition.isColumn) {
       type = 'column';
     } else if (self.definition.isComplex) {
       type = 'complex';
@@ -217,10 +219,6 @@ var AssistDbEntry = (function () {
       type = 'database';
     }
 
-    if (self.sourceType === 'solr') {
-      type = 'collection';
-    }
-
     self.statsVisible(true);
     huePubSub.publish('context.popover.show', {
       data: {

+ 0 - 4
desktop/core/src/desktop/templates/assist.mako

@@ -86,9 +86,7 @@ from desktop.views import _ko
   <script type="text/html" id="sql-context-items">
     <!-- ko if: typeof definition !== 'undefined' -->
       <!-- ko if: sourceType === 'solr' -->
-        <!-- ko if: definition.isColumn -->
         <li><a href="javascript:void(0);" data-bind="click: function (data) { showContextPopover(data, { target: $parentContext.$contextSourceElement }, { left: 4, top: 2 }); }"><i class="fa fa-fw fa-info"></i> ${ _('Show details') }</a></li>
-        <!-- /ko -->
         <!-- ko if: definition.isView || definition.isTable -->
         <li><a href="javascript:void(0);" data-bind="click: openInIndexer"><i class="fa fa-fw fa-table"></i> ${ _('Open in Browser') }</a></li>
         <li>
@@ -210,9 +208,7 @@ from desktop.views import _ko
   <script type="text/html" id="assist-table-entry">
     <li class="assist-table" data-bind="appAwareTemplateContextMenu: { template: 'sql-context-items', scrollContainer: '.assist-db-scrollable' }, visibleOnHover: { override: statsVisible() || navigationSettings.rightAssist, selector: '.table-actions' }">
       <div class="assist-actions table-actions" data-bind="css: { 'assist-actions-left': navigationSettings.rightAssist }" style="opacity: 0">
-        <!-- ko if: sourceType !== 'solr' -->
         <a class="inactive-action" href="javascript:void(0)" data-bind="visible: navigationSettings.showStats, click: showContextPopover, css: { 'blue': statsVisible }"><i class="fa fa-fw fa-info" title="${_('Show details')}"></i></a>
-        <!-- /ko -->
         <a class="inactive-action" href="javascript:void(0)" data-bind="visible: navigationSettings.openItem, click: openItem"><i class="fa fa-long-arrow-right" title="${_('Open')}"></i></a>
       </div>
       <a class="assist-entry assist-table-link" href="javascript:void(0)" data-bind="click: toggleOpen, attr: {'title': definition.title }, draggableText: { text: editorText,  meta: {'type': 'sql', 'isView': definition.isView, 'table': tableName, 'database': databaseName} }">

+ 30 - 19
desktop/core/src/desktop/templates/ko_components/ko_context_popover.mako

@@ -37,9 +37,11 @@ from metadata.conf import has_navigator
           <i style="font-size: 11px;" title="${ _("Open in Dashboard...") }" class="fa fa-external-link"></i> ${ _("Dashboard") }
         </a>
         % endif
+        <!-- ko if: sourceType !== 'solr' -->
         <a class="inactive-action pointer" data-bind="visible: openInTableBrowserEnabled, click: function() { huePubSub.publish('context.popover.open.in.metastore', isTable || isView ? 'table' : 'db') }">
           <i style="font-size: 11px;" title="${ _("Open in Table Browser...") }" class="fa fa-external-link"></i> ${ _("Table Browser") }
         </a>
+        <!-- /ko -->
         <a class="inactive-action pointer" data-bind="visible: replaceEditorContentEnabled, click: function() { huePubSub.publish('context.popover.replace.in.editor') }">
           <i style="font-size: 11px;" title="${ _("Replace the editor content...") }" class="fa fa-pencil"></i> ${ _("Insert in the editor") }
         </a>
@@ -680,18 +682,20 @@ from metadata.conf import has_navigator
             errorText: '${ _("There was a problem loading the columns.") }',
             isColumn: false
           });
-          self.tabs.push({
-            id: 'tableDetails',
-            label: '${ _("Details") }',
-            template: 'context-popover-table-details',
-            templateData: self.tableDetails,
-            errorText: '${ _("There was a problem loading the table details.") }',
-            isColumn: false
-          });
+          if (sourceType !== 'solr') {
+            self.tabs.push({
+              id: 'tableDetails',
+              label: '${ _("Details") }',
+              template: 'context-popover-table-details',
+              templateData: self.tableDetails,
+              errorText: '${ _("There was a problem loading the table details.") }',
+              isColumn: false
+            });
+          }
           self.activeTab('columns');
         }
 
-        if (!isComplex) {
+        if (!isComplex && sourceType !== 'solr') {
           self.tabs.push({
             id: 'sample',
             label: '${ _("Sample") }',
@@ -1520,6 +1524,8 @@ from metadata.conf import has_navigator
             self.left(params.source.left - self.width());
         }
 
+        self.isSolr = params.sourceType === 'solr';
+
         self.isDatabase = params.data.type === 'database';
         self.isTable = params.data.type === 'table';
         self.isColumn = params.data.type === 'column';
@@ -1558,9 +1564,14 @@ 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.isSolr) {
+            self.title = self.data.identifierChain[self.data.identifierChain.length - 1].name;
+          }
+          else {
+            self.title = $.map(self.data.identifierChain, function (identifier) { return identifier.name; }).join('.');
+            if (self.title.indexOf('.') === -1) {
+              self.title = self.defaultDatabase + '.' + self.title;
+            }
           }
         }
 
@@ -1570,14 +1581,14 @@ from metadata.conf import has_navigator
           self.iconClass = 'fa-database';
         } else if (self.isTable) {
           self.contents = new TableAndColumnContextTabs(self.data, self.sourceType, self.defaultDatabase, false, false);
-          self.iconClass = 'fa-table'
+          self.iconClass = self.isSolr ? 'fa-search' : 'fa-table';
         } else if (self.isView) {
           self.contents = new TableAndColumnContextTabs(self.data, self.sourceType, self.defaultDatabase, false, false);
-          self.iconClass = 'fa-eye'
+          self.iconClass = self.isSolr ? 'fa-search' : '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;
-          self.iconClass = 'fa-columns'
+          self.iconClass = 'fa-columns';
         } else if (self.isColumn) {
           self.contents = new TableAndColumnContextTabs(self.data, self.sourceType, self.defaultDatabase, true, false);
           if (self.data.identifierChain.length > 1) {
@@ -1585,15 +1596,15 @@ from metadata.conf import has_navigator
           } else {
             self.title = self.data.identifierChain[self.data.identifierChain.length - 1].name;
           }
-          self.iconClass = 'fa-columns'
+          self.iconClass = 'fa-columns';
         } else if (self.isFunction) {
           self.contents = new FunctionContextTabs(self.data, self.sourceType);
           self.title = self.data.function;
-          self.iconClass = 'fa-superscript'
+          self.iconClass = 'fa-superscript';
         } else if (self.isHdfs) {
           self.contents = new HdfsContextTabs(self.data);
           self.title = self.data.path;
-          self.iconClass = 'fa-folder-o'
+          self.iconClass = 'fa-folder-o';
         } else if (self.isAsterisk) {
           self.contents = new AsteriskContextTabs(self.data, self.sourceType, self.defaultDatabase);
           self.title = '*';
@@ -1608,7 +1619,7 @@ from metadata.conf import has_navigator
           self.iconClass = 'fa-search';
         } else {
           self.title = '';
-          self.iconClass = 'fa-info'
+          self.iconClass = 'fa-info';
         }
         self.orientationClass = 'hue-popover-' + orientation;