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/76789aae Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/76789aae Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/76789aae Branch: refs/heads/branch-2.2 Commit: 76789aae44c61af944310cd52fafc026ff1f6786 Parents: 4e89a91 Author: Dipayan Bhowmick <[email protected]> Authored: Fri Feb 26 15:49:29 2016 +0530 Committer: Dipayan Bhowmick <[email protected]> Committed: Fri Feb 26 15:51:03 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/76789aae/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(); } }
