Răsfoiți Sursa

HUE-9187 [editor] Don't publish snippet changes from the history panel

Johan Ahlen 5 ani în urmă
părinte
comite
8f9329bc1b
1 a modificat fișierele cu 20 adăugiri și 14 ștergeri
  1. 20 14
      desktop/core/src/desktop/js/apps/notebook/editorViewModel.js

+ 20 - 14
desktop/core/src/desktop/js/apps/notebook/editorViewModel.js

@@ -565,10 +565,12 @@ class EditorViewModel {
             if (typeof skipUrlChange === 'undefined' && !self.isNotificationManager()) {
               if (self.editorMode()) {
                 self.editorType(data.document.type.substring('query-'.length));
-                huePubSub.publish('active.snippet.type.changed', {
-                  type: self.editorType(),
-                  isSqlDialect: self.getSnippetViewSettings(self.editorType()).sqlDialect
-                });
+                if (!self.isNotificationManager()) {
+                  huePubSub.publish('active.snippet.type.changed', {
+                    type: self.editorType(),
+                    isSqlDialect: self.getSnippetViewSettings(self.editorType()).sqlDialect
+                  });
+                }
                 self.changeURL(
                   self.URLS.editor + '?editor=' + data.document.id + '&type=' + self.editorType()
                 );
@@ -591,10 +593,12 @@ class EditorViewModel {
     };
 
     self.newNotebook = function(editorType, callback, queryTab) {
-      huePubSub.publish('active.snippet.type.changed', {
-        type: editorType,
-        isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined
-      });
+      if (!self.isNotificationManager()) {
+        huePubSub.publish('active.snippet.type.changed', {
+          type: editorType,
+          isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined
+        });
+      }
       $.post(
         '/notebook/api/create_notebook',
         {
@@ -619,12 +623,14 @@ class EditorViewModel {
             if (window.location.getParameter('type') === '') {
               hueUtils.changeURLParameter('type', self.editorType());
             }
-            huePubSub.publish('active.snippet.type.changed', {
-              type: editorType,
-              isSqlDialect: editorType
-                ? self.getSnippetViewSettings(editorType).sqlDialect
-                : undefined
-            });
+            if (!self.isNotificationManager()) {
+              huePubSub.publish('active.snippet.type.changed', {
+                type: editorType,
+                isSqlDialect: editorType
+                  ? self.getSnippetViewSettings(editorType).sqlDialect
+                  : undefined
+              });
+            }
           }
 
           if (callback) {