Skip to content

Commit

Permalink
pkp/pkp-lib#5160 Fix dropped data during publishing process in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Oct 23, 2019
1 parent 8d993f8 commit e0da221
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/components/Container/WorkflowContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default {
self.isLoadingVersion = false;
} else {
setTimeout(() => {
self.isLoadingVersion = true;
self.isLoadingVersion = false;
}, timeDiff);
}
});
Expand Down Expand Up @@ -319,7 +319,7 @@ export default {
success(submission) {
// Store some publication data and discard the rest
submission.publications.forEach(publication =>
self.updatePublication(publication)
self.updatePublicationInList(publication)
);
delete submission.publications;
self.submission = {};
Expand Down Expand Up @@ -407,7 +407,7 @@ export default {
success(r) {
self.workingPublication = {};
self.workingPublication = r;
self.updatePublication(r);
self.updatePublicationInList(r);
self.$nextTick(() => {
self.setFocusIn(self.$refs.publication);
self.isLoadingVersion = false;
Expand Down Expand Up @@ -440,7 +440,7 @@ export default {
success(r) {
self.workingPublication = {};
self.workingPublication = r;
self.updatePublication(r);
self.updatePublicationInList(r);
self.isLoadingVersion = false;
self.setFocusIn(self.$refs.publication);
self.refreshSubmission();
Expand All @@ -449,24 +449,18 @@ export default {
},
/**
* Update a publication's details
* Update a publication's details in the publication list
*
* @param {Object} newPublication
*/
updatePublication(newPublication) {
updatePublicationInList(newPublication) {
this.publicationList.forEach(publication => {
if (publication.id === newPublication.id) {
(publication.id = newPublication.id),
(publication.datePublished = newPublication.datePublished);
publication.status = newPublication.status;
}
});
if (this.workingPublication.id === newPublication.id) {
this.workingPublication = {};
this.workingPublication = newPublication;
}
if (this.currentPublication.id === newPublication.id) {
this.currentPublication = {};
this.currentPublication = newPublication;
}
}
},
watch: {
Expand All @@ -486,12 +480,16 @@ export default {
*/
pkp.eventBus.$on('form-success', (formId, newPublication) => {
if (this.publicationFormIds.includes(formId)) {
this.updatePublication(newPublication);
this.workingPublication = {};
this.workingPublication = newPublication;
}
// Update the submission's status when the publish form is completed
if (formId === pkp.const.FORM_PUBLISH) {
this.setPublicationForms(newPublication);
this.currentPublication = {};
this.currentPublication = newPublication;
this.submission.currentPublicationId = newPublication.id;
this.refreshSubmission();
}
});
Expand All @@ -506,7 +504,9 @@ export default {
this.submissionApiUrl + '/publications/' + this.workingPublication.id,
type: 'GET',
success(publication) {
self.updatePublication(publication);
self.workingPublication = {};
self.workingPublication = publication;
self.updatePublicationInList(publication);
}
});
});
Expand Down

0 comments on commit e0da221

Please sign in to comment.