blob: 44d6d17232fe2aa317061fafa242e6dbce998e6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<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) =>
ns.toLowerCase().includes(this.searchTerm.toLowerCase()),
);
},
},
};
</script>
<template>
<gl-dropdown
toggle-class="gl-rounded-top-right-none! gl-rounded-bottom-right-none!"
class="import-entities-namespace-dropdown gl-h-7 gl-flex-fill-1"
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>
|