Przeglądaj źródła

HUE-7746 [assist] Show a spinner when searching in the right assistant while columns are being loaded

Johan Ahlen 8 lat temu
rodzic
commit
4afc3e2827

+ 3 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -616,6 +616,9 @@
           }
           if (options.center) {
             $spinner.addClass('hue-spinner-center');
+            if (options.inline) {
+              $container.css('width', '100%');
+            }
           }
         }
         $container.append($spinner);

+ 8 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -2285,7 +2285,7 @@ from desktop.views import _ko
             <!-- /ko -->
           </div>
           <!-- /ko -->
-          <!-- ko if: filteredTables().length === 0 && filter.querySpec() && filter.querySpec().query !== '' -->
+          <!-- ko if: filteredTables().length === 0 && filter.querySpec() && filter.querySpec().query !== '' && !someLoading() -->
           <div class="assist-no-entries">${ _('No entries found.') }</div>
           <!-- /ko -->
           <!-- ko if: filteredTables().length > 0 -->
@@ -2304,6 +2304,7 @@ from desktop.views import _ko
             <!-- /ko -->
           </ul>
           <!-- /ko -->
+          <!-- ko hueSpinner: { spin: filter.querySpec() && filter.querySpec().query !== '' && someLoading(), inline: true,  center: true} --><!-- /ko -->
         </div>
 
         <!-- ko if: HAS_OPTIMIZER && !isSolr() -->
@@ -2432,6 +2433,12 @@ from desktop.views import _ko
           % endif
         });
 
+        self.someLoading = ko.pureComputed(function () {
+          return self.activeTables().some(function (table) {
+            return table.loading() || (!table.hasEntries() && !table.hasErrors());
+          });
+        });
+
         var createQualifiedIdentifier = function (identifierChain, defaultDatabase) {
           if (identifierChain.length === 1) {
             return defaultDatabase + '.' + identifierChain[0].name;