mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Small fixes for upload error behaviour
* Change error dialog text slightly * Only show global notification on first error * Only create the S3 blob if the response is successful
This commit is contained in:
parent
5250427ce0
commit
edeec39548
@ -24,7 +24,7 @@ let FileDragAndDropErrorDialog = React.createClass({
|
||||
className='btn btn-default'
|
||||
onClick={() => {
|
||||
if (openIntercom) {
|
||||
window.Intercom('showNewMessage', getLangText("I'm having trouble with uploading my file: "));
|
||||
window.Intercom('showNewMessage', getLangText("I'm having trouble uploading my file."));
|
||||
}
|
||||
|
||||
this.retryAllFiles()
|
||||
@ -38,7 +38,7 @@ let FileDragAndDropErrorDialog = React.createClass({
|
||||
return (
|
||||
<div className='file-drag-and-drop-error'>
|
||||
<h4>Let us help you</h4>
|
||||
<p>{getLangText('Still having problems? Give us a call!')}</p>
|
||||
<p>{getLangText('Still having problems? Send us a message!')}</p>
|
||||
{this.getRetryButton('Contact us', true)}
|
||||
</div>
|
||||
);
|
||||
|
@ -547,7 +547,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
xhr: this.getXhrErrorComment(xhr)
|
||||
});
|
||||
// onError will catch any errors, so we can ignore them here
|
||||
} else if (!res.error || res.success) {
|
||||
} else if (!res.error && res.success) {
|
||||
let files = this.state.filesToUpload;
|
||||
|
||||
// Set the state of the completed file to 'upload successful' in order to
|
||||
@ -596,13 +596,13 @@ const ReactS3FineUploader = React.createClass({
|
||||
let notificationMessage;
|
||||
|
||||
if (showErrorPrompt) {
|
||||
notificationMessage = errorNotificationMessage;
|
||||
|
||||
this.setStatusOfFile(id, FileStatus.UPLOAD_FAILED);
|
||||
|
||||
// If we've already found an error on this upload, just ignore other errors
|
||||
// that pop up. They'll likely pop up again when the user retries.
|
||||
if (!this.state.errorState.errorClass) {
|
||||
notificationMessage = errorNotificationMessage;
|
||||
|
||||
const errorState = React.addons.update(this.state.errorState, {
|
||||
errorClass: {
|
||||
$set: this.getUploadErrorClass({
|
||||
@ -620,8 +620,10 @@ const ReactS3FineUploader = React.createClass({
|
||||
this.cancelUploads();
|
||||
}
|
||||
|
||||
const notification = new GlobalNotificationModel(notificationMessage, 'danger', 5000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
if (notificationMessage) {
|
||||
const notification = new GlobalNotificationModel(notificationMessage, 'danger', 5000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
}
|
||||
},
|
||||
|
||||
onCancel(id) {
|
||||
@ -1061,7 +1063,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
uploadMethod } = this.props;
|
||||
|
||||
// Only show the error state once all files are finished
|
||||
const showError = !uploadInProgress && showErrorPrompt && errorClass;
|
||||
const showError = !uploadInProgress && showErrorPrompt && errorClass != null;
|
||||
|
||||
const props = {
|
||||
multiple,
|
||||
|
Loading…
Reference in New Issue
Block a user