瀏覽代碼

HUE-3731 [editor] Send database on Impala refresh with invalidate

Johan Ahlen 9 年之前
父節點
當前提交
6cc8b7d

+ 3 - 2
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -509,6 +509,7 @@
    * @param {boolean} [options.silenceErrors]
    *
    * @param {string} options.sourceType
+   * @param {string} [options.database]
    **/
   ApiHelper.prototype.loadDatabases = function (options) {
     var self = this;
@@ -544,9 +545,9 @@
     };
 
     if (options.sourceType === 'impala' && self.invalidateImpala == 'invalidateAndFlush') {
-      $.post(IMPALA_INVALIDATE_API, { flush_all: true }, loadFunction);
+      $.post(IMPALA_INVALIDATE_API, { flush_all: true, database: options.database }, loadFunction);
     } else if (options.sourceType === 'impala' && self.invalidateImpala == 'invalidate') {
-      $.post(IMPALA_INVALIDATE_API, {flush_all: false}, loadFunction);
+      $.post(IMPALA_INVALIDATE_API, { flush_all: false, database: options.database }, loadFunction);
     } else {
       loadFunction();
     }

+ 2 - 1
desktop/core/src/desktop/static/desktop/js/assist/assistDbSource.js

@@ -169,7 +169,8 @@
         errorCallback: function() {
           self.hasErrors(true);
           updateDatabases([]);
-        }
+        },
+        database: lastSelectedDb
       });
     };
 

+ 2 - 2
desktop/core/src/desktop/templates/assist.mako

@@ -675,10 +675,10 @@ from desktop.views import _ko
       <span class="assist-tables-counter">(<span data-bind="text: filteredEntries().length"></span>)</span>
       <!-- ko ifnot: loading -->
       <a class="inactive-action" href="javascript:void(0)" data-bind="click: toggleSearch, css: { 'blue' : isSearchVisible }"><i class="pointer fa fa-search" title="${_('Search')}"></i></a>
-      <!-- ko if: sourceType === 'impala' -->
+      <!-- ko if: sourceType === 'impala' && typeof databaseName !== 'undefined'-->
       <a class="inactive-action" href="javascript:void(0)" data-bind="templatePopover : { contentTemplate: 'ask-for-invalidate-content', titleTemplate: 'ask-for-invalidate-title', trigger: 'click', minWidth: '320px' }"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${_('Manually refresh the table list')}"></i></a>
       <!-- /ko -->
-      <!-- ko if: sourceType !== 'impala' -->
+      <!-- ko if: sourceType !== 'impala' || typeof databaseName === 'undefined' -->
       <a class="inactive-action" href="javascript:void(0)" data-bind="click: triggerRefresh"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${_('Manually refresh the table list')}"></i></a>
       <!-- /ko -->
       <!-- /ko -->