Skip to content

Commit eeafa9e

Browse files
authored
Merge pull request #101 from SafeExamBrowser/SEBSERV-902-GUI-Client-SearchBar
Sebserv 902 g UI client search bar
2 parents a13295b + eb629be commit eeafa9e

18 files changed

Lines changed: 328 additions & 273 deletions

File tree

client/src/components/blocks/entity-table/composables/useUrlTableState.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,6 @@ export function useUrlTableState(
156156
});
157157
};
158158

159-
const resetFilters = async () => {
160-
await updateQuery((query) => {
161-
if (dateKey) query[dateKey] = undefined;
162-
for (const key of filterKeys) {
163-
query[key] = undefined;
164-
}
165-
});
166-
};
167-
168159
const clearAll = async () => {
169160
searchInputValue.value = null;
170161

@@ -196,7 +187,6 @@ export function useUrlTableState(
196187
onSearch,
197188
onClearSearch,
198189
setFilters,
199-
resetFilters,
200190
clearAll,
201191
setDate,
202192
};

client/src/components/blocks/filters/FilterSection.vue

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<template>
2-
<div>
3-
<template v-if="options.length > 0">
4-
<div class="text-caption text-medium-emphasis mb-1">
2+
<div v-if="options.length > 0">
3+
<div class="d-flex align-center ga-2 mb-2">
4+
<span
5+
class="text-caption text-medium-emphasis text-uppercase font-weight-medium"
6+
>
57
{{ title }}
6-
</div>
7-
<div class="d-flex flex-wrap ga-1">
8-
<FilterChip
9-
v-for="option in options"
10-
:key="option.value"
11-
:label="option.label"
12-
:active="modelValue === option.value"
13-
:color="option.color"
14-
@toggle="toggle(option.value)"
15-
/>
16-
</div>
17-
</template>
8+
</span>
9+
</div>
10+
<div class="d-flex flex-wrap ga-2">
11+
<FilterChip
12+
v-for="option in options"
13+
:key="option.value"
14+
:label="option.label"
15+
:active="modelValue === option.value"
16+
:color="option.color"
17+
@toggle="toggle(option.value)"
18+
/>
19+
</div>
1820
</div>
1921
</template>
2022

client/src/components/blocks/filters/FiltersBar.vue

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,17 @@
11
<template>
2-
<v-row class="align-start">
3-
<v-col cols="10">
4-
<v-row>
5-
<v-col v-for="section in sections" :key="section.key" cols="6">
6-
<FilterSection
7-
:title="section.title"
8-
:options="section.options"
9-
:model-value="modelValue[section.key] ?? null"
10-
@update:model-value="
11-
onSectionChange(section.key, $event)
12-
"
13-
/>
14-
</v-col>
15-
</v-row>
16-
</v-col>
17-
18-
<v-col cols="2" class="d-flex justify-end align-center">
19-
<v-btn
20-
variant="outlined"
21-
size="small"
22-
color="primary"
23-
class="text-none text-caption font-weight-medium"
24-
:style="{
25-
visibility: hasActiveFilters ? 'visible' : 'hidden',
26-
}"
27-
@click="emit('clear')"
28-
>
29-
<v-icon start size="small">mdi-close</v-icon>
30-
{{ translate("general.clearFilters") }}
31-
</v-btn>
32-
</v-col>
33-
</v-row>
2+
<div class="d-flex flex-column ga-4">
3+
<FilterSection
4+
v-for="section in sections"
5+
:key="section.key"
6+
:title="section.title"
7+
:options="section.options"
8+
:model-value="modelValue[section.key] ?? null"
9+
@update:model-value="onSectionChange(section.key, $event)"
10+
/>
11+
</div>
3412
</template>
3513

3614
<script setup lang="ts">
37-
import { computed } from "vue";
38-
import { translate } from "@/utils/generalUtils.ts";
3915
import FilterSection from "./FilterSection.vue";
4016
import type { FilterSectionDef } from "./filterTypes.ts";
4117
@@ -46,13 +22,8 @@ const props = defineProps<{
4622
4723
const emit = defineEmits<{
4824
"update:modelValue": [value: Record<string, string | null>];
49-
clear: [];
5025
}>();
5126
52-
const hasActiveFilters = computed(() =>
53-
props.sections.some((s) => !!props.modelValue[s.key]),
54-
);
55-
5627
function onSectionChange(key: string, value: string | null) {
5728
emit("update:modelValue", { ...props.modelValue, [key]: value });
5829
}

0 commit comments

Comments
 (0)