import { faArrowRight, 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 { ProjectPermissionCertificateActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { useDeleteCert } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { CertificateCertModal } from "./CertificateCertModal"; import { CertificateImportModal } from "./CertificateImportModal"; import { CertificateModal } from "./CertificateModal"; import { CertificateRevocationModal } from "./CertificateRevocationModal"; import { CertificatesTable } from "./CertificatesTable"; export const CertificatesSection = () => { const { currentWorkspace } = useWorkspace(); const { mutateAsync: deleteCert } = useDeleteCert(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "certificate", "certificateImport", "certificateCert", "deleteCertificate", "revokeCertificate" ] as const); const onRemoveCertificateSubmit = async (serialNumber: string) => { try { if (!currentWorkspace?.slug) return; await deleteCert({ serialNumber, projectSlug: currentWorkspace.slug }); createNotification({ text: "Successfully deleted certificate", type: "success" }); handlePopUpClose("deleteCertificate"); } catch (err) { console.error(err); createNotification({ text: "Failed to delete certificate", type: "error" }); } }; return (
Certificates