Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
use conventional styles
Thiago Araujo da Silva7a6d407a7faa
diff --git a/frontend/src/hooks/api/alerts/mutations.ts b/frontend/src/hooks/api/alerts/mutations.tsindex 8d6406f96b..5ac8bcfbbe 100644--- a/frontend/src/hooks/api/alerts/mutations.ts+++ b/frontend/src/hooks/api/alerts/mutations.ts@@ -33,3 +33,20 @@ export const useUpdateAlert = () => {}});};++export const useDeleteAlert = () => {+ const queryClient = useQueryClient();++ return useMutation<{ id: string }, unknown, { alertId: string }>({+ mutationFn: async ({ alertId }) => {+ const { data } = await apiRequest.delete<{ alert: { id: string } }>(+ `/api/v1/alerts/${alertId}`+ );+ return data.alert;+ },+ onSuccess: (_, { alertId }) => {+ queryClient.invalidateQueries({ queryKey: alertKeys.all });+ queryClient.invalidateQueries({ queryKey: alertKeys.byId(alertId) });+ }+ });+};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsxindex b8ac8515aa..bbe84aaa9d 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAlertDetail.tsx@@ -1,6 +1,8 @@-import { BellPlusIcon, PencilIcon } from "lucide-react";+import { BellPlusIcon, 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,@@ -20,6 +22,7 @@ import {AlertEventType,AlertResourceType,TAlert,+ useDeleteAlert,useListAlerts} from "@app/hooks/api/alerts";import { AddAlertModal } from "@app/views/AlertsPage/components/AddAlertModal";@@ -40,7 +43,9 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {resourceId: identityId});- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["alert"] as const);+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["alert", "deleteAlert"] as const);++ const deleteAlert = useDeleteAlert();const existingAlert = alerts[0] as TAlert | undefined;const eventLabel = existingAlert@@ -48,14 +53,39 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {existingAlert.eventType): "";+ const handleDeleteAlert = async () => {+ if (!existingAlert) return;++ try {+ await deleteAlert.mutateAsync({ alertId: existingAlert.id });+ createNotification({ text: "Successfully deleted alert", type: "success" });+ handlePopUpToggle("deleteAlert", false);+ } catch {+ createNotification({ text: "Failed to delete alert", type: "error" });+ }+ };+return (<Detail><DetailLabel>Alert</DetailLabel><DetailValue>{existingAlert ? (- <div className="flex w-full items-center justify-between gap-2 rounded-md border border-mineshaft-600 p-3">+ <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">- <span className="truncate font-medium text-foreground">{existingAlert.name}</span>+ <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) => {@@ -63,7 +93,7 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {return (<Tooltip key={channel.id}><TooltipTrigger asChild>- <span className="flex size-6 items-center justify-center rounded border border-mineshaft-600 text-muted">+ <span className="flex size-6 items-center justify-center rounded border border-border text-muted"><Icon className="size-3.5" /></span></TooltipTrigger>@@ -75,21 +105,41 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {})}</div></div>- <OrgPermissionCan- I={OrgPermissionIdentityActions.Edit}- a={OrgPermissionSubjects.Identity}- >- {(isAllowed) => (- <IconButton- isDisabled={!isAllowed}- onClick={() => handlePopUpOpen("alert")}- variant="ghost"- size="xs"- >- <PencilIcon />- </IconButton>- )}- </OrgPermissionCan>+ <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>) : (<OrgPermissionCan@@ -117,6 +167,13 @@ export const IdentityAlertDetail = ({ identityId, identityName }: Props) => {resourceName={identityName}alert={existingAlert}/>+ <DeleteActionModal+ isOpen={popUp.deleteAlert.isOpen}+ title={`Are you sure you want to delete the alert ${existingAlert?.name ?? ""}?`}+ onChange={(isOpen) => handlePopUpToggle("deleteAlert", isOpen)}+ deleteKey="confirm"+ onDeleteApproved={handleDeleteAlert}+ /></Detail>);};diff --git a/frontend/src/views/AlertsPage/components/AlertForm.tsx b/frontend/src/views/AlertsPage/components/AlertForm.tsxindex faf2d98dd3..88a20ac37a 100644--- a/frontend/src/views/AlertsPage/components/AlertForm.tsx+++ b/frontend/src/views/AlertsPage/components/AlertForm.tsx@@ -61,7 +61,7 @@ type Props = {};const SectionHeader = ({ step, title }: { step: number; title: string }) => (- <p className="text-xs font-semibold tracking-wider text-mineshaft-400 uppercase">+ <p className="text-xs font-semibold text-label">{step} · {title}</p>);@@ -71,7 +71,7 @@ const SectionHeader = ({ step, title }: { step: number; title: string }) => (const FixedField = ({ label, children }: { label: string; children: ReactNode }) => (<div className="flex flex-col gap-1.5"><FieldLabel>{label}</FieldLabel>- <Card className="flex-row items-center justify-between p-4">+ <Card className="flex-row items-center justify-between gap-3"><div className="flex items-center gap-3">{children}</div><span className="flex items-center gap-1 text-xs text-muted"><LockIcon className="size-3" />@@ -282,7 +282,7 @@ export const AlertForm = ({<Field><FieldLabel htmlFor="alert-description">- Description <span className="text-mineshaft-400">(optional)</span>+ Description <span className="text-muted">(optional)</span></FieldLabel><FieldContent><TextArea@@ -316,7 +316,7 @@ export const AlertForm = ({{Object.values(AlertResourceType).map((resourceType) => (<SelectItem key={resourceType} value={resourceType}><span className="flex items-center gap-2">- <KeyRoundIcon className="size-4 text-blue-400" />+ <KeyRoundIcon className="size-4 text-muted" /><span className="font-medium">{ALERT_RESOURCE_TYPE_LABELS[resourceType]}</span>@@ -355,7 +355,7 @@ export const AlertForm = ({<SelectItem key={eventType} value={eventType}><span className="flex items-center gap-2"><Badge variant="warning">{ALERT_EVENT_TYPE_LABELS[eventType]}</Badge>- <span className="text-mineshaft-300">+ <span className="text-muted">Fires as the credential nears expiration</span></span>@@ -372,7 +372,7 @@ export const AlertForm = ({<FieldLabel>Condition</FieldLabel><div className="flex flex-col gap-1"><div className="flex items-center gap-3">- <span className="text-sm text-mineshaft-100">Alert before</span>+ <span className="text-sm text-foreground">Alert before</span><Inputid="alert-alert-before"type="number"@@ -391,7 +391,7 @@ export const AlertForm = ({</SelectTrigger><SelectContent position="popper">{Object.values(AlertTimeUnit).map((unit) => (- <SelectItem key={unit} value={unit} className="capitalize">+ <SelectItem key={unit} value={unit}>{ALERT_TIME_UNIT_LABELS[unit]}</SelectItem>))}diff --git a/frontend/src/views/AlertsPage/components/ChannelCard.tsx b/frontend/src/views/AlertsPage/components/ChannelCard.tsxindex b4f95d6089..fa561566a3 100644--- a/frontend/src/views/AlertsPage/components/ChannelCard.tsx+++ b/frontend/src/views/AlertsPage/components/ChannelCard.tsx@@ -146,7 +146,7 @@ export const ChannelCard = ({ index, projectId, onRemove, canRemove }: Props) =></Field><Field><FieldLabel htmlFor={`channel-${index}-signingSecret`}>- Signing secret <span className="text-mineshaft-400">(optional)</span>+ Signing secret <span className="text-muted">(optional)</span></FieldLabel><FieldContent><Inputdiff --git a/frontend/src/views/AlertsPage/components/ChannelsField.tsx b/frontend/src/views/AlertsPage/components/ChannelsField.tsxindex 1f6abedbe9..a5a6e51ecb 100644--- a/frontend/src/views/AlertsPage/components/ChannelsField.tsx+++ b/frontend/src/views/AlertsPage/components/ChannelsField.tsx@@ -48,7 +48,7 @@ export const ChannelsField = ({ projectId }: Props) => {<div className="flex items-center justify-between"><div className="flex flex-col"><FieldLabel>- Channels <span className="text-red">*</span>+ Channels <span className="text-danger">*</span></FieldLabel><span className="text-xs text-muted">Add at least one delivery channel.</span></div>@@ -78,7 +78,7 @@ export const ChannelsField = ({ projectId }: Props) => {</DropdownMenu></div>- {rootError && <p className="text-xs text-red-500">{rootError}</p>}+ {rootError && <p className="text-xs text-danger">{rootError}</p>}{fields.length === 0 ? (<div className="rounded-lg border border-dashed border-border p-4 text-center text-sm text-muted">