mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-12 23:29:15 +00:00
- Changed PAM session status from 'Expired' to 'Ended' in the database update logic and service layer for clarity. - Updated the PamSessionStatus enum to consolidate the definitions of 'Ended' and 'Expired', reflecting that 'Ended' can result from both user action and automatic expiration. - Removed references to 'Expired' in the frontend components and adjusted related UI elements for consistency.
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import {
|
|
ActivityIcon,
|
|
BanIcon,
|
|
ChevronsLeftRightEllipsisIcon,
|
|
GavelIcon,
|
|
LucideIcon
|
|
} from "lucide-react";
|
|
|
|
import { Badge, TBadgeProps } from "@app/components/v3";
|
|
import { PamSessionStatus } from "@app/hooks/api/pam";
|
|
|
|
interface StatusConfig {
|
|
variant: TBadgeProps["variant"];
|
|
icon: LucideIcon;
|
|
className?: string;
|
|
}
|
|
|
|
const PAM_SESSION_STATUS_CONFIG: Record<PamSessionStatus, StatusConfig> = {
|
|
[PamSessionStatus.Active]: {
|
|
variant: "success",
|
|
icon: ActivityIcon,
|
|
className: "animate-pulse"
|
|
},
|
|
[PamSessionStatus.Terminated]: {
|
|
variant: "danger",
|
|
icon: GavelIcon
|
|
},
|
|
[PamSessionStatus.Starting]: {
|
|
variant: "info",
|
|
icon: ChevronsLeftRightEllipsisIcon,
|
|
className: "animate-pulse"
|
|
},
|
|
[PamSessionStatus.Ended]: {
|
|
variant: "neutral",
|
|
icon: BanIcon
|
|
}
|
|
};
|
|
|
|
export const PamSessionStatusBadge = ({ status }: { status: PamSessionStatus }) => {
|
|
const config = PAM_SESSION_STATUS_CONFIG[status];
|
|
|
|
const displayName = status[0].toUpperCase() + status.slice(1);
|
|
|
|
const Icon = config.icon;
|
|
|
|
return (
|
|
<Badge variant={config.variant} className={config.className}>
|
|
<Icon />
|
|
{displayName}
|
|
</Badge>
|
|
);
|
|
};
|