mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-30 07:14:20 +00:00
chore: add new component for finding status and add sorting to the findings table
This commit is contained in:
5 files changed
+85
-35
No files matched your search
@@ -4,4 +4,5 @@ export * from "./data-table-filter-custom";
|
||||
export * from "./data-table-pagination";
|
||||
export * from "./severity-badge";
|
||||
export * from "./status-badge";
|
||||
export * from "./status-finding-badge";
|
||||
export * from "./table";
|
||||
@@ -37,7 +37,8 @@ export const SeverityBadge = ({ severity }: { severity: Severity }) => {
|
||||
return (
|
||||
<Chip
|
||||
className={clsx("gap-1 border-none capitalize text-default-600", {
|
||||
"bg-rose-700/20": severity === "critical",
|
||||
"bg-system-severity-critical text-white dark:text-white":
|
||||
severity === "critical",
|
||||
})}
|
||||
size="sm"
|
||||
variant="flat"
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Chip } from "@nextui-org/react";
|
||||
import React from "react";
|
||||
|
||||
export type FindingStatus = "FAIL" | "PASS" | "MANUAL" | "MUTED";
|
||||
|
||||
const statusColorMap: Record<
|
||||
FindingStatus,
|
||||
"danger" | "warning" | "success" | "default"
|
||||
> = {
|
||||
FAIL: "danger",
|
||||
PASS: "success",
|
||||
MANUAL: "warning",
|
||||
MUTED: "default",
|
||||
};
|
||||
|
||||
export const StatusFindingBadge = ({
|
||||
status,
|
||||
size = "sm",
|
||||
...props
|
||||
}: {
|
||||
status: FindingStatus;
|
||||
size?: "sm" | "md" | "lg";
|
||||
}) => {
|
||||
const color = statusColorMap[status];
|
||||
|
||||
return (
|
||||
<Chip
|
||||
className="gap-1 border-none px-2 py-4 capitalize text-default-600"
|
||||
size={size}
|
||||
variant="flat"
|
||||
color={color}
|
||||
{...props}
|
||||
>
|
||||
{status}
|
||||
</Chip>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user