Kaynağa Gözat

HUE-3394 [notebook] Jar submit button is always disabled

Romain Rigaux 9 yıl önce
ebeveyn
işleme
8a93323fe0

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

@@ -687,6 +687,10 @@
     };
 
     self.wasBatchExecuted = ko.observable(typeof snippet.wasBatchExecuted != "undefined" && snippet.wasBatchExecuted != null ? snippet.wasBatchExecuted : false);
+    self.isReady = ko.computed(function() {
+      return ((self.type() != 'jar' && self.type() != 'java') && self.statement() !== '') ||
+        ((self.type() == 'jar' || self.type() == 'java') && (self.properties().app_jar() != '' && self.properties().class() != ''));
+    });
     self.lastExecuted = ko.observable(typeof snippet.lastExecuted != "undefined" && snippet.lastExecuted != null ? snippet.lastExecuted : 0);
 
     self.executingBlockingOperation = null; // A ExecuteStatement()
@@ -707,7 +711,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 || self.statement() == '') {
+      if (self.status() == 'running' || self.status() == 'loading' || now - self.lastExecuted() < 1000 || ! self.isReady()) {
         return;
       }
 

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

@@ -1836,8 +1836,8 @@ ${ hueIcons.symbols() }
         <i class="fa fa-fw fa-send"></i>
       </a>
       <!-- /ko -->
-      <!-- ko if: type() != 'hive' || !wasBatchExecuted() -->
-      <a class="snippet-side-btn" style="padding-right:0" href="javascript: void(0)" data-bind="attr: {'title': $root.editorMode() && result.statements_count() > 1 ? '${ _ko('Execute next statement')}' : '${ _ko('Execute or CTRL + ENTER') }'}, click: function() { wasBatchExecuted(false); execute(); }, visible: status() != 'running' && status() != 'loading', css: {'blue': $parent.history().length == 0 || $root.editorMode(), 'disabled': statement() === '' }, style: {'padding-left': type() == 'hive' ? '2px' : '0' }">
+      <!-- ko if: type() != 'hive' || ! wasBatchExecuted() -->
+      <a class="snippet-side-btn" style="padding-right:0" href="javascript: void(0)" data-bind="attr: {'title': $root.editorMode() && result.statements_count() > 1 ? '${ _ko('Execute next statement')}' : '${ _ko('Execute or CTRL + ENTER') }'}, click: function() { wasBatchExecuted(false); execute(); }, visible: status() != 'running' && status() != 'loading', css: {'blue': $parent.history().length == 0 || $root.editorMode(), 'disabled': ! isReady() }, style: {'padding-left': type() == 'hive' ? '2px' : '0' }">
         <i class="fa fa-fw fa-play" data-bind="css: { 'snippet-side-single' : type() !== 'hive' }"></i>
       </a>
       <!-- /ko -->