blob: 25d4037bbe54fb8059ecffc5919f5f9e3e3a71ea (
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.fullPath.toLowerCase().includes(this.searchTerm.toLowerCase()),
);
},
},
};
</script>
<template>
<gl-dropdown
toggle-class="gl-rounded-top-right-none! gl-rounded-bottom-right-none!"
class="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>
|