瀏覽代碼

[editor] Disable execute in case of empty statement

Enrico Berti 10 年之前
父節點
當前提交
472dd3c

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

@@ -406,7 +406,7 @@
 
     self.execute = function () {
       var now = (new Date()).getTime(); // We don't allow fast clicks
-      if (self.status() == 'running' || self.status() == 'loading' || now - self.lastExecuted < 1000) {
+      if (self.status() == 'running' || self.status() == 'loading' || now - self.lastExecuted < 1000 || self.statement() == '') {
         return;
       }
 

+ 1 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -870,7 +870,7 @@ ${ require.config() }
     <a class="snippet-side-btn" data-bind="click: cancel, visible: status() == 'running'" title="${ _('Cancel') }">
       <i class="fa fa-fw fa-stop"></i>
     </a>
-    <a class="snippet-side-btn" data-bind="click: execute, visible: status() != 'running' && status() != 'loading', css: {'blue': $parent.history().length == 0}" title="${ _('CTRL + ENTER') }">
+    <a class="snippet-side-btn" data-bind="click: execute, visible: status() != 'running' && status() != 'loading' && statement() != '', css: {'blue': $parent.history().length == 0}" title="${ _('CTRL + ENTER') }">
       <i class="fa fa-fw fa-play"></i>
     </a>
   </div>