Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Auto-open / don't auto-close uploader if there were errors during tra…
Browse files Browse the repository at this point in the history
…nsfer
  • Loading branch information
cdujeu committed Sep 27, 2016
1 parent 228560a commit dc0022a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions core/src/plugins/uploader.html/js/react/UploaderModel.js
Expand Up @@ -396,8 +396,12 @@
}.bind(this));
}else{
UploadTask.getInstance().setIdle();
if(this.getAutoClose() && pydio.Controller.react_selector){
pydio.UI.modal.dismiss();
if(this.hasErrors()){
if(!pydio.getController().react_selector){
global.pydio.getController().fireAction("upload");
}
}else if(this.getAutoClose()){
this.notify("auto_close");
}
}
}
Expand Down Expand Up @@ -426,6 +430,15 @@
processed: this._processed
};
}
hasErrors(){
let result = false;
this._processed.map(function(item){
if(item.getStatus() === 'error'){
result = true;
}
});
return result;
}
static getInstance(){
if(!UploaderStore.__INSTANCE){
UploaderStore.__INSTANCE = new UploaderStore();
Expand Down
4 changes: 4 additions & 0 deletions core/src/plugins/uploader.html/js/react/UploaderView.js
Expand Up @@ -182,12 +182,16 @@
this.setState({items: store.getItems()});
}.bind(this);
store.observe("update", this._storeObserver);
store.observe("auto_close", function(){
pydio.UI.modal.dismiss();
});
this.setState({items: store.getItems()});
},

componentWillUnmount: function(){
if(this._storeObserver){
UploaderModel.Store.getInstance().stopObserving("update", this._storeObserver);
UploaderModel.Store.getInstance().stopObserving("auto_close");
}
},

Expand Down

0 comments on commit dc0022a

Please sign in to comment.