From b5b2e225ce7e6451982a6ba33839882dd693a4b7 Mon Sep 17 00:00:00 2001 From: Sophia Dao Date: Thu, 8 Aug 2024 15:04:47 -0500 Subject: [PATCH] Findings page Status component (#34) * feat(findings): Severity and Status badge WIP * Remove SeverityBadge from PR --- components/findings/table/ColumnsFindings.tsx | 5 ++-- components/index.ts | 20 --------------- components/ui/table/StatusBadge.tsx | 25 +++++++++++++------ types/components.ts | 4 +-- 4 files changed, 23 insertions(+), 31 deletions(-) delete mode 100644 components/index.ts diff --git a/components/findings/table/ColumnsFindings.tsx b/components/findings/table/ColumnsFindings.tsx index afbd6c406f..7c8b6f2396 100644 --- a/components/findings/table/ColumnsFindings.tsx +++ b/components/findings/table/ColumnsFindings.tsx @@ -10,6 +10,7 @@ import { import { ColumnDef } from "@tanstack/react-table"; import { VerticalDotsIcon } from "@/components/icons"; +import { StatusBadge } from "@/components/ui"; import { FindingProps } from "@/types"; const getFindingsAttributes = (row: { original: FindingProps }) => { @@ -30,7 +31,7 @@ export const ColumnsFindings: ColumnDef[] = [ header: "Severity", cell: ({ row }) => { const { severity } = getFindingsAttributes(row); - return

{severity}

; + return

{severity}

; }, }, { @@ -38,7 +39,7 @@ export const ColumnsFindings: ColumnDef[] = [ header: "Status", cell: ({ row }) => { const { status } = getFindingsAttributes(row); - return

{status}

; + return ; }, }, { diff --git a/components/index.ts b/components/index.ts deleted file mode 100644 index 8fb02340c9..0000000000 --- a/components/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export * from "./findings/table/ColumnsFindings"; -export * from "./findings/table/DataTableFindings"; -export * from "./findings/table/SkeletonTableFindings"; -export * from "./providers/AddProvider"; -export * from "./providers/ButtonAddProvider"; -export * from "./providers/ButtonCheckConnectionProvider"; -export * from "./providers/ButtonDeleteProvider"; -export * from "./providers/CheckConnectionProvider"; -export * from "./providers/DateWithTime"; -export * from "./providers/ProviderInfo"; -export * from "./providers/ScanStatus"; -export * from "./providers/table/ColumnsProvider"; -export * from "./providers/table/DataTableProvider"; -export * from "./providers/table/SkeletonTableProvider"; -export * from "./ui/alert/Alert"; -export * from "./ui/header/Header"; -export * from "./ui/sidebar"; -export * from "./ui/table/StatusBadge"; -export * from "./ui/table/Table"; -export * from "./ui/toast"; diff --git a/components/ui/table/StatusBadge.tsx b/components/ui/table/StatusBadge.tsx index a1dea200aa..c11e7271cb 100644 --- a/components/ui/table/StatusBadge.tsx +++ b/components/ui/table/StatusBadge.tsx @@ -1,14 +1,25 @@ import { Chip } from "@nextui-org/react"; import React from "react"; -type Status = "completed" | "pending" | "cancelled"; +type Status = + | "completed" + | "pending" + | "cancelled" + | "fail" + | "success" + | "muted"; -export const statusColorMap: Record = - { - completed: "success", - pending: "warning", - cancelled: "danger", - }; +export const statusColorMap: Record< + Status, + "success" | "danger" | "warning" | "default" +> = { + completed: "success", + pending: "warning", + cancelled: "danger", + fail: "danger", + success: "success", + muted: "default", +}; export const StatusBadge = ({ status }: { status: Status }) => { return ( diff --git a/types/components.ts b/types/components.ts index 6741e118e2..209b6e4c0d 100644 --- a/types/components.ts +++ b/types/components.ts @@ -40,8 +40,8 @@ export interface FindingProps { id: string; attributes: { CheckTitle: string; - severity: string; - status: string; + severity: "critical" | "high" | "medium" | "low"; + status: "fail" | "success" | "muted"; region: string; service: string; account: string;