浏览代码

HUE-7244 [presentation] Cancel a running presentation on exit

To avoid leaking queries in the background for now.
Romain Rigaux 8 年之前
父节点
当前提交
0dffdc7b6c

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

@@ -2023,7 +2023,7 @@ var EditorViewModel = (function() {
     self.isExecutingAll = ko.observable(typeof notebook.isExecutingAll != "undefined" && notebook.isExecutingAll != null ? notebook.isExecutingAll : false);
     self.cancelExecutingAll = function() {
       var index = self.executingAllIndex();
-      if (self.snippets()[index]) {
+      if (self.isExecutingAll() && self.snippets()[index]) {
         self.snippets()[index].cancel();
       } else {
         self.isExecutingAll(false);

+ 3 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -3205,6 +3205,9 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
       });
       viewModel.isPresentationMode.subscribe(function(newValue) {
         wasResultFullScreenMode = false;
+        if (! newValue) {
+          viewModel.selectedNotebook().cancelExecutingAll();
+        }
         togglePresentation(newValue);
         viewModel.togglePresentationMode();
         if (newValue) {