diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-26 15:12:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-26 15:12:11 +0300 |
commit | 0594381ba711725d7d676db202902dfcbe9ec4a0 (patch) | |
tree | 9922e6dcee0fae9c04539f3763a8b5314c1060c4 /app/assets/javascripts/integrations | |
parent | e48c28ed86567f049865a590fdda4569a760ee1f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/integrations')
-rw-r--r-- | app/assets/javascripts/integrations/constants.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/integrations/integration_settings_form.js | 16 |
2 files changed, 14 insertions, 10 deletions
diff --git a/app/assets/javascripts/integrations/constants.js b/app/assets/javascripts/integrations/constants.js index 8a8d38b295c..d214ee4ded6 100644 --- a/app/assets/javascripts/integrations/constants.js +++ b/app/assets/javascripts/integrations/constants.js @@ -1,4 +1,4 @@ -import { s__ } from '~/locale'; +import { s__, __ } from '~/locale'; export const TEST_INTEGRATION_EVENT = 'testIntegration'; export const SAVE_INTEGRATION_EVENT = 'saveIntegration'; @@ -21,3 +21,9 @@ export const overrideDropdownDescriptions = { 'Integrations|Default settings are inherited from the instance level.', ), }; + +export const I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE = s__( + 'Integrations|Connection failed. Please check your settings.', +); +export const I18N_DEFAULT_ERROR_MESSAGE = __('Something went wrong on our end.'); +export const I18N_SUCCESSFUL_CONNECTION_MESSAGE = s__('Integrations|Connection successful.'); diff --git a/app/assets/javascripts/integrations/integration_settings_form.js b/app/assets/javascripts/integrations/integration_settings_form.js index f33364d5545..f519fc87c46 100644 --- a/app/assets/javascripts/integrations/integration_settings_form.js +++ b/app/assets/javascripts/integrations/integration_settings_form.js @@ -1,5 +1,4 @@ import { delay } from 'lodash'; -import { __, s__ } from '~/locale'; import toast from '~/vue_shared/plugins/global_toast'; import axios from '../lib/utils/axios_utils'; import initForm from './edit'; @@ -10,6 +9,9 @@ import { GET_JIRA_ISSUE_TYPES_EVENT, TOGGLE_INTEGRATION_EVENT, VALIDATE_INTEGRATION_FORM_EVENT, + I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE, + I18N_DEFAULT_ERROR_MESSAGE, + I18N_SUCCESSFUL_CONNECTION_MESSAGE, } from './constants'; export default class IntegrationSettingsForm { @@ -104,11 +106,7 @@ export default class IntegrationSettingsForm { return this.fetchTestSettings(formData) .then( ({ - data: { - issuetypes, - error, - message = s__('Integrations|Connection failed. Please check your settings.'), - }, + data: { issuetypes, error, message = I18N_FETCH_TEST_SETTINGS_DEFAULT_ERROR_MESSAGE }, }) => { if (error || !issuetypes?.length) { eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT); @@ -118,7 +116,7 @@ export default class IntegrationSettingsForm { dispatch('receiveJiraIssueTypesSuccess', issuetypes); }, ) - .catch(({ message = __('Something went wrong on our end.') }) => { + .catch(({ message = I18N_DEFAULT_ERROR_MESSAGE }) => { dispatch('receiveJiraIssueTypesError', message); }); } @@ -140,11 +138,11 @@ export default class IntegrationSettingsForm { toast(`${data.message} ${data.service_response}`); } else { this.vue.$store.dispatch('receiveJiraIssueTypesSuccess', data.issuetypes); - toast(s__('Integrations|Connection successful.')); + toast(I18N_SUCCESSFUL_CONNECTION_MESSAGE); } }) .catch(() => { - toast(__('Something went wrong on our end.')); + toast(I18N_DEFAULT_ERROR_MESSAGE); }) .finally(() => { this.vue.$store.dispatch('setIsTesting', false); |