mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +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'
|
className='btn btn-default'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (openIntercom) {
|
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()
|
this.retryAllFiles()
|
||||||
@ -38,7 +38,7 @@ let FileDragAndDropErrorDialog = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div className='file-drag-and-drop-error'>
|
<div className='file-drag-and-drop-error'>
|
||||||
<h4>Let us help you</h4>
|
<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)}
|
{this.getRetryButton('Contact us', true)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -547,7 +547,7 @@ const ReactS3FineUploader = React.createClass({
|
|||||||
xhr: this.getXhrErrorComment(xhr)
|
xhr: this.getXhrErrorComment(xhr)
|
||||||
});
|
});
|
||||||
// onError will catch any errors, so we can ignore them here
|
// 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;
|
let files = this.state.filesToUpload;
|
||||||
|
|
||||||
// Set the state of the completed file to 'upload successful' in order to
|
// Set the state of the completed file to 'upload successful' in order to
|
||||||
@ -596,13 +596,13 @@ const ReactS3FineUploader = React.createClass({
|
|||||||
let notificationMessage;
|
let notificationMessage;
|
||||||
|
|
||||||
if (showErrorPrompt) {
|
if (showErrorPrompt) {
|
||||||
notificationMessage = errorNotificationMessage;
|
|
||||||
|
|
||||||
this.setStatusOfFile(id, FileStatus.UPLOAD_FAILED);
|
this.setStatusOfFile(id, FileStatus.UPLOAD_FAILED);
|
||||||
|
|
||||||
// If we've already found an error on this upload, just ignore other errors
|
// 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.
|
// that pop up. They'll likely pop up again when the user retries.
|
||||||
if (!this.state.errorState.errorClass) {
|
if (!this.state.errorState.errorClass) {
|
||||||
|
notificationMessage = errorNotificationMessage;
|
||||||
|
|
||||||
const errorState = React.addons.update(this.state.errorState, {
|
const errorState = React.addons.update(this.state.errorState, {
|
||||||
errorClass: {
|
errorClass: {
|
||||||
$set: this.getUploadErrorClass({
|
$set: this.getUploadErrorClass({
|
||||||
@ -620,8 +620,10 @@ const ReactS3FineUploader = React.createClass({
|
|||||||
this.cancelUploads();
|
this.cancelUploads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (notificationMessage) {
|
||||||
const notification = new GlobalNotificationModel(notificationMessage, 'danger', 5000);
|
const notification = new GlobalNotificationModel(notificationMessage, 'danger', 5000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCancel(id) {
|
onCancel(id) {
|
||||||
@ -1061,7 +1063,7 @@ const ReactS3FineUploader = React.createClass({
|
|||||||
uploadMethod } = this.props;
|
uploadMethod } = this.props;
|
||||||
|
|
||||||
// Only show the error state once all files are finished
|
// Only show the error state once all files are finished
|
||||||
const showError = !uploadInProgress && showErrorPrompt && errorClass;
|
const showError = !uploadInProgress && showErrorPrompt && errorClass != null;
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
multiple,
|
multiple,
|
||||||
|
Loading…
Reference in New Issue
Block a user