From 99f637d6114c29c47ecf78fc63f95b8739eb7906 Mon Sep 17 00:00:00 2001 From: MasterSplinter <25282637+Splinter0@users.noreply.github.com> Date: Thu, 21 Nov 2024 01:20:15 +0100 Subject: [PATCH] Added filtering by status and fixed colors (#27) * Hacky solution to fix filtering * Update SDK and use HTTPQL api to filter reuqests * Add table filtering based on status * Add status colors back --- .../dashboard/TemplateTable/Container.vue | 31 +++++++++++++++++-- .../dashboard/TemplateTable/RuleStatus.vue | 6 ++-- packages/frontend/src/styles/style.css | 19 ++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/components/dashboard/TemplateTable/Container.vue b/packages/frontend/src/components/dashboard/TemplateTable/Container.vue index f6ec244..7a61f82 100644 --- a/packages/frontend/src/components/dashboard/TemplateTable/Container.vue +++ b/packages/frontend/src/components/dashboard/TemplateTable/Container.vue @@ -12,8 +12,8 @@ import Column from "primevue/column"; import DataTable from "primevue/datatable"; import InputText from "primevue/inputtext"; import SelectButton from "primevue/selectbutton"; -import type { RoleDTO, TemplateDTO, UserDTO } from "shared"; -import { computed } from "vue"; +import type { RoleDTO, RuleStatusDTO, TemplateDTO, UserDTO } from "shared"; +import { computed, ref } from "vue"; import RuleStatus from "./RuleStatus.vue"; const props = defineProps<{ @@ -23,6 +23,20 @@ const props = defineProps<{ settingsState: SettingsState & { type: "Success" }; }>(); +const selectedStatusFilter = ref("All"); + +const filteredTemplates = computed(() => { + if (selectedStatusFilter.value === "All") return props.state.templates; + + return props.state.templates.filter(template => + template.rules.some(rule => rule.status === selectedStatusFilter.value) + ); +}); + +const handleStatusFilterChange = (status: RuleStatusDTO | "All") => { + selectedStatusFilter.value = status; +}; + const getRoleValue = (template: TemplateDTO, role: RoleDTO) => { const rule = template.rules.find( (rule) => rule.type === "RoleRule" && rule.roleId === role.id, @@ -171,6 +185,17 @@ const onTemplateUpdate = ( @update:model-value="setAutoCaptureRequests" /> +
+ + +