}>
@@ -67,6 +77,35 @@ const SSRDataTableProviders = async ({
columns={ColumnProviderScans}
data={providersData?.data || []}
metadata={providersData?.meta}
+ customFilters={filterProviders}
+ />
+ );
+};
+
+const SSRDataTableScansSchedule = async ({
+ searchParams,
+}: {
+ searchParams: SearchParamsProps;
+}) => {
+ const page = parseInt(searchParams.page?.toString() || "1", 10);
+ const sort = searchParams.sort?.toString();
+
+ // Extract all filter parameters
+ const filters = Object.fromEntries(
+ Object.entries(searchParams).filter(([key]) => key.startsWith("filter[")),
+ );
+
+ // Extract query from filters
+ const query = (filters["filter[search]"] as string) || "";
+
+ const scansData = await getScans({ query, page, sort, filters });
+
+ return (
+
);
};
diff --git a/components/scans/table/column-get-scans-schedule.tsx b/components/scans/table/column-get-scans-schedule.tsx
new file mode 100644
index 0000000000..71b6267791
--- /dev/null
+++ b/components/scans/table/column-get-scans-schedule.tsx
@@ -0,0 +1,90 @@
+"use client";
+
+import { ColumnDef } from "@tanstack/react-table";
+
+import { DateWithTime, EntityInfoShort } from "@/components/ui/entities";
+import { DataTableColumnHeader, StatusBadge } from "@/components/ui/table";
+import { ScanProps } from "@/types";
+
+import { DataTableRowActions } from "./data-table-row-actions";
+
+const getScanData = (row: { original: ScanProps }) => {
+ return row.original;
+};
+
+export const ColumnGetScansSchedule: ColumnDef
[] = [
+ {
+ accessorKey: "name",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { name },
+ } = getScanData(row);
+ return ;
+ },
+ },
+
+ {
+ accessorKey: "status",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { state },
+ } = getScanData(row);
+ return ;
+ },
+ },
+ {
+ accessorKey: "started_at",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { started_at },
+ } = getScanData(row);
+ return ;
+ },
+ },
+ {
+ accessorKey: "lastScan",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { completed_at },
+ } = getScanData(row);
+ return ;
+ },
+ },
+ {
+ accessorKey: "resources",
+ header: "Resources",
+ cell: ({ row }) => {
+ const {
+ attributes: { unique_resource_count },
+ } = getScanData(row);
+ return {unique_resource_count}
;
+ },
+ },
+
+ {
+ id: "actions",
+ cell: ({ row }) => {
+ return ;
+ },
+ },
+];
diff --git a/components/scans/table/column-get-scans.tsx b/components/scans/table/column-get-scans.tsx
index 670d165c6f..e8acabb434 100644
--- a/components/scans/table/column-get-scans.tsx
+++ b/components/scans/table/column-get-scans.tsx
@@ -1,7 +1,6 @@
"use client";
import { ColumnDef } from "@tanstack/react-table";
-import { add } from "date-fns";
import { DateWithTime, EntityInfoShort } from "@/components/ui/entities";
import { DataTableColumnHeader, StatusBadge } from "@/components/ui/table";
@@ -26,6 +25,18 @@ export const ColumnGetScans: ColumnDef[] = [
return ;
},
},
+ {
+ accessorKey: "trigger",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { trigger },
+ } = getScanData(row);
+ return {trigger}
;
+ },
+ },
{
accessorKey: "status",
@@ -40,11 +51,43 @@ export const ColumnGetScans: ColumnDef[] = [
},
},
{
- accessorKey: "lastScan",
+ accessorKey: "scheduled_at",
header: ({ column }) => (
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { scheduled_at },
+ } = getScanData(row);
+ return ;
+ },
+ },
+ {
+ accessorKey: "started_at",
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => {
+ const {
+ attributes: { started_at },
+ } = getScanData(row);
+ return ;
+ },
+ },
+ {
+ accessorKey: "completed_at",
+ header: ({ column }) => (
+
),
@@ -56,18 +99,13 @@ export const ColumnGetScans: ColumnDef[] = [
},
},
{
- accessorKey: "nextScan",
- header: "Next Scan",
+ accessorKey: "scanner_args",
+ header: "Scanner Args",
cell: ({ row }) => {
const {
- attributes: { scheduled_at, completed_at },
+ attributes: { scanner_args },
} = getScanData(row);
- const nextDay = add(new Date(completed_at), {
- hours: 24,
- });
- if (scheduled_at === null)
- return ;
- return ;
+ return {scanner_args?.only_logs}
;
},
},
{
@@ -80,22 +118,7 @@ export const ColumnGetScans: ColumnDef[] = [
return {unique_resource_count}
;
},
},
- {
- accessorKey: "started_at",
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => {
- const {
- attributes: { started_at },
- } = getScanData(row);
- return ;
- },
- },
+
{
id: "actions",
cell: ({ row }) => {
diff --git a/components/scans/table/index.ts b/components/scans/table/index.ts
index 471e150f9f..9015ed3651 100644
--- a/components/scans/table/index.ts
+++ b/components/scans/table/index.ts
@@ -1,4 +1,5 @@
export * from "./column-get-scans";
+export * from "./column-get-scans-schedule";
export * from "./column-provider-scans";
export * from "./data-table-row-actions";
export * from "./skeleton-table-scans";