diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /app/assets/javascripts/integrations | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'app/assets/javascripts/integrations')
4 files changed, 50 insertions, 37 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/edit/components/dynamic_field.vue b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue index f30298676df..258cd1bf365 100644 --- a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue +++ b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue @@ -62,6 +62,14 @@ export default { required: false, default: null, }, + /** + * The label that is displayed inline with the checkbox. + */ + checkboxLabel: { + type: String, + required: false, + default: null, + }, }, data() { return { @@ -152,7 +160,7 @@ export default { <template v-if="isCheckbox"> <input :name="fieldName" type="hidden" :value="model || false" /> <gl-form-checkbox :id="fieldId" v-model="model" :disabled="isInheriting"> - {{ humanizedTitle }} + {{ checkboxLabel || humanizedTitle }} </gl-form-checkbox> </template> <template v-else-if="isSelect"> diff --git a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue index 0521e1eeea5..7cbfb35aeaa 100644 --- a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue +++ b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue @@ -5,6 +5,7 @@ import { VALIDATE_INTEGRATION_FORM_EVENT, GET_JIRA_ISSUE_TYPES_EVENT, } from '~/integrations/constants'; +import { s__, __ } from '~/locale'; import eventHub from '../event_hub'; import JiraUpgradeCta from './jira_upgrade_cta.vue'; @@ -94,33 +95,38 @@ export default { eventHub.$emit(GET_JIRA_ISSUE_TYPES_EVENT); }, }, + i18n: { + sectionTitle: s__('JiraService|View Jira issues in GitLab'), + sectionDescription: s__( + 'JiraService|Work on Jira issues without leaving GitLab. Adds a Jira menu to access your list of Jira issues and view any issue as read-only.', + ), + enableCheckboxLabel: s__('JiraService|Enable Jira issues'), + enableCheckboxHelp: s__( + 'JiraService|Warning: All GitLab users that have access to this GitLab project are able to view all issues from the Jira project specified below.', + ), + projectKeyLabel: s__('JiraService|Jira project key'), + projectKeyPlaceholder: s__('JiraService|For example, AB'), + requiredFieldFeedback: __('This field is required.'), + issueTrackerConflictWarning: s__( + 'JiraService|Displaying Jira issues while leaving the GitLab issue functionality enabled might be confusing. Consider %{linkStart}disabling GitLab issues%{linkEnd} if they won’t otherwise be used.', + ), + }, }; </script> <template> <div> - <gl-form-group - :label="s__('JiraService|View Jira issues in GitLab')" - label-for="jira-issue-settings" - > + <gl-form-group :label="$options.i18n.sectionTitle" label-for="jira-issue-settings"> <div id="jira-issue-settings"> <p> - {{ - s__( - 'JiraService|Work on Jira issues without leaving GitLab. Adds a Jira menu to access your list of Jira issues and view any issue as read-only.', - ) - }} + {{ $options.i18n.sectionDescription }} </p> <template v-if="showJiraIssuesIntegration"> <input name="service[issues_enabled]" type="hidden" :value="enableJiraIssues || false" /> <gl-form-checkbox v-model="enableJiraIssues" :disabled="isInheriting"> - {{ s__('JiraService|Enable Jira issues') }} + {{ $options.i18n.enableCheckboxLabel }} <template #help> - {{ - s__( - 'JiraService|Warning: All GitLab users that have access to this GitLab project are able to view all issues from the Jira project specified below.', - ) - }} + {{ $options.i18n.enableCheckboxHelp }} </template> </gl-form-checkbox> <template v-if="enableJiraIssues"> @@ -152,30 +158,25 @@ export default { </gl-form-group> <template v-if="showJiraIssuesIntegration"> <gl-form-group - :label="s__('JiraService|Jira project key')" + :label="$options.i18n.projectKeyLabel" label-for="service_project_key" - :invalid-feedback="__('This field is required.')" + :invalid-feedback="$options.i18n.requiredFieldFeedback" :state="validProjectKey" + data-testid="project-key-form-group" > <gl-form-input id="service_project_key" v-model="projectKey" name="service[project_key]" - :placeholder="s__('JiraService|For example, AB')" + :placeholder="$options.i18n.projectKeyPlaceholder" :required="enableJiraIssues" :state="validProjectKey" :disabled="!enableJiraIssues" :readonly="isInheriting" /> </gl-form-group> - <p v-if="gitlabIssuesEnabled"> - <gl-sprintf - :message=" - s__( - 'JiraService|Displaying Jira issues while leaving the GitLab issue functionality enabled might be confusing. Consider %{linkStart}disabling GitLab issues%{linkEnd} if they won’t otherwise be used.', - ) - " - > + <p v-if="gitlabIssuesEnabled" data-testid="conflict-warning-text"> + <gl-sprintf :message="$options.i18n.issueTrackerConflictWarning"> <template #link="{ content }"> <gl-link :href="editProjectPath" target="_blank">{{ content }}</gl-link> </template> 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); |