Преглед изворни кода

HUE-7241 [assist] Only refresh the docs assist when saving new documents in the editor

Johan Ahlen пре 8 година
родитељ
комит
6a10238
1 измењених фајлова са 8 додато и 5 уклоњено
  1. 8 5
      desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

+ 8 - 5
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2202,7 +2202,7 @@ var EditorViewModel = (function() {
       };
     };
 
-    self.save = function () {
+    self.save = function (callback) {
       hueAnalytics.log('notebook', 'save');
 
       // Remove the result data from the snippets
@@ -2262,9 +2262,10 @@ var EditorViewModel = (function() {
               vm.changeURL('/notebook/notebook?notebook=' + data.id);
             }
           }
-          huePubSub.publish('assist.document.refresh');
-        }
-        else {
+          if (callback) {
+            callback();
+          }
+        } else {
           $(document).trigger("error", data.message);
         }
       }).fail(function (xhr, textStatus, errorThrown) {
@@ -3101,7 +3102,9 @@ var EditorViewModel = (function() {
       self.selectedNotebook().id(null);
       self.selectedNotebook().uuid(UUID());
       self.selectedNotebook().parentSavedQueryUuid(null);
-      self.saveNotebook();
+      self.selectedNotebook().save(function () {
+        huePubSub.publish('assist.document.refresh');
+      });
     };
   }