From 796199827e001614c33c2cd1a2fa72a94a67c345 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 30 Oct 2024 15:27:33 +0100 Subject: [PATCH] feat(filters): show when the current view has a filter as well and both will be used This should make it clear when a filter does not bring the expected results - maybe because it contradicts with the one set in the view. Related to https://github.com/go-vikunja/vikunja/issues/296 --- .../project/partials/FilterPopup.vue | 22 +++++++++++++++++++ .../components/project/partials/Filters.vue | 10 +++++++++ .../project/views/ProjectKanban.vue | 2 ++ .../components/project/views/ProjectList.vue | 2 ++ .../components/project/views/ProjectTable.vue | 8 ++++++- frontend/src/i18n/lang/en.json | 2 ++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/project/partials/FilterPopup.vue b/frontend/src/components/project/partials/FilterPopup.vue index 23a069a36..765f12e45 100644 --- a/frontend/src/components/project/partials/FilterPopup.vue +++ b/frontend/src/components/project/partials/FilterPopup.vue @@ -20,6 +20,7 @@ :has-title="true" class="filter-popup" :change-immediately="false" + :filter-from-view="filterFromView" @showResults="showResults" /> @@ -31,14 +32,22 @@ import {computed, ref, watch} from 'vue' import Filters from '@/components/project/partials/Filters.vue' import {type TaskFilterParams} from '@/services/taskCollection' +import {type IProjectView} from '@/modelTypes/IProjectView' +import {type IProject} from '@/modelTypes/IProject' +import {useProjectStore} from '@/stores/projects' const props = defineProps<{ modelValue: TaskFilterParams, + projectId?: IProject['id'], + viewId?: IProjectView['id'], }>() + const emit = defineEmits<{ 'update:modelValue': [value: TaskFilterParams] }>() +const projectStore = useProjectStore() + const value = ref({}) watch( @@ -67,6 +76,19 @@ function showResults() { }) modalOpen.value = false } + +const filterFromView = computed(() => { + if (!props.projectId || !props.viewId) { + return + } + + const project = projectStore.projects[props.projectId] + if (!project) { + return + } + const view = project.views.find(v => v.id === props.viewId) + return view?.filter +})