Skip to content

Commit 3c52c3c

Browse files
committed
Added search capability
1 parent cd0b532 commit 3c52c3c

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

databud/src/components/SchemaView.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
:isLoading="isSchemaListLoading"
66
@refresh="fetchSchemas"
77
>
8+
<template v-slot:header-end>
9+
<b-input
10+
placeholder="Search ..."
11+
v-model="searchText"
12+
/>
13+
</template>
814
<b-list-group-item
915
v-for="item of schemaDRIs"
1016
:key="item.dri"
@@ -118,6 +124,7 @@ interface IData {
118124
isSaving: boolean,
119125
isExecutingAction: boolean,
120126
saveMessage?: string,
127+
searchText: string,
121128
122129
// charting
123130
selectedTabIndex: number,
@@ -138,6 +145,7 @@ export default Vue.extend({
138145
isSaving: false,
139146
isExecutingAction: false,
140147
saveMessage: undefined,
148+
searchText: '',
141149
142150
// charting
143151
selectedTabIndex: 0,
@@ -185,6 +193,7 @@ export default Vue.extend({
185193
},
186194
async fetchSchemas() {
187195
this.selectedSchema = undefined;
196+
this.searchText = '';
188197
await this.$store.dispatch(ActionType.FETCH_SCHEMA_DRIS);
189198
},
190199
async fetchVaultItems(refreshObj?: RefreshObj) {
@@ -291,7 +300,12 @@ export default Vue.extend({
291300
},
292301
computed: {
293302
schemaDRIs(): (VaultSchema & { dri?: string })[] {
294-
return [{ dri: undefined, title: 'Default' }, ...this.$store.state.schemaDRI.all];
303+
let items = [{ dri: undefined, title: 'Default' }, ...this.$store.state.schemaDRI.all];
304+
const search = this.searchText.trim();
305+
if (search)
306+
items = items.filter(x => x.title.indexOf(search) !== -1);
307+
308+
return items;
295309
},
296310
isSchemaListLoading(): boolean {
297311
return (this.$store.state as IStore).schemaDRI.state === FetchState.FETCHING;

0 commit comments

Comments
 (0)