Bläddra i källkod

HUE-7211 [metastore] Invalidate the Impala cache when pressing refresh in the metastore

Johan Ahlen 8 år sedan
förälder
incheckning
2545df8

+ 8 - 1
apps/metastore/src/metastore/static/metastore/js/metastore.ko.js

@@ -70,6 +70,13 @@ var MetastoreViewModel = (function () {
 
     self.loadDatabases();
 
+    self.refresh = function () {
+      if (self.sourceType() === 'impala') {
+        huePubSub.publish('assist.invalidate.on.refresh');
+      }
+      huePubSub.publish('assist.db.refresh', { sourceTypes: [ self.sourceType() ] });
+    };
+
     huePubSub.subscribe('assist.db.refresh', function (options) {
       if (typeof options.sourceTypes !== 'undefined' && options.sourceTypes.indexOf('hive') === -1 && options.sourceTypes.indexOf('impala') === -1 ) {
         return;
@@ -183,7 +190,7 @@ var MetastoreViewModel = (function () {
             name: name,
             optimizerEnabled: self.optimizerEnabled,
             navigatorEnabled: self.navigatorEnabled,
-            sourceType: self.sourceType,
+            sourceType: self.sourceType
           })
         }));
         self.loading(false);

+ 1 - 1
apps/metastore/src/metastore/templates/metastore.mako

@@ -619,7 +619,7 @@ ${ components.menubar(is_embeddable) }
 
 <script type="text/html" id="metastore-tables-actions">
   <div class="inline-block pull-right">
-    <a class="inactive-action" href="javascript:void(0)" data-bind="tooltip: { placement: 'bottom', delay: 750 }, click: function () { huePubSub.publish('assist.db.refresh', { sourceTypes: [sourceType()] }); }" title="${_('Refresh')}"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : $root.reloading }"></i></a>
+    <a class="inactive-action" href="javascript:void(0)" data-bind="tooltip: { placement: 'bottom', delay: 750 }, click: refresh" title="${_('Refresh')}"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : $root.reloading }"></i></a>
     % if has_write_access:
       % if is_embeddable:
         <a class="inactive-action margin-left-10" data-bind="tooltip: { placement: 'bottom', delay: 750 }, click: function () { huePubSub.publish('open.link', '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + database().name ); }" title="${_('Create a new table')}" href="javascript:void(0)"><i class="fa fa-plus"></i></a>

+ 4 - 0
desktop/core/src/desktop/static/desktop/js/assist/assistDbSource.js

@@ -303,6 +303,10 @@ var AssistDbSource = (function () {
       self.initDatabases();
     };
 
+    huePubSub.subscribe('assist.invalidate.on.refresh', function () {
+      self.invalidateOnRefresh('invalidate');
+    });
+
     huePubSub.subscribe('assist.db.refresh', function (options) {
       if (typeof options.sourceTypes === 'undefined' || options.sourceTypes.indexOf(self.sourceType) !== -1) {
         window.setTimeout(function () {