Browse Source

HUE-7876 [presentation] Editor should not convert to Notebook in presentation mode when saving

Romain Rigaux 7 years ago
parent
commit
3925fa76d0

+ 3 - 2
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2364,10 +2364,11 @@ var EditorViewModel = (function() {
       if (cp.schedulerViewModel) {
       if (cp.schedulerViewModel) {
         cp.schedulerViewModel.availableTimezones = [];
         cp.schedulerViewModel.availableTimezones = [];
       }
       }
+      var editorMode = vm.editorMode() || (self.isPresentationMode() && vm.editorType() != 'notebook'); // Editor should not convert to Notebook in presentation mode
 
 
       $.post("/notebook/api/notebook/save", {
       $.post("/notebook/api/notebook/save", {
         "notebook": ko.mapping.toJSON(cp, NOTEBOOK_MAPPING),
         "notebook": ko.mapping.toJSON(cp, NOTEBOOK_MAPPING),
-        "editorMode": vm.editorMode()
+        "editorMode": editorMode
       }, function (data) {
       }, function (data) {
         if (data.status == 0) {
         if (data.status == 0) {
           self.id(data.id);
           self.id(data.id);
@@ -2375,7 +2376,7 @@ var EditorViewModel = (function() {
           var wasHistory = self.isHistory();
           var wasHistory = self.isHistory();
           self.isHistory(false);
           self.isHistory(false);
           $(document).trigger("info", data.message);
           $(document).trigger("info", data.message);
-          if (vm.editorMode()) {
+          if (editorMode) {
             if (! data.save_as) {
             if (! data.save_as) {
               var existingQuery = self.snippets()[0].queries().filter(function (item) {
               var existingQuery = self.snippets()[0].queries().filter(function (item) {
                 return item.uuid() === data.uuid
                 return item.uuid() === data.uuid