Skip to content

Commit

Permalink
Merge pull request #12389 from nucleogenesis/fix--noisy-snackbars
Browse files Browse the repository at this point in the history
EQM: Only show save success message when saving
  • Loading branch information
rtibbles authored Jul 3, 2024
2 parents ab7e7e4 + 05d3b54 commit f3ce7c0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@
return '--';
},
},
mounted() {
if (this.$route.query.snackbar) {
this.$store.dispatch('createSnackbar', this.$route.query.snackbar);
}
},
methods: {
handleOpenQuiz(quizId) {
const promise = ExamResource.saveModel({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@
numberOfReplacementsAvailable$,
sectionDeletedNotification$,
deleteConfirmation$,
changesSavedSuccessfully$,
questionsDeletedNotification$,
expandAll$,
collapseAll$,
Expand Down Expand Up @@ -449,7 +448,6 @@
numberOfReplacementsAvailable$,
sectionDeletedNotification$,
deleteConfirmation$,
changesSavedSuccessfully$,
questionsDeletedNotification$,
toggleQuestionInSelection,
Expand Down Expand Up @@ -574,10 +572,7 @@
}
},
handleConfirmDelete() {
const section_title = displaySectionTitle(
this.activeSection.value,
this.activeSectionIndex.value,
);
const section_title = displaySectionTitle(this.activeSection, this.activeSectionIndex);
const newIndex = this.activeSectionIndex > 0 ? this.activeSectionIndex - 1 : 0;
this.setActiveSection(newIndex);
this.removeSection(this.activeSectionIndex);
Expand Down Expand Up @@ -657,7 +652,6 @@
questions: newArray,
};
this.updateSection(payload);
this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$());
this.dragActive = false;
},
handleAddSection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@
numberOfSelectedBookmarks$,
selectResourcesDescription$,
questionsFromResources$,
changesSavedSuccessfully$,
cannotSelectSomeTopicWarning$,
closeConfirmationMessage$,
closeConfirmationTitle$,
Expand Down Expand Up @@ -662,7 +661,6 @@
cannotSelectSomeTopicWarning$,
closeConfirmationMessage$,
closeConfirmationTitle$,
changesSavedSuccessfully$,
sectionSettings$,
numberOfQuestionsSelected$,
tooManyQuestions$,
Expand Down Expand Up @@ -809,7 +807,6 @@
...this.$route.params,
},
});
this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$());
},
// The message put onto the content's card when listed
selectionMetadata(content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@
closeConfirmationMessage$,
closeConfirmationTitle$,
deleteConfirmation$,
changesSavedSuccessfully$,
addQuestionsLabel$,
addMoreQuestionsLabel$,
sectionDeletedNotification$,
Expand Down Expand Up @@ -401,7 +400,6 @@
currentSection$,
deleteSectionLabel$,
applySettings$,
changesSavedSuccessfully$,
closeConfirmationTitle$,
closeConfirmationMessage$,
deleteConfirmation$,
Expand Down Expand Up @@ -478,7 +476,7 @@
question_sources,
});
}
this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$());
this.$emit('closePanel');
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
allSectionsEmptyWarning$,
closeConfirmationTitle$,
closeConfirmationMessage$,
changesSavedSuccessfully$,
sectionOrderLabel$,
randomizedLabel$,
fixedLabel$,
Expand All @@ -165,6 +166,7 @@
allSectionsEmpty,
allSectionsEmptyWarning$,
saveAndClose$,
changesSavedSuccessfully$,
sectionOrderLabel$,
randomizedLabel$,
fixedLabel$,
Expand Down Expand Up @@ -238,12 +240,17 @@
saveQuizAndRedirect(close = true) {
this.saveQuiz()
.then(exam => {
this.$refs.detailsModal.handleSubmitSuccess();
this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$());
if (close) {
this.$router.replace({
name: PageNames.EXAMS,
params: {
classId: this.$route.params.classId,
},
query: {
snackbar: this.changesSavedSuccessfully$(),
},
});
} else {
if (String(this.$route.params.quizId) === String(exam.id)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<UiAlert
v-if="showServerError"
type="error"
:dismissible="false"
:dismissible="true"
@dismiss="showServerError = false"
>
{{ submitErrorMessage }}
</UiAlert>
Expand Down Expand Up @@ -319,6 +320,13 @@
// Scroll to the title field in case focus() didn't do that immediately
window.scrollTo({ top: 0, behavior: 'smooth' });
},
/**
* @public
*/
handleSubmitSuccess() {
this.showTitleError = false;
this.showServerError = false;
},
},
};
Expand Down

0 comments on commit f3ce7c0

Please sign in to comment.