浏览代码

HUE-7244 [presentation] Add feedback effect to the global cancel operation

Romain Rigaux 8 年之前
父节点
当前提交
fb31ac0

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

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

+ 17 - 6
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1157,12 +1157,23 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
 
 <script type="text/html" id="notebook-actions">
   <div class="btn-group">
-    <a class="btn" rel="tooltip" data-placement="bottom" title="${ _("Execute all") }" data-bind="visible: $root.selectedNotebook() && ! $root.selectedNotebook().isExecutingAll(), click: function() { $root.selectedNotebook().executeAll(); }">
-      <i class="fa fa-fw fa-play"></i>
-    </a>
-    <a class="btn red" rel="tooltip" data-placement="bottom" title="${ _("Stop all") }" data-bind="visible: $root.selectedNotebook() && $root.selectedNotebook().isExecutingAll(), click: function() { $root.selectedNotebook().cancelExecutingAll(); }">
-      <i class="fa fa-fw fa-stop"></i>
-    </a>
+    <!-- ko if: $root.selectedNotebook() -->
+    <!-- ko with: $root.selectedNotebook() -->
+      <a class="btn" rel="tooltip" data-placement="bottom" title="${ _("Execute all") }" data-bind="visible: ! isExecutingAll(), click: function() { executeAll(); }">
+        <i class="fa fa-fw fa-play"></i>
+      </a>
+      <!-- ko if: ! (snippets()[executingAllIndex()] && snippets()[executingAllIndex()].isCanceling()) -->
+      <a class="btn red" rel="tooltip" data-placement="bottom" title="${ _("Stop all") }" data-bind="visible: isExecutingAll(), click: function() { cancelExecutingAll(); }">
+        <i class="fa fa-fw fa-stop"></i>
+      </a>
+      <!-- /ko -->
+      <!-- ko if: snippets()[executingAllIndex()] && snippets()[executingAllIndex()].isCanceling() -->
+      <a class="btn" style="cursor: default;" title="${ _('Canceling operation...') }">
+        <i class="fa fa-fw fa-spinner snippet-side-single fa-spin"></i>
+      </a>
+      <!-- /ko -->
+    <!-- /ko -->
+    <!-- /ko -->
 
     <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
       <span class="caret"></span>