AMBARI-15178. New Files View : [UI Issue] No way to cancel/stop the upload file in File browser view. (dipayanb)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6e758b76 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6e758b76 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6e758b76 Branch: refs/heads/trunk Commit: 6e758b76a0d0802db89163467997433fa43f4a11 Parents: 4e253f6 Author: Dipayan Bhowmick <[email protected]> Authored: Fri Feb 26 15:49:29 2016 +0530 Committer: Dipayan Bhowmick <[email protected]> Committed: Fri Feb 26 15:49:29 2016 +0530 ---------------------------------------------------------------------- .../main/resources/ui/app/components/upload-file.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6e758b76/contrib/views/files/src/main/resources/ui/app/components/upload-file.js ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js b/contrib/views/files/src/main/resources/ui/app/components/upload-file.js index 9da6854..e50dec8 100644 --- a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js +++ b/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(); } }
