diff --git a/.rubocop_todo/rspec/context_wording.yml b/.rubocop_todo/rspec/context_wording.yml index 1120d9e8a14..8026dfc4357 100644 --- a/.rubocop_todo/rspec/context_wording.yml +++ b/.rubocop_todo/rspec/context_wording.yml @@ -2398,7 +2398,6 @@ RSpec/ContextWording: - 'spec/requests/api/usage_data_spec.rb' - 'spec/requests/api/users_preferences_spec.rb' - 'spec/requests/api/users_spec.rb' - - 'spec/requests/content_security_policy_spec.rb' - 'spec/requests/dashboard/projects_controller_spec.rb' - 'spec/requests/dashboard_controller_spec.rb' - 'spec/requests/git_http_spec.rb' diff --git a/app/assets/javascripts/group_settings/constants.js b/app/assets/javascripts/group_settings/constants.js index d4ac7d94bf4..3b595bac686 100644 --- a/app/assets/javascripts/group_settings/constants.js +++ b/app/assets/javascripts/group_settings/constants.js @@ -1,7 +1,7 @@ import { __, s__ } from '~/locale'; export const I18N_CONFIRM_MESSAGE = s__( - 'Runners|Shared runners will be disabled for all projects and subgroups in this group. If you proceed, you must manually re-enable shared runners in the settings of each project and subgroup.', + 'Runners|Shared runners will be disabled for all projects and subgroups in this group.', ); export const I18N_CONFIRM_OK = s__('Runners|Yes, disable shared runners'); export const I18N_CONFIRM_CANCEL = s__('Runners|No, keep shared runners enabled'); diff --git a/app/assets/javascripts/projects/components/shared/delete_modal.vue b/app/assets/javascripts/projects/components/shared/delete_modal.vue index 44e29d00d45..db2e283f9d2 100644 --- a/app/assets/javascripts/projects/components/shared/delete_modal.vue +++ b/app/assets/javascripts/projects/components/shared/delete_modal.vue @@ -74,7 +74,7 @@ export default { attributes: { variant: 'danger', disabled: this.confirmDisabled, - 'data-qa-selector': 'confirm_delete_button', + 'data-testid': 'confirm-delete-button', }, }, cancel: { @@ -147,7 +147,7 @@ export default { v-model="userInput" name="confirm_name_input" type="text" - data-qa-selector="confirm_name_field" + data-testid="confirm-name-field" /> diff --git a/app/assets/javascripts/projects/settings_service_desk/components/custom_email.vue b/app/assets/javascripts/projects/settings_service_desk/components/custom_email.vue index f7a9949db4b..6d5443a5df0 100644 --- a/app/assets/javascripts/projects/settings_service_desk/components/custom_email.vue +++ b/app/assets/javascripts/projects/settings_service_desk/components/custom_email.vue @@ -25,6 +25,10 @@ export default { I18N_STATE_VERIFICATION_FINISHED_TOGGLE_HELP, I18N_RESET_BUTTON_LABEL, props: { + incomingEmail: { + type: String, + required: true, + }, customEmail: { type: String, required: true, @@ -128,7 +132,13 @@ export default {

{{ errorLabel }}

-

{{ errorDescription }}

+

+ + + +

{{ resetNote }}

diff --git a/app/assets/javascripts/projects/settings_service_desk/components/custom_email_wrapper.vue b/app/assets/javascripts/projects/settings_service_desk/components/custom_email_wrapper.vue index f72aa19bdf2..2fe3ea4215a 100644 --- a/app/assets/javascripts/projects/settings_service_desk/components/custom_email_wrapper.vue +++ b/app/assets/javascripts/projects/settings_service_desk/components/custom_email_wrapper.vue @@ -216,6 +216,7 @@ export default { item.value === value).text; - this.$emit('input', { - value: this.selectedValue, - text: this.selectedText, - }); - }, - get() { - return this.selectedValue; - }, + selectedItem() { + const item = this.items.find(({ value }) => value === this.selected); + + return item || this.initialSelectedItem; }, toggleText() { - return this.selectedText ?? this.defaultToggleText; + return this.selectedItem?.text ?? this.defaultToggleText; }, resetButtonLabel() { return this.clearable ? RESET_LABEL : ''; }, - inputValue() { - return this.selectedValue ? this.selectedValue : ''; - }, isSearchQueryTooShort() { return this.searchString && this.searchString.length < MINIMUM_QUERY_LENGTH; }, @@ -115,8 +103,13 @@ export default { : this.$options.i18n.noResultsText; }, }, + watch: { + selected() { + this.$emit('input', this.selectedItem); + }, + }, created() { - this.fetchInitialSelection(); + this.getInitialSelection(); }, methods: { search: debounce(function debouncedSearch(searchString) { @@ -148,23 +141,20 @@ export default { this.searching = false; this.infiniteScrollLoading = false; }, - async fetchInitialSelection() { + async getInitialSelection() { if (!this.initialSelection) { this.pristine = false; return; } - if (!this.fetchInitialSelectionText) { + if (!this.fetchInitialSelection) { throw new Error( '`initialSelection` is provided but lacks `fetchInitialSelectionText` to retrieve the corresponding text', ); } this.searching = true; - const name = await this.fetchInitialSelectionText(this.initialSelection); - - this.selectedValue = this.initialSelection; - this.selectedText = name; + this.initialSelectedItem = await this.fetchInitialSelection(this.initialSelection); this.pristine = false; this.searching = false; }, @@ -218,6 +208,6 @@ export default { - + diff --git a/app/assets/javascripts/vue_shared/components/entity_select/group_select.vue b/app/assets/javascripts/vue_shared/components/entity_select/group_select.vue index 8a338551fbe..da42c017541 100644 --- a/app/assets/javascripts/vue_shared/components/entity_select/group_select.vue +++ b/app/assets/javascripts/vue_shared/components/entity_select/group_select.vue @@ -76,11 +76,7 @@ export default { try { const url = groupsPath(this.groupsFilter, this.parentGroupID); const { data = [], headers } = await axios.get(url, { params }); - groups = data.map((group) => ({ - ...group, - text: group.full_name, - value: String(group.id), - })); + groups = data.map((group) => this.mapGroupData(group)); totalPages = parseIntPagination(normalizeHeaders(headers)).totalPages; } catch (error) { @@ -88,15 +84,19 @@ export default { } return { items: groups, totalPages }; }, - async fetchGroupName(groupId) { - let groupName = ''; + async fetchInitialGroup(groupId) { try { const group = await Api.group(groupId); - groupName = group.full_name; + + return this.mapGroupData(group); } catch (error) { this.handleError({ message: FETCH_GROUP_ERROR, error }); + + return {}; } - return groupName; + }, + mapGroupData(group) { + return { ...group, text: group.full_name, value: String(group.id) }; }, handleError({ message, error }) { Sentry.captureException(error); @@ -123,7 +123,7 @@ export default { :header-text="$options.i18n.selectGroup" :default-toggle-text="$options.i18n.toggleText" :fetch-items="fetchGroups" - :fetch-initial-selection-text="fetchGroupName" + :fetch-initial-selection="fetchInitialGroup" v-on="$listeners" >