mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
chore: add a default name for scans if it's empty by the user
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
export * from "./launch-scan-workflow";
|
||||
export * from "./launch-scan-workflow-form";
|
||||
export * from "./select-scan-provider";
|
||||
|
||||
+13
-2
@@ -39,11 +39,22 @@ export const LaunchScanWorkflow = ({
|
||||
const isLoading = form.formState.isSubmitting;
|
||||
|
||||
const onSubmitClient = async (values: z.infer<typeof formSchema>) => {
|
||||
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();
|
||||
console.log(values);
|
||||
|
||||
// Loop through form values and add to formData
|
||||
Object.entries(values).forEach(
|
||||
Object.entries(formValues).forEach(
|
||||
([key, value]) =>
|
||||
value !== undefined &&
|
||||
formData.append(
|
||||
@@ -29,18 +29,6 @@ export const ColumnGetScans: ColumnDef<ScanProps>[] = [
|
||||
return <EntityInfoShort entityAlias={name} entityId={row.original.id} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "trigger",
|
||||
header: ({ column }) => (
|
||||
<DataTableColumnHeader column={column} title={"Type"} param="trigger" />
|
||||
),
|
||||
cell: ({ row }) => {
|
||||
const {
|
||||
attributes: { trigger },
|
||||
} = getScanData(row);
|
||||
return <p>{trigger}</p>;
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
accessorKey: "status",
|
||||
@@ -54,6 +42,27 @@ export const ColumnGetScans: ColumnDef<ScanProps>[] = [
|
||||
return <StatusBadge status={state} />;
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
accessorKey: "scanner_args",
|
||||
header: "Scanner Args",
|
||||
cell: ({ row }) => {
|
||||
const {
|
||||
attributes: { scanner_args },
|
||||
} = getScanData(row);
|
||||
return <p className="font-medium">{scanner_args?.only_logs}</p>;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "resources",
|
||||
header: "Resources",
|
||||
cell: ({ row }) => {
|
||||
const {
|
||||
attributes: { unique_resource_count },
|
||||
} = getScanData(row);
|
||||
return <p className="font-medium">{unique_resource_count}</p>;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "scheduled_at",
|
||||
header: ({ column }) => (
|
||||
@@ -103,23 +112,15 @@ export const ColumnGetScans: ColumnDef<ScanProps>[] = [
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "scanner_args",
|
||||
header: "Scanner Args",
|
||||
accessorKey: "trigger",
|
||||
header: ({ column }) => (
|
||||
<DataTableColumnHeader column={column} title={"Type"} param="trigger" />
|
||||
),
|
||||
cell: ({ row }) => {
|
||||
const {
|
||||
attributes: { scanner_args },
|
||||
attributes: { trigger },
|
||||
} = getScanData(row);
|
||||
return <p className="font-medium">{scanner_args?.only_logs}</p>;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "resources",
|
||||
header: "Resources",
|
||||
cell: ({ row }) => {
|
||||
const {
|
||||
attributes: { unique_resource_count },
|
||||
} = getScanData(row);
|
||||
return <p className="font-medium">{unique_resource_count}</p>;
|
||||
return <p>{trigger}</p>;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user