From 42b4cc0b85069055a7aef4c3291111ea780d5519 Mon Sep 17 00:00:00 2001 From: lakshay122007 Date: Mon, 22 Jun 2026 17:17:15 +0530 Subject: [PATCH] lement fully functional advanced filter drawer --- frontend/src/app/pages/findings.tsx | 93 +++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/pages/findings.tsx b/frontend/src/app/pages/findings.tsx index 284ab9d..b374372 100644 --- a/frontend/src/app/pages/findings.tsx +++ b/frontend/src/app/pages/findings.tsx @@ -240,12 +240,19 @@ export function Findings() { } }; + const [isFilterSheetOpen, setIsFilterSheetOpen] = useState(false); + const [selectedStatuses, setSelectedStatuses] = useState>(new Set()); + const [selectedTools, setSelectedTools] = useState>(new Set()); + + const availableTools = useMemo(() => Array.from(new Set(findings.map(f => f.tool).filter(Boolean))), [findings]); + const availableStatuses = ["open", "accepted", "ignored"]; + const activeSeverities = useMemo( () => new Set(filters.filter((f) => f.active).map((f) => f.id)), [filters], ); - const filteredFindings = useMemo(() => { + const filteredFindings = useMemo(() => { const q = searchQuery.trim().toLowerCase(); const filtered = findings.filter((f) => { @@ -257,8 +264,14 @@ export function Findings() { const matchesSeverity = activeSeverities.size === 0 || activeSeverities.has(f.severity); - - return matchesQuery && matchesSeverity; + + const matchesStatus = + selectedStatuses.size === 0 || selectedStatuses.has(f.status); + + const matchesTool = + selectedTools.size === 0 || selectedTools.has(f.tool); + + return matchesQuery && matchesSeverity && matchesStatus && matchesTool; }); const severityOrder: Record = { @@ -296,7 +309,7 @@ export function Findings() { } return filtered; - }, [findings, searchQuery, activeSeverities, sortBy]); + }, [findings, searchQuery, activeSeverities, sortBy, selectedStatuses, selectedTools]); if (isLoadingFindings) { return ( @@ -377,7 +390,7 @@ export function Findings() { ML Score - @@ -707,6 +720,76 @@ export function Findings() { )} + + + + + + + Advanced Filters + Filter findings by status and tool + + +
+
+

Status

+
+ {availableStatuses.map(status => ( +
+ { + const next = new Set(selectedStatuses); + if (checked) next.add(status); + else next.delete(status); + setSelectedStatuses(next); + }} + /> + +
+ ))} +
+
+ +
+

Tool

+
+ {availableTools.map(tool => ( +
+ { + const next = new Set(selectedTools); + if (checked) next.add(tool); + else next.delete(tool); + setSelectedTools(next); + }} + /> + +
+ ))} +
+
+ +
+ +
+