Эх сурвалжийг харах

HUE-5632 [editor] Show table comments in the autocomplete dropdown details panel

Johan Ahlen 8 жил өмнө
parent
commit
cf0b768

+ 6 - 6
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter3.js

@@ -518,17 +518,17 @@ var SqlAutocompleter3 = (function () {
           databaseName: suggestTables.identifierChain && suggestTables.identifierChain.length === 1 ? suggestTables.identifierChain[0].name : self.activeDatabase,
           successCallback: function (data) {
             var tableSuggestions = [];
-            data.tables_meta.forEach(function (tablesMeta) {
-              if (suggestTables.onlyTables && tablesMeta.type.toLowerCase() !== 'table' ||
-                  suggestTables.onlyViews && tablesMeta.type.toLowerCase() !== 'view') {
+            data.tables_meta.forEach(function (tableMeta) {
+              if (suggestTables.onlyTables && tableMeta.type.toLowerCase() !== 'table' ||
+                  suggestTables.onlyViews && tableMeta.type.toLowerCase() !== 'view') {
                 return;
               }
               tableSuggestions.push({
-                value: prefix + self.backTickIfNeeded(tablesMeta.name),
-                meta: AutocompleterGlobals.i18n.meta[tablesMeta.type.toLowerCase()],
+                value: prefix + self.backTickIfNeeded(tableMeta.name),
+                meta: AutocompleterGlobals.i18n.meta[tableMeta.type.toLowerCase()],
                 category: CATEGORIES.TABLE,
                 detailsTemplate: 'table',
-                details: tablesMeta
+                details: tableMeta.comment ? tableMeta : null
               });
             });
             self.loadingTables(false);

+ 10 - 1
desktop/libs/notebook/src/notebook/templates/hue_ace_autocompleter.mako

@@ -81,6 +81,8 @@ from desktop.views import _ko
       flex: 0 0 300px;
       width: 300px;
       overflow-y: auto;
+      padding: 10px;
+      border-left: 1px solid #F9F9F9;
     }
 
     .autocompleter-categories {
@@ -122,6 +124,12 @@ from desktop.views import _ko
       height: 8px;
       border-radius: 4px;
     }
+
+    .details-header {
+      margin-bottom: 10px;
+      font-size: 15px;
+      font-weight: 300;
+    }
   </style>
 
   <script type="text/html" id="hue-ace-autocompleter">
@@ -168,7 +176,8 @@ from desktop.views import _ko
   </script>
 
   <script type="text/html" id="autocomplete-details-table">
-    <pre data-bind="text: ko.mapping.toJSON(details)"></pre>
+    <div class="details-header">${ _('Comment') }</div>
+    <div data-bind="text: details.comment"></div>
   </script>
 
   <script type="text/html" id="autocomplete-details-column">