2021-09-30 23:02:18 +05:30
|
|
|
<script>
|
|
|
|
import { GlDropdown, GlSearchBoxByType } from '@gitlab/ui';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlDropdown,
|
|
|
|
GlSearchBoxByType,
|
|
|
|
},
|
|
|
|
inheritAttrs: false,
|
|
|
|
props: {
|
|
|
|
namespaces: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return { searchTerm: '' };
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
filteredNamespaces() {
|
|
|
|
return this.namespaces.filter((ns) =>
|
2021-12-11 22:18:48 +05:30
|
|
|
ns.fullPath.toLowerCase().includes(this.searchTerm.toLowerCase()),
|
2021-09-30 23:02:18 +05:30
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<gl-dropdown
|
|
|
|
toggle-class="gl-rounded-top-right-none! gl-rounded-bottom-right-none!"
|
2021-10-27 15:23:28 +05:30
|
|
|
class="gl-h-7 gl-flex-fill-1"
|
2021-09-30 23:02:18 +05:30
|
|
|
data-qa-selector="target_namespace_selector_dropdown"
|
|
|
|
v-bind="$attrs"
|
|
|
|
>
|
|
|
|
<template #header>
|
|
|
|
<gl-search-box-by-type v-model.trim="searchTerm" />
|
|
|
|
</template>
|
|
|
|
<slot :namespaces="filteredNamespaces"></slot>
|
|
|
|
</gl-dropdown>
|
|
|
|
</template>
|