Pārlūkot izejas kodu

HUE-7497 [indexer] Refresh assist collection list on index creation

Romain Rigaux 8 gadi atpakaļ
vecāks
revīzija
e759caf

+ 3 - 0
desktop/core/src/desktop/templates/ko_components.mako

@@ -420,6 +420,9 @@ from desktop.views import _ko
                   if (notebook.onSuccessUrl() && notebook.onSuccessUrl() !== 'assist.db.refresh') { // TODO: Similar if in in FB directory, also refresh FB dir
                     huePubSub.publish('open.link', notebook.onSuccessUrl());
                   }
+                  if (notebook.onSuccessUrl()) {
+                    huePubSub.publish(notebook.pubSubUrl());
+                  }
                 } else { // Perform last DROP statement execute
                   snippet.execute();
                 }

+ 1 - 0
desktop/libs/indexer/src/indexer/indexers/morphline.py

@@ -72,6 +72,7 @@ class MorphlineIndexer(object):
       name=_('Indexing into %s') % collection_name,
       editor_type='notebook',
       on_success_url=reverse('search:browse', kwargs={'name': collection_name}),
+      pub_sub_url='assist.collections.refresh',
       is_task=True,
       is_notebook=True,
       last_executed=start_time

+ 2 - 1
desktop/libs/notebook/src/notebook/models.py

@@ -57,7 +57,7 @@ def escape_rows(rows, nulls_only=False):
 
 def make_notebook(name='Browse', description='', editor_type='hive', statement='', status='ready',
                   files=None, functions=None, settings=None, is_saved=False, database='default', snippet_properties=None, batch_submit=False,
-                  on_success_url=None, skip_historify=False, is_task=False, last_executed=-1, is_notebook=False):
+                  on_success_url=None, skip_historify=False, is_task=False, last_executed=-1, is_notebook=False, pub_sub_url=None):
   '''
   skip_historify: do not add the task to the query history. e.g. SQL Dashboard
   isManaged: true when being a managed by Hue operation (include_managed=True in document), e.g. exporting query result, dropping some tables
@@ -103,6 +103,7 @@ def make_notebook(name='Browse', description='', editor_type='hive', statement='
     'showHistory': True,
     'isSaved': is_saved,
     'onSuccessUrl': on_success_url,
+    'pubSubUrl': pub_sub_url,
     'skipHistorify': skip_historify,
     'isManaged': is_task,
     'snippets': [

+ 1 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2018,6 +2018,7 @@ var EditorViewModel = (function() {
     self.isSaved = ko.observable(typeof notebook.isSaved != "undefined" && notebook.isSaved != null ? notebook.isSaved : false);
     self.canWrite = ko.observable(typeof notebook.can_write != "undefined" && notebook.can_write != null ? notebook.can_write : true);
     self.onSuccessUrl = ko.observable(typeof notebook.onSuccessUrl != "undefined" && notebook.onSuccessUrl != null ? notebook.onSuccessUrl : null);
+    self.pubSubUrl = ko.observable(typeof notebook.pubSubUrl != "undefined" && notebook.pubSubUrl != null ? notebook.pubSubUrl : null);
     self.presentationSnippets = ko.observable({});
 
     self.snippets = ko.observableArray();