mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
Fix duplicated/missing attachements when bulk upload to result/step [SCI-9920] (#6879)
This commit is contained in:
parent
7298042f2a
commit
e9d42beec4
|
@ -90,6 +90,10 @@
|
|||
},
|
||||
computed: {
|
||||
attachmentsOrdered() {
|
||||
if (this.attachments.some((attachment) => attachment.attributes.uploading)) {
|
||||
return this.attachments;
|
||||
}
|
||||
|
||||
return this.attachments.sort((a, b) => {
|
||||
if (a.attributes.asset_order == b.attributes.asset_order) {
|
||||
switch(this.parent.attributes.assets_order) {
|
||||
|
|
|
@ -97,10 +97,7 @@ export default {
|
|||
upload.create((error, blob) => {
|
||||
if (error) {
|
||||
fileObject.error = I18n.t('attachments.new.general_error');
|
||||
this.attachments.splice(filePosition, 1);
|
||||
setTimeout(() => {
|
||||
this.attachments.push(fileObject);
|
||||
}, 0);
|
||||
this.attachments = this.attachments.with(filePosition, fileObject);
|
||||
reject(error);
|
||||
} else {
|
||||
const signedId = blob.signed_id;
|
||||
|
@ -109,16 +106,10 @@ export default {
|
|||
}, (result) => {
|
||||
fileObject.id = result.data.id;
|
||||
fileObject.attributes = result.data.attributes;
|
||||
this.attachments.splice(filePosition, 1);
|
||||
setTimeout(() => {
|
||||
this.attachments.push(fileObject);
|
||||
}, 0);
|
||||
this.attachments = this.attachments.with(filePosition, fileObject);
|
||||
}).fail(() => {
|
||||
fileObject.error = I18n.t('attachments.new.general_error');
|
||||
this.attachments.splice(filePosition, 1);
|
||||
setTimeout(() => {
|
||||
this.attachments.push(fileObject);
|
||||
}, 0);
|
||||
this.attachments = this.attachments.with(filePosition, fileObject);
|
||||
});
|
||||
filesUploadedCntr += 1;
|
||||
if (filesUploadedCntr === filesToUploadCntr) {
|
||||
|
|
Loading…
Reference in a new issue