From 0206674fc999d2032c7ef23bbb469c6de2dbcc22 Mon Sep 17 00:00:00 2001 From: sumit_chaturvedi Date: Wed, 21 May 2025 21:39:48 +0530 Subject: [PATCH] srn Updated failed findings count --- ui/app/(prowler)/resources/page.tsx | 4 ++-- ui/components/resources/table/column-resources.tsx | 4 +++- ui/types/resources.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/app/(prowler)/resources/page.tsx b/ui/app/(prowler)/resources/page.tsx index 0175fcb5d9..f1e65d2f23 100644 --- a/ui/app/(prowler)/resources/page.tsx +++ b/ui/app/(prowler)/resources/page.tsx @@ -38,7 +38,7 @@ export default async function Resources({ }, }); - if (scansData.data?.length !== 0) { + if (scansData?.data?.length !== 0) { const latestScandate = scansData.data?.[0]?.attributes?.inserted_at; const formattedDate = format(parseISO(latestScandate), "yyyy-MM-dd"); filters["filter[updated_at]"] = formattedDate; @@ -157,7 +157,7 @@ const SSRDataTable = async ({ }, }); - if (scansData.data?.length !== 0) { + if (scansData?.data?.length !== 0) { const latestScandate = scansData?.data?.[0]?.attributes?.inserted_at; const formattedDate = format(parseISO(latestScandate), "yyyy-MM-dd"); filters["filter[updated_at]"] = formattedDate; diff --git a/ui/components/resources/table/column-resources.tsx b/ui/components/resources/table/column-resources.tsx index 50c79f31ee..a396408408 100644 --- a/ui/components/resources/table/column-resources.tsx +++ b/ui/components/resources/table/column-resources.tsx @@ -93,8 +93,10 @@ export const ColumnResources: ColumnDef[] = [ header: () =>
Failed Findings
, cell: ({ row }) => { const count = row.original.relationships.findings.data.filter( - (data) => data.attributes.status === "FAIL", + (data) => + data.attributes.status === "FAIL" && data.attributes.delta === "new", ).length; + return ( <>

diff --git a/ui/types/resources.ts b/ui/types/resources.ts index 6d23b5bc51..5db29804a1 100644 --- a/ui/types/resources.ts +++ b/ui/types/resources.ts @@ -47,7 +47,7 @@ export interface ResourceProps { data: { type: "findings"; id: string; - attributes: { status: string }; + attributes: { status: string; delta: string }; }[]; }; };