import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; import { Button, DeleteActionModal } from "@app/components/v2"; import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context"; import { useDeletePkiAlert } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { PkiAlertModal } from "./PkiAlertModal"; import { PkiAlertsTable } from "./PkiAlertsTable"; export const PkiAlertsSection = () => { const { currentProject } = useProject(); const projectId = currentProject?.id || ""; const { mutateAsync: deletePkiAlert } = useDeletePkiAlert(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "pkiAlert", "deletePkiAlert" ] as const); const onRemoveAlertSubmit = async (alertId: string) => { try { if (!projectId) return; await deletePkiAlert({ alertId, projectId }); createNotification({ text: "Successfully deleted alert", type: "success" }); handlePopUpClose("deletePkiAlert"); } catch (err) { console.error(err); createNotification({ text: "Failed to delete alert", type: "error" }); } }; return (

Alerts

{(isAllowed) => ( )}
handlePopUpToggle("deletePkiAlert", isOpen)} deleteKey="confirm" onDeleteApproved={() => onRemoveAlertSubmit((popUp?.deletePkiAlert?.data as { alertId: string })?.alertId) } />
); };