fix: scope FP workflow counts donut by BU

- Rewrite /fp-workflow-counts endpoint to query ivanti_findings table
  directly with optional teams ILIKE filter (replaces pre-computed JSON blob)
- Frontend passes getActiveTeamsParam() to FP counts fetch
- FP counts refresh on scope toggle change alongside open/closed counts
- Both FP Finding Status and FP Workflow Status donuts now respect BU scope
This commit is contained in:
Jordan Ramos
2026-05-06 15:19:34 -06:00
parent 6163be626e
commit cf43e85c38
2 changed files with 51 additions and 7 deletions

View File

@@ -5069,7 +5069,11 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) {
const fetchFPWorkflowCounts = async () => {
try {
const res = await fetch(`${API_BASE}/ivanti/findings/fp-workflow-counts`, { credentials: 'include' });
const teamsParam = getActiveTeamsParam();
const url = teamsParam
? `${API_BASE}/ivanti/findings/fp-workflow-counts?teams=${encodeURIComponent(teamsParam)}`
: `${API_BASE}/ivanti/findings/fp-workflow-counts`;
const res = await fetch(url, { credentials: 'include' });
const data = await res.json();
if (res.ok) setFPCounts({
findingCounts: data.findingCounts || {},
@@ -5197,6 +5201,8 @@ export default function VulnerabilityTriagePage({ filterDate, filterEXC }) {
.then(r => r.ok ? r.json() : null)
.then(data => { if (data) setStatusCounts({ open: data.open ?? 0, closed: data.closed ?? 0 }); })
.catch(() => {});
// Also refresh FP workflow counts for the new scope
fetchFPWorkflowCounts();
}, [adminScope]); // eslint-disable-line
// Set/clear a single column filter