Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

minimalist card

Thiago Araujo da Silva7f689c292448
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx
index bbe84aaa9d..48efb97359 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx
@@ -1,32 +1,23 @@
-import { BellPlusIcon, PencilIcon, TrashIcon } from "lucide-react";
+import { BellPlusIcon, MoreHorizontalIcon, PencilIcon, TrashIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
import {
- Badge,
Button,
Detail,
DetailLabel,
DetailValue,
- IconButton,
- Tooltip,
- TooltipContent,
- TooltipTrigger
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ IconButton
} from "@app/components/v3";
import { OrgPermissionIdentityActions, OrgPermissionSubjects } from "@app/context";
import { usePopUp } from "@app/hooks";
-import {
- ALERT_CHANNEL_TYPE_LABELS,
- ALERT_EVENT_TYPE_LABELS,
- AlertEventType,
- AlertResourceType,
- TAlert,
- useDeleteAlert,
- useListAlerts
-} from "@app/hooks/api/alerts";
+import { AlertResourceType, TAlert, useDeleteAlert, useListAlerts } from "@app/hooks/api/alerts";
import { AddAlertModal } from "@app/views/AlertsPage/components/AddAlertModal";
-import { getChannelIcon } from "@app/views/AlertsPage/components/channelIcons";
type Props = {
identityId: string;
@@ -48,10 +39,6 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {
const deleteAlert = useDeleteAlert();
const existingAlert = alerts[0] as TAlert | undefined;
- const eventLabel = existingAlert
- ? (ALERT_EVENT_TYPE_LABELS[existingAlert.eventType as AlertEventType] ??
- existingAlert.eventType)
- : "";
const handleDeleteAlert = async () => {
if (!existingAlert) return;
@@ -70,76 +57,47 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {
<DetailLabel>Alert</DetailLabel>
<DetailValue>
{existingAlert ? (
- <div className="flex w-full items-center justify-between gap-2 rounded-md border border-border p-3">
- <div className="flex min-w-0 flex-col gap-2">
- <div className="flex items-center gap-2">
- <span className="truncate text-foreground">{existingAlert.name}</span>
- {existingAlert.enabled ? (
- <span className="flex items-center gap-1.5 text-sm text-success">
- <span className="size-1.5 rounded-full bg-success" aria-hidden />
- Enabled
- </span>
- ) : (
- <span className="flex items-center gap-1.5 text-sm text-muted">
- <span className="size-1.5 rounded-full bg-muted" aria-hidden />
- Disabled
- </span>
- )}
- </div>
- <div className="flex flex-wrap items-center gap-1.5">
- <Badge variant="warning">{eventLabel}</Badge>
- {existingAlert.channels.map((channel) => {
- const Icon = getChannelIcon(channel.channelType);
- return (
- <Tooltip key={channel.id}>
- <TooltipTrigger asChild>
- <span className="flex size-6 items-center justify-center rounded border border-border text-muted">
- <Icon className="size-3.5" />
- </span>
- </TooltipTrigger>
- <TooltipContent>
- {channel.name} · {ALERT_CHANNEL_TYPE_LABELS[channel.channelType]}
- </TooltipContent>
- </Tooltip>
- );
- })}
- </div>
- </div>
- <div className="flex items-center gap-1">
- <OrgPermissionCan
- I={OrgPermissionIdentityActions.Edit}
- a={OrgPermissionSubjects.Identity}
- >
- {(isAllowed) => (
- <IconButton
- aria-label="Edit alert"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("alert")}
- variant="ghost"
- size="xs"
- >
- <PencilIcon />
- </IconButton>
- )}
- </OrgPermissionCan>
- <OrgPermissionCan
- I={OrgPermissionIdentityActions.Edit}
- a={OrgPermissionSubjects.Identity}
- >
- {(isAllowed) => (
- <IconButton
- aria-label="Delete alert"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("deleteAlert")}
- variant="ghost"
- size="xs"
- className="hover:text-danger"
- >
- <TrashIcon />
- </IconButton>
- )}
- </OrgPermissionCan>
- </div>
+ <div className="flex w-full items-center gap-2 rounded-md border border-border p-3">
+ <span
+ className={`size-2 shrink-0 rounded-full ${existingAlert.enabled ? "bg-success" : "bg-muted"}`}
+ title={existingAlert.enabled ? "Enabled" : "Disabled"}
+ aria-hidden
+ />
+ <span className="min-w-0 flex-1 truncate text-xs text-foreground">
+ {existingAlert.name}
+ </span>
+ <OrgPermissionCan
+ I={OrgPermissionIdentityActions.Edit}
+ a={OrgPermissionSubjects.Identity}
+ >
+ {(isAllowed) => (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ aria-label="Alert actions"
+ isDisabled={!isAllowed}
+ variant="ghost"
+ size="xs"
+ >
+ <MoreHorizontalIcon />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => handlePopUpOpen("alert")}>
+ <PencilIcon />
+ Edit
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant="danger"
+ onClick={() => handlePopUpOpen("deleteAlert")}
+ >
+ <TrashIcon />
+ Remove
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </OrgPermissionCan>
</div>
) : (
<OrgPermissionCan