diff --git a/components/findings/table/column-findings.tsx b/components/findings/table/column-findings.tsx index bb9e95cd9c..1d3d2a28d5 100644 --- a/components/findings/table/column-findings.tsx +++ b/components/findings/table/column-findings.tsx @@ -142,10 +142,10 @@ export const ColumnFindings: ColumnDef[] = [ return ( } - title="Scan Details" - description="View the scan details" + title="Finding Details" + description="View the finding details" > - + ); }, diff --git a/components/findings/table/data-table-row-details.tsx b/components/findings/table/data-table-row-details.tsx index 997fa0e5d9..b843847e7a 100644 --- a/components/findings/table/data-table-row-details.tsx +++ b/components/findings/table/data-table-row-details.tsx @@ -2,36 +2,10 @@ import { useEffect, useState } from "react"; -import { getScan } from "@/actions/scans"; -import { ScanDetail, SkeletonTableScans } from "@/components/scans/table"; -import { ScanProps } from "@/types"; +import { FindingDetail } from "@/components/findings/table"; +import { FindingProps } from "@/types"; -export const DataTableRowDetails = ({ entityId }: { entityId: string }) => { - const [scanDetails, setScanDetails] = useState(null); - const [isLoading, setIsLoading] = useState(true); - - useEffect(() => { - const fetchScanDetails = async () => { - try { - const result = await getScan(entityId); - setScanDetails(result?.data); - } catch (error) { - console.error("Error fetching scan details:", error); - } finally { - setIsLoading(false); - } - }; - - fetchScanDetails(); - }, [entityId]); - - if (isLoading) { - return ; - } - - if (!scanDetails) { - return
No scan details available
; - } - - return ; +export const DataTableRowDetails = ({ finding }: { finding: FindingProps }) => { + console.log(finding); + return ; }; diff --git a/components/findings/table/finding-detail.tsx b/components/findings/table/finding-detail.tsx index 1b8455cfe7..2aa99a2719 100644 --- a/components/findings/table/finding-detail.tsx +++ b/components/findings/table/finding-detail.tsx @@ -4,139 +4,94 @@ import { Card, CardBody, CardHeader, Divider } from "@nextui-org/react"; import { DateWithTime, SnippetId } from "@/components/ui/entities"; import { StatusBadge } from "@/components/ui/table/status-badge"; -import { ScanProps } from "@/types"; +import { FindingProps } from "@/types"; +import {Table, TableHeader, TableColumn, TableBody, TableRow, TableCell} from "@nextui-org/react"; -export const FindingDetail = ({ findingDetails }: { findingDetails: ScanProps }) => { - const scanOnDemand = findingDetails.attributes; +export const FindingDetail = ({ findingDetails }: { findingDetails: FindingProps }) => { + const finding = findingDetails; + console.log(finding) return (
-
-

Scan Details -

-

{scanOnDemand.name}

-
- -
- -
-
-
- } - /> - - - - -
-
- - ) : ( - "Not Started" - ) - } - /> - - ) : ( - "Not Started" - ) - } - /> - - ) : ( - "Not Scheduled" - ) - } - /> - - } - /> - - } - /> -
-
-
- - -

Scan Arguments

-
- - - - - - -
+ + + Name + Value + + + + Resource ID + {finding.relationships.resource.id} + + + Resource ARN + {finding.relationships.resource.attributes.uid} + + + Check ID + {finding.attributes.check_id} + + + Types + {finding.attributes.check_metadata.checktype} + + + Scan time + {finding.attributes.inserted_at} + + + Prowler Finding ID + {finding.relationships.resource.attributes.uid} + + + Severity + {finding.id} + + + Status + {finding.attributes.status} + + + Region + {finding.relationships.resource.attributes.region} + + + Service + {finding.relationships.resource.attributes.service} + + + Account + {finding.relationships.provider.attributes.uid} + + + Details + {finding.attributes.status_extended} + + + Risk + {finding.attributes.check_metadata.risk} + + + Recommendation + {finding.attributes.check_metadata.remediation.recommendation.text} + + + CLI + {finding.attributes.check_metadata.remediation.code.cli} + + + Other + {finding.attributes.check_metadata.remediation.code.other} + + + Terraform + {finding.attributes.check_metadata.remediation.code.terraform} + + +
+ +
); }; - -const DateItem = ({ - label, - value, -}: { - label: string; - value: React.ReactNode; -}) => ( -
- {label}: - {value} -
-); - -const DetailItem = ({ - label, - value, -}: { - label: string; - value: React.ReactNode; -}) => ( -
- {label}: - {value} -
-); diff --git a/components/findings/table/index.ts b/components/findings/table/index.ts index 131a0ac73c..3aad78e3f4 100644 --- a/components/findings/table/index.ts +++ b/components/findings/table/index.ts @@ -2,3 +2,4 @@ export * from "./column-findings"; export * from "./data-table-row-actions"; export * from "./data-table-row-details"; export * from "./skeleton-table-findings"; +export * from "./finding-detail"; diff --git a/types/components.ts b/types/components.ts index 60fe123b51..fb78990811 100644 --- a/types/components.ts +++ b/types/components.ts @@ -247,6 +247,7 @@ export interface FindingProps { type: "Resource"; id: string; }[]; + id: string; attributes: { uid: string; name: string;