Skip to content

Commit

Permalink
Merge pull request #4036 from marcellamaki/immediate-save-all-no-reso…
Browse files Browse the repository at this point in the history
…urce

Ensure the saving and validation runs on bulk edit, even if user has not selected all nodes
  • Loading branch information
bjester authored Apr 25, 2023
2 parents 0dfd8c6 + fcb1656 commit 6dfeae9
Showing 1 changed file with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
:clipped-right="$isRTL"
app
>
<VBtn data-test="close" icon dark @click="handleClose">
<VBtn data-test="close" icon dark @click="handleClose()">
<Icon>clear</Icon>
</VBtn>
<VToolbarTitle>{{ modalTitle }}</VToolbarTitle>
Expand Down Expand Up @@ -116,7 +116,7 @@
</div>
</VFlex>
<VFlex shrink>
<VBtn color="primary" @click="handleClose">
<VBtn color="primary" @click="handleClose()">
{{ $tr('finishButton') }}
</VBtn>
</VFlex>
Expand Down Expand Up @@ -421,27 +421,35 @@
/* Button actions */
handleClose() {
// X button action
this.enableValidation(this.nodeIds);
let assessmentItems = this.getAssessmentItems(this.nodeIds);
assessmentItems.forEach(item => (item.question ? (item[DELAYED_VALIDATION] = false) : ''));
this.updateAssessmentItems(assessmentItems);
// reaches into Details Tab to run save of diffTracker
// before the validation pop up is executed
if (this.$refs.editView) {
this.$refs.editView.immediateSaveAll().then(() => {
// Catch uploads in progress and invalid nodes
if (this.invalidNodes.length) {
this.selected = [this.invalidNodes[0]];
this.promptInvalid = true;
} else if (this.contentNodesAreUploading(this.nodeIds)) {
this.promptUploading = true;
} else {
this.closeModal();
}
});
} else {
this.closeModal();
}
this.selected = this.nodeIds;
this.$nextTick(() => {
this.enableValidation(this.nodeIds);
let assessmentItems = this.getAssessmentItems(this.nodeIds);
assessmentItems.forEach(item =>
item.question ? (item[DELAYED_VALIDATION] = false) : ''
);
this.updateAssessmentItems(assessmentItems);
// reaches into Details Tab to run save of diffTracker
// before the validation pop up is executed
if (this.$refs.editView) {
this.$nextTick(() => {
this.$refs.editView.immediateSaveAll().then(() => {
// Catch uploads in progress and invalid nodes
if (this.invalidNodes.length) {
this.selected = [this.invalidNodes[0]];
this.promptInvalid = true;
} else if (this.contentNodesAreUploading(this.nodeIds)) {
this.promptUploading = true;
} else {
this.closeModal();
}
});
});
} else {
this.closeModal();
}
});
},
/* Creation actions */
Expand Down

0 comments on commit 6dfeae9

Please sign in to comment.