[] = [
- // {
- // header: " ",
- // cell: ({ row }) => {row.index + 1}
,
- // },
{
accessorKey: "check",
- header: ({ column }) => (
-
- ),
+ header: "Check",
cell: ({ row }) => {
const { checktitle } = getFindingsMetadata(row);
return {checktitle}
;
},
},
{
- accessorKey: "region",
- header: "Region",
+ accessorKey: "scanName",
+ header: "Scan Name",
cell: ({ row }) => {
- const region = getResourceData(row, "region");
+ const name = getScanData(row, "name");
return (
- <>
- {region}
- >
+
+ {typeof name === "string" || typeof name === "number"
+ ? name
+ : "Invalid data"}
+
);
},
},
-
- // {
- // accessorKey: "uid",
- // header: ({ column }) => (
- //
- // ),
- // cell: ({ row }) => {
- // const {
- // attributes: { uid },
- // } = getFindingsData(row);
- // return ;
- // },
- // },
- // {
- // accessorKey: "provider",
- // header: "Provider Alias",
- // cell: ({ row }) => {
- // const {
- // attributes: { alias },
- // } = getProviderData(row, "alias");
- // return {alias}
;
- // },
- // },
{
accessorKey: "severity",
- header: ({ column }) => (
-
- ),
+ header: "Severity",
cell: ({ row }) => {
const {
attributes: { severity },
@@ -128,38 +99,44 @@ export const ColumnFindings: ColumnDef[] = [
const {
attributes: { status },
} = getFindingsData(row);
- // Temporarily overwriting the value until the API is functional.
- return ;
+
+ const mappedStatus = statusMap[status];
+
+ return ;
+ },
+ },
+ {
+ accessorKey: "region",
+ header: "Region",
+ cell: ({ row }) => {
+ const region = getResourceData(row, "region");
+
+ return (
+ <>
+ {typeof region === "string" ? region : "Invalid region"}
+ >
+ );
},
},
{
accessorKey: "service",
- header: ({ column }) => (
-
- ),
+ header: "Service",
cell: ({ row }) => {
const { servicename } = getFindingsMetadata(row);
return {servicename}
;
},
},
{
- accessorKey: "added",
- header: ({ column }) => (
-
- ),
+ accessorKey: "account",
+ header: "Account",
cell: ({ row }) => {
- const {
- attributes: { inserted_at },
- } = getFindingsData(row);
- return ;
+ const account = getProviderData(row, "uid");
+
+ return (
+ <>
+ {typeof account === "string" ? account : "Invalid account"}
+ >
+ );
},
},
{
diff --git a/components/findings/table/data-table-row-actions.tsx b/components/findings/table/data-table-row-actions.tsx
index dea023d359..9513bb11a8 100644
--- a/components/findings/table/data-table-row-actions.tsx
+++ b/components/findings/table/data-table-row-actions.tsx
@@ -14,7 +14,6 @@ import {
EditDocumentBulkIcon,
} from "@nextui-org/shared-icons";
import { Row } from "@tanstack/react-table";
-import clsx from "clsx";
// import { useState } from "react";
import { VerticalDotsIcon } from "@/components/icons";
@@ -74,30 +73,22 @@ export function DataTableRowActions({
>
}
// onClick={() => setIsEditOpen(true)}
>
- Edit Finding
+ Send to Jira
-
-
- }
- // onClick={() => setIsDeleteOpen(true)}
+ key="slack"
+ description="Allows you to send the finding to Slack"
+ textValue="Send to Slack"
+ startContent={}
+ // onClick={() => setIsEditOpen(true)}
>
- Delete Finding
+ Send to Slack
diff --git a/components/ui/table/status-badge.tsx b/components/ui/table/status-badge.tsx
index c0f0356407..932d4105d6 100644
--- a/components/ui/table/status-badge.tsx
+++ b/components/ui/table/status-badge.tsx
@@ -1,7 +1,7 @@
import { Chip } from "@nextui-org/react";
import React from "react";
-type Status =
+export type Status =
| "available"
| "scheduled"
| "executing"
diff --git a/lib/custom.ts b/lib/helper.ts
similarity index 76%
rename from lib/custom.ts
rename to lib/helper.ts
index a33f07d6fe..7eeee17a6f 100644
--- a/lib/custom.ts
+++ b/lib/helper.ts
@@ -1,5 +1,17 @@
import { MetaDataProps } from "@/types";
+// Helper function to create dictionaries by type
+export const createDict = (
+ type: string,
+ data: any,
+ includedField: string = "included",
+) =>
+ Object.fromEntries(
+ data[includedField]
+ .filter((item: { type: string }) => item.type === type)
+ .map((item: { id: string }) => [item.id, item]),
+ );
+
export const parseStringify = (value: any) => JSON.parse(JSON.stringify(value));
export const convertFileToUrl = (file: File) => URL.createObjectURL(file);
diff --git a/lib/index.ts b/lib/index.ts
index 38d384fb6e..56ebefcc21 100644
--- a/lib/index.ts
+++ b/lib/index.ts
@@ -1,2 +1,2 @@
-export * from "./custom";
+export * from "./helper";
export * from "./utils";
diff --git a/types/components.ts b/types/components.ts
index 89dee77381..086e6e4a60 100644
--- a/types/components.ts
+++ b/types/components.ts
@@ -154,17 +154,37 @@ export interface FindingProps {
updated_at: string;
};
relationships: {
+ resources: {
+ data: {
+ type: "Resource";
+ id: string;
+ }[];
+ };
scan: {
data: {
type: "Scan";
id: string;
};
+ attributes: {
+ name: string;
+ trigger: string;
+ state: string;
+ unique_resource_count: number;
+ progress: number;
+ scanner_args: {
+ checks_to_execute: string[];
+ };
+ duration: number;
+ started_at: string;
+ completed_at: string;
+ scheduled_at: string | null;
+ };
};
resource: {
data: {
type: "Resource";
id: string;
- };
+ }[];
attributes: {
uid: string;
name: string;