diff --git a/components/filters/custom-select-provider.tsx b/components/filters/custom-select-provider.tsx index 0aff523282..d2a419bbbb 100644 --- a/components/filters/custom-select-provider.tsx +++ b/components/filters/custom-select-provider.tsx @@ -42,16 +42,16 @@ export const CustomSelectProvider: React.FC = () => { (value: string) => { const params = new URLSearchParams(searchParams.toString()); if (value) { - params.set("filter[provider__in]", value); + params.set("filter[provider_type]", value); } else { - params.delete("filter[provider__in]"); + params.delete("filter[provider_type]"); } router.push(`?${params.toString()}`, { scroll: false }); }, [router, searchParams], ); - const currentProvider = searchParams.get("filter[provider__in]") || ""; + const currentProvider = searchParams.get("filter[provider_type]") || ""; const selectedKeys = useMemo(() => { return dataInputsProvider.some( diff --git a/components/findings/table/column-findings.tsx b/components/findings/table/column-findings.tsx index 4d0d7dd3ab..8bfb34998e 100644 --- a/components/findings/table/column-findings.tsx +++ b/components/findings/table/column-findings.tsx @@ -5,19 +5,17 @@ import { ColumnDef } from "@tanstack/react-table"; import { DataTableRowDetails } from "@/components/findings/table"; import { PlusIcon } from "@/components/icons"; import { TriggerSheet } from "@/components/ui/sheet"; -import { SeverityBadge, Status, StatusBadge } from "@/components/ui/table"; +import { + DataTableColumnHeader, + SeverityBadge, + StatusFindingBadge, +} from "@/components/ui/table"; import { FindingProps } from "@/types"; import { DataTableRowActions } from "./data-table-row-actions"; -const statusMap: Record<"PASS" | "FAIL" | "MANUAL" | "MUTED", Status> = { - PASS: "completed", - FAIL: "failed", - MANUAL: "completed", - MUTED: "cancelled", -}; - const getFindingsData = (row: { original: FindingProps }) => { + console.log(row.original, "finding"); return row.original; }; @@ -29,6 +27,7 @@ const getResourceData = ( row: { original: FindingProps }, field: keyof FindingProps["relationships"]["resource"]["attributes"], ) => { + // console.log(row.original, "resource"); return ( row.original.relationships?.resource?.attributes?.[field] || `No ${field} found in resource` @@ -39,6 +38,7 @@ const getProviderData = ( row: { original: FindingProps }, field: keyof FindingProps["relationships"]["provider"]["attributes"], ) => { + // console.log(row.original, "provider"); return ( row.original.relationships?.provider?.attributes?.[field] || `No ${field} found in provider` @@ -49,6 +49,7 @@ const getScanData = ( row: { original: FindingProps }, field: keyof FindingProps["relationships"]["scan"]["attributes"], ) => { + // console.log(row.original, "scan"); return ( row.original.relationships?.scan?.attributes?.[field] || `No ${field} found in scan` @@ -58,30 +59,23 @@ const getScanData = ( export const ColumnFindings: ColumnDef[] = [ { accessorKey: "check", - header: "Check", + header: ({ column }) => ( + + ), cell: ({ row }) => { const { checktitle } = getFindingsMetadata(row); - return

{checktitle}

; - }, - }, - { - accessorKey: "scanName", - header: "Scan Name", - cell: ({ row }) => { - const name = getScanData(row, "name"); - - return ( -

- {typeof name === "string" || typeof name === "number" - ? name - : "Invalid data"} -

- ); + return

{checktitle}

; }, }, { accessorKey: "severity", - header: "Severity", + header: ({ column }) => ( + + ), cell: ({ row }) => { const { attributes: { severity }, @@ -91,15 +85,30 @@ export const ColumnFindings: ColumnDef[] = [ }, { accessorKey: "status", - header: "Status", + header: ({ column }) => ( + + ), cell: ({ row }) => { const { attributes: { status }, } = getFindingsData(row); - const mappedStatus = statusMap[status]; + return ; + }, + }, + { + accessorKey: "scanName", + header: "Scan Name", + cell: ({ row }) => { + const name = getScanData(row, "name"); - return ; + return ( +

+ {typeof name === "string" || typeof name === "number" + ? name + : "Invalid data"} +

+ ); }, }, { @@ -120,7 +129,7 @@ export const ColumnFindings: ColumnDef[] = [ header: "Service", cell: ({ row }) => { const { servicename } = getFindingsMetadata(row); - return

{servicename}

; + return

{servicename}

; }, }, { @@ -131,7 +140,9 @@ export const ColumnFindings: ColumnDef[] = [ return ( <> -
{typeof account === "string" ? account : "Invalid account"}
+

+ {typeof account === "string" ? account : "Invalid account"} +

); }, diff --git a/components/ui/table/index.ts b/components/ui/table/index.ts index a344b959de..48080e8ef7 100644 --- a/components/ui/table/index.ts +++ b/components/ui/table/index.ts @@ -4,4 +4,5 @@ export * from "./data-table-filter-custom"; export * from "./data-table-pagination"; export * from "./severity-badge"; export * from "./status-badge"; +export * from "./status-finding-badge"; export * from "./table"; diff --git a/components/ui/table/severity-badge.tsx b/components/ui/table/severity-badge.tsx index 8b852eea36..d15c8a098a 100644 --- a/components/ui/table/severity-badge.tsx +++ b/components/ui/table/severity-badge.tsx @@ -37,7 +37,8 @@ export const SeverityBadge = ({ severity }: { severity: Severity }) => { return ( = { + FAIL: "danger", + PASS: "success", + MANUAL: "warning", + MUTED: "default", +}; + +export const StatusFindingBadge = ({ + status, + size = "sm", + ...props +}: { + status: FindingStatus; + size?: "sm" | "md" | "lg"; +}) => { + const color = statusColorMap[status]; + + return ( + + {status} + + ); +};