瀏覽代碼

AMBARI-15178. New Files View : [UI Issue] No way to cancel/stop the upload file in File browser view. (dipayanb)

Dipayan Bhowmick 9 年之前
父節點
當前提交
6e758b76a0
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      contrib/views/files/src/main/resources/ui/app/components/upload-file.js

+ 13 - 0
contrib/views/files/src/main/resources/ui/app/components/upload-file.js

@@ -62,11 +62,16 @@ export default Ember.Component.extend(OperationModal, {
       this.set('closeOnEscape', true);
     },
 
+    didCloseModal: function() {
+      this.set('uploader');
+    },
+
     fileLoaded: function(file) {
       var url = this.get('fileOperationService').getUploadUrl();
       var uploader = FileUploader.create({
         url: url
       });
+      this.set('uploader', uploader);
       if(!Ember.isEmpty(file)) {
         uploader.upload(file, {path: this.get('path')});
         this.setUploading(file.name);
@@ -85,6 +90,14 @@ export default Ember.Component.extend(OperationModal, {
         });
       }
 
+    },
+
+    close: function() {
+      if (!Ember.isNone(this.get('uploader'))) {
+        console.log('cancelling the upload');
+        this.get('uploader').abort();
+      }
+      this._super();
     }
 
   }