Skip to content

Commit 6e8d856

Browse files
Merge pull request #1233 from Giskard-AI/feature/gsk-1376-add-search-bar-for-all-tabs-with-lists
[GSK-1376] Add search bar for all tabs with lists
2 parents 41f71ec + 1920b8e commit 6e8d856

2 files changed

Lines changed: 51 additions & 20 deletions

File tree

frontend/src/views/main/project/Datasets.vue

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
<template>
22
<div class="vertical-container">
3-
<div class="d-flex mb-6">
4-
<v-spacer></v-spacer>
5-
<div class="mr-2">
6-
<v-btn v-if="projectArtifactsStore.datasets.length > 0" class="ml-2" href="https://docs.giskard.ai/en/latest/guides/wrap_dataset/index.html" target="_blank" rel="noopener">
7-
add a dataset
8-
<v-icon right>mdi-open-in-new</v-icon>
9-
</v-btn>
10-
</div>
11-
</div>
3+
<v-row class="mt-2 pl-3">
4+
<v-col cols='4'>
5+
<v-text-field v-model='searchDataset' append-icon='search' label='Search for a dataset' outlined></v-text-field>
6+
</v-col>
7+
<v-col cols="8">
8+
<div class="d-flex justify-end mb-6">
9+
<v-btn v-if="projectArtifactsStore.datasets.length > 0" class="mr-2" href="https://docs.giskard.ai/en/latest/guides/wrap_dataset/index.html" target="_blank" rel="noopener">
10+
add a dataset
11+
<v-icon right>mdi-open-in-new</v-icon>
12+
</v-btn>
13+
</div>
14+
</v-col>
15+
</v-row>
16+
1217
<LoadingFullscreen v-if="isLoading" name="datasets" />
1318
<v-container v-if="projectArtifactsStore.datasets.length > 0 && !isLoading" fluid class="vc">
1419
<v-expansion-panels flat>
@@ -20,7 +25,7 @@
2025
<v-col cols="1" class="col-container">Id</v-col>
2126
<v-col cols="2" class="col-container">Actions</v-col>
2227
</v-row>
23-
<v-expansion-panel v-for="f in projectArtifactsStore.datasets" :key="f.id">
28+
<v-expansion-panel v-for="f in filteredDatasets" :key="f.id">
2429
<v-expansion-panel-header @click="peakDataFile(f.id)" class="grey lighten-5 py-1 pl-2">
2530
<v-row class="px-2 py-1 align-center">
2631
<v-col cols="4" class="font-weight-bold" :title="f.name ? f.name : f.id">
@@ -114,6 +119,17 @@ const isLoading = ref<boolean>(false);
114119
const lastVisitedFileId = ref<string | null>(null);
115120
const filePreviewHeader = ref<{ text: string, value: string, sortable: boolean }[]>([]);
116121
const filePreviewData = ref<any[]>([]);
122+
const searchDataset = ref<string>('');
123+
124+
const filteredDatasets = computed(() => {
125+
return projectArtifactsStore.datasets.filter((dataset) => {
126+
const search = searchDataset.value.toLowerCase();
127+
return (
128+
dataset.name.toLowerCase().includes(search) ||
129+
dataset.id.toString().includes(search)
130+
);
131+
});
132+
});
117133
118134
const project = computed(() => {
119135
return projectStore.project(props.projectId)

frontend/src/views/main/project/Models.vue

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<template>
22
<div class="vertical-container">
3-
<div class="d-flex mb-6">
4-
<v-spacer></v-spacer>
5-
<div class="mr-2">
6-
<v-btn v-if="projectArtifactsStore.models.length > 0" class="ml-2" href="https://docs.giskard.ai/en/latest/guides/wrap_model/index.html" target="_blank" rel="noopener">
7-
add a model
8-
<v-icon right>mdi-open-in-new</v-icon>
9-
</v-btn>
10-
</div>
11-
</div>
3+
<v-row class="mt-2 pl-3">
4+
<v-col cols='4'>
5+
<v-text-field v-model='searchModel' append-icon='search' label='Search for a model' outlined></v-text-field>
6+
</v-col>
7+
<v-col cols="8">
8+
<div class="d-flex justify-end mb-6">
9+
<v-btn v-if="projectArtifactsStore.models.length > 0" class="mr-2" href="https://docs.giskard.ai/en/latest/guides/wrap_model/index.html" target="_blank" rel="noopener">
10+
add a model
11+
<v-icon right>mdi-open-in-new</v-icon>
12+
</v-btn>
13+
</div>
14+
</v-col>
15+
</v-row>
1216
<LoadingFullscreen v-if="isLoading" name="models" />
1317
<v-container v-if="projectArtifactsStore.models.length > 0 && !isLoading" fluid class="vc">
1418
<v-card flat>
@@ -21,7 +25,7 @@
2125
<v-col cols="3" class="col-container">Actions</v-col>
2226
</v-row>
2327
</v-card>
24-
<v-card class="grey lighten-5" v-for="m in projectArtifactsStore.models " :key="m.id" outlined tiled>
28+
<v-card class="grey lighten-5" v-for="m in filteredModels" :key="m.id" outlined tiled>
2529
<v-row class="px-2 py-1 align-center">
2630
<v-col cols="3" class="font-weight-bold" :title="m.name">
2731
<InlineEditText :text="m.name" :can-edit="isProjectOwnerOrAdmin" @save="(name) => renameModel(m.id, name)">
@@ -140,6 +144,17 @@ const props = defineProps<Props>();
140144
const isLoading = ref<boolean>(false);
141145
const showInspectDialog = ref<boolean>(false);
142146
const modelToInspect = ref<ModelDTO | null>(null);
147+
const searchModel = ref<string>('');
148+
149+
const filteredModels = computed(() => {
150+
return projectArtifactsStore.models.filter((model) => {
151+
const search = searchModel.value.toLowerCase();
152+
return (
153+
model.name.toLowerCase().includes(search) ||
154+
model.id.toString().includes(search)
155+
);
156+
});
157+
});
143158
144159
const isMLWorkerConnected = computed(() => {
145160
return state.workerStatus.connected;

0 commit comments

Comments
 (0)