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

Commit dc0022a

Browse files
committed
Auto-open / don't auto-close uploader if there were errors during transfer
1 parent 228560a commit dc0022a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

core/src/plugins/uploader.html/js/react/UploaderModel.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,12 @@
396396
}.bind(this));
397397
}else{
398398
UploadTask.getInstance().setIdle();
399-
if(this.getAutoClose() && pydio.Controller.react_selector){
400-
pydio.UI.modal.dismiss();
399+
if(this.hasErrors()){
400+
if(!pydio.getController().react_selector){
401+
global.pydio.getController().fireAction("upload");
402+
}
403+
}else if(this.getAutoClose()){
404+
this.notify("auto_close");
401405
}
402406
}
403407
}
@@ -426,6 +430,15 @@
426430
processed: this._processed
427431
};
428432
}
433+
hasErrors(){
434+
let result = false;
435+
this._processed.map(function(item){
436+
if(item.getStatus() === 'error'){
437+
result = true;
438+
}
439+
});
440+
return result;
441+
}
429442
static getInstance(){
430443
if(!UploaderStore.__INSTANCE){
431444
UploaderStore.__INSTANCE = new UploaderStore();

core/src/plugins/uploader.html/js/react/UploaderView.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,16 @@
182182
this.setState({items: store.getItems()});
183183
}.bind(this);
184184
store.observe("update", this._storeObserver);
185+
store.observe("auto_close", function(){
186+
pydio.UI.modal.dismiss();
187+
});
185188
this.setState({items: store.getItems()});
186189
},
187190

188191
componentWillUnmount: function(){
189192
if(this._storeObserver){
190193
UploaderModel.Store.getInstance().stopObserving("update", this._storeObserver);
194+
UploaderModel.Store.getInstance().stopObserving("auto_close");
191195
}
192196
},
193197

0 commit comments

Comments
 (0)