diff --git a/actions/scans/scans.ts b/actions/scans/scans.ts index be481fc2ea..866918cf86 100644 --- a/actions/scans/scans.ts +++ b/actions/scans/scans.ts @@ -94,9 +94,6 @@ export const scanOnDemand = async (formData: FormData) => { type: "Scan", attributes: { name: scanName, - scanner_args: { - checks_to_execute: ["accessanalyzer_enabled"], - }, }, relationships: { provider: { diff --git a/app/(prowler)/findings/page.tsx b/app/(prowler)/findings/page.tsx index 1c277cad0c..4a0a80b8dd 100644 --- a/app/(prowler)/findings/page.tsx +++ b/app/(prowler)/findings/page.tsx @@ -58,17 +58,20 @@ const SSRDataTable = async ({ const providerDict = createDict("Provider", findingsData); // Expand each finding with its corresponding resource, scan, and provider - const expandedFindings = findingsData.data.map((finding: FindingProps) => { - const scan = scanDict[finding.relationships?.scan?.data?.id]; - const resource = - resourceDict[finding.relationships?.resources?.data?.[0]?.id]; - const provider = providerDict[resource?.relationships?.provider?.data?.id]; + const expandedFindings = findingsData?.data + ? findingsData.data.map((finding: FindingProps) => { + const scan = scanDict[finding.relationships?.scan?.data?.id]; + const resource = + resourceDict[finding.relationships?.resources?.data?.[0]?.id]; + const provider = + providerDict[resource?.relationships?.provider?.data?.id]; - return { - ...finding, - relationships: { scan, resource, provider }, - }; - }); + return { + ...finding, + relationships: { scan, resource, provider }, + }; + }) + : []; // Create the new object while maintaining the original structure const expandedResponse = { diff --git a/components/scans/launch-workflow/launch-scan-workflow-form.tsx b/components/scans/launch-workflow/launch-scan-workflow-form.tsx index b1149fceac..a19acfea42 100644 --- a/components/scans/launch-workflow/launch-scan-workflow-form.tsx +++ b/components/scans/launch-workflow/launch-scan-workflow-form.tsx @@ -41,16 +41,6 @@ export const LaunchScanWorkflow = ({ const onSubmitClient = async (values: z.infer) => { const formValues = { ...values }; - if (!formValues.scanName?.trim()) { - const date = new Date(); - const month = (date.getMonth() + 1).toString().padStart(2, "0"); - const day = date.getDate().toString().padStart(2, "0"); - const year = date.getFullYear(); - const hours = date.getHours().toString().padStart(2, "0"); - const minutes = date.getMinutes().toString().padStart(2, "0"); - formValues.scanName = `scan:${month}/${day}/${year} ${hours}:${minutes}`; - } - const formData = new FormData(); // Loop through form values and add to formData diff --git a/components/scans/table/scan-detail.tsx b/components/scans/table/scan-detail.tsx index c95e28fcfc..b0a85f73f3 100644 --- a/components/scans/table/scan-detail.tsx +++ b/components/scans/table/scan-detail.tsx @@ -23,7 +23,11 @@ export const ScanDetail = ({ scanDetails }: ScanDetailsProps) => {

Scan Details

- +
@@ -156,7 +160,7 @@ export const ScanDetail = ({ scanDetails }: ScanDetailsProps) => { diff --git a/components/scans/table/scans/column-get-scans.tsx b/components/scans/table/scans/column-get-scans.tsx index 604d67ef8b..fccc203ae6 100644 --- a/components/scans/table/scans/column-get-scans.tsx +++ b/components/scans/table/scans/column-get-scans.tsx @@ -4,7 +4,7 @@ import { ColumnDef } from "@tanstack/react-table"; import { useSearchParams } from "next/navigation"; import { InfoIcon } from "@/components/icons"; -import { DateWithTime, EntityInfoShort } from "@/components/ui/entities"; +import { DateWithTime, SnippetId } from "@/components/ui/entities"; import { TriggerSheet } from "@/components/ui/sheet"; import { DataTableColumnHeader, StatusBadge } from "@/components/ui/table"; import { ScanProps } from "@/types"; @@ -18,18 +18,16 @@ const getScanData = (row: { original: ScanProps }) => { export const ColumnGetScans: ColumnDef[] = [ { - accessorKey: "name", - header: ({ column }) => ( - - ), + accessorKey: "started_at", + header: () =>

Started at

, cell: ({ row }) => { const { - attributes: { name }, + attributes: { started_at }, } = getScanData(row); - return ; + + return ; }, }, - { accessorKey: "status", header: ({ column }) => ( @@ -39,7 +37,12 @@ export const ColumnGetScans: ColumnDef[] = [ const { attributes: { state }, } = getScanData(row); - return ; + return ( + + ); }, }, @@ -79,29 +82,14 @@ export const ColumnGetScans: ColumnDef[] = [ return ; }, }, - { - accessorKey: "started_at", - header: ({ column }) => ( - - ), - cell: ({ row }) => { - const { - attributes: { started_at }, - } = getScanData(row); - return ; - }, - }, + { accessorKey: "completed_at", header: ({ column }) => ( ), cell: ({ row }) => { @@ -123,6 +111,29 @@ export const ColumnGetScans: ColumnDef[] = [ return

{trigger}

; }, }, + + { + accessorKey: "id", + header: () => ID, + cell: ({ row }) => { + return ; + }, + }, + { + accessorKey: "name", + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const { + attributes: { name }, + } = getScanData(row); + if (name.length === 0) { + return -; + } + return {name}; + }, + }, { id: "moreInfo", header: "Details", diff --git a/components/ui/table/status-badge.tsx b/components/ui/table/status-badge.tsx index 932d4105d6..3639e3a8a1 100644 --- a/components/ui/table/status-badge.tsx +++ b/components/ui/table/status-badge.tsx @@ -1,4 +1,4 @@ -import { Chip } from "@nextui-org/react"; +import { Chip, CircularProgress } from "@nextui-org/react"; import React from "react"; export type Status = @@ -24,22 +24,41 @@ const statusColorMap: Record< export const StatusBadge = ({ status, size = "sm", + loadingProgress, ...props }: { status: Status; size?: "sm" | "md" | "lg"; + loadingProgress?: number; }) => { const color = statusColorMap[status as keyof typeof statusColorMap]; return ( - {status} + {status === "executing" ? ( +
+ + executing +
+ ) : ( + status + )}
); }; diff --git a/lib/helper.ts b/lib/helper.ts index aed48d9478..5b6d2ec8f2 100644 --- a/lib/helper.ts +++ b/lib/helper.ts @@ -30,7 +30,6 @@ export async function checkTaskStatus( await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY)); break; default: - console.warn(`Unexpected task state: ${state}`); return { completed: false, error: "Unexpected task state" }; } }