diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-19 21:09:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-19 21:09:06 +0000 |
commit | 376ae6f3b376d6956fe037c9097b48a2e4867859 (patch) | |
tree | 80fa30139aa81d962efed6ebba47d81170419bb1 /app/assets/javascripts/alerts_settings | |
parent | b9d98fe10a624d9a6033c516c970954b4fc09372 (diff) | |
download | gitlab-ce-376ae6f3b376d6956fe037c9097b48a2e4867859.tar.gz |
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 | 75 | ||||
-rw-r--r-- | app/assets/javascripts/alerts_settings/constants.js | 5 |
2 files changed, 43 insertions, 37 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 6a44f87d0e7..f885afae378 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue @@ -191,9 +191,12 @@ export default { this.authKey = this.selectedService.authKey ?? ''; }, methods: { - createUserErrorMessage(errors = { error: [''] }) { - // eslint-disable-next-line prefer-destructuring - this.serverError = errors.error[0]; + createUserErrorMessage(errors = {}) { + const error = Object.entries(errors)?.[0]; + if (error) { + const [field, [msg]] = error; + this.serverError = `${field} ${msg}`; + } }, setOpsgenieAsDefault() { this.options = this.options.map(el => { @@ -267,7 +270,7 @@ export default { .catch(({ response: { data: { errors } = {} } = {} }) => { this.createUserErrorMessage(errors); this.setFeedback({ - feedbackMessage: `${this.$options.i18n.errorMsg}.`, + feedbackMessage: this.$options.i18n.errorMsg, variant: 'danger', }); }) @@ -298,7 +301,7 @@ export default { .catch(({ response: { data: { errors } = {} } = {} }) => { this.createUserErrorMessage(errors); this.setFeedback({ - feedbackMessage: `${this.$options.i18n.errorMsg}.`, + feedbackMessage: this.$options.i18n.errorMsg, variant: 'danger', }); }) @@ -368,48 +371,50 @@ export default { <template> <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" - category="primary" - class="gl-display-block gl-mt-3" - @click="toggle(active)" - > - {{ __('Save anyway') }} - </gl-button> - </gl-alert> - <integrations-list :integrations="integrations" /> <gl-form @submit.prevent="onSubmit" @reset.prevent="onReset"> - <h5 class="gl-font-lg">{{ $options.i18n.integrationsLabel }}</h5> + <h5 class="gl-font-lg gl-my-5">{{ $options.i18n.integrationsLabel }}</h5> + + <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" + category="primary" + class="gl-display-block gl-mt-3" + @click="toggle(active)" + > + {{ __('Save anyway') }} + </gl-button> + </gl-alert> + + <div data-testid="alert-settings-description"> + <p v-for="section in sections" :key="section.text"> + <gl-sprintf :message="section.text"> + <template #link="{ content }"> + <gl-link :href="section.url" target="_blank">{{ content }}</gl-link> + </template> + </gl-sprintf> + </p> + </div> - <gl-form-group label-for="integrations"> - <div data-testid="alert-settings-description" class="gl-mt-5"> - <p v-for="section in sections" :key="section.text"> - <gl-sprintf :message="section.text"> - <template #link="{ content }"> - <gl-link :href="section.url" target="_blank">{{ content }}</gl-link> - </template> - </gl-sprintf> - </p> - </div> + <gl-form-group label-for="integration-type" :label="$options.i18n.integration"> <gl-form-select + id="integration-type" v-model="selectedEndpoint" :options="options" data-testid="alert-settings-select" @change="resetFormValues" /> - <span class="gl-text-gray-200"> + <span class="gl-text-gray-500"> <gl-sprintf :message="$options.i18n.integrationsInfo"> <template #link="{ content }"> <gl-link class="gl-display-inline-block" - href="https://gitlab.com/groups/gitlab-org/-/epics/3362" + href="https://gitlab.com/groups/gitlab-org/-/epics/4390" target="_blank" >{{ content }}</gl-link > @@ -438,7 +443,7 @@ export default { :placeholder="baseUrlPlaceholder" :disabled="!active" /> - <span class="gl-text-gray-200"> + <span class="gl-text-gray-500"> {{ $options.i18n.apiBaseUrlHelpText }} </span> </gl-form-group> @@ -453,7 +458,7 @@ export default { /> </template> </gl-form-input-group> - <span class="gl-text-gray-200"> + <span class="gl-text-gray-500"> {{ prometheusInfo }} </span> </gl-form-group> diff --git a/app/assets/javascripts/alerts_settings/constants.js b/app/assets/javascripts/alerts_settings/constants.js index 5025a14fdc9..4220dbde0c7 100644 --- a/app/assets/javascripts/alerts_settings/constants.js +++ b/app/assets/javascripts/alerts_settings/constants.js @@ -7,7 +7,7 @@ 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 alert settings'), + 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.', ), @@ -17,7 +17,7 @@ export const i18n = { changesSaved: s__('AlertSettings|Your integration was successfully updated.'), prometheusInfo: s__('AlertSettings|Add URL and auth key to your Prometheus config file'), integrationsInfo: s__( - 'AlertSettings|Learn more about our %{linkStart}upcoming integrations%{linkEnd}', + 'AlertSettings|Learn more about our improvements for %{linkStart}integrations%{linkEnd}', ), resetKey: s__('AlertSettings|Reset key'), copyToClipboard: s__('AlertSettings|Copy'), @@ -37,6 +37,7 @@ export const i18n = { authKeyRest: s__( 'AlertSettings|Authorization key has been successfully reset. Please save your changes now.', ), + integration: s__('AlertSettings|Integration'), }; export const serviceOptions = [ |