diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-16 15:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-16 15:09:22 +0300 |
commit | 9d67bc14cb59a27c9877474e77d155173a1dedff (patch) | |
tree | fae9da04bb838c0bf93df6ba7669c15413e99f8e /app/assets/javascripts/alerts_settings | |
parent | 9c7b3812a22465b77ee24657ad1b446b81ffbc74 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/alerts_settings')
-rw-r--r-- | app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue | 18 | ||||
-rw-r--r-- | app/assets/javascripts/alerts_settings/constants.js | 7 |
2 files changed, 15 insertions, 10 deletions
diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue index 6e7da070bbc..18c9f82f052 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue @@ -91,6 +91,7 @@ export default { feedbackMessage: null, isFeedbackDismissed: false, }, + serverError: null, testAlert: { json: null, error: null, @@ -196,6 +197,10 @@ export default { } }, methods: { + createUserErrorMessage(errors) { + // eslint-disable-next-line prefer-destructuring + this.serverError = Object.values(errors)[0][0]; + }, setOpsgenieAsDefault() { this.options = this.options.map(el => { if (el.value !== 'opsgenie') { @@ -221,6 +226,7 @@ export default { this.targetUrl = this.selectedService.targetUrl; }, dismissFeedback() { + this.serverError = null; this.feedback = { ...this.feedback, feedbackMessage: null }; this.isFeedbackDismissed = false; }, @@ -285,9 +291,10 @@ export default { // eslint-disable-next-line no-return-assign return (this.options = serviceOptions); }) - .catch(() => { + .catch(({ response: { data: { errors } = {} } = {} }) => { + this.createUserErrorMessage(errors); this.setFeedback({ - feedbackMessage: this.$options.i18n.errorMsg, + feedbackMessage: `${this.$options.i18n.errorMsg}.`, variant: 'danger', }); }) @@ -313,9 +320,10 @@ export default { this.toggleSuccess(value); this.removeOpsGenieOption(); }) - .catch(() => { + .catch(({ response: { data: { errors } = {} } = {} }) => { + this.createUserErrorMessage(errors); this.setFeedback({ - feedbackMessage: this.$options.i18n.errorApiUrlMsg, + feedbackMessage: `${this.$options.i18n.errorMsg}.`, variant: 'danger', }); }) @@ -394,6 +402,8 @@ export default { <div> <gl-alert v-if="showFeedbackMsg" :variant="feedback.variant" @dismiss="dismissFeedback"> {{ feedback.feedbackMessage }} + <br /> + <i v-if="serverError">{{ __('Error message:') }} {{ serverError }}</i> <gl-button v-if="showAlertSave" variant="danger" diff --git a/app/assets/javascripts/alerts_settings/constants.js b/app/assets/javascripts/alerts_settings/constants.js index b8735f3900e..d15e8619df4 100644 --- a/app/assets/javascripts/alerts_settings/constants.js +++ b/app/assets/javascripts/alerts_settings/constants.js @@ -7,15 +7,10 @@ export const i18n = { setupSection: s__( "AlertSettings|Review your external service's documentation to learn where to provide this information to your external service, and the %{linkStart}GitLab documentation%{linkEnd} to learn more about configuring your endpoint.", ), - errorMsg: s__( - 'AlertSettings|There was an error updating the the alert settings. Please refresh the page to try again.', - ), + errorMsg: s__('AlertSettings|There was an error updating the alert settings'), errorKeyMsg: s__( 'AlertSettings|There was an error while trying to reset the key. Please refresh the page to try again.', ), - errorApiUrlMsg: s__( - 'AlertSettings|There was an error while trying to enable the alert settings. Please ensure you are using a valid URL.', - ), restKeyInfo: s__( 'AlertSettings|Resetting the authorization key for this project will require updating the authorization key in every alert source it is enabled in.', ), |