diff --git a/app/(prowler)/scans/page.tsx b/app/(prowler)/scans/page.tsx index c93ea87ad8..be74f9a28a 100644 --- a/app/(prowler)/scans/page.tsx +++ b/app/(prowler)/scans/page.tsx @@ -1,9 +1,10 @@ -import { Spacer } from "@nextui-org/react"; +import { Link, Spacer, Tooltip } from "@nextui-org/react"; import { Suspense } from "react"; import { getProviders } from "@/actions/providers"; import { getScans } from "@/actions/scans"; import { FilterControls, filterScans } from "@/components/filters"; +import { InfoIcon } from "@/components/icons"; import { SkeletonTableScans } from "@/components/scans/table"; import { ColumnProviderScans } from "@/components/scans/table/provider-scans"; import { ColumnGetScans } from "@/components/scans/table/scans"; @@ -32,7 +33,7 @@ export default async function Scans({ -
+
}> @@ -46,7 +47,26 @@ const SSRDataTableProviders = async () => { const filters = { "filter[connected]": "true" }; const providersData = await getProviders({ page: 1, filters }); return ( - + <> +
+ + + +

Connected providers

+
+ +

+ If you don't see any providers, please check your connection settings on + the{" "} + + providers page + + . +

+ ); }; diff --git a/components/icons/Icons.tsx b/components/icons/Icons.tsx index 7b7ccd7cda..b8f448afd3 100644 --- a/components/icons/Icons.tsx +++ b/components/icons/Icons.tsx @@ -785,3 +785,26 @@ export const ScheduleIcon: React.FC = ({ ); }; + +export const InfoIcon: React.FC = ({ + size = 24, + width, + height, + ...props +}) => ( + + + + +); diff --git a/components/scans/table/scan-detail.tsx b/components/scans/table/scan-detail.tsx index f9c14384ee..5dd8dc2547 100644 --- a/components/scans/table/scan-detail.tsx +++ b/components/scans/table/scan-detail.tsx @@ -84,10 +84,14 @@ export const ScanDetail = ({ scanDetails }: { scanDetails: ScanProps }) => { + scanDetails.relationships.task?.data?.id ? ( + + ) : ( + "N/A" + ) } />
@@ -101,14 +105,14 @@ export const ScanDetail = ({ scanDetails }: { scanDetails: ScanProps }) => { - + Checks + + {(scanOnDemand.scanner_args as any)?.checks_to_execute?.join( ", ", - ) || "N/A" - } - /> + ) || "N/A"} + +
diff --git a/components/scans/table/scans/column-get-scans.tsx b/components/scans/table/scans/column-get-scans.tsx index e8acabb434..f995d711b6 100644 --- a/components/scans/table/scans/column-get-scans.tsx +++ b/components/scans/table/scans/column-get-scans.tsx @@ -2,11 +2,14 @@ import { ColumnDef } from "@tanstack/react-table"; +import { InfoIcon, PlusIcon } from "@/components/icons"; import { DateWithTime, EntityInfoShort } from "@/components/ui/entities"; +import { TriggerSheet } from "@/components/ui/sheet"; import { DataTableColumnHeader, StatusBadge } from "@/components/ui/table"; import { ScanProps } from "@/types"; import { DataTableRowActions } from "./data-table-row-actions"; +import { DataTableRowDetails } from "./data-table-row-details"; const getScanData = (row: { original: ScanProps }) => { return row.original; @@ -118,6 +121,21 @@ export const ColumnGetScans: ColumnDef[] = [ return

{unique_resource_count}

; }, }, + { + id: "moreInfo", + header: "Details", + cell: ({ row }) => { + return ( + } + title="Scan Details" + description="View the scan details" + > + + + ); + }, + }, { id: "actions", diff --git a/components/scans/table/scans/data-table-row-details.tsx b/components/scans/table/scans/data-table-row-details.tsx new file mode 100644 index 0000000000..997fa0e5d9 --- /dev/null +++ b/components/scans/table/scans/data-table-row-details.tsx @@ -0,0 +1,37 @@ +"use client"; + +import { useEffect, useState } from "react"; + +import { getScan } from "@/actions/scans"; +import { ScanDetail, SkeletonTableScans } from "@/components/scans/table"; +import { ScanProps } 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 ; +}; diff --git a/components/scans/table/scans/index.ts b/components/scans/table/scans/index.ts index d38c1879ca..2567c0098c 100644 --- a/components/scans/table/scans/index.ts +++ b/components/scans/table/scans/index.ts @@ -1,2 +1,3 @@ export * from "./column-get-scans"; export * from "./data-table-row-actions"; +export * from "./data-table-row-details"; diff --git a/components/ui/sheet/trigger-sheet.tsx b/components/ui/sheet/trigger-sheet.tsx index e97e2a45a5..2275577cbd 100644 --- a/components/ui/sheet/trigger-sheet.tsx +++ b/components/ui/sheet/trigger-sheet.tsx @@ -22,7 +22,9 @@ export function TriggerSheet({ }: TriggerSheetProps) { return ( - {triggerComponent} + + {triggerComponent} + {title}