Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-09 03:09:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-09 03:09:20 +0300
commit5cd8380e46d88d2afc314b11d8e3b3dee0335948 (patch)
tree61ef7a60b73cf3a985c2bcf2e2c4f694a30e8dc6 /app/assets/javascripts/groups_projects
parent9f9d994f13388fb3ce117ed01c2cd0c05c98d055 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/groups_projects')
-rw-r--r--app/assets/javascripts/groups_projects/components/transfer_locations.vue57
1 files changed, 53 insertions, 4 deletions
diff --git a/app/assets/javascripts/groups_projects/components/transfer_locations.vue b/app/assets/javascripts/groups_projects/components/transfer_locations.vue
index 11d7fa8d65b..e0c8ce36e3c 100644
--- a/app/assets/javascripts/groups_projects/components/transfer_locations.vue
+++ b/app/assets/javascripts/groups_projects/components/transfer_locations.vue
@@ -5,6 +5,7 @@ import {
GlDropdown,
GlDropdownItem,
GlDropdownSectionHeader,
+ GlDropdownDivider,
GlSearchBoxByType,
GlIntersectionObserver,
GlLoadingIcon,
@@ -34,6 +35,7 @@ export default {
GlDropdown,
GlDropdownItem,
GlDropdownSectionHeader,
+ GlDropdownDivider,
GlSearchBoxByType,
GlIntersectionObserver,
GlLoadingIcon,
@@ -49,6 +51,23 @@ export default {
type: Function,
required: true,
},
+ showUserTransferLocations: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
+ additionalDropdownItems: {
+ type: Array,
+ required: false,
+ default() {
+ return [];
+ },
+ },
+ label: {
+ type: String,
+ required: false,
+ default: i18n.SELECT_A_NAMESPACE,
+ },
},
initialTransferLocationsLoaded: false,
data() {
@@ -56,6 +75,7 @@ export default {
searchTerm: '',
userTransferLocations: [],
groupTransferLocations: [],
+ filteredAdditionalDropdownItems: this.additionalDropdownItems,
isLoading: false,
isSearchLoading: false,
hasError: false,
@@ -71,11 +91,14 @@ export default {
return this.groupTransferLocations.length;
},
selectedText() {
- return this.value?.humanName || i18n.SELECT_A_NAMESPACE;
+ return this.value?.humanName || this.label;
},
hasNextPageOfGroups() {
return this.page < this.totalPages;
},
+ showAdditionalDropdownItems() {
+ return !this.isLoading && this.filteredAdditionalDropdownItems.length;
+ },
},
watch: {
searchTerm() {
@@ -128,6 +151,10 @@ export default {
}
},
async getUserTransferLocations() {
+ if (!this.showUserTransferLocations) {
+ return [];
+ }
+
try {
const {
data: {
@@ -167,6 +194,10 @@ export default {
this.groupTransferLocations = await this.getGroupTransferLocations();
+ this.filteredAdditionalDropdownItems = this.additionalDropdownItems.filter((dropdownItem) =>
+ dropdownItem.humanName.toLowerCase().includes(this.searchTerm.toLowerCase()),
+ );
+
this.isSearchLoading = false;
}, DEBOUNCE_DELAY),
handleError() {
@@ -188,8 +219,15 @@ export default {
@dismiss="handleAlertDismiss"
>{{ $options.i18n.ERROR_MESSAGE }}</gl-alert
>
- <gl-form-group :label="$options.i18n.SELECT_A_NAMESPACE">
- <gl-dropdown :text="selectedText" data-qa-selector="namespaces_list" block @show="handleShow">
+ <gl-form-group :label="label">
+ <gl-dropdown
+ :text="selectedText"
+ data-qa-selector="namespaces_list"
+ data-testid="transfer-locations-dropdown"
+ block
+ toggle-class="gl-mb-0"
+ @show="handleShow"
+ >
<template #header>
<gl-search-box-by-type
v-model.trim="searchTerm"
@@ -197,6 +235,15 @@ export default {
data-qa-selector="namespaces_list_search"
/>
</template>
+ <template v-if="showAdditionalDropdownItems">
+ <gl-dropdown-item
+ v-for="item in filteredAdditionalDropdownItems"
+ :key="item.id"
+ @click="handleSelect(item)"
+ >{{ item.humanName }}</gl-dropdown-item
+ >
+ <gl-dropdown-divider />
+ </template>
<div
v-if="hasUserTransferLocations"
data-qa-selector="namespaces_list_users"
@@ -216,7 +263,9 @@ export default {
data-qa-selector="namespaces_list_groups"
data-testid="group-transfer-locations"
>
- <gl-dropdown-section-header>{{ $options.i18n.GROUPS }}</gl-dropdown-section-header>
+ <gl-dropdown-section-header v-if="showUserTransferLocations">{{
+ $options.i18n.GROUPS
+ }}</gl-dropdown-section-header>
<gl-dropdown-item
v-for="item in groupTransferLocations"
:key="item.id"