Debounce cancel upload message
This commit is contained in:
parent
64a8d01694
commit
47475f3b4c
|
@ -75,6 +75,9 @@ OC.Upload = {
|
||||||
this._uploads.push(jqXHR);
|
this._uploads.push(jqXHR);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
showUploadCancelMessage: _.debounce(function() {
|
||||||
|
OC.Notification.showTemporary(t('files', 'Upload cancelled.'), {timeout: 10});
|
||||||
|
}, 500),
|
||||||
/**
|
/**
|
||||||
* Checks the currently known uploads.
|
* Checks the currently known uploads.
|
||||||
* returns true if any hxr has the state 'pending'
|
* returns true if any hxr has the state 'pending'
|
||||||
|
@ -415,10 +418,10 @@ OC.Upload = {
|
||||||
OC.Upload.log('fail', e, data);
|
OC.Upload.log('fail', e, data);
|
||||||
if (typeof data.textStatus !== 'undefined' && data.textStatus !== 'success' ) {
|
if (typeof data.textStatus !== 'undefined' && data.textStatus !== 'success' ) {
|
||||||
if (data.textStatus === 'abort') {
|
if (data.textStatus === 'abort') {
|
||||||
OC.Notification.show(t('files', 'Upload cancelled.'));
|
OC.Upload.showUploadCancelMessage();
|
||||||
} else {
|
} else {
|
||||||
// HTTP connection problem
|
// HTTP connection problem
|
||||||
OC.Notification.show(data.errorThrown);
|
OC.Notification.showTemporary(data.errorThrown, {timeout: 10});
|
||||||
if (data.result) {
|
if (data.result) {
|
||||||
var result = JSON.parse(data.result);
|
var result = JSON.parse(data.result);
|
||||||
if (result && result[0] && result[0].data && result[0].data.code === 'targetnotfound') {
|
if (result && result[0] && result[0].data && result[0].data.code === 'targetnotfound') {
|
||||||
|
@ -427,10 +430,6 @@ OC.Upload = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//hide notification after 10 sec
|
|
||||||
setTimeout(function() {
|
|
||||||
OC.Notification.hide();
|
|
||||||
}, 10000);
|
|
||||||
}
|
}
|
||||||
OC.Upload.deleteUpload(data);
|
OC.Upload.deleteUpload(data);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue