ソースを参照

HUE-8042 [editor] Better prevention of double query submissions

Romain Rigaux 7 年 前
コミット
d2ad5a0

+ 1 - 2
desktop/libs/hadoop/src/hadoop/fs/upload.py

@@ -32,10 +32,9 @@ import time
 from django.core.files.uploadhandler import FileUploadHandler, StopFutureHandlers, StopUpload, UploadFileException, SkipFile
 from django.utils.translation import ugettext as _
 
+from desktop.lib import fsmanager
 
 import hadoop.cluster
-from desktop.lib import fsmanager
-from urlparse import urlparse
 from hadoop.conf import UPLOAD_CHUNK_SIZE
 from hadoop.fs.exceptions import WebHdfsException
 

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

@@ -1371,6 +1371,9 @@ var EditorViewModel = (function() {
         return;
       }
 
+      self.status('running');
+      self.statusForButtons('executing');
+
       if (self.isSqlDialect()) {
         huePubSub.publish('editor.refresh.statement.locations', self);
       }
@@ -1391,7 +1394,6 @@ var EditorViewModel = (function() {
 
       if (self.result.handle()) {
         self.close();
-        self.statusForButtons('executed');
       }
 
       if (self.isSqlDialect() && self.positionStatement()) {
@@ -1400,8 +1402,6 @@ var EditorViewModel = (function() {
         self.lastExecutedStatement(null);
       }
 
-      self.status('running');
-      self.statusForButtons('executing');
       self.errors([]);
       huePubSub.publish('editor.clear.highlighted.errors', self.ace());
       self.result.clear();
@@ -1938,7 +1938,7 @@ var EditorViewModel = (function() {
         if (xhr.status !== 502) {
           // $(document).trigger("error", xhr.responseText);
         }
-        self.status('failed');
+        // self.status('failed'); // Can conflict with slow close and new query execution
       });
     };
 

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

@@ -1682,7 +1682,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
         'progress-warning': progress() > 0 && progress() < 100,
         'progress-success': progress() == 100,
         'progress-danger': progress() == 0 && errors().length > 0}" style="background-color: #FFF; width: 100%">
-        <div class="bar" data-bind="style: {'width': (errors().length > 0 ? 100 : Math.max(2,progress())) + '%'}"></div>
+        <div class="bar" data-bind="style: {'width': (errors().length > 0 ? 100 : Math.max(2, progress())) + '%'}"></div>
       </div>
     </div>
     <div class="snippet-error-container alert alert-error" style="margin-bottom: 0" data-bind="visible: errors().length > 0">