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
Cert Manager UI revamp: Profiles + External Certificate Authorities + certificate issuance UI + PKI Syncs
Carlos Monastyrski2a73ef954f48
diff --git a/frontend/src/components/pki-syncs/CertificateManagementModal.tsx b/frontend/src/components/pki-syncs/CertificateManagementModal.tsxindex 48e22729ad..2ff25d25e6 100644--- a/frontend/src/components/pki-syncs/CertificateManagementModal.tsx+++ b/frontend/src/components/pki-syncs/CertificateManagementModal.tsx@@ -1,26 +1,36 @@import React, { useEffect, useState } from "react";-import { faSearch, faX } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { ScrollText, Search, X } from "lucide-react";import { createNotification } from "@app/components/notifications";import {Button,Checkbox,- EmptyState,- Input,- Modal,- ModalContent,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Empty,+ EmptyDescription,+ EmptyMedia,+ EmptyTitle,+ InputGroup,+ InputGroupAddon,+ InputGroupInput,Pagination,Table,- TableContainer,- TBody,- Td,- Th,- THead,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,Tooltip,- Tr-} from "@app/components/v2";+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useProject } from "@app/context";+import { getCertificateDisplayName, truncateCertificateSerialNumber } from "@app/helpers/pkiSyncs";import {CertStatus,useAddCertificatesToPkiSync,@@ -258,12 +268,17 @@ export const CertificateManagementModal = ({onClose();} else {const partialSuccess = successes.length > 0;- console.error("Certificate sync operation failures:", failures);++ const firstError = failures.map((f) => (f as { error?: unknown }).error).find(Boolean) as+ | { response?: { data?: { message?: string } }; message?: string }+ | undefined;+ const reason =+ firstError?.response?.data?.message ?? firstError?.message ?? "Please try again.";createNotification({text: partialSuccess- ? "Some certificate changes failed. Check console for details."- : "Failed to update certificate selection",+ ? `Some certificate changes could not be saved: ${reason}`+ : `Failed to update certificate selection: ${reason}`,type: partialSuccess ? "warning" : "error"});@@ -283,178 +298,169 @@ export const CertificateManagementModal = ({const isLoading = addCertificatesToSync.isPending || removeCertificatesFromSync.isPending;return (- <Modal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>- <ModalContent title={title} subTitle={subtitle} className="max-w-4xl">+ <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>+ <DialogContent className="max-w-4xl">+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ <DialogDescription>{subtitle}</DialogDescription>+ </DialogHeader>+<div className="space-y-4">- <div className="space-y-3">- <div className="relative">- <Input- placeholder="Search by common name, serial number, or SAN..."- value={searchTerm}- onChange={(e) => {- setSearchTerm(e.target.value);- setCurrentPage(1);- }}- className="pl-9"- />- <FontAwesomeIcon- icon={faSearch}- className="absolute top-1/2 left-3 h-3 w-3 -translate-y-1/2 transform text-bunker-300"- />- {searchTerm && (+ <InputGroup>+ <InputGroupAddon align="inline-start">+ <Search />+ </InputGroupAddon>+ <InputGroupInput+ placeholder="Search by common name, serial number, or SAN..."+ value={searchTerm}+ onChange={(e) => {+ setSearchTerm(e.target.value);+ setCurrentPage(1);+ }}+ />+ {searchTerm && (+ <InputGroupAddon align="inline-end"><buttontype="button"+ aria-label="Clear search"onClick={clearSearch}- className="absolute top-1/2 right-3 -translate-y-1/2 transform text-bunker-300 hover:text-bunker-100"+ className="cursor-pointer text-muted transition-colors hover:text-foreground">- <FontAwesomeIcon icon={faX} className="h-3 w-3" />+ <X className="size-3.5" /></button>- )}- </div>- </div>-- <TableContainer>- <Table>- <THead>- <Tr>- <Th className="w-12">- {!isSingleSelect && (- <Checkbox- id="select-all-certificates"- isChecked={- allCertificates.length > 0 &&- allCertificates.every((cert) => selectedIds.includes(cert.id))- }- onCheckedChange={handleSelectAll}- />- )}- </Th>- <Th className="w-1/3">SAN / CN</Th>- <Th className="w-1/4">Serial Number</Th>- <Th className="w-1/6">Issued At</Th>- <Th className="w-1/6">Expires At</Th>- </Tr>- </THead>- <TBody>- {allCertificates.map((cert) => {- const isExpired = new Date(cert.notAfter) < new Date();- const isRevoked = cert.status === CertStatus.REVOKED;- const cannotBeAdded = isExpired || isRevoked;- const isAlreadySynced = syncedCertificateIds.includes(cert.id);-- let originalDisplayName = "—";- if (cert.altNames && cert.altNames.trim()) {- originalDisplayName = cert.altNames.trim();- } else if (cert.commonName && cert.commonName.trim()) {- originalDisplayName = cert.commonName.trim();- }-- let displayName = originalDisplayName;- let isTruncated = false;- if (originalDisplayName.length > 34) {- displayName = `${originalDisplayName.substring(0, 34)}...`;- isTruncated = true;- }-- const truncatedSerial =- cert.serialNumber.length > 8- ? `${cert.serialNumber.slice(0, 4)}...${cert.serialNumber.slice(-4)}`- : cert.serialNumber;-- return (- <Tr- key={cert.id}- className={`cursor-pointer hover:bg-mineshaft-700 ${- cannotBeAdded && !isAlreadySynced ? "opacity-50" : ""- }`}- onClick={() => {- if (!cannotBeAdded || isAlreadySynced) {- handleToggleSelection(cert.id);- }- }}- >- <Td className="max-w-0" onClick={(e) => e.stopPropagation()}>+ </InputGroupAddon>+ )}+ </InputGroup>++ <div>+ {allCertificates.length === 0 ? (+ <Empty className="border">+ <EmptyMedia variant="icon">+ <ScrollText />+ </EmptyMedia>+ <EmptyTitle>No certificates found</EmptyTitle>+ <EmptyDescription>+ {searchTerm+ ? "No certificates match your search criteria."+ : "No certificates available for sync."}+ </EmptyDescription>+ </Empty>+ ) : (+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead className="w-12">+ {!isSingleSelect && (<Checkbox- id={cert.id}- isChecked={selectedIds.includes(cert.id)}- onCheckedChange={() => {- if (!cannotBeAdded || isAlreadySynced) {- handleToggleSelection(cert.id);- }- }}- isDisabled={cannotBeAdded && !isAlreadySynced}+ id="select-all-certificates"+ variant="project"+ isChecked={+ allCertificates.length > 0 &&+ allCertificates.every((cert) => selectedIds.includes(cert.id))+ }+ onCheckedChange={handleSelectAll}/>- </Td>- <Td className="max-w-0">- {isTruncated ? (- <Tooltip content={originalDisplayName} className="max-w-lg">+ )}+ </TableHead>+ <TableHead className="w-1/3">SAN / CN</TableHead>+ <TableHead className="w-1/4">Serial Number</TableHead>+ <TableHead className="w-1/6">Issued At</TableHead>+ <TableHead className="w-1/6">Expires At</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {allCertificates.map((cert) => {+ const isExpired = new Date(cert.notAfter) < new Date();+ const isRevoked = cert.status === CertStatus.REVOKED;+ const cannotBeAdded = isExpired || isRevoked;+ const isAlreadySynced = syncedCertificateIds.includes(cert.id);++ const { originalDisplayName, displayName, isTruncated } =+ getCertificateDisplayName(cert);+ const truncatedSerial = truncateCertificateSerialNumber(cert.serialNumber);++ return (+ <TableRow+ key={cert.id}+ className={`cursor-pointer ${+ cannotBeAdded && !isAlreadySynced ? "opacity-50" : ""+ }`}+ onClick={() => {+ if (!cannotBeAdded || isAlreadySynced) {+ handleToggleSelection(cert.id);+ }+ }}+ >+ <TableCell className="max-w-0" onClick={(e) => e.stopPropagation()}>+ <Checkbox+ id={cert.id}+ variant="project"+ isChecked={selectedIds.includes(cert.id)}+ onCheckedChange={() => {+ if (!cannotBeAdded || isAlreadySynced) {+ handleToggleSelection(cert.id);+ }+ }}+ isDisabled={cannotBeAdded && !isAlreadySynced}+ />+ </TableCell>+ <TableCell className="max-w-0">+ {isTruncated ? (+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="truncate">{displayName}</div>+ </TooltipTrigger>+ <TooltipContent className="max-w-lg">+ {originalDisplayName}+ </TooltipContent>+ </Tooltip>+ ) : (<div className="truncate">{displayName}</div>- </Tooltip>- ) : (- <div className="truncate">{displayName}</div>- )}- </Td>- <Td className="max-w-0">- <div- className="font-mono text-xs text-bunker-300"- title={cert.serialNumber}- >- {truncatedSerial}- </div>- </Td>- <Td className="max-w-0">- <span className="text-sm text-bunker-300">- {new Date(cert.notBefore).toLocaleDateString()}- </span>- </Td>- <Td className="max-w-0">- <span- className={`text-sm ${isExpired ? "text-red-400" : "text-bunker-300"}`}- >- {new Date(cert.notAfter).toLocaleDateString()}- </span>- </Td>- </Tr>- );- })}- </TBody>- </Table>- {allCertificates.length === 0 && (- <EmptyState title="No certificates found">- {searchTerm- ? "No certificates match your search criteria."- : "No certificates available for sync."}- </EmptyState>+ )}+ </TableCell>+ <TableCell className="max-w-0">+ <div className="font-mono text-xs text-muted" title={cert.serialNumber}>+ {truncatedSerial}+ </div>+ </TableCell>+ <TableCell className="max-w-0">+ <span className="text-sm text-muted">+ {new Date(cert.notBefore).toLocaleDateString()}+ </span>+ </TableCell>+ <TableCell className="max-w-0">+ <span className={`text-sm ${isExpired ? "text-danger" : "text-muted"}`}>+ {new Date(cert.notAfter).toLocaleDateString()}+ </span>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>)}- </TableContainer>-- {totalPages > 1 && (- <div className="mt-4 flex justify-center">+ {totalPages > 1 && (<Paginationcount={totalCount}page={currentPage}perPage={pageSize}onChangePage={(page: number) => setCurrentPage(page)}onChangePerPage={() => {}}+ perPageList={[pageSize]}/>- </div>- )}+ )}+ </div></div>- <div className="mt-6 flex justify-end gap-2">- <Button variant="outline_bg" onClick={onClose}>+ <DialogFooter>+ <Button variant="outline" onClick={onClose}>Cancel</Button>- <Button- variant="solid"- colorSchema="primary"- onClick={handleSaveCertificates}- isLoading={isLoading}- >+ <Button variant="project" onClick={handleSaveCertificates} isPending={isLoading}>{saveButtonText}</Button>- </div>- </ModalContent>- </Modal>+ </DialogFooter>+ </DialogContent>+ </Dialog>);};diff --git a/frontend/src/components/pki-syncs/CreatePkiSyncModal.tsx b/frontend/src/components/pki-syncs/CreatePkiSyncModal.tsxindex a5480eaafd..b1af492770 100644--- a/frontend/src/components/pki-syncs/CreatePkiSyncModal.tsx+++ b/frontend/src/components/pki-syncs/CreatePkiSyncModal.tsx@@ -1,8 +1,25 @@import { useEffect, useState } from "react";+import { AlertTriangleIcon, ArrowLeftIcon } from "lucide-react";-import { Modal, ModalContent } from "@app/components/v2";-import { PkiSync, TPkiSync } from "@app/hooks/api/pkiSyncs";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetHeader,+ SheetTitle+} from "@app/components/v3";+import { PkiSync } from "@app/hooks/api/pkiSyncs";+import { TPkiSyncForm } from "./forms/schemas/pki-sync-schema";import { CreatePkiSyncForm } from "./forms";import { PkiSyncModalHeader } from "./PkiSyncModalHeader";import { PkiSyncSelect } from "./PkiSyncSelect";@@ -11,90 +28,106 @@ type Props = {isOpen: boolean;onOpenChange: (isOpen: boolean) => void;selectSync?: PkiSync | null;- initialData?: any;+ initialData?: Partial<TPkiSyncForm>;applicationId?: string;};-type ContentProps = {- onComplete: (pkiSync: TPkiSync) => void;- selectedSync: PkiSync | null;- setSelectedSync: (selectedSync: PkiSync | null) => void;- initialData?: any;- applicationId?: string;-};--const Content = ({- onComplete,- setSelectedSync,- selectedSync,- initialData,- applicationId-}: ContentProps) => {- if (selectedSync) {- return (- <CreatePkiSyncForm- onComplete={onComplete}- onCancel={() => setSelectedSync(null)}- destination={selectedSync}- initialData={initialData}- applicationId={applicationId}- />- );- }-- return <PkiSyncSelect onSelect={setSelectedSync} />;-};-export const CreatePkiSyncModal = ({+ isOpen,onOpenChange,selectSync = null,initialData,- applicationId,- ...props+ applicationId}: Props) => {const [selectedSync, setSelectedSync] = useState<PkiSync | null>(selectSync);+ const [confirmDiscardOpen, setConfirmDiscardOpen] = useState(false);useEffect(() => {setSelectedSync(selectSync);}, [selectSync]);+ const closeSheet = () => {+ setConfirmDiscardOpen(false);+ setSelectedSync(null);+ onOpenChange(false);+ };++ const handleSheetOpenChange = (nextOpen: boolean) => {+ if (!nextOpen && selectedSync) {+ setConfirmDiscardOpen(true);+ return;+ }+ if (!nextOpen) setSelectedSync(null);+ onOpenChange(nextOpen);+ };++ const showBack = !selectSync && Boolean(selectedSync);+return (- <Modal- {...props}- onOpenChange={(isOpen) => {- if (!isOpen) setSelectedSync(null);- onOpenChange(isOpen);- }}- >- {/* z-50 (not the v2 default z-[60]) so the inline "Create Connection" Sheet and its v3 Select- menus (all z-50, portaled later) stack above this modal instead of being buried behind it,- while the backdrop still covers page chrome up to z-50 by portal order. */}- <ModalContent- overlayClassName="z-50"- title={- selectedSync ? (- <PkiSyncModalHeader isConfigured={false} destination={selectedSync} />+ <>+ <Sheet open={isOpen} onOpenChange={handleSheetOpenChange}>+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 p-0 sm:max-w-[1500px]">+ <SheetHeader className="border-b">+ {selectedSync ? (+ <>+ {showBack && (+ <button+ type="button"+ onClick={() => setSelectedSync(null)}+ className="mb-1 flex w-fit cursor-pointer items-center gap-1 text-xs text-muted transition-colors hover:text-foreground hover:underline"+ >+ <ArrowLeftIcon className="size-3" />+ Select Another Service+ </button>+ )}+ <SheetTitle>+ <PkiSyncModalHeader isConfigured={false} destination={selectedSync} />+ </SheetTitle>+ </>+ ) : (+ <>+ <SheetTitle>Add Sync</SheetTitle>+ <SheetDescription>+ Select a third-party service to sync certificates to.+ </SheetDescription>+ </>+ )}+ </SheetHeader>+ {selectedSync ? (+ <CreatePkiSyncForm+ onComplete={closeSheet}+ onCancel={() => setSelectedSync(null)}+ destination={selectedSync}+ initialData={initialData}+ applicationId={applicationId}+ />) : (- "Add Sync"- )- }- className="z-50 max-w-3xl"- bodyClassName={selectedSync ? "overflow-visible" : undefined}- subTitle={- selectedSync ? undefined : "Select a third-party service to sync certificates to."- }- >- <Content- onComplete={() => {- setSelectedSync(null);- onOpenChange(false);- }}- selectedSync={selectedSync}- setSelectedSync={setSelectedSync}- initialData={initialData}- applicationId={applicationId}- />- </ModalContent>- </Modal>+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto p-6">+ <PkiSyncSelect onSelect={setSelectedSync} />+ </div>+ )}+ </SheetContent>+ </Sheet>++ <AlertDialog open={confirmDiscardOpen} onOpenChange={setConfirmDiscardOpen}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <AlertTriangleIcon />+ </AlertDialogMedia>+ <AlertDialogTitle>Discard sync setup?</AlertDialogTitle>+ <AlertDialogDescription>+ Your progress configuring this sync will be lost.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Keep Editing</AlertDialogCancel>+ <AlertDialogAction variant="danger" onClick={closeSheet}>+ Discard+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </>);};diff --git a/frontend/src/components/pki-syncs/DeletePkiSyncModal.tsx b/frontend/src/components/pki-syncs/DeletePkiSyncModal.tsxindex c01efcbf2b..40f20829d6 100644--- a/frontend/src/components/pki-syncs/DeletePkiSyncModal.tsx+++ b/frontend/src/components/pki-syncs/DeletePkiSyncModal.tsx@@ -1,5 +1,22 @@+import { useEffect, useState } from "react";+import { Trash2Icon } from "lucide-react";+import { createNotification } from "@app/components/notifications";-import { DeleteActionModal } from "@app/components/v2";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Field,+ FieldContent,+ FieldLabel,+ Input+} from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import { TPkiSync, useDeletePkiSync } from "@app/hooks/api/pkiSyncs";@@ -12,13 +29,20 @@ type Props = {export const DeletePkiSyncModal = ({ isOpen, onOpenChange, pkiSync, onComplete }: Props) => {const deleteSync = useDeletePkiSync();+ const [inputData, setInputData] = useState("");++ useEffect(() => {+ setInputData("");+ }, [isOpen]);if (!pkiSync) return null;const { id: syncId, name, destination, projectId } = pkiSync;+ const destinationName = PKI_SYNC_MAP[destination].name;+ const isConfirmed = inputData === name;const handleDeletePkiSync = async () => {- const destinationName = PKI_SYNC_MAP[destination].name;+ if (!isConfirmed) return;await deleteSync.mutateAsync({syncId,@@ -27,21 +51,56 @@ export const DeletePkiSyncModal = ({ isOpen, onOpenChange, pkiSync, onComplete }});createNotification({- text: `Successfully deleted ${destinationName} PKI Sync`,+ text: `Successfully deleted ${destinationName} Certificate Sync`,type: "success"});- if (onComplete) onComplete();+ onComplete?.();onOpenChange(false);};return (- <DeleteActionModal- isOpen={isOpen}- onChange={onOpenChange}- title={`Are you sure you want to delete ${name}?`}- deleteKey={name}- onDeleteApproved={handleDeletePkiSync}- />+ <AlertDialog open={isOpen} onOpenChange={onOpenChange}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <Trash2Icon />+ </AlertDialogMedia>+ <AlertDialogTitle>Are you sure you want to delete {name}?</AlertDialogTitle>+ <AlertDialogDescription>This action is irreversible.</AlertDialogDescription>+ </AlertDialogHeader>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ handleDeletePkiSync();+ }}+ >+ <Field>+ <FieldLabel>+ Type <span className="font-bold">{name}</span> to confirm+ </FieldLabel>+ <FieldContent>+ <Input+ value={inputData}+ onChange={(e) => setInputData(e.target.value)}+ placeholder={`Type ${name} here`}+ autoComplete="off"+ />+ </FieldContent>+ </Field>+ </form>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ onClick={handleDeletePkiSync}+ disabled={!isConfirmed}+ isPending={deleteSync.isPending}+ >+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>);};diff --git a/frontend/src/components/pki-syncs/EditPkiSyncModal.tsx b/frontend/src/components/pki-syncs/EditPkiSyncModal.tsxindex f3868f39e5..f91d9b41ee 100644--- a/frontend/src/components/pki-syncs/EditPkiSyncModal.tsx+++ b/frontend/src/components/pki-syncs/EditPkiSyncModal.tsx@@ -1,5 +1,21 @@-import { PkiSyncEditFields } from "@app/components/pki-syncs/types";-import { Modal, ModalContent } from "@app/components/v2";+import { useState } from "react";+import { AlertTriangleIcon } from "lucide-react";++import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Sheet,+ SheetContent,+ SheetHeader,+ SheetTitle+} from "@app/components/v3";import { TPkiSync } from "@app/hooks/api/pkiSyncs";import { EditPkiSyncForm } from "./forms";@@ -9,28 +25,66 @@ type Props = {isOpen: boolean;onOpenChange: (isOpen: boolean) => void;pkiSync?: TPkiSync;- fields: PkiSyncEditFields;};-export const EditPkiSyncModal = ({ pkiSync, onOpenChange, fields, ...props }: Props) => {+export const EditPkiSyncModal = ({ isOpen, pkiSync, onOpenChange }: Props) => {+ const [isDirty, setIsDirty] = useState(false);+ const [confirmDiscardOpen, setConfirmDiscardOpen] = useState(false);+if (!pkiSync) return null;- // z-50 (not the v2 default z-[60]) so the inline "Create Connection" Sheet and its v3 Select- // menus (all z-50, portaled later) stack above this modal instead of being buried behind it,- // while the backdrop still covers page chrome up to z-50 by portal order.- const modalClassName =- fields === PkiSyncEditFields.Mappings ? "z-50 max-w-4xl" : "z-50 max-w-2xl";+ const closeSheet = () => {+ setConfirmDiscardOpen(false);+ onOpenChange(false);+ };++ const handleSheetOpenChange = (nextOpen: boolean) => {+ if (!nextOpen && isDirty) {+ setConfirmDiscardOpen(true);+ return;+ }+ onOpenChange(nextOpen);+ };return (- <Modal {...props} onOpenChange={onOpenChange}>- <ModalContent- overlayClassName="z-50"- title={<PkiSyncModalHeader isConfigured destination={pkiSync.destination} />}- className={modalClassName}- bodyClassName="overflow-visible"- >- <EditPkiSyncForm onComplete={() => onOpenChange(false)} fields={fields} pkiSync={pkiSync} />- </ModalContent>- </Modal>+ <>+ <Sheet open={isOpen} onOpenChange={handleSheetOpenChange}>+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-[1500px]">+ <SheetHeader className="border-b">+ <SheetTitle>+ <PkiSyncModalHeader isConfigured destination={pkiSync.destination} />+ </SheetTitle>+ </SheetHeader>+ <div className="flex min-h-0 flex-1 flex-col">+ <EditPkiSyncForm+ pkiSync={pkiSync}+ onComplete={() => onOpenChange(false)}+ onDirtyChange={setIsDirty}+ onCancel={() => handleSheetOpenChange(false)}+ />+ </div>+ </SheetContent>+ </Sheet>++ <AlertDialog open={confirmDiscardOpen} onOpenChange={setConfirmDiscardOpen}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <AlertTriangleIcon />+ </AlertDialogMedia>+ <AlertDialogTitle>Discard changes?</AlertDialogTitle>+ <AlertDialogDescription>+ Your unsaved changes to this sync will be lost.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Keep Editing</AlertDialogCancel>+ <AlertDialogAction variant="danger" onClick={closeSheet}>+ Discard+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </>);};diff --git a/frontend/src/components/pki-syncs/PkiSyncImportCertificatesModal.tsx b/frontend/src/components/pki-syncs/PkiSyncImportCertificatesModal.tsxindex 43192c5e3c..1588d42fc3 100644--- a/frontend/src/components/pki-syncs/PkiSyncImportCertificatesModal.tsx+++ b/frontend/src/components/pki-syncs/PkiSyncImportCertificatesModal.tsx@@ -1,5 +1,17 @@+import { DownloadIcon } from "lucide-react";+import { createNotification } from "@app/components/notifications";-import { Button, Modal, ModalClose, ModalContent } from "@app/components/v2";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle+} from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import { TPkiSync, useTriggerPkiSyncImportCertificates } from "@app/hooks/api/pkiSyncs";@@ -9,17 +21,14 @@ type Props = {onOpenChange: (isOpen: boolean) => void;};-type ContentProps = {- pkiSync: TPkiSync;- onComplete: () => void;-};+export const PkiSyncImportCertificatesModal = ({ isOpen, onOpenChange, pkiSync }: Props) => {+ const triggerImportCertificates = useTriggerPkiSyncImportCertificates();++ if (!pkiSync) return null;-const Content = ({ pkiSync, onComplete }: ContentProps) => {const { id: syncId, destination, projectId } = pkiSync;const destinationName = PKI_SYNC_MAP[destination].name;- const triggerImportCertificates = useTriggerPkiSyncImportCertificates();-const handleTriggerImportCertificates = async () => {await triggerImportCertificates.mutateAsync({syncId,@@ -28,59 +37,36 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {});createNotification({- text: `Successfully triggered certificate import for ${destinationName} Sync`,+ text: `Successfully triggered certificate import for ${destinationName} Certificate Sync`,type: "success"});- onComplete();+ onOpenChange(false);};return (- <form- onSubmit={(e) => {- e.preventDefault();- handleTriggerImportCertificates();- }}- >- <p className="mb-8 text-sm text-mineshaft-200">- Are you sure you want to import certificates from this {destinationName} destination into- Infisical?- </p>- <p className="mb-6 text-xs text-bunker-300">- This operation will retrieve certificates from {destinationName} and make them available in- your PKI subscriber. Only certificates that are not already imported will be processed.- </p>- <div className="mt-8 flex w-full items-center justify-between gap-2">- <ModalClose asChild>- <Button colorSchema="secondary" variant="plain">- Cancel- </Button>- </ModalClose>- <Button- type="submit"- isLoading={triggerImportCertificates.isPending}- colorSchema="secondary"- >- Import Certificates- </Button>- </div>- </form>- );-};--export const PkiSyncImportCertificatesModal = ({ isOpen, onOpenChange, pkiSync }: Props) => {- if (!pkiSync) return null;-- const destinationName = PKI_SYNC_MAP[pkiSync.destination].name;-- return (- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>- <ModalContent- title="Import Certificates"- subTitle={`Import certificates into Infisical from this ${destinationName} Sync destination.`}- >- <Content pkiSync={pkiSync} onComplete={() => onOpenChange(false)} />- </ModalContent>- </Modal>+ <AlertDialog open={isOpen} onOpenChange={onOpenChange}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <DownloadIcon />+ </AlertDialogMedia>+ <AlertDialogTitle>Import certificates from {destinationName}?</AlertDialogTitle>+ <AlertDialogDescription>+ This retrieves certificates from {destinationName} and makes them available in+ Infisical. Only certificates that are not already imported will be processed.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ onClick={handleTriggerImportCertificates}+ isPending={triggerImportCertificates.isPending}+ >+ Import Certificates+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>);};diff --git a/frontend/src/components/pki-syncs/PkiSyncImportStatusBadge.tsx b/frontend/src/components/pki-syncs/PkiSyncImportStatusBadge.tsxindex 2cea3c55bd..440aa037a3 100644--- a/frontend/src/components/pki-syncs/PkiSyncImportStatusBadge.tsx+++ b/frontend/src/components/pki-syncs/PkiSyncImportStatusBadge.tsx@@ -4,8 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { differenceInSeconds } from "date-fns";import { CheckIcon, DownloadIcon, LucideIcon, TriangleAlertIcon } from "lucide-react";-import { Tooltip } from "@app/components/v2";-import { Badge, TBadgeProps } from "@app/components/v3";+import { Badge, TBadgeProps, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import { PkiSyncStatus, TPkiSync } from "@app/hooks/api/pkiSyncs";@@ -90,11 +89,18 @@ export const PkiSyncImportStatusBadge = ({ pkiSync, mini }: Props) => {}return (- <Tooltip position="bottom" className="max-w-sm" content={tooltipContent}>- <Badge isSquare={mini} variant={variant}>- <Icon />- {!mini && label}- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="inline-block">+ <Badge isSquare={mini} variant={variant}>+ <Icon />+ {!mini && label}+ </Badge>+ </span>+ </TooltipTrigger>+ <TooltipContent side="bottom" className="max-w-sm">+ {tooltipContent}+ </TooltipContent></Tooltip>);};diff --git a/frontend/src/components/pki-syncs/PkiSyncRemoveCertificatesModal.tsx b/frontend/src/components/pki-syncs/PkiSyncRemoveCertificatesModal.tsxindex cee845381e..f3f871f35e 100644--- a/frontend/src/components/pki-syncs/PkiSyncRemoveCertificatesModal.tsx+++ b/frontend/src/components/pki-syncs/PkiSyncRemoveCertificatesModal.tsx@@ -1,5 +1,17 @@+import { EraserIcon } from "lucide-react";+import { createNotification } from "@app/components/notifications";-import { Button, Modal, ModalClose, ModalContent } from "@app/components/v2";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle+} from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import { TPkiSync, useTriggerPkiSyncRemoveCertificates } from "@app/hooks/api/pkiSyncs";@@ -9,17 +21,14 @@ type Props = {onOpenChange: (isOpen: boolean) => void;};-type ContentProps = {- pkiSync: TPkiSync;- onComplete: () => void;-};+export const PkiSyncRemoveCertificatesModal = ({ isOpen, onOpenChange, pkiSync }: Props) => {+ const triggerRemoveCertificates = useTriggerPkiSyncRemoveCertificates();++ if (!pkiSync) return null;-const Content = ({ pkiSync, onComplete }: ContentProps) => {const { id: syncId, destination, projectId } = pkiSync;const destinationName = PKI_SYNC_MAP[destination].name;- const triggerRemoveCertificates = useTriggerPkiSyncRemoveCertificates();-const handleTriggerRemoveCertificates = async () => {await triggerRemoveCertificates.mutateAsync({syncId,@@ -28,51 +37,37 @@ const Content = ({ pkiSync, onComplete }: ContentProps) => {});createNotification({- text: `Successfully triggered certificate removal for ${destinationName} Sync`,+ text: `Successfully triggered certificate removal for ${destinationName} Certificate Sync`,type: "success"});- onComplete();+ onOpenChange(false);};return (- <form- onSubmit={(e) => {- e.preventDefault();- handleTriggerRemoveCertificates();- }}- >- <p className="mb-8 text-sm text-mineshaft-200">- Are you sure you want to remove certificates synced by Infisical from this {destinationName}{" "}- destination?- </p>- <div className="mt-8 flex w-full items-center justify-between gap-2">- <ModalClose asChild>- <Button colorSchema="secondary" variant="plain">- Cancel- </Button>- </ModalClose>- <Button type="submit" isLoading={triggerRemoveCertificates.isPending} colorSchema="danger">- Remove Certificates- </Button>- </div>- </form>- );-};--export const PkiSyncRemoveCertificatesModal = ({ isOpen, onOpenChange, pkiSync }: Props) => {- if (!pkiSync) return null;-- const destinationName = PKI_SYNC_MAP[pkiSync.destination].name;-- return (- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>- <ModalContent- title="Remove Certificates"- subTitle={`Remove certificates synced by Infisical from this ${destinationName} Sync destination.`}- >- <Content pkiSync={pkiSync} onComplete={() => onOpenChange(false)} />- </ModalContent>- </Modal>+ <AlertDialog open={isOpen} onOpenChange={onOpenChange}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <EraserIcon />+ </AlertDialogMedia>+ <AlertDialogTitle>Remove synced certificates from {destinationName}?</AlertDialogTitle>+ <AlertDialogDescription>+ This removes the certificates synced by Infisical from this {destinationName}{" "}+ destination. Certificates you manage manually there are not affected.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ onClick={handleTriggerRemoveCertificates}+ isPending={triggerRemoveCertificates.isPending}+ >+ Remove Certificates+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>);};diff --git a/frontend/src/components/pki-syncs/PkiSyncRemoveStatusBadge.tsx b/frontend/src/components/pki-syncs/PkiSyncRemoveStatusBadge.tsxindex 968431b844..2156acbc39 100644--- a/frontend/src/components/pki-syncs/PkiSyncRemoveStatusBadge.tsx+++ b/frontend/src/components/pki-syncs/PkiSyncRemoveStatusBadge.tsx@@ -4,8 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { differenceInSeconds } from "date-fns";import { AlertTriangleIcon, CheckIcon, EraserIcon, LucideIcon } from "lucide-react";-import { Tooltip } from "@app/components/v2";-import { Badge, TBadgeProps } from "@app/components/v3";+import { Badge, TBadgeProps, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import { PkiSyncStatus, TPkiSync } from "@app/hooks/api/pkiSyncs";@@ -90,11 +89,18 @@ export const PkiSyncRemoveStatusBadge = ({ pkiSync, mini }: Props) => {}return (- <Tooltip position="bottom" className="max-w-sm" content={tooltipContent}>- <Badge isSquare={mini} variant={variant}>- <Icon />- {!mini && label}- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="inline-block">+ <Badge isSquare={mini} variant={variant}>+ <Icon />+ {!mini && label}+ </Badge>+ </span>+ </TooltipTrigger>+ <TooltipContent side="bottom" className="max-w-sm">+ {tooltipContent}+ </TooltipContent></Tooltip>);};diff --git a/frontend/src/components/pki-syncs/PkiSyncSelect.tsx b/frontend/src/components/pki-syncs/PkiSyncSelect.tsxindex 0a17815020..5158024310 100644--- a/frontend/src/components/pki-syncs/PkiSyncSelect.tsx+++ b/frontend/src/components/pki-syncs/PkiSyncSelect.tsx@@ -1,11 +1,19 @@-import { useMemo } from "react";-import { faInfoCircle, faMagnifyingGlass, faSearch } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { useMemo, useState } from "react";+import { Loader2Icon, Search } from "lucide-react";-import { EmptyState, Input, Pagination, Spinner, Tooltip } from "@app/components/v2";+import {+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ InputGroup,+ InputGroupAddon,+ InputGroupInput+} from "@app/components/v3";import { useSubscription } from "@app/context";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";-import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";+import { usePopUp } from "@app/hooks";import { PkiSync, usePkiSyncOptions } from "@app/hooks/api/pkiSyncs";import { UpgradePlanModal } from "../license/UpgradePlanModal";@@ -14,138 +22,132 @@ type Props = {onSelect: (destination: PkiSync) => void;};+const SyncCard = ({ destination, onClick }: { destination: PkiSync; onClick: () => void }) => {+ const { name, image, category, description } = PKI_SYNC_MAP[destination];++ return (+ <button+ type="button"+ onClick={onClick}+ className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors hover:border-mineshaft-500 hover:bg-mineshaft-700/50"+ >+ <div className="flex items-start justify-between gap-2">+ <div className="flex h-9 w-9 items-center justify-center rounded-md bg-mineshaft-700">+ <img+ src={`/images/integrations/${image}`}+ alt={`${name} logo`}+ className="h-6 w-6 object-contain"+ />+ </div>+ <span className="text-[10px] font-medium tracking-wider text-muted uppercase">+ {category}+ </span>+ </div>+ <div className="flex flex-col gap-1">+ <p className="text-sm font-semibold text-foreground">{name}</p>+ <p className="text-xs leading-relaxed text-muted">{description}</p>+ </div>+ </button>+ );+};+export const PkiSyncSelect = ({ onSelect }: Props) => {const { subscription } = useSubscription();const { isPending, data: pkiSyncOptions } = usePkiSyncOptions();-const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);+ const [search, setSearch] = useState("");- const { search, setSearch, setPage, page, perPage, setPerPage, offset } = usePagination("", {- initPerPage: 16- });+ const handleSelect = (destination: PkiSync, enterprise?: boolean) => {+ if (enterprise && !subscription.enterpriseCertificateSyncs) {+ handlePopUpOpen("upgradePlan", {+ isEnterpriseFeature: true,+ text: "All Certificate Syncs can be unlocked if you switch to Infisical Enterprise plan."+ });+ return;+ }+ onSelect(destination);+ };- const filteredOptions = useMemo(- () =>- pkiSyncOptions?.filter(({ destination }) => {- const { name } = PKI_SYNC_MAP[destination];- return (- name?.toLowerCase().includes(search.trim().toLowerCase()) ||- destination.toLowerCase().includes(search.toLowerCase())- );- }) ?? [],- [pkiSyncOptions, search]- );-- useResetPageHelper({- totalCount: filteredOptions.length,- offset,- setPage- });+ const filteredOptions = useMemo(() => {+ const query = search.trim().toLowerCase();+ const options = pkiSyncOptions ?? [];+ if (!query) return options;+ return options.filter(({ destination }) => {+ const { name, category } = PKI_SYNC_MAP[destination];+ return (+ name.toLowerCase().includes(query) ||+ category.toLowerCase().includes(query) ||+ destination.toLowerCase().includes(query)+ );+ });+ }, [pkiSyncOptions, search]);if (isPending) {return (- <div className="flex h-full flex-col items-center justify-center py-2.5">- <Spinner size="lg" className="text-mineshaft-500" />- <p className="mt-4 text-sm text-mineshaft-400">Loading options...</p>+ <div className="flex h-full flex-col items-center justify-center py-10">+ <Loader2Icon className="size-8 animate-spin text-accent" />+ <p className="mt-4 text-sm text-muted">Loading options...</p></div>);}return (- <div className="flex flex-col gap-4">- <Input- value={search}- onChange={(e) => setSearch(e.target.value)}- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}- placeholder="Search options..."- className="bg-mineshaft-800 placeholder:text-mineshaft-400"- />- <div className="grid h-118 grid-cols-4 content-start gap-2">- {filteredOptions.slice(offset, perPage * page)?.map(({ destination, enterprise }) => {- const { image, name } = PKI_SYNC_MAP[destination];- return (- <button- key={destination}- type="button"- onClick={() =>- enterprise && !subscription.enterpriseCertificateSyncs- ? handlePopUpOpen("upgradePlan", {- isEnterpriseFeature: true,- text: "All Certificate Syncs can be unlocked if you switch to Infisical Enterprise plan."- })- : onSelect(destination)- }- className="group relative flex h-28 cursor-pointer flex-col items-center justify-center overflow-hidden rounded-md border border-mineshaft-600 bg-mineshaft-700 p-4 duration-200 hover:bg-mineshaft-600"- >- <img- src={`/images/integrations/${image}`}- className="mt-auto h-10 w-full max-w-24 object-contain"- alt={`${name} logo`}- />- <div className="mt-auto max-w-xs text-center text-xs font-medium text-gray-300 duration-200 group-hover:text-gray-200">- {name}- </div>- </button>- );- })}- {!filteredOptions?.length && (- <EmptyState- className="col-span-full mt-40"- title="No Certificate Syncs match search"- icon={faSearch}- />- )}- </div>- {Boolean(filteredOptions.length) && (- <Pagination- startAdornment={- <Tooltip- side="bottom"- className="max-w-sm py-4"- content={- <>- <p className="mb-2">Infisical is constantly adding support for more services.</p>- <p>- {`If you don't see the third-party- service you're looking for,`}{" "}- <a- target="_blank"- className="underline hover:text-mineshaft-300"- href="https://infisical.com/slack"- rel="noopener noreferrer"- >- let us know on Slack- </a>{" "}- or{" "}- <a- target="_blank"- className="underline hover:text-mineshaft-300"- href="https://github.com/Infisical/infisical/discussions"- rel="noopener noreferrer"- >- make a request on GitHub- </a>- .- </p>- </>- }- >- <div className="-ml-3 flex items-center gap-1.5 text-mineshaft-400">- <span className="text-xs">- Don't see the third-party service you're looking for?- </span>- <FontAwesomeIcon size="xs" icon={faInfoCircle} />- </div>- </Tooltip>- }- count={filteredOptions.length}- page={page}- perPage={perPage}- onChangePage={setPage}- onChangePerPage={setPerPage}- perPageList={[16]}+ <div className="flex flex-col gap-6">+ <InputGroup>+ <InputGroupAddon align="inline-start">+ <Search />+ </InputGroupAddon>+ <InputGroupInput+ value={search}+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Search options..."/>+ </InputGroup>++ {filteredOptions.length ? (+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">+ {filteredOptions.map(({ destination, enterprise }) => (+ <SyncCard+ key={destination}+ destination={destination}+ onClick={() => handleSelect(destination, enterprise)}+ />+ ))}+ </div>+ ) : (+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <Search />+ </EmptyMedia>+ <EmptyTitle>No matching services</EmptyTitle>+ <EmptyDescription>Try a different search term.</EmptyDescription>+ </EmptyHeader>+ </Empty>)}++ <p className="text-xs text-muted">+ Don't see the third-party service you're looking for?{" "}+ <a+ target="_blank"+ rel="noopener noreferrer"+ href="https://infisical.com/slack"+ className="underline underline-offset-2 hover:text-foreground"+ >+ Let us know on Slack+ </a>{" "}+ or{" "}+ <a+ target="_blank"+ rel="noopener noreferrer"+ href="https://github.com/Infisical/infisical/discussions"+ className="underline underline-offset-2 hover:text-foreground"+ >+ request it on GitHub+ </a>+ .+ </p>+<UpgradePlanModalisOpen={popUp.upgradePlan.isOpen}onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}diff --git a/frontend/src/components/pki-syncs/PkiSyncTable.tsx b/frontend/src/components/pki-syncs/PkiSyncTable.tsxdeleted file mode 100644index 4fbc7a16d8..0000000000--- a/frontend/src/components/pki-syncs/PkiSyncTable.tsx+++ /dev/null@@ -1,121 +0,0 @@-import { faPlug, faRefresh, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";--import {- EmptyState,- IconButton,- Table,- TableContainer,- TBody,- Td,- Th,- THead,- Tr-} from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { TPkiSync } from "@app/hooks/api/pkiSyncs";--type Props = {- pkiSyncs: TPkiSync[];- onEdit: (pkiSync: TPkiSync) => void;- onDelete: (pkiSync: TPkiSync) => void;- onTrigger: (pkiSync: TPkiSync) => void;-};--const getSyncStatusBadge = (status?: string) => {- switch (status) {- case "SUCCESS":- return <Badge variant="success">Success</Badge>;- case "FAILED":- return <Badge variant="danger">Failed</Badge>;- case "RUNNING":- return <Badge variant="warning">Running</Badge>;- case "PENDING":- default:- return <Badge variant="warning">Pending</Badge>;- }-};--export const PkiSyncTable = ({ pkiSyncs, onEdit, onDelete, onTrigger }: Props) => {- if (!pkiSyncs.length) {- return (- <div className="flex h-96 items-center justify-center">- <EmptyState title="No PKI syncs created" icon={faPlug}>- Start by creating a PKI sync to synchronize certificates with external services- </EmptyState>- </div>- );- }-- return (- <TableContainer>- <Table>- <THead>- <Tr>- <Th>Name</Th>- <Th>Destination</Th>- <Th>Connection</Th>- <Th>Auto Sync</Th>- <Th>Status</Th>- <Th>Last Sync</Th>- <Th className="w-5" />- </Tr>- </THead>- <TBody>- {pkiSyncs.map((pkiSync) => (- <Tr- key={pkiSync.id}- className="cursor-pointer hover:bg-mineshaft-700"- onClick={() => onEdit(pkiSync)}- >- <Td>{pkiSync.name}</Td>- <Td>- <div className="flex items-center space-x-2">- <Badge variant="warning">{pkiSync.destination}</Badge>- </div>- </Td>- <Td>{pkiSync.appConnectionName || "Unknown"}</Td>- <Td>- <Badge variant={pkiSync.isAutoSyncEnabled ? "success" : "danger"}>- {pkiSync.isAutoSyncEnabled ? "Enabled" : "Disabled"}- </Badge>- </Td>- <Td>{getSyncStatusBadge(pkiSync.syncStatus ?? undefined)}</Td>- <Td>- {pkiSync.lastSyncedAt- ? new Date(pkiSync.lastSyncedAt).toLocaleDateString()- : "Never"}- </Td>- <Td>- <div className="flex items-center space-x-2">- <IconButton- size="sm"- variant="plain"- ariaLabel="Trigger sync"- onClick={(e) => {- e.stopPropagation();- onTrigger(pkiSync);- }}- >- <FontAwesomeIcon icon={faRefresh} />- </IconButton>- <IconButton- size="sm"- variant="plain"- ariaLabel="Delete"- onClick={(e) => {- e.stopPropagation();- onDelete(pkiSync);- }}- >- <FontAwesomeIcon icon={faTrash} />- </IconButton>- </div>- </Td>- </Tr>- ))}- </TBody>- </Table>- </TableContainer>- );-};diff --git a/frontend/src/components/pki-syncs/forms/AwsCertificateManagerPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/AwsCertificateManagerPkiSyncFields.tsxindex 83d85a35f5..88d85e03e5 100644--- a/frontend/src/components/pki-syncs/forms/AwsCertificateManagerPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/AwsCertificateManagerPkiSyncFields.tsx@@ -1,50 +1,5 @@-import { Controller, useFormContext } from "react-hook-form";+import { AwsRegionField } from "./AwsRegionField";-import { FormControl, Select, SelectItem } from "@app/components/v2";-import { AWS_REGIONS } from "@app/helpers/appConnections";-import { PkiSync } from "@app/hooks/api/pkiSyncs";--import { TPkiSyncForm } from "./schemas/pki-sync-schema";-import { PkiSyncConnectionField } from "./PkiSyncConnectionField";--export const AwsCertificateManagerPkiSyncFields = () => {- const { control, setValue } = useFormContext<- TPkiSyncForm & { destination: PkiSync.AwsCertificateManager }- >();-- return (- <>- <PkiSyncConnectionField- onChange={() => {- setValue("destinationConfig.region", "");- }}- />- <Controller- name="destinationConfig.region"- control={control}- render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="AWS Region"- tooltipText="Select the AWS region where your Certificate Manager certificates should be stored."- >- <Select- value={field.value}- onValueChange={field.onChange}- className="w-full border border-mineshaft-500 capitalize"- position="popper"- placeholder="Select an AWS region"- >- {AWS_REGIONS.map(({ name, slug }) => (- <SelectItem value={slug} key={slug}>- {name}- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- </>- );-};+export const AwsCertificateManagerPkiSyncFields = () => (+ <AwsRegionField tooltip="Select the AWS region where your Certificate Manager certificates should be stored." />+);diff --git a/frontend/src/components/pki-syncs/forms/AwsElasticLoadBalancerPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/AwsElasticLoadBalancerPkiSyncFields.tsxindex b2cecb60be..ecca375db6 100644--- a/frontend/src/components/pki-syncs/forms/AwsElasticLoadBalancerPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/AwsElasticLoadBalancerPkiSyncFields.tsx@@ -1,7 +1,21 @@import { useEffect, useRef } from "react";import { Controller, useFieldArray, useFormContext } from "react-hook-form";+import { Info, Loader2Icon } from "lucide-react";-import { Checkbox, FormControl, FormLabel, Select, SelectItem, Spinner } from "@app/components/v2";+import {+ Checkbox,+ Field,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { AWS_REGIONS } from "@app/helpers/appConnections";import {PkiSync,@@ -17,13 +31,13 @@ type TAwsElasticLoadBalancerForm = TPkiSyncForm & { destination: PkiSync.AwsElasconst ListenersLoadingState = () => (<div className="flex items-center justify-center py-4">- <Spinner size="sm" />- <span className="ml-2 text-sm text-mineshaft-400">Loading listeners...</span>+ <Loader2Icon className="size-4 animate-spin text-muted" />+ <span className="ml-2 text-sm text-muted">Loading listeners...</span></div>);const NoListenersState = () => (- <div className="rounded-md border border-mineshaft-600 bg-mineshaft-900 p-4 text-center text-sm text-mineshaft-400">+ <div className="rounded-md border border-border bg-background p-4 text-center text-sm text-muted">No HTTPS/TLS listeners found for this load balancer.</div>);@@ -35,23 +49,23 @@ type ListenerItemProps = {};const ListenerItem = ({ listener, isSelected, onToggle }: ListenerItemProps) => (- <div- key={listener.listenerArn}- className="flex items-center justify-between rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3"- >+ <div className="flex items-center justify-between rounded-md border border-border bg-container p-3"><div className="flex items-center gap-3"><Checkboxid={`listener-${listener.listenerArn}`}+ variant="project"isChecked={isSelected}onCheckedChange={(checked) => onToggle(listener, checked === true)}/><div>- <FormLabel- label={`Port ${listener.port} (${listener.protocol})`}- className="mb-0 cursor-pointer text-sm font-medium text-mineshaft-100"- />+ <FieldLabel+ htmlFor={`listener-${listener.listenerArn}`}+ className="mb-0 cursor-pointer text-sm font-medium text-foreground"+ >+ Port {listener.port} ({listener.protocol})+ </FieldLabel>{listener.sslPolicy && (- <p className="text-xs text-mineshaft-400">SSL Policy: {listener.sslPolicy}</p>+ <p className="text-xs text-muted">SSL Policy: {listener.sslPolicy}</p>)}</div></div>@@ -165,7 +179,7 @@ export const AwsElasticLoadBalancerPkiSyncFields = () => {}return (- <div className="space-y-3 rounded-md border border-mineshaft-600 bg-mineshaft-900 p-4">+ <div className="space-y-3 rounded-md border border-border bg-background p-4">{listeners.map((listener) => {const isSelected = selectedListenerArns.has(listener.listenerArn);@@ -196,29 +210,38 @@ export const AwsElasticLoadBalancerPkiSyncFields = () => {name="destinationConfig.region"control={control}render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="AWS Region"- tooltipText="Select the AWS region where your Elastic Load Balancers are located."- >+ <Field className="mb-4">+ <FieldLabel>+ AWS Region+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Select the AWS region where your Elastic Load Balancers are located.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Select- value={field.value}+ value={field.value ?? ""}onValueChange={(value) => {field.onChange(value);}}- className="w-full border border-mineshaft-500 capitalize"- position="popper"- placeholder="Select an AWS region"- isDisabled={!connectionId}+ disabled={!connectionId}>- {AWS_REGIONS.map(({ name, slug }) => (- <SelectItem value={slug} key={slug}>- {name}- </SelectItem>- ))}+ <SelectTrigger className="w-full capitalize" isError={Boolean(error)}>+ <SelectValue placeholder="Select an AWS region" />+ </SelectTrigger>+ <SelectContent position="popper">+ {AWS_REGIONS.map(({ name, slug }) => (+ <SelectItem value={slug} key={slug}>+ {name}+ </SelectItem>+ ))}+ </SelectContent></Select>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/>@@ -226,37 +249,46 @@ export const AwsElasticLoadBalancerPkiSyncFields = () => {name="destinationConfig.loadBalancerArn"control={control}render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Load Balancer"- tooltipText="Select the Application or Network Load Balancer to deploy certificates to."- >+ <Field className="mb-4">+ <FieldLabel>+ Load Balancer+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Select the Application or Network Load Balancer to deploy certificates to.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>{isLoadingLoadBalancers ? (<div className="flex items-center justify-center py-4">- <Spinner size="sm" />- <span className="ml-2 text-sm text-mineshaft-400">Loading load balancers...</span>+ <Loader2Icon className="size-4 animate-spin text-muted" />+ <span className="ml-2 text-sm text-muted">Loading load balancers...</span></div>) : (<Select- value={field.value}+ value={field.value ?? ""}onValueChange={(value) => {field.onChange(value);replace([]);}}- className="w-full border border-mineshaft-500"- position="popper"- placeholder="Select a load balancer"- isDisabled={!connectionId || !region}+ disabled={!connectionId || !region}>- {loadBalancers?.map((lb) => (- <SelectItem value={lb.loadBalancerArn} key={lb.loadBalancerArn}>- {lb.loadBalancerName}- </SelectItem>- ))}+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a load balancer" />+ </SelectTrigger>+ <SelectContent position="popper">+ {loadBalancers?.map((lb) => (+ <SelectItem value={lb.loadBalancerArn} key={lb.loadBalancerArn}>+ {lb.loadBalancerName}+ </SelectItem>+ ))}+ </SelectContent></Select>)}- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/>@@ -265,14 +297,22 @@ export const AwsElasticLoadBalancerPkiSyncFields = () => {name="destinationConfig.listeners"control={control}render={({ fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="HTTPS/TLS Listeners"- tooltipText="Select which listeners should receive the certificate. You can set a default certificate from the certificates table after creating the sync."- >+ <Field className="mb-4">+ <FieldLabel>+ HTTPS/TLS Listeners+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Select which listeners should receive the certificate. You can set a default+ certificate from the certificates table after creating the sync.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>{renderListenersContent()}- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/>)}diff --git a/frontend/src/components/pki-syncs/forms/AwsRegionField.tsx b/frontend/src/components/pki-syncs/forms/AwsRegionField.tsxnew file mode 100644index 0000000000..b54da0cf42--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/AwsRegionField.tsx@@ -0,0 +1,72 @@+import { ReactNode } from "react";+import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { AWS_REGIONS } from "@app/helpers/appConnections";+import { PkiSync } from "@app/hooks/api/pkiSyncs";++import { TPkiSyncForm } from "./schemas/pki-sync-schema";+import { PkiSyncConnectionField } from "./PkiSyncConnectionField";++type Props = {+ tooltip: ReactNode;+};++export const AwsRegionField = ({ tooltip }: Props) => {+ const { control, setValue } = useFormContext<+ TPkiSyncForm & { destination: PkiSync.AwsCertificateManager | PkiSync.AwsSecretsManager }+ >();++ return (+ <>+ <PkiSyncConnectionField+ onChange={() => {+ setValue("destinationConfig.region", "");+ }}+ />+ <Controller+ name="destinationConfig.region"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ AWS Region+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">{tooltip}</TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select value={field.value ?? ""} onValueChange={field.onChange}>+ <SelectTrigger className="w-full capitalize" isError={Boolean(error)}>+ <SelectValue placeholder="Select an AWS region" />+ </SelectTrigger>+ <SelectContent position="popper">+ {AWS_REGIONS.map(({ name, slug }) => (+ <SelectItem value={slug} key={slug}>+ {name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+ );+};diff --git a/frontend/src/components/pki-syncs/forms/AwsSecretsManagerPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/AwsSecretsManagerPkiSyncFields.tsxindex fe9e52efb1..f9a891476c 100644--- a/frontend/src/components/pki-syncs/forms/AwsSecretsManagerPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/AwsSecretsManagerPkiSyncFields.tsx@@ -1,50 +1,5 @@-import { Controller, useFormContext } from "react-hook-form";+import { AwsRegionField } from "./AwsRegionField";-import { FormControl, Select, SelectItem } from "@app/components/v2";-import { AWS_REGIONS } from "@app/helpers/appConnections";-import { PkiSync } from "@app/hooks/api/pkiSyncs";--import { TPkiSyncForm } from "./schemas/pki-sync-schema";-import { PkiSyncConnectionField } from "./PkiSyncConnectionField";--export const AwsSecretsManagerPkiSyncFields = () => {- const { control, setValue } = useFormContext<- TPkiSyncForm & { destination: PkiSync.AwsSecretsManager }- >();-- return (- <>- <PkiSyncConnectionField- onChange={() => {- setValue("destinationConfig.region", "");- }}- />- <Controller- name="destinationConfig.region"- control={control}- render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="AWS Region"- tooltipText="Select the AWS region where your secrets will be stored in AWS Secrets Manager."- >- <Select- value={field.value}- onValueChange={field.onChange}- className="w-full border border-mineshaft-500 capitalize"- position="popper"- placeholder="Select an AWS region"- >- {AWS_REGIONS.map(({ name, slug }) => (- <SelectItem value={slug} key={slug}>- {name}- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- </>- );-};+export const AwsSecretsManagerPkiSyncFields = () => (+ <AwsRegionField tooltip="Select the AWS region where your secrets will be stored in AWS Secrets Manager." />+);diff --git a/frontend/src/components/pki-syncs/forms/AzureKeyVaultPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/AzureKeyVaultPkiSyncFields.tsxindex 2c4af9376b..417c3174de 100644--- a/frontend/src/components/pki-syncs/forms/AzureKeyVaultPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/AzureKeyVaultPkiSyncFields.tsx@@ -1,6 +1,15 @@import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";-import { FormControl, Input } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { PkiSync } from "@app/hooks/api/pkiSyncs";import { TPkiSyncForm } from "./schemas/pki-sync-schema";@@ -21,15 +30,29 @@ export const AzureKeyVaultPkiSyncFields = () => {<Controllername="destinationConfig.vaultBaseUrl"control={control}- render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Vault Base URL"- tooltipText="Enter your Azure Key Vault URL. This is the base URL for your Azure Key Vault, e.g. https://example.vault.azure.net."- >- <Input {...field} placeholder="https://example.vault.azure.net" />- </FormControl>+ render={({ field: { value, onChange, ...field }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Vault Base URL+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Enter your Azure Key Vault URL. This is the base URL for your Azure Key Vault,+ e.g. https://example.vault.azure.net.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ value={value ?? ""}+ onChange={onChange}+ placeholder="https://example.vault.azure.net"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>)}/></>diff --git a/frontend/src/components/pki-syncs/forms/ChefPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/ChefPkiSyncFields.tsxindex ffd4de9074..19e25c1e5b 100644--- a/frontend/src/components/pki-syncs/forms/ChefPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/ChefPkiSyncFields.tsx@@ -1,6 +1,15 @@import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";-import { FormControl, Input } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { PkiSync } from "@app/hooks/api/pkiSyncs";import { TPkiSyncForm } from "./schemas/pki-sync-schema";@@ -19,15 +28,32 @@ export const ChefPkiSyncFields = () => {<Controllername="destinationConfig.dataBagName"control={control}- render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Data Bag Name"- tooltipText="Enter your Chef data bag name where certificates will be stored. This data bag will be used to store SSL/TLS certificates, private keys, and certificate chains. Data bag names must contain only alphanumeric characters, underscores, and hyphens."- >- <Input {...field} placeholder="ssl_certificates" maxLength={255} />- </FormControl>+ render={({ field: { value, onChange, ...field }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Data Bag Name+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Enter your Chef data bag name where certificates will be stored. This data bag+ will be used to store SSL/TLS certificates, private keys, and certificate chains.+ Data bag names must contain only alphanumeric characters, underscores, and+ hyphens.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ value={value ?? ""}+ onChange={onChange}+ placeholder="ssl_certificates"+ maxLength={255}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>)}/></>diff --git a/frontend/src/components/pki-syncs/forms/CloudflareCustomCertificatePkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/CloudflareCustomCertificatePkiSyncFields.tsxindex 773a4a9056..001a99e733 100644--- a/frontend/src/components/pki-syncs/forms/CloudflareCustomCertificatePkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/CloudflareCustomCertificatePkiSyncFields.tsx@@ -1,7 +1,16 @@import { Controller, useFormContext } from "react-hook-form";import { SingleValue } from "react-select";+import { Info } from "lucide-react";-import { FilterableSelect, FormControl } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import {TCloudflareZone,useCloudflareConnectionListZones@@ -37,16 +46,26 @@ export const CloudflareCustomCertificatePkiSyncFields = () => {name="destinationConfig.zoneId"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Zone"- tooltipText="Select the Cloudflare zone (domain) where the custom SSL certificate will be uploaded."- >+ <Field className="mb-4">+ <FieldLabel>+ Zone+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Select the Cloudflare zone (domain) where the custom SSL certificate will be+ uploaded.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><FilterableSelectisLoading={isZonesLoading && !!connectionId}isDisabled={!connectionId}- value={zones.find((zone) => zone.id === value)}+ value={+ zones.find((zone) => zone.id === value) ||+ (value ? { id: value, name: value } : null)+ }onChange={(option) => {onChange((option as SingleValue<TCloudflareZone>)?.id ?? "");}}@@ -54,8 +73,10 @@ export const CloudflareCustomCertificatePkiSyncFields = () => {placeholder={connectionId ? "Select a zone..." : "Select a connection first"}getOptionLabel={(option) => option.name}getOptionValue={(option) => option.id}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/></>diff --git a/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx b/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsxindex b570c44a36..d36af35091 100644--- a/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx+++ b/frontend/src/components/pki-syncs/forms/CreatePkiSyncForm.tsx@@ -1,12 +1,20 @@import { useState } from "react";import { Controller, FieldPath, FormProvider, useForm } from "react-hook-form";-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { Tab } from "@headlessui/react";import { zodResolver } from "@hookform/resolvers/zod";import { createNotification } from "@app/components/notifications";-import { Button, FormControl, Switch } from "@app/components/v2";+import {+ Button,+ DocumentationLinkBadge,+ Field,+ FieldContent,+ FieldDescription,+ Label,+ Stepper,+ StepperList,+ StepperStep,+ Switch+} from "@app/components/v3";import { useProject } from "@app/context";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import {@@ -34,6 +42,54 @@ type Props = {applicationId?: string;};+const STEP_META: Record<+ string,+ { short: string; subtitle: string; rightLabel: string; rightDescription: string }+> = {+ destination: {+ short: "Where to sync",+ subtitle: "Choose a connection and configure the target location.",+ rightLabel: "DESTINATION",+ rightDescription:+ "Choose the connection and the destination where certificates will be pushed. The available fields depend on the selected service."+ },+ options: {+ short: "Sync behavior",+ subtitle: "Control how certificates are written and whether they sync automatically.",+ rightLabel: "SYNC OPTIONS",+ rightDescription:+ "Control how certificates are synced, such as whether stale certificates are removed and whether the root CA is included. Auto-Sync pushes changes automatically as they occur."+ },+ mappings: {+ short: "Field mappings",+ subtitle: "Map each certificate component to the field names used at the destination.",+ rightLabel: "MAPPINGS",+ rightDescription:+ "Map each certificate component (certificate, private key, and chain) to the field names used at the destination."+ },+ details: {+ short: "Name and description",+ subtitle: "Give this sync a name and an optional description.",+ rightLabel: "DETAILS",+ rightDescription:+ "Give this sync a name and an optional description so your team can identify it later."+ },+ certificates: {+ short: "Certificates to sync",+ subtitle: "Select which of this application's certificates are included in the sync.",+ rightLabel: "CERTIFICATES",+ rightDescription:+ "Select which of this application's certificates are included in the sync. You can change this selection after the sync is created."+ },+ review: {+ short: "Confirm and create",+ subtitle: "Double-check everything before creating the sync.",+ rightLabel: "REVIEW",+ rightDescription:+ "Review the configuration and create the sync. Every setting can be edited afterward from the sync's details."+ }+};+const getFormTabs = (destination: PkiSync): { name: string; key: string; fields: FieldPath<TPkiSyncForm>[] }[] => {@@ -86,8 +142,6 @@ export const CreatePkiSyncForm = ({const { currentProject } = useProject();const { name: destinationName } = PKI_SYNC_MAP[destination];- const [showConfirmation, setShowConfirmation] = useState(false);-const [selectedTabIndex, setSelectedTabIndex] = useState(0);const FORM_TABS = getFormTabs(destination);@@ -158,17 +212,11 @@ export const CreatePkiSyncForm = ({});onComplete(pkiSync);} catch {- setShowConfirmation(false);- }- };-- const handlePrev = () => {- if (selectedTabIndex === 0) {- onCancel();- return;+ createNotification({+ text: `Failed to create ${destinationName} Certificate Sync`,+ type: "error"+ });}-- setSelectedTabIndex((prev) => prev - 1);};const { handleSubmit, trigger, control, getValues, setError } = formMethods;@@ -204,150 +252,140 @@ export const CreatePkiSyncForm = ({const handleNext = async () => {if (isFinalStep) {- setShowConfirmation(true);+ await handleSubmit(onSubmit)();return;}const isValid = await isStepValid(selectedTabIndex);-if (!isValid) return;setSelectedTabIndex((prev) => prev + 1);};- const isTabEnabled = async (index: number) => {- let isEnabled = true;- for (let i = index - 1; i >= 0; i -= 1) {- // eslint-disable-next-line no-await-in-loop- isEnabled = isEnabled && (await isStepValid(i));+ const handleBack = () => {+ if (selectedTabIndex === 0) {+ onCancel();+ return;}-- return isEnabled;+ setSelectedTabIndex((prev) => prev - 1);};- if (showConfirmation)- return (- <>- <div className="flex flex-col rounded-xs border border-l-2 border-mineshaft-600 border-l-primary bg-mineshaft-700/80 px-4 py-3">- <div className="mb-1 flex items-center text-sm">- <FontAwesomeIcon icon={faInfoCircle} size="sm" className="mr-1.5 text-primary" />- Certificate Sync Behavior- </div>- <p className="mt-1 text-sm text-bunker-200">- Only certificates managed by Infisical will be affected during sync operations.- Certificates not created or managed by Infisical will remain untouched, and changes made- to Infisical-managed certificates directly in the destination service may be overwritten- by future syncs.- </p>- </div>- <div className="mt-4 flex gap-4">- <Button- isDisabled={createPkiSync.isPending}- isLoading={createPkiSync.isPending}- onClick={handleSubmit(onSubmit)}- colorSchema="secondary"- >- I Understand- </Button>+ const handleStepChange = (index: number) => {+ if (index < selectedTabIndex) setSelectedTabIndex(index);+ };- <Button- isDisabled={createPkiSync.isPending}- variant="plain"- onClick={() => setShowConfirmation(false)}- colorSchema="secondary"- >- Cancel- </Button>- </div>- </>- );+ const currentKey = FORM_TABS[selectedTabIndex].key;+ const currentName = FORM_TABS[selectedTabIndex].name;+ const currentDetail = STEP_META[currentKey];return (- <form className="flex max-h-[70vh] flex-col overflow-hidden">+ <form+ onSubmit={(e) => e.preventDefault()}+ className="flex min-h-0 flex-1 flex-col overflow-hidden"+ ><FormProvider {...formMethods}>- <Tab.Group selectedIndex={selectedTabIndex} onChange={setSelectedTabIndex}>- <Tab.List className="-pb-1 mb-6 w-full flex-shrink-0 border-b-2 border-mineshaft-600">- {FORM_TABS.map((tab, index) => (- <Tab- onClick={async (e) => {- e.preventDefault();- const isEnabled = await isTabEnabled(index);- setSelectedTabIndex((prev) => (isEnabled ? index : prev));- }}- className={({ selected }) =>- `-mb-[0.14rem] whitespace-nowrap ${index > selectedTabIndex ? "opacity-30" : ""} px-4 py-2 text-sm font-medium outline-hidden disabled:opacity-60 ${- selected- ? "border-b-2 border-mineshaft-300 text-mineshaft-200"- : "text-bunker-300"- }`- }- key={tab.key}- >- {index + 1}. {tab.name}- </Tab>- ))}- </Tab.List>- <Tab.Panels className="flex-1 overflow-y-auto">- <Tab.Panel className="max-h-full overflow-y-auto">- <PkiSyncDestinationFields />- </Tab.Panel>- <Tab.Panel className="max-h-full overflow-y-auto">- <PkiSyncOptionsFields destination={destination} />- <Controller- control={control}- name="isAutoSyncEnabled"- render={({ field: { value, onChange }, fieldState: { error } }) => {- return (- <FormControl- helperText={- value- ? "Certificates will automatically be synced when changes occur in the selected certificates."- : "Certificates will not automatically be synced when changes occur. You can still trigger syncs manually."- }- isError={Boolean(error)}- errorText={error?.message}- >- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="auto-sync-enabled"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p className="w-[8.4rem]">Auto-Sync {value ? "Enabled" : "Disabled"}</p>- </Switch>- </FormControl>- );- }}- />- </Tab.Panel>- {(destination === PkiSync.Chef || destination === PkiSync.AwsSecretsManager) && (- <Tab.Panel className="max-h-full overflow-y-auto">- <PkiSyncFieldMappingsFields destination={destination} />- </Tab.Panel>+ <div className="flex min-h-0 flex-1 overflow-hidden">+ <aside className="flex w-60 shrink-0 flex-col border-r border-border px-5 py-6">+ <p className="mb-5 text-[11px] font-medium tracking-wider text-muted uppercase">+ Setup steps+ </p>+ <Stepper+ activeStep={selectedTabIndex}+ orientation="vertical"+ onStepChange={handleStepChange}+ >+ <StepperList>+ {FORM_TABS.map((tab, index) => (+ <StepperStep+ key={tab.key}+ index={index}+ title={tab.name}+ description={STEP_META[tab.key].short}+ />+ ))}+ </StepperList>+ </Stepper>+ </aside>++ <div className="flex min-w-0 flex-1 flex-col gap-y-2 overflow-y-auto px-8 py-6">+ <div className="mb-6">+ <h2 className="text-lg font-semibold text-foreground">{currentName}</h2>+ <p className="mt-1 text-sm text-muted">{currentDetail.subtitle}</p>+ </div>+ {currentKey === "destination" && <PkiSyncDestinationFields />}+ {currentKey === "options" && (+ <>+ <PkiSyncOptionsFields destination={destination} />+ <Controller+ control={control}+ name="isAutoSyncEnabled"+ render={({ field: { value, onChange } }) => (+ <Field className="mt-2">+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor="auto-sync-enabled">Auto-sync on changes</Label>+ <FieldDescription>+ When certificates in the selected list change, sync automatically. Turn+ off to only sync manually.+ </FieldDescription>+ </FieldContent>+ <Switch+ id="auto-sync-enabled"+ variant="project"+ checked={value}+ onCheckedChange={onChange}+ />+ </Field>+ </Field>+ )}+ />+ </>)}- <Tab.Panel className="max-h-full overflow-y-auto">- <PkiSyncDetailsFields />- </Tab.Panel>- <Tab.Panel className="max-h-full overflow-y-auto">+ {currentKey === "mappings" && <PkiSyncFieldMappingsFields destination={destination} />}+ {currentKey === "details" && <PkiSyncDetailsFields />}+ {currentKey === "certificates" && (<PkiSyncCertificatesFields applicationId={applicationId} />- </Tab.Panel>- <Tab.Panel className="max-h-full overflow-y-auto">- <PkiSyncReviewFields />- </Tab.Panel>- </Tab.Panels>- </Tab.Group>+ )}+ {currentKey === "review" && <PkiSyncReviewFields />}+ </div>++ <aside className="hidden w-80 shrink-0 flex-col gap-4 overflow-y-auto border-l border-border px-6 py-6 lg:flex">+ <div className="mb-auto">+ <div className="flex items-center justify-between gap-2">+ <p className="text-[11px] font-medium tracking-wider text-muted uppercase">+ Step {selectedTabIndex + 1} · {currentDetail.rightLabel}+ </p>+ <DocumentationLinkBadge+ href={`https://infisical.com/docs/documentation/platform/pki/applications/certificate-syncs/${destination}`}+ />+ </div>+ <p className="mt-4 text-sm font-semibold text-foreground">What this step does</p>+ <p className="mt-2 text-sm leading-relaxed text-muted">+ {currentDetail.rightDescription}+ </p>+ </div>+ </aside>+ </div></FormProvider>- <div className="mt-4 flex w-full flex-shrink-0 flex-row-reverse justify-between gap-4 border-t border-mineshaft-600 pt-4">- <Button onClick={handleNext} colorSchema="secondary">- {isFinalStep ? "Create Sync" : "Next"}- </Button>- {selectedTabIndex > 0 && (- <Button onClick={handlePrev} colorSchema="secondary">- Back+ <div className="flex shrink-0 items-center justify-between gap-3 border-t border-border px-6 py-4">+ <span className="text-xs text-muted">+ Step {selectedTabIndex + 1} of {FORM_TABS.length}+ </span>+ <div className="flex items-center gap-3">+ <Button type="button" variant="outline" onClick={handleBack}>+ {selectedTabIndex === 0 ? "Cancel" : "Back"}</Button>- )}+ <Button+ type="button"+ variant="project"+ onClick={handleNext}+ isPending={isFinalStep && createPkiSync.isPending}+ isDisabled={isFinalStep && createPkiSync.isPending}+ >+ {isFinalStep ? "Create Sync" : "Continue"}+ </Button>+ </div></div></form>);diff --git a/frontend/src/components/pki-syncs/forms/DestinationPathField.tsx b/frontend/src/components/pki-syncs/forms/DestinationPathField.tsxnew file mode 100644index 0000000000..abcd2c051e--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/DestinationPathField.tsx@@ -0,0 +1,59 @@+import { ReactNode } from "react";+import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { PkiSync } from "@app/hooks/api/pkiSyncs";++import { TPkiSyncForm } from "./schemas/pki-sync-schema";+import { PkiSyncConnectionField } from "./PkiSyncConnectionField";++type Props = {+ label: string;+ tooltip: ReactNode;+ placeholder: string;+};++export const DestinationPathField = ({ label, tooltip, placeholder }: Props) => {+ const { control } = useFormContext<+ TPkiSyncForm & { destination: PkiSync.LinuxServer | PkiSync.WindowsServer }+ >();++ return (+ <>+ <PkiSyncConnectionField />+ <Controller+ name="destinationConfig.destinationPath"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ {label}+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">{tooltip}</TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder={placeholder}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+ );+};diff --git a/frontend/src/components/pki-syncs/forms/EditPkiSyncForm.tsx b/frontend/src/components/pki-syncs/forms/EditPkiSyncForm.tsxindex 522e4df56f..4d5dbb7e88 100644--- a/frontend/src/components/pki-syncs/forms/EditPkiSyncForm.tsx+++ b/frontend/src/components/pki-syncs/forms/EditPkiSyncForm.tsx@@ -1,29 +1,103 @@-import { ReactNode } from "react";-import { FormProvider, useForm } from "react-hook-form";+import { useEffect, useState } from "react";+import { Controller, FormProvider, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { createNotification } from "@app/components/notifications";-import { PkiSyncEditFields } from "@app/components/pki-syncs/types";-import { Button, ModalClose } from "@app/components/v2";+import {+ Button,+ DocumentationLinkBadge,+ Field,+ FieldContent,+ FieldDescription,+ Label,+ Stepper,+ StepperList,+ StepperStep,+ Switch+} from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";-import { TPkiSync, useUpdatePkiSync } from "@app/hooks/api/pkiSyncs";+import { PkiSync, TPkiSync, useUpdatePkiSync } from "@app/hooks/api/pkiSyncs";import { TUpdatePkiSyncForm, UpdatePkiSyncFormSchema } from "./schemas/pki-sync-schema";import { PkiSyncDestinationFields } from "./PkiSyncDestinationFields";import { PkiSyncDetailsFields } from "./PkiSyncDetailsFields";import { PkiSyncFieldMappingsFields } from "./PkiSyncFieldMappingsFields";import { PkiSyncOptionsFields } from "./PkiSyncOptionsFields";-import { PkiSyncSourceFields } from "./PkiSyncSourceFields";type Props = {onComplete: (pkiSync: TPkiSync) => void;pkiSync: TPkiSync;- fields: PkiSyncEditFields;+ onDirtyChange?: (isDirty: boolean) => void;+ onCancel?: () => void;};-export const EditPkiSyncForm = ({ pkiSync, fields, onComplete }: Props) => {+type FormStep = {+ key: string;+ name: string;+ description: string;+ title: string;+ subtitle: string;+ rightLabel: string;+ rightDescription: string;+};++const getFormSteps = (destination: PkiSync): FormStep[] => {+ const steps: FormStep[] = [+ {+ key: "destination",+ name: "Destination",+ description: "Where to sync",+ title: "Destination",+ subtitle: "Choose a connection and configure the target location.",+ rightLabel: "DESTINATION",+ rightDescription:+ "Choose the connection and the destination where certificates will be pushed. The available fields depend on the selected service."+ },+ {+ key: "options",+ name: "Sync Options",+ description: "Sync behavior",+ title: "Sync Options",+ subtitle: "Control how certificates are written and whether they sync automatically.",+ rightLabel: "SYNC OPTIONS",+ rightDescription:+ "Control how certificates are synced, such as whether stale certificates are removed and whether the root CA is included. Auto-Sync pushes changes automatically as they occur."+ }+ ];++ if (destination === PkiSync.Chef || destination === PkiSync.AwsSecretsManager) {+ steps.push({+ key: "mappings",+ name: "Mappings",+ description: "Field mappings",+ title: "Field Mappings",+ subtitle: "Map each certificate component to the field names used at the destination.",+ rightLabel: "MAPPINGS",+ rightDescription:+ "Map each certificate component (certificate, private key, and chain) to the field names used at the destination."+ });+ }++ steps.push({+ key: "details",+ name: "Details",+ description: "Name and description",+ title: "Details",+ subtitle: "Give this sync a name and an optional description.",+ rightLabel: "DETAILS",+ rightDescription:+ "Give this sync a name and an optional description so your team can identify it later."+ });++ return steps;+};++export const EditPkiSyncForm = ({ pkiSync, onComplete, onDirtyChange, onCancel }: Props) => {const updatePkiSync = useUpdatePkiSync();const { name: destinationName } = PKI_SYNC_MAP[pkiSync.destination];+ const steps = getFormSteps(pkiSync.destination);++ const [selectedStepIndex, setSelectedStepIndex] = useState(0);const formMethods = useForm<TUpdatePkiSyncForm>({resolver: zodResolver(UpdatePkiSyncFormSchema),@@ -42,66 +116,178 @@ export const EditPkiSyncForm = ({ pkiSync, fields, onComplete }: Props) => {reValidateMode: "onChange"});+ const {+ handleSubmit,+ control,+ formState: { isSubmitting, isDirty }+ } = formMethods;++ useEffect(() => {+ onDirtyChange?.(isDirty);+ }, [isDirty, onDirtyChange]);+const onSubmit = async ({ connection, ...formData }: TUpdatePkiSyncForm) => {- const updatedPkiSync = await updatePkiSync.mutateAsync({- syncId: pkiSync.id,- ...formData,- connectionId: connection.id,- projectId: pkiSync.projectId,- destination: pkiSync.destination- });+ try {+ const updatedPkiSync = await updatePkiSync.mutateAsync({+ syncId: pkiSync.id,+ ...formData,+ connectionId: connection.id,+ projectId: pkiSync.projectId,+ destination: pkiSync.destination+ });- createNotification({- text: `Successfully updated ${destinationName} PKI Sync`,- type: "success"- });- onComplete(updatedPkiSync);+ createNotification({+ text: `Successfully updated ${destinationName} Certificate Sync`,+ type: "success"+ });+ onComplete(updatedPkiSync);+ } catch {+ createNotification({+ text: `Failed to update ${destinationName} Certificate Sync`,+ type: "error"+ });+ }};- let Component: ReactNode;-- switch (fields) {- case PkiSyncEditFields.Destination:- Component = <PkiSyncDestinationFields />;- break;- case PkiSyncEditFields.Options:- Component = <PkiSyncOptionsFields destination={pkiSync.destination} isUpdate />;- break;- case PkiSyncEditFields.Mappings:- Component = <PkiSyncFieldMappingsFields destination={pkiSync.destination} />;- break;- case PkiSyncEditFields.Source:- Component = <PkiSyncSourceFields />;- break;- case PkiSyncEditFields.Details:- default:- Component = <PkiSyncDetailsFields />;- break;- }+ const currentStep = steps[selectedStepIndex];- const {- handleSubmit,- formState: { isSubmitting, isDirty }- } = formMethods;+ const renderStep = () => {+ switch (currentStep.key) {+ case "destination":+ return <PkiSyncDestinationFields />;+ case "options":+ return (+ <>+ <PkiSyncOptionsFields destination={pkiSync.destination} isUpdate />+ <Controller+ control={control}+ name="isAutoSyncEnabled"+ render={({ field: { value, onChange } }) => (+ <Field className="mt-2">+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor="auto-sync-enabled">Auto-sync on changes</Label>+ <FieldDescription>+ When certificates in the selected list change, sync automatically. Turn off+ to only sync manually.+ </FieldDescription>+ </FieldContent>+ <Switch+ id="auto-sync-enabled"+ variant="project"+ checked={value}+ onCheckedChange={onChange}+ />+ </Field>+ </Field>+ )}+ />+ </>+ );+ case "mappings":+ return <PkiSyncFieldMappingsFields destination={pkiSync.destination} />;+ case "details":+ return <PkiSyncDetailsFields />;+ default:+ return null;+ }+ };return (- <form onSubmit={handleSubmit(onSubmit)}>- <FormProvider {...formMethods}>{Component}</FormProvider>- <div className="flex w-full justify-between gap-4 pt-4">- <ModalClose asChild>- <Button colorSchema="secondary" variant="plain">- Cancel- </Button>- </ModalClose>- <Button- isLoading={isSubmitting}- isDisabled={!isDirty || isSubmitting}- type="submit"- colorSchema="secondary"- >- Update PKI Sync- </Button>- </div>- </form>+ <FormProvider {...formMethods}>+ <form className="flex h-full min-h-0 flex-col" onSubmit={handleSubmit(onSubmit)}>+ <div className="flex min-h-0 flex-1 overflow-hidden">+ <aside className="flex w-60 shrink-0 flex-col border-r border-border px-5 py-6">+ <p className="mb-5 text-[11px] font-medium tracking-wider text-muted uppercase">+ Sections+ </p>+ <Stepper+ activeStep={selectedStepIndex}+ orientation="vertical"+ onStepChange={setSelectedStepIndex}+ nonLinear+ >+ <StepperList>+ {steps.map((step, i) => (+ <StepperStep+ key={step.key}+ index={i}+ title={step.name}+ description={step.description}+ />+ ))}+ </StepperList>+ </Stepper>+ </aside>++ <div className="flex min-w-0 flex-1 flex-col gap-y-2 overflow-y-auto px-8 py-6">+ <div className="mb-6">+ <h2 className="text-lg font-semibold text-foreground">{currentStep.title}</h2>+ <p className="mt-1 text-sm text-muted">{currentStep.subtitle}</p>+ </div>+ {renderStep()}+ </div>++ <aside className="hidden w-80 shrink-0 flex-col gap-4 overflow-y-auto border-l border-border px-6 py-6 lg:flex">+ <div className="mb-auto">+ <div className="flex items-center justify-between gap-2">+ <p className="text-[11px] font-medium tracking-wider text-muted uppercase">+ Step {selectedStepIndex + 1} · {currentStep.rightLabel}+ </p>+ <DocumentationLinkBadge+ href={`https://infisical.com/docs/documentation/platform/pki/applications/certificate-syncs/${pkiSync.destination}`}+ />+ </div>+ <p className="mt-4 text-sm font-semibold text-foreground">What this step does</p>+ <p className="mt-2 text-sm leading-relaxed text-muted">+ {currentStep.rightDescription}+ </p>+ </div>+ </aside>+ </div>++ <div className="flex shrink-0 items-center justify-between gap-3 border-t border-border px-6 py-4">+ <div className="flex items-center gap-3">+ <Button+ variant="project"+ type="submit"+ isPending={isSubmitting}+ isDisabled={!isDirty || isSubmitting}+ >+ Save+ </Button>+ <Button+ variant="outline"+ type="button"+ onClick={onCancel ?? (() => onComplete(pkiSync))}+ >+ Cancel+ </Button>+ <span className="text-xs text-muted">{isDirty ? "Unsaved changes" : ""}</span>+ </div>+ <div className="flex items-center gap-3">+ <span className="text-xs text-muted">+ Step {selectedStepIndex + 1} of {steps.length}+ </span>+ <Button+ variant="outline"+ type="button"+ onClick={() => setSelectedStepIndex((i) => Math.max(0, i - 1))}+ isDisabled={selectedStepIndex === 0}+ >+ Back+ </Button>+ <Button+ variant="outline"+ type="button"+ onClick={() => setSelectedStepIndex((i) => Math.min(steps.length - 1, i + 1))}+ isDisabled={selectedStepIndex === steps.length - 1}+ >+ Next+ </Button>+ </div>+ </div>+ </form>+ </FormProvider>);};diff --git a/frontend/src/components/pki-syncs/forms/F5BigIpPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/F5BigIpPkiSyncFields.tsxindex 951947462f..3fb6b98ece 100644--- a/frontend/src/components/pki-syncs/forms/F5BigIpPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/F5BigIpPkiSyncFields.tsx@@ -1,9 +1,24 @@import { useEffect } from "react";import { Controller, useFormContext } from "react-hook-form";-import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { Info } from "lucide-react";-import { FormControl, Input, Select, SelectItem, Switch, Tooltip } from "@app/components/v2";+import {+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ Input,+ Label,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Switch,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { PkiSync } from "@app/hooks/api/pkiSyncs";import { F5BigIpProfileType } from "@app/hooks/api/pkiSyncs/types/f5-big-ip-sync";@@ -45,41 +60,65 @@ export const F5BigIpPkiSyncFields = () => {name="destinationConfig.partition"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Partition"- isOptional- tooltipText="The F5 partition where certificates will be stored. Defaults to Common."- >- <Input value={value ?? ""} onChange={onChange} placeholder="Common" />- </FormControl>+ <Field className="mb-4">+ <FieldLabel>+ Partition <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The F5 partition where certificates will be stored. Defaults to Common.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="Common"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>)}/><Controllername="destinationConfig.profileType"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Profile Binding"- tooltipText="Attach each synced certificate to a Client SSL or Server SSL profile so the BIG-IP starts using it right away. F5 only allows one certificate per algorithm type (RSA, ECDSA, DSA) per profile, so use separate profiles if you have multiple certificates of the same type. Choose None to just upload certificates without attaching them."- >+ <Field className="mb-4">+ <FieldLabel>+ Profile Binding+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Attach each synced certificate to a Client SSL or Server SSL profile so the BIG-IP+ starts using it right away. F5 only allows one certificate per algorithm type+ (RSA, ECDSA, DSA) per profile, so use separate profiles if you have multiple+ certificates of the same type. Choose None to just upload certificates without+ attaching them.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Selectvalue={value ?? F5BigIpProfileType.None}onValueChange={(v) => onChange(v as F5BigIpProfileType)}- className="w-full border border-mineshaft-500"- dropdownContainerClassName="max-w-none"- position="popper">- {PROFILE_TYPE_OPTIONS.map((option) => (- <SelectItem value={option.value} key={option.value}>- {option.label}- </SelectItem>- ))}+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ {PROFILE_TYPE_OPTIONS.map((option) => (+ <SelectItem value={option.value} key={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent></Select>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/>{requiresProfile && (@@ -88,16 +127,21 @@ export const F5BigIpPkiSyncFields = () => {name="destinationConfig.profileName"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label={- profileType === F5BigIpProfileType.ServerSsl+ <Field className="mb-4">+ <FieldLabel>+ {profileType === F5BigIpProfileType.ServerSsl? "Server SSL Profile Name"- : "Client SSL Profile Name"- }- tooltipText="The name of the SSL profile inside the partition. Infisical will add each synced certificate to it."- >+ : "Client SSL Profile Name"}+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The name of the SSL profile inside the partition. Infisical will add each+ synced certificate to it.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Inputvalue={value ?? ""}onChange={onChange}@@ -106,33 +150,44 @@ export const F5BigIpPkiSyncFields = () => {? "e.g. backend-ssl": "e.g. clientssl-prod"}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/><Controllername="destinationConfig.createProfileIfMissing"control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="f5-create-profile-if-missing"- thumbClassName="bg-mineshaft-800"- isChecked={value ?? false}- onCheckedChange={onChange}- >- <p>- Create profile if missing{" "}- <Tooltip- className="max-w-md"- content="Create the SSL profile on the BIG-IP if it doesn't exist yet. Off by default, since production profiles are usually managed by F5 administrators."+ render={({ field: { value, onChange } }) => (+ <Field className="mb-4">+ <Field orientation="horizontal">+ <FieldContent>+ <Label+ htmlFor="f5-create-profile-if-missing"+ className="flex items-center gap-1.5">- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>+ Create profile if missing+ <Tooltip>+ <TooltipTrigger asChild>+ <Info className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ Create the SSL profile on the BIG-IP if it doesn't exist yet. Off by+ default, since production profiles are usually managed by F5+ administrators.+ </TooltipContent>+ </Tooltip>+ </Label>+ </FieldContent>+ <Switch+ id="f5-create-profile-if-missing"+ variant="project"+ checked={value ?? false}+ onCheckedChange={onChange}+ />+ </Field>+ </Field>)}/>{createProfileIfMissing && (@@ -140,13 +195,18 @@ export const F5BigIpPkiSyncFields = () => {name="destinationConfig.parentProfile"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Parent Profile"- isOptional- tooltipText={`The existing F5 profile we'll copy settings from when creating the new one. Defaults to /Common/${profileType === F5BigIpProfileType.ServerSsl ? "serverssl" : "clientssl"}. Enter just a name (looked up in /Common) or a full path like /MyPartition/my-parent.`}- >+ <Field className="mb-4">+ <FieldLabel>+ Parent Profile <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The existing F5 profile we'll copy settings from when creating the new one. Defaults to /Common/${profileType === F5BigIpProfileType.ServerSsl ? "serverssl" : "clientssl"}. Enter just a name (looked up in /Common) or a full path like /MyPartition/my-parent.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Inputvalue={value ?? ""}onChange={onChange}@@ -155,8 +215,10 @@ export const F5BigIpPkiSyncFields = () => {? "/Common/serverssl": "/Common/clientssl"}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/>)}diff --git a/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsxindex 07179ce93c..00b53dc592 100644--- a/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/KempLoadMasterPkiSyncFields.tsx@@ -1,6 +1,15 @@import { Controller, useFormContext, useWatch } from "react-hook-form";+import { Info } from "lucide-react";-import { FilterableSelect, FormControl } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { PkiSync, TKempVirtualService, useListKempVirtualServices } from "@app/hooks/api/pkiSyncs";import { TPkiSyncForm } from "./schemas/pki-sync-schema";@@ -30,13 +39,19 @@ export const KempLoadMasterPkiSyncFields = () => {name="destinationConfig.virtualServiceId"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Virtual Service"- isOptional- tooltipText="The Virtual Service to bind the certificate to. Leave unset to only import the certificate without binding it to a Virtual Service."- >+ <Field className="mb-4">+ <FieldLabel>+ Virtual Service <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The Virtual Service to bind the certificate to. Leave unset to only import the+ certificate without binding it to a Virtual Service.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><FilterableSelectisDisabled={!connectionId}isLoading={Boolean(connectionId) && isLoadingVirtualServices}@@ -51,8 +66,10 @@ export const KempLoadMasterPkiSyncFields = () => {? "Leave unset to import certificate only": "Select a connection first"}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/></>diff --git a/frontend/src/components/pki-syncs/forms/LinuxServerPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/LinuxServerPkiSyncFields.tsxindex 5c467b55d4..ac28c47121 100644--- a/frontend/src/components/pki-syncs/forms/LinuxServerPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/LinuxServerPkiSyncFields.tsx@@ -1,31 +1,9 @@-import { Controller, useFormContext } from "react-hook-form";--import { FormControl, Input } from "@app/components/v2";-import { PkiSync } from "@app/hooks/api/pkiSyncs";--import { TPkiSyncForm } from "./schemas/pki-sync-schema";-import { PkiSyncConnectionField } from "./PkiSyncConnectionField";--export const LinuxServerPkiSyncFields = () => {- const { control } = useFormContext<TPkiSyncForm & { destination: PkiSync.LinuxServer }>();-- return (- <>- <PkiSyncConnectionField />- <Controller- name="destinationConfig.destinationPath"- control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Destination Directory"- tooltipText="The absolute path to the directory on the server where certificate files are written. The directory must already exist."- >- <Input value={value ?? ""} onChange={onChange} placeholder="/etc/ssl/certs" />- </FormControl>- )}- />- </>- );-};+import { DestinationPathField } from "./DestinationPathField";++export const LinuxServerPkiSyncFields = () => (+ <DestinationPathField+ label="Destination Directory"+ tooltip="The absolute path to the directory on the server where certificate files are written. The directory must already exist."+ placeholder="/etc/ssl/certs"+ />+);diff --git a/frontend/src/components/pki-syncs/forms/NetScalerPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/NetScalerPkiSyncFields.tsxindex 12a736b389..8e6e646f5a 100644--- a/frontend/src/components/pki-syncs/forms/NetScalerPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/NetScalerPkiSyncFields.tsx@@ -1,6 +1,15 @@import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";-import { FormControl, Input } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { PkiSync } from "@app/hooks/api/pkiSyncs";import { TPkiSyncForm } from "./schemas/pki-sync-schema";@@ -16,15 +25,27 @@ export const NetScalerPkiSyncFields = () => {name="destinationConfig.vserverName"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="SSL vServer Name"- isOptional- tooltipText="The name of the SSL virtual server to bind the certificate to. Leave empty to only upload the certificate without binding."- >- <Input value={value ?? ""} onChange={onChange} placeholder="e.g. vs-ssl-prod" />- </FormControl>+ <Field className="mb-4">+ <FieldLabel>+ SSL vServer Name <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The name of the SSL virtual server to bind the certificate to. Leave empty to only+ upload the certificate without binding.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="e.g. vs-ssl-prod"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>)}/></>diff --git a/frontend/src/components/pki-syncs/forms/NutanixPrismCentralPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/NutanixPrismCentralPkiSyncFields.tsxindex 5fa54db394..10def1df4a 100644--- a/frontend/src/components/pki-syncs/forms/NutanixPrismCentralPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/NutanixPrismCentralPkiSyncFields.tsx@@ -1,7 +1,20 @@import { Controller, useFormContext, useWatch } from "react-hook-form";import { AxiosError } from "axios";+import { Info, Loader2Icon } from "lucide-react";-import { FormControl, Select, SelectItem, Spinner } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useNutanixPrismCentralConnectionListClusters } from "@app/hooks/api/appConnections/nutanix-prism-central";import { PkiSync } from "@app/hooks/api/pkiSyncs";@@ -42,40 +55,56 @@ export const NutanixPrismCentralPkiSyncFields = () => {"Failed to fetch clusters. Check connection settings."): undefined;+ const combinedError =+ error ??+ (clusterFetchErrorText+ ? { type: "manual", message: clusterFetchErrorText }+ : undefined);+return (- <FormControl- isError={Boolean(error) || Boolean(clusterFetchErrorText)}- errorText={error?.message ?? clusterFetchErrorText}- label="Target Cluster"- tooltipText="The Nutanix cluster that will receive the certificate."- >+ <Field className="mb-4">+ <FieldLabel>+ Target Cluster+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The Nutanix cluster that will receive the certificate.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>{connectionId && isLoadingClusters ? (- <div className="flex items-center gap-2 py-2 text-sm text-mineshaft-400">- <Spinner size="sm" />+ <div className="flex items-center gap-2 py-2 text-sm text-muted">+ <Loader2Icon className="size-4 animate-spin" />Loading clusters...</div>) : (<Select- value={value}+ value={value ?? ""}onValueChange={(newValue) => {const cluster = clusters?.find((c) => c.id === newValue);onChange(newValue);setValue("destinationConfig.clusterName", cluster?.name ?? "");}}- placeholder={connectionId ? "Select a cluster" : "Select a connection first"}- isDisabled={!connectionId || isLoadingClusters}- className="w-full"- position="popper"- dropdownContainerClassName="max-w-none"+ disabled={!connectionId || isLoadingClusters}>- {(clusters ?? []).map((cluster) => (- <SelectItem key={cluster.id} value={cluster.id}>- {cluster.name}- </SelectItem>- ))}+ <SelectTrigger className="w-full" isError={Boolean(combinedError)}>+ <SelectValue+ placeholder={connectionId ? "Select a cluster" : "Select a connection first"}+ />+ </SelectTrigger>+ <SelectContent position="popper">+ {(clusters ?? []).map((cluster) => (+ <SelectItem key={cluster.id} value={cluster.id}>+ {cluster.name}+ </SelectItem>+ ))}+ </SelectContent></Select>)}- </FormControl>+ <FieldError errors={[combinedError]} />+ </Field>);}}/>diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncCertificatesFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncCertificatesFields.tsxindex 41e13be51c..fca7c148e8 100644--- a/frontend/src/components/pki-syncs/forms/PkiSyncCertificatesFields.tsx+++ b/frontend/src/components/pki-syncs/forms/PkiSyncCertificatesFields.tsx@@ -1,22 +1,26 @@import { useMemo, useState } from "react";import { Controller, useFormContext } from "react-hook-form";-import { faCertificate, faEdit, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { Pencil, ScrollText, Trash2 } from "lucide-react";import {Button,- EmptyState,- FormControl,+ Empty,+ EmptyMedia,+ EmptyTitle,+ Field,+ FieldError,Table,- TableContainer,- TBody,- Td,- Th,- THead,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,Tooltip,- Tr-} from "@app/components/v2";+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useProject } from "@app/context";+import { getCertificateDisplayName, truncateCertificateSerialNumber } from "@app/helpers/pkiSyncs";import { CertStatus } from "@app/hooks/api";import { useListWorkspaceCertificates } from "@app/hooks/api/projects";@@ -57,124 +61,116 @@ export const PkiSyncCertificatesFields = ({ applicationId }: Props = {}) => {if (isLoading) {return (<div className="flex items-center justify-center py-8">- <div className="text-sm text-bunker-300">Loading certificates...</div>+ <div className="text-sm text-muted">Loading certificates...</div></div>);}return (- <>- <p className="mb-4 text-sm text-bunker-300">- Select certificates to sync with this integration. Only active certificates can be synced.- You can modify this selection after creating the sync.- </p>-+ <div className="flex min-h-0 flex-1 flex-col"><Controllercontrol={control}name="certificateIds"render={({ field: { value = [], onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <div className="space-y-4">+ <Field className="min-h-0 flex-1">+ <div className="flex min-h-0 flex-1 flex-col gap-4"><Button- variant="outline_bg"- leftIcon={<FontAwesomeIcon icon={faEdit} />}+ type="button"+ variant="outline"+ size="sm"+ className="self-end"onClick={() => setIsSelectionModalOpen(true)}>+ <Pencil className="size-3.5" />Add Certificates</Button>- <div className="max-h-64 overflow-y-auto">- <TableContainer>+ <div className="min-h-0 flex-1 overflow-y-auto">+ {selectedCertificates.length > 0 ? (<Table>- <THead>- <Tr>- <Th className="w-1/3">SAN / CN</Th>- <Th className="w-1/4">Serial Number</Th>- <Th className="w-1/6">Issued At</Th>- <Th className="w-1/6">Expires At</Th>- <Th className="w-12">Remove</Th>- </Tr>- </THead>- <TBody>+ <TableHeader>+ <TableRow>+ <TableHead className="w-1/3">SAN / CN</TableHead>+ <TableHead className="w-1/4">Serial Number</TableHead>+ <TableHead className="w-1/6">Issued At</TableHead>+ <TableHead className="w-1/6">Expires At</TableHead>+ <TableHead className="w-12">Remove</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>{selectedCertificates.map((cert) => {- let originalDisplayName = "—";- if (cert.altNames && cert.altNames.trim()) {- originalDisplayName = cert.altNames.trim();- } else if (cert.commonName && cert.commonName.trim()) {- originalDisplayName = cert.commonName.trim();- }-- let displayName = originalDisplayName;- let isTruncated = false;- if (originalDisplayName.length > 34) {- displayName = `${originalDisplayName.substring(0, 34)}...`;- isTruncated = true;- }-- const truncatedSerial =- cert.serialNumber.length > 8- ? `${cert.serialNumber.slice(0, 4)}...${cert.serialNumber.slice(-4)}`- : cert.serialNumber;+ const { originalDisplayName, displayName, isTruncated } =+ getCertificateDisplayName(cert);+ const truncatedSerial = truncateCertificateSerialNumber(cert.serialNumber);const isExpired = new Date(cert.notAfter) < new Date();return (- <Tr key={cert.id}>- <Td className="max-w-0">+ <TableRow key={cert.id}>+ <TableCell className="max-w-0">{isTruncated ? (- <Tooltip content={originalDisplayName} className="max-w-lg">- <div className="truncate">{displayName}</div>+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="truncate">{displayName}</div>+ </TooltipTrigger>+ <TooltipContent className="max-w-lg">+ {originalDisplayName}+ </TooltipContent></Tooltip>) : (<div className="truncate">{displayName}</div>)}- </Td>- <Td className="max-w-0">+ </TableCell>+ <TableCell className="max-w-0"><div- className="font-mono text-xs text-bunker-300"+ className="font-mono text-xs text-muted"title={cert.serialNumber}>{truncatedSerial}</div>- </Td>- <Td className="max-w-0">- <span className="text-sm text-bunker-300">+ </TableCell>+ <TableCell className="max-w-0">+ <span className="text-sm text-muted">{new Date(cert.notBefore).toLocaleDateString()}</span>- </Td>- <Td className="max-w-0">+ </TableCell>+ <TableCell className="max-w-0"><span- className={`text-sm ${isExpired ? "text-red-400" : "text-bunker-300"}`}+ className={`text-sm ${isExpired ? "text-danger" : "text-muted"}`}>{new Date(cert.notAfter).toLocaleDateString()}</span>- </Td>- <Td>+ </TableCell>+ <TableCell><Button- size="xs"- variant="plain"- colorSchema="secondary"- className="pl-5"+ type="button"+ size="sm"+ variant="ghost"aria-label="Remove certificate"onClick={() => {const newIds = value.filter((id: string) => id !== cert.id);onChange(newIds);}}>- <FontAwesomeIcon icon={faTrash} />+ <Trash2 className="size-4" /></Button>- </Td>- </Tr>+ </TableCell>+ </TableRow>);})}- </TBody>+ </TableBody></Table>- {selectedCertificates.length === 0 && (- <EmptyState title="No certificates selected" icon={faCertificate} />- )}- </TableContainer>+ ) : (+ <Empty className="border py-8">+ <EmptyMedia variant="icon">+ <ScrollText />+ </EmptyMedia>+ <EmptyTitle>No certificates selected</EmptyTitle>+ </Empty>+ )}</div></div>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}/>@@ -191,6 +187,6 @@ export const PkiSyncCertificatesFields = ({ applicationId }: Props = {}) => {subtitle="Choose which certificates you want to include in this sync. You can modify this selection after creating the sync."saveButtonText="Update Selection"/>- </>+ </div>);};diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncConnectionField.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncConnectionField.tsxindex c8da83aacf..142ff0cd71 100644--- a/frontend/src/components/pki-syncs/forms/PkiSyncConnectionField.tsx+++ b/frontend/src/components/pki-syncs/forms/PkiSyncConnectionField.tsx@@ -1,11 +1,19 @@import { Controller, useFormContext } from "react-hook-form";import { SingleValue } from "react-select";-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useRouterState } from "@tanstack/react-router";+import { Info } from "lucide-react";import { AppConnectionOption } from "@app/components/app-connections";-import { FilterableSelect, FormControl } from "@app/components/v2";+import {+ Field,+ FieldDescription,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { ProjectPermissionSub, useProject, useProjectPermission } from "@app/context";import { ProjectPermissionAppConnectionActions } from "@app/context/ProjectPermissionContext/types";import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";@@ -62,18 +70,22 @@ export const PkiSyncConnectionField = ({ onChange: callback }: Props) => {return (<>- <p className="mb-4 text-sm text-bunker-300">- Specify the {appName} Connection to use to connect to {connectionName} and configure- destination parameters.- </p><Controller+ control={control}+ name="connection"render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="App Connections can be created from the Project Settings page."- isError={Boolean(error)}- errorText={error?.message}- label={`${connectionName} Connection`}- >+ <Field className="mb-4">+ <FieldLabel>+ {connectionName} Connection+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ App Connections can be created from the Project Settings page.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><FilterableSelectvalue={value}onChange={(newValue) => {@@ -98,18 +110,18 @@ export const PkiSyncConnectionField = ({ onChange: callback }: Props) => {getOptionLabel={(option) => option.name}getOptionValue={(option) => option.id}components={{ Option: AppConnectionOption }}+ isError={Boolean(error)}/>- </FormControl>+ {!isPending && !availableConnections?.length && !canCreateConnection ? (+ <FieldDescription className="text-warning">+ You do not have access to any {appName} Connections. Contact an admin to create one.+ </FieldDescription>+ ) : (+ <FieldError errors={[error]} />+ )}+ </Field>)}- control={control}- name="connection"/>- {!isPending && !availableConnections?.length && !canCreateConnection && (- <p className="-mt-2.5 mb-2.5 text-xs text-yellow">- <FontAwesomeIcon className="mr-1" size="xs" icon={faInfoCircle} />- You do not have access to any {appName} Connections. Contact an admin to create one.- </p>- )}<AddAppConnectionModalisOpen={popUp.addConnection.isOpen}onOpenChange={(isOpen) => {diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncDetailsFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncDetailsFields.tsxindex 4a7af22bf7..946996dd33 100644--- a/frontend/src/components/pki-syncs/forms/PkiSyncDetailsFields.tsx+++ b/frontend/src/components/pki-syncs/forms/PkiSyncDetailsFields.tsx@@ -1,6 +1,13 @@import { Controller, useFormContext } from "react-hook-form";-import { FormControl, Input, TextArea } from "@app/components/v2";+import {+ Field,+ FieldDescription,+ FieldError,+ FieldLabel,+ Input,+ TextArea+} from "@app/components/v3";import { TPkiSyncForm } from "./schemas/pki-sync-schema";@@ -9,42 +16,42 @@ export const PkiSyncDetailsFields = () => {return (<>- <p className="mb-4 text-sm text-bunker-300">- Provide a name and description for this Certificate Sync.- </p><Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- helperText="Must be slug-friendly"- isError={Boolean(error)}- errorText={error?.message}- label="Name"- >- <Input value={value} onChange={onChange} placeholder="my-certificate-sync" />- </FormControl>- )}control={control}name="name"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>Name</FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="my-certificate-sync"+ isError={Boolean(error)}+ />+ {!error?.message && <FieldDescription>Must be slug-friendly.</FieldDescription>}+ <FieldError errors={[error]} />+ </Field>+ )}/><Controller+ control={control}+ name="description"render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- isOptional- errorText={error?.message}- label="Description"- >+ <Field className="mb-4">+ <FieldLabel>+ Description <span className="text-muted">(optional)</span>+ </FieldLabel><TextArea- value={value}+ value={value ?? ""}onChange={onChange}placeholder="Describe the purpose of this sync..."- className="resize-none!"+ className="resize-none"rows={4}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}- control={control}- name="description"/></>);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncFieldMappingsFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncFieldMappingsFields.tsxindex 922ad8e6f1..7672033032 100644--- a/frontend/src/components/pki-syncs/forms/PkiSyncFieldMappingsFields.tsx+++ b/frontend/src/components/pki-syncs/forms/PkiSyncFieldMappingsFields.tsx@@ -1,6 +1,15 @@import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";-import { FormControl, Input } from "@app/components/v2";+import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { PkiSync } from "@app/hooks/api/pkiSyncs";import { TPkiSyncForm } from "./schemas/pki-sync-schema";@@ -19,24 +28,26 @@ export const PkiSyncFieldMappingsFields = ({ destination }: Props) => {return (<>- <p className="mb-4 text-sm text-bunker-300">- Configure how certificate fields are mapped to your{" "}- {currentDestination === PkiSync.Chef ? "Chef data bag items" : "AWS secrets"}.- </p>-<div className="grid grid-cols-2 gap-4"><Controllercontrol={control}name="syncOptions.fieldMappings.certificate"render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Certificate Field"- tooltipText={`The field name used to store the certificate content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}- >- <Input {...field} placeholder="certificate" />- </FormControl>+ <Field className="mb-4">+ <FieldLabel>+ Certificate Field+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The field name used to store the certificate content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="certificate" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>)}/>@@ -44,14 +55,21 @@ export const PkiSyncFieldMappingsFields = ({ destination }: Props) => {control={control}name="syncOptions.fieldMappings.privateKey"render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Private Key Field"- tooltipText={`The field name used to store the private key content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}- >- <Input {...field} placeholder="private_key" />- </FormControl>+ <Field className="mb-4">+ <FieldLabel>+ Private Key Field+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The field name used to store the private key content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="private_key" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>)}/>@@ -59,14 +77,21 @@ export const PkiSyncFieldMappingsFields = ({ destination }: Props) => {control={control}name="syncOptions.fieldMappings.certificateChain"render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Certificate Chain Field"- tooltipText={`The field name used to store the certificate chain content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}- >- <Input {...field} placeholder="certificate_chain" />- </FormControl>+ <Field className="mb-4">+ <FieldLabel>+ Certificate Chain Field+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The field name used to store the certificate chain content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="certificate_chain" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>)}/>@@ -74,21 +99,28 @@ export const PkiSyncFieldMappingsFields = ({ destination }: Props) => {control={control}name="syncOptions.fieldMappings.caCertificate"render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="CA Certificate Field"- tooltipText={`The field name used to store the CA certificate content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}- >- <Input {...field} placeholder="ca_certificate" />- </FormControl>+ <Field className="mb-4">+ <FieldLabel>+ CA Certificate Field+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The field name used to store the CA certificate content in the ${currentDestination === PkiSync.Chef ? "Chef data bag item" : "AWS secret"}.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="ca_certificate" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>)}/></div>- <div className="mt-6 rounded-lg border border-mineshaft-600 bg-mineshaft-800 p-4">- <h4 className="mb-2 text-sm font-medium text-mineshaft-100">Preview JSON Structure</h4>- <pre className="text-xs text-bunker-300">+ <div className="mt-6 rounded-lg border border-border bg-container p-4">+ <h4 className="mb-2 text-sm font-medium text-foreground">Preview JSON Structure</h4>+ <pre className="text-xs text-muted">{`{"id": "certificate-item-name","${watch("syncOptions.fieldMappings.certificate") || "certificate"}": "<certificate-content>",diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsCertificateManagerSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsCertificateManagerSyncOptions.tsxnew file mode 100644index 0000000000..c2e19c3ea5--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsCertificateManagerSyncOptions.tsx@@ -0,0 +1,3 @@+import { PreserveArnField } from "./PreserveArnField";++export const AwsCertificateManagerSyncOptions = () => <PreserveArnField />;diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsElasticLoadBalancerSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsElasticLoadBalancerSyncOptions.tsxnew file mode 100644index 0000000000..9e2307c35d--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsElasticLoadBalancerSyncOptions.tsx@@ -0,0 +1,3 @@+import { PreserveArnField } from "./PreserveArnField";++export const AwsElasticLoadBalancerSyncOptions = () => <PreserveArnField />;diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsSecretsManagerSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsSecretsManagerSyncOptions.tsxnew file mode 100644index 0000000000..e1ea36a07c--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AwsSecretsManagerSyncOptions.tsx@@ -0,0 +1,11 @@+import { SyncSwitchField } from "./SyncSwitchField";++export const AwsSecretsManagerSyncOptions = () => (+ <SyncSwitchField+ name="syncOptions.preserveSecretOnRenewal"+ id="preserve-secret-on-renewal"+ label="Preserve Secret on Renewal"+ description="Applies to certificate renewals only. When enabled, the renewed certificate updates the existing secret, keeping the same name and ARN so consumers need no updates. When disabled, a new secret is created and the old one is removed."+ defaultChecked+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AzureKeyVaultSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AzureKeyVaultSyncOptions.tsxnew file mode 100644index 0000000000..fbfa74b35a--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/AzureKeyVaultSyncOptions.tsx@@ -0,0 +1,11 @@+import { SyncSwitchField } from "./SyncSwitchField";++export const AzureKeyVaultSyncOptions = () => (+ <SyncSwitchField+ name="syncOptions.enableVersioning"+ id="preserve-version"+ label="Enable Versioning on Renewal"+ description="When enabled, renewals add a new version of the existing certificate in Azure Key Vault under the same name, so consumers automatically use the latest version. When disabled, a new certificate is created and the old one is removed."+ defaultChecked+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/ChefSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/ChefSyncOptions.tsxnew file mode 100644index 0000000000..3bcafc7a1d--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/ChefSyncOptions.tsx@@ -0,0 +1,8 @@+import { PreserveItemOnRenewalField } from "./PreserveItemOnRenewalField";++export const ChefSyncOptions = () => (+ <PreserveItemOnRenewalField+ label="Preserve Data Bag Item on Renewal"+ description="Applies to certificate renewals only. When enabled, the renewed certificate updates the existing data bag item, keeping the same name so Chef cookbooks and recipes need no updates. When disabled, a new item is created and the old one is removed."+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/F5BigIpSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/F5BigIpSyncOptions.tsxnew file mode 100644index 0000000000..babd5134e1--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/F5BigIpSyncOptions.tsx@@ -0,0 +1,8 @@+import { PreserveItemOnRenewalField } from "./PreserveItemOnRenewalField";++export const F5BigIpSyncOptions = () => (+ <PreserveItemOnRenewalField+ label="Preserve Certificate on Renewal"+ description="Applies to certificate renewals only. When enabled, the renewed certificate replaces the existing one under the same name, so any profile that uses it keeps working. When disabled, it is uploaded with a new name and the original stays on the BIG-IP."+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/KempLoadMasterSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/KempLoadMasterSyncOptions.tsxnew file mode 100644index 0000000000..ede4628ee1--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/KempLoadMasterSyncOptions.tsx@@ -0,0 +1,96 @@+import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldDescription,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { usePkiSyncOption } from "@app/hooks/api/pkiSyncs";++import { KEMP_DEFAULT_CA_NAME_SCHEMA } from "../schemas/kemp-loadmaster-pki-sync-destination-schema";+import { TPkiSyncForm } from "../schemas/pki-sync-schema";+import { PreserveItemOnRenewalField } from "./PreserveItemOnRenewalField";++export const KempLoadMasterSyncOptions = () => {+ const { control, watch } = useFormContext<TPkiSyncForm>();+ const { syncOption } = usePkiSyncOption(watch("destination"));++ return (+ <>+ <PreserveItemOnRenewalField+ label="Preserve Certificate on Renewal"+ description="Applies to certificate renewals only. When enabled, the renewed certificate keeps the original certificate's identifier and replaces that entry in place, so any Virtual Service binding keeps working. When disabled, the renewed certificate is imported under a newly generated identifier and the original stays on the LoadMaster."+ />+ <Controller+ control={control}+ name="syncOptions.caCertificateNameSchema"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ CA Certificate Name Schema+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ <div className="flex flex-col gap-3">+ <span>+ This schema names each CA (intermediate) certificate that Infisical pushes+ into the LoadMaster's Intermediate Certs store.+ </span>+ <div className="flex flex-col">+ <span>Available placeholders:</span>+ <ul className="list-disc pl-4 text-sm">+ <li>+ <code>{"{{fingerprint}}"}</code> - A hash of the CA certificate. Include+ it so each distinct CA gets a unique name and is never duplicated.+ </li>+ <li>+ <code>{"{{commonName}}"}</code> - The CA certificate's common name+ </li>+ </ul>+ <span className="mt-1 text-xs text-muted">+ A placeholder is optional. A schema with no placeholder resolves to a fixed+ name and can hold only one CA certificate. When placeholders resolve, any+ characters the destination doesn't support are replaced with hyphens.+ </span>+ </div>+ {syncOption?.forbiddenCharacters &&+ syncOption.forbiddenCharacters.length > 0 && (+ <div className="flex flex-col">+ <span className="text-warning">+ Character restrictions for {syncOption.name}:+ </span>+ <div className="text-xs text-muted">+ The following characters are not allowed:{" "}+ {syncOption.forbiddenCharacters.split("").join(" ")}+ </div>+ </div>+ )}+ </div>+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={(e) => onChange(e.target.value)}+ placeholder={KEMP_DEFAULT_CA_NAME_SCHEMA}+ isError={Boolean(error)}+ />+ <FieldDescription>+ Controls how CA (intermediate) certificates are named in the LoadMaster's+ Intermediate Certs store.+ </FieldDescription>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+ );+};diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/LinuxServerSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/LinuxServerSyncOptions.tsxnew file mode 100644index 0000000000..9a0e611c69--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/LinuxServerSyncOptions.tsx@@ -0,0 +1,139 @@+import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";++import { TPkiSyncForm } from "../schemas/pki-sync-schema";+import { ServerExportFormatFields } from "./ServerExportFormatFields";++type Props = {+ isUpdate?: boolean;+};++export const LinuxServerSyncOptions = ({ isUpdate }: Props) => {+ const { control } = useFormContext<TPkiSyncForm>();++ return (+ <>+ <ServerExportFormatFields isUpdate={isUpdate} />+ <div className="grid grid-cols-2 gap-2">+ <Controller+ control={control}+ name="syncOptions.fileMode"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ File Permissions <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Octal mode for the delivered certificate and chain files (default 644).+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="644"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="syncOptions.privateKeyFileMode"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Private Key Permissions <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Octal mode for the delivered private key file (default 600).+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="600"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </div>+ <div className="grid grid-cols-2 gap-2">+ <Controller+ control={control}+ name="syncOptions.owner"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Owner <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Owner applied to the delivered files (chown). Requires the connection user to be+ root or have passwordless sudo.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="e.g. root"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="syncOptions.group"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Group <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Group applied to the delivered files (chown). Requires the connection user to be+ root or have passwordless sudo.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ value={value ?? ""}+ onChange={onChange}+ placeholder="e.g. ssl-cert"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </div>+ </>+ );+};diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/NetScalerSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/NetScalerSyncOptions.tsxnew file mode 100644index 0000000000..ef358dfa31--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/NetScalerSyncOptions.tsx@@ -0,0 +1,8 @@+import { PreserveItemOnRenewalField } from "./PreserveItemOnRenewalField";++export const NetScalerSyncOptions = () => (+ <PreserveItemOnRenewalField+ label="Preserve Certificate on Renewal"+ description="Applies to certificate renewals only. When enabled, the renewed certificate updates the existing certkey object, keeping its name and vServer bindings. When disabled, a new certkey object is created and the old certificate remains on NetScaler."+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsxindex 9f289acd20..4a05b0e046 100644--- a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PkiSyncOptionsFields.tsx@@ -1,917 +1,202 @@-import { Controller, useFieldArray, useFormContext } from "react-hook-form";-import { faPlus, faQuestionCircle, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";import {- Button,- FormControl,- IconButton,+ Field,+ FieldDescription,+ FieldError,+ FieldLabel,Input,- Select,- SelectItem,- Switch,- Tooltip-} from "@app/components/v2";-import {- PemCertificateExtension,- PkiSync,- PkiSyncExportFormat,- usePkiSyncOption,- WindowsFileAccess-} from "@app/hooks/api/pkiSyncs";+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { PkiSync, usePkiSyncOption } from "@app/hooks/api/pkiSyncs";-import { KEMP_DEFAULT_CA_NAME_SCHEMA } from "../schemas/kemp-loadmaster-pki-sync-destination-schema";import { TPkiSyncForm } from "../schemas/pki-sync-schema";+import { AwsCertificateManagerSyncOptions } from "./AwsCertificateManagerSyncOptions";+import { AwsElasticLoadBalancerSyncOptions } from "./AwsElasticLoadBalancerSyncOptions";+import { AwsSecretsManagerSyncOptions } from "./AwsSecretsManagerSyncOptions";+import { AzureKeyVaultSyncOptions } from "./AzureKeyVaultSyncOptions";+import { ChefSyncOptions } from "./ChefSyncOptions";+import { F5BigIpSyncOptions } from "./F5BigIpSyncOptions";+import { KempLoadMasterSyncOptions } from "./KempLoadMasterSyncOptions";+import { LinuxServerSyncOptions } from "./LinuxServerSyncOptions";+import { NetScalerSyncOptions } from "./NetScalerSyncOptions";+import { SyncSwitchField } from "./SyncSwitchField";+import { WindowsServerSyncOptions } from "./WindowsServerSyncOptions";type Props = {destination?: PkiSync;isUpdate?: boolean;};+const renderDestinationOptions = (currentDestination: PkiSync, isUpdate?: boolean) => {+ switch (currentDestination) {+ case PkiSync.AwsCertificateManager:+ return <AwsCertificateManagerSyncOptions />;+ case PkiSync.AwsElasticLoadBalancer:+ return <AwsElasticLoadBalancerSyncOptions />;+ case PkiSync.AzureKeyVault:+ return <AzureKeyVaultSyncOptions />;+ case PkiSync.AwsSecretsManager:+ return <AwsSecretsManagerSyncOptions />;+ case PkiSync.Chef:+ return <ChefSyncOptions />;+ case PkiSync.NetScaler:+ return <NetScalerSyncOptions />;+ case PkiSync.F5BigIp:+ return <F5BigIpSyncOptions />;+ case PkiSync.KempLoadMaster:+ return <KempLoadMasterSyncOptions />;+ case PkiSync.LinuxServer:+ return <LinuxServerSyncOptions isUpdate={isUpdate} />;+ case PkiSync.WindowsServer:+ return <WindowsServerSyncOptions isUpdate={isUpdate} />;+ default:+ return null;+ }+};+export const PkiSyncOptionsFields = ({ destination, isUpdate }: Props) => {const { control, watch } = useFormContext<TPkiSyncForm>();const currentDestination = destination || watch("destination");const { syncOption } = usePkiSyncOption(currentDestination);- const {- fields: accessRuleFields,- append: appendAccessRule,- remove: removeAccessRule- } = useFieldArray({ control, name: "syncOptions.fileAccessRules" as never });return (<>- <p className="mb-4 text-sm text-bunker-300">Configure how certificates should be synced.</p>- {/*- TODO: Re-enable this when we have a way to import certificates- <Controller- control={control}- name="syncOptions.canImportCertificates"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="can-import-certificates"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Auto Import Certificates{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- When enabled, Infisical will automatically import certificates from the PKI- subscriber to the destination during sync operations.- </p>- <p className="mt-4">- This allows you to automatically populate your destination with certificates- issued by your Certificate Authority.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- */}{syncOption?.canRemoveCertificates && (- <Controller- control={control}+ <SyncSwitchFieldname="syncOptions.canRemoveCertificates"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="can-remove-certificates"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Enable Removal of Expired/Revoked Certificates{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- When enabled, Infisical will remove certificates from the destination- during a sync if they are no longer active in Infisical.- </p>- {currentDestination === PkiSync.AwsElasticLoadBalancer && (- <p className="mt-4">- For AWS Elastic Load Balancer, this will remove the certificate from- both the load balancer listeners and AWS Certificate Manager. This only- affects certificates managed by this specific sync and will not- interfere with certificates managed by other syncs (such as ACM syncs or- other ELB syncs).- </p>- )}- <p className="mt-4">- Disable this option if you intend to manage some certificates manually- outside of Infisical.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}+ id="can-remove-certificates"+ label="Enable Removal of Expired/Revoked Certificates"+ description={+ <>+ When enabled, Infisical removes certificates from the destination during a sync once+ they are no longer active in Infisical. Disable this if you manage some certificates+ manually outside of Infisical.+ {currentDestination === PkiSync.AwsElasticLoadBalancer &&+ " For AWS Elastic Load Balancer, this removes the certificate from both the load balancer listeners and AWS Certificate Manager, affecting only certificates managed by this sync."}+ </>+ }/>)}{currentDestination !== PkiSync.CloudflareCustomCertificate &¤tDestination !== PkiSync.NutanixPrismCentral && (- <Controller- control={control}+ <SyncSwitchFieldname="syncOptions.includeRootCa"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="include-root-ca"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Include Root CA in Certificate Chain{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- When enabled, the full certificate chain including the root CA will be- synced to the destination.- </p>- <p className="mt-4">- When disabled, the root CA will be excluded from the certificate chain- during sync operations, reducing the size of the synced certificate- chain.- </p>- <p className="mt-4">- Most applications and services work correctly with intermediate- certificates only, as they can validate the trust chain up to a root CA- they already trust.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}+ id="include-root-ca"+ label="Include Root CA in Certificate Chain"+ description="When enabled, the full certificate chain including the root CA is synced. When disabled, the root CA is excluded to reduce the chain size; most applications validate correctly with intermediate certificates only."/>)}- {(currentDestination === PkiSync.AwsCertificateManager ||- currentDestination === PkiSync.AwsElasticLoadBalancer) && (- <Controller- control={control}- name="syncOptions.preserveArn"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-arn"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Preserve ARN on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- When enabled, Infisical will replace the contents of existing certificates- while preserving the same ARN during certificate renewal syncs.- </p>- <p className="mt-4">- This allows consuming services like load balancers to continue using the- same ARN without requiring manual updates.- </p>- <p className="mt-4">- When disabled, new certificates will be created with new ARNs, and old- certificates will be removed.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.AzureKeyVault && (- <Controller- control={control}- name="syncOptions.enableVersioning"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-version"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Enable Versioning on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- When enabled, Infisical will create a new version of the existing- certificate in Azure Key Vault during certificate renewal syncs,- preserving the original certificate name.- </p>- <p className="mt-4">- This allows consuming services to continue using the same certificate name- while automatically using the latest version without requiring manual- updates.- </p>- <p className="mt-4">- When disabled, new certificates will be created with new names, and old- certificates will be removed.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.AwsSecretsManager && (- <Controller- control={control}- name="syncOptions.preserveSecretOnRenewal"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-secret-on-renewal"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Preserve Secret on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- <strong>Only applies to certificate renewals:</strong> When a certificate- is renewed in Infisical, this option controls how the renewed certificate- is handled in AWS Secrets Manager.- </p>- <p className="mt-4">- When enabled, the renewed certificate will update the existing secret,- preserving the same secret name and ARN. This allows consuming services to- continue using the same secret reference without requiring updates.- </p>- <p className="mt-4">- When disabled, the renewed certificate will be created as a new secret- with a new name, and the old secret will be removed.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.Chef && (- <Controller- control={control}- name="syncOptions.preserveItemOnRenewal"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-item-on-renewal"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Preserve Data Bag Item on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- <strong>Only applies to certificate renewals:</strong> When a certificate- is renewed in Infisical, this option controls how the renewed certificate- is handled in Chef.- </p>- <p className="mt-4">- When enabled, the renewed certificate will update the existing data bag- item, preserving the same item name. This allows consuming services to- continue using the same data bag item without requiring updates to Chef- cookbooks or recipes.- </p>- <p className="mt-4">- When disabled, the renewed certificate will be created as a new data bag- item with a new name, and the old item will be removed.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.NetScaler && (- <Controller- control={control}- name="syncOptions.preserveItemOnRenewal"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-item-on-renewal"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Preserve Certificate on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- <strong>Only applies to certificate renewals:</strong> When a certificate- is renewed in Infisical, this option controls how the renewed certificate- is handled in NetScaler.- </p>- <p className="mt-4">- When enabled, the renewed certificate will update the existing certkey- object, preserving the same name and vServer bindings.- </p>- <p className="mt-4">- When disabled, the renewed certificate will be created as a new certkey- object with a new name, and the old certificate will remain on NetScaler.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.F5BigIp && (- <Controller- control={control}- name="syncOptions.preserveItemOnRenewal"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-item-on-renewal"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Preserve Certificate on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- <strong>Only applies to certificate renewals:</strong> controls what- happens on the BIG-IP when Infisical renews a certificate.- </p>- <p className="mt-4">- When on, the renewed certificate replaces the existing one under the same- name, so any profile that uses it keeps working without any extra setup.- </p>- <p className="mt-4">- When off, the renewed certificate is uploaded with a new name and the- original stays on the BIG-IP.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.KempLoadMaster && (- <Controller- control={control}- name="syncOptions.preserveItemOnRenewal"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="preserve-item-on-renewal"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value}- >- <p>- Preserve Certificate on Renewal{" "}- <Tooltip- className="max-w-md"- content={- <>- <p>- <strong>Only applies to certificate renewals:</strong> controls the- identifier a renewed certificate uses on the LoadMaster.- </p>- <p className="mt-4">- When on, the renewed certificate keeps the original certificate's- identifier and replaces that entry in place, so any Virtual Service- binding keeps working. This matters when your name schema is- certificate-specific (for example it includes{" "}- <code>{"{{certificateId}}"}</code>), which would otherwise resolve to a- new name on renewal.- </p>- <p className="mt-4">- When off, the renewed certificate is imported under a newly generated- identifier and the original stays on the LoadMaster.- </p>- </>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}-- {currentDestination === PkiSync.KempLoadMaster && (- <Controller- control={control}- name="syncOptions.caCertificateNameSchema"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipClassName="max-w-md"- tooltipText={- <div className="flex flex-col gap-3">- <span>- This schema names each CA (intermediate) certificate that Infisical pushes into- the LoadMaster's Intermediate Certs store.- </span>-- <div className="flex flex-col">- <span>Available placeholders:</span>- <ul className="list-disc pl-4 text-sm">- <li>- <code>{"{{fingerprint}}"}</code> - A hash of the CA certificate. Include it- so each distinct CA gets a unique name and is never duplicated.- </li>- <li>- <code>{"{{commonName}}"}</code> - The CA certificate's common name- </li>- </ul>- <span className="mt-1 text-xs text-bunker-300">- A placeholder is optional. A schema with no placeholder resolves to a fixed- name and can hold only one CA certificate. When placeholders resolve, any- characters the destination doesn't support are replaced with hyphens.- </span>- </div>- {syncOption?.forbiddenCharacters && syncOption.forbiddenCharacters.length > 0 && (- <div className="flex flex-col">- <span className="text-yellow">- Character restrictions for {syncOption.name}:- </span>- <div className="text-xs text-bunker-300">- The following characters are not allowed:{" "}- {syncOption.forbiddenCharacters.split("").join(" ")}- </div>- </div>- )}- </div>- }- isError={Boolean(error)}- errorText={error?.message}- label="CA Certificate Name Schema"- helperText="Controls how CA (intermediate) certificates are named in the LoadMaster's Intermediate Certs store."- >- <Input- value={value ?? ""}- onChange={(e) => onChange(e.target.value)}- placeholder={KEMP_DEFAULT_CA_NAME_SCHEMA}- />- </FormControl>- )}- />- )}-- {(currentDestination === PkiSync.LinuxServer ||- currentDestination === PkiSync.WindowsServer) && (- <>- <Controller- control={control}- name="syncOptions.exportFormat"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Export Format"- tooltipText="PEM writes separate certificate, chain, and key files. PKCS#12 writes a single password-protected .pfx bundle."- >- <Select- value={value ?? PkiSyncExportFormat.Pem}- onValueChange={(v) => onChange(v as PkiSyncExportFormat)}- className="w-full border border-mineshaft-500"- position="popper"- >- <SelectItem value={PkiSyncExportFormat.Pem}>PEM</SelectItem>- <SelectItem value={PkiSyncExportFormat.Pkcs12}>PKCS#12 (.pfx)</SelectItem>- </Select>- </FormControl>- )}- />- {watch("syncOptions.exportFormat") === PkiSyncExportFormat.Pem && (- <Controller- control={control}- name="syncOptions.pemCertificateExtension"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Certificate File Extension"- tooltipText="The extension for the certificate and chain files. Both hold the same PEM-encoded content; choose the one the consuming service expects."- >- <Select- value={value ?? PemCertificateExtension.Pem}- onValueChange={(v) => onChange(v as PemCertificateExtension)}- className="w-full border border-mineshaft-500"- position="popper"- >- <SelectItem value={PemCertificateExtension.Pem}>.pem</SelectItem>- <SelectItem value={PemCertificateExtension.Crt}>.crt</SelectItem>- </Select>- </FormControl>- )}- />- )}- {watch("syncOptions.exportFormat") === PkiSyncExportFormat.Pem && (- <Controller- control={control}- name="syncOptions.combineCertificateChain"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="combine-certificate-chain"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value ?? false}- >- <p>- Combine Certificate and Chain{" "}- <Tooltip- className="max-w-md"- content="When on, the certificate file holds the leaf certificate followed by the chain (a full-chain file, as nginx expects) and no separate chain file is written."- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}- {watch("syncOptions.exportFormat") === PkiSyncExportFormat.Pkcs12 && (- <Controller- control={control}- name="credentials.exportPassword"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="PKCS#12 Password"- tooltipText={- isUpdate- ? "Protects the .pfx bundle. Leave blank to keep the current password."- : "Protects the .pfx bundle."- }- >- <Input- type="password"- value={value ?? ""}- onChange={onChange}- placeholder="Enter a password"- />- </FormControl>- )}- />- )}- {watch("syncOptions.exportFormat") !== PkiSyncExportFormat.Pkcs12 && (- <Controller- control={control}- name="syncOptions.includePrivateKey"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl isError={Boolean(error)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- id="include-private-key"- thumbClassName="bg-mineshaft-800"- onCheckedChange={onChange}- isChecked={value ?? true}- >- <p>- Include Private Key{" "}- <Tooltip- className="max-w-md"- content="When on, the certificate's private key is written alongside the certificate as a .key file. The sync fails for a certificate whose key is not available (for example, one issued from an external CSR)."- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </p>- </Switch>- </FormControl>- )}- />- )}- </>- )}-- {currentDestination === PkiSync.LinuxServer && (- <>- <div className="grid grid-cols-2 gap-2">- <Controller- control={control}- name="syncOptions.fileMode"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="File Permissions"- isOptional- tooltipText="Octal mode for the delivered certificate and chain files (default 644)."- >- <Input value={value ?? ""} onChange={onChange} placeholder="644" />- </FormControl>- )}- />- <Controller- control={control}- name="syncOptions.privateKeyFileMode"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Private Key Permissions"- isOptional- tooltipText="Octal mode for the delivered private key file (default 600)."- >- <Input value={value ?? ""} onChange={onChange} placeholder="600" />- </FormControl>- )}- />- </div>- <div className="grid grid-cols-2 gap-2">- <Controller- control={control}- name="syncOptions.owner"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Owner"- isOptional- tooltipText="Owner applied to the delivered files (chown). Requires the connection user to be root or have passwordless sudo."- >- <Input value={value ?? ""} onChange={onChange} placeholder="e.g. root" />- </FormControl>- )}- />- <Controller- control={control}- name="syncOptions.group"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Group"- isOptional- tooltipText="Group applied to the delivered files (chown). Requires the connection user to be root or have passwordless sudo."- >- <Input value={value ?? ""} onChange={onChange} placeholder="e.g. ssl-cert" />- </FormControl>- )}- />- </div>- </>- )}-- {currentDestination === PkiSync.WindowsServer && (- <FormControl- label="File Permissions"- isOptional- tooltipText="Grant Windows users or groups access to the delivered files (for example, restrict who can read the private key). Rules are added on top of the destination folder's inherited permissions."- >- <div className="flex flex-col gap-2">- {accessRuleFields.map((ruleField, index) => (- <div key={ruleField.id} className="flex items-start gap-2">- <Controller- control={control}- name={`syncOptions.fileAccessRules.${index}.identity` as never}- render={({ field, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- className="mb-0 flex-1"- >- <Input- {...field}- value={(field.value as string) ?? ""}- placeholder="DOMAIN\svc-account"- />- </FormControl>- )}- />- <Controller- control={control}- name={`syncOptions.fileAccessRules.${index}.access` as never}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- className="mb-0 w-40"- >- <Select- value={(value as WindowsFileAccess) ?? WindowsFileAccess.Read}- onValueChange={onChange}- className="w-full border border-mineshaft-500"- position="popper"- >- <SelectItem value={WindowsFileAccess.Read}>Read</SelectItem>- <SelectItem value={WindowsFileAccess.Modify}>Modify</SelectItem>- <SelectItem value={WindowsFileAccess.FullControl}>Full Control</SelectItem>- </Select>- </FormControl>- )}- />- <IconButton- ariaLabel="Remove permission rule"- variant="plain"- className="mt-1"- onClick={() => removeAccessRule(index)}- >- <FontAwesomeIcon icon={faTrash} />- </IconButton>- </div>- ))}- <div>- <Button- type="button"- variant="outline_bg"- size="xs"- leftIcon={<FontAwesomeIcon icon={faPlus} />}- onClick={() => appendAccessRule({ identity: "", access: WindowsFileAccess.Read })}- >- Add Permission- </Button>- </div>- </div>- </FormControl>- )}+ {renderDestinationOptions(currentDestination, isUpdate)}{currentDestination !== PkiSync.NutanixPrismCentral && (<Controllercontrol={control}name="syncOptions.certificateNameSchema"render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipClassName="max-w-md"- tooltipText={- <div className="flex flex-col gap-3">- <span>- When a certificate is synced, the certificate name schema will be applied before- it reaches the destination.- </span>-- <div className="flex flex-col">- <span>Available placeholders:</span>- <ul className="list-disc pl-4 text-sm">- <li>- <code>{"{{certificateId}}"}</code> - The unique ID of the certificate- </li>- <li>- <code>{"{{shortCertificateId}}"}</code> - A shorter (22-character) form of- the certificate ID. Use it instead of <code>{"{{certificateId}}"}</code>{" "}- when the destination's name limit is tight (e.g. NetScaler's 63- characters).- </li>- <li>- <code>{"{{commonName}}"}</code> - The certificate's common name (FQDN)- </li>- <li>- <code>{"{{profileId}}"}</code> - The certificate profile ID (falls back to- the certificate ID when none is set)- </li>- <li>- <code>{"{{applicationId}}"}</code> - The ID of the application the sync- belongs to- </li>- <li>- <code>{"{{applicationName}}"}</code> - The name of the application the sync- belongs to- </li>- </ul>- {currentDestination === PkiSync.LinuxServer ||- currentDestination === PkiSync.WindowsServer ? (- <span className="mt-1 text-xs text-bunker-300">- A placeholder is optional here. Include one (for example{" "}- <code>{"{{commonName}}"}</code>) so each certificate resolves to a distinct- file name. A schema with no placeholder resolves to a fixed name and can be- linked to only one certificate. When placeholders resolve, any characters- the destination doesn't support are replaced with hyphens.- </span>- ) : (- <span className="mt-1 text-xs text-bunker-300">- The schema must include <code>{"{{certificateId}}"}</code> or{" "}- <code>{"{{shortCertificateId}}"}</code> so each certificate gets a unique- name. The template itself can only contain letters, numbers, and the- separators allowed by the destination. When placeholders resolve, any- characters the destination doesn't support are replaced with hyphens.+ <Field className="mb-4">+ <FieldLabel>+ Certificate Name Schema+ {currentDestination === PkiSync.AwsElasticLoadBalancer && (+ <span className="text-muted">(optional)</span>+ )}+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ <div className="flex flex-col gap-3">+ <span>+ When a certificate is synced, the certificate name schema will be applied+ before it reaches the destination.</span>- )}- </div>- {syncOption?.forbiddenCharacters && syncOption.forbiddenCharacters.length > 0 && (- <div className="flex flex-col">- <span className="text-yellow">- Character restrictions for {syncOption.name}:- </span>- <div className="text-xs text-bunker-300">- The following characters are not allowed:{" "}- {syncOption.forbiddenCharacters.split("").join(" ")}++ <div className="flex flex-col">+ <span>Available placeholders:</span>+ <ul className="list-disc pl-4 text-sm">+ <li>+ <code>{"{{certificateId}}"}</code> - The unique ID of the certificate+ </li>+ <li>+ <code>{"{{shortCertificateId}}"}</code> - A shorter (22-character) form+ of the certificate ID. Use it instead of{" "}+ <code>{"{{certificateId}}"}</code> when the destination's name+ limit is tight (e.g. NetScaler's 63 characters).+ </li>+ <li>+ <code>{"{{commonName}}"}</code> - The certificate's common name+ (FQDN)+ </li>+ <li>+ <code>{"{{profileId}}"}</code> - The certificate profile ID (falls back+ to the certificate ID when none is set)+ </li>+ <li>+ <code>{"{{applicationId}}"}</code> - The ID of the application the sync+ belongs to+ </li>+ <li>+ <code>{"{{applicationName}}"}</code> - The name of the application the+ sync belongs to+ </li>+ </ul>+ {currentDestination === PkiSync.LinuxServer ||+ currentDestination === PkiSync.WindowsServer ? (+ <span className="mt-1 text-xs text-muted">+ A placeholder is optional here. Include one (for example{" "}+ <code>{"{{commonName}}"}</code>) so each certificate resolves to a+ distinct file name. A schema with no placeholder resolves to a fixed+ name and can be linked to only one certificate. When placeholders+ resolve, any characters the destination doesn't support are+ replaced with hyphens.+ </span>+ ) : (+ <span className="mt-1 text-xs text-muted">+ The schema must include <code>{"{{certificateId}}"}</code> or{" "}+ <code>{"{{shortCertificateId}}"}</code> so each certificate gets a+ unique name. The template itself can only contain letters, numbers, and+ the separators allowed by the destination. When placeholders resolve,+ any characters the destination doesn't support are replaced with+ hyphens.+ </span>+ )}</div>+ {syncOption?.forbiddenCharacters &&+ syncOption.forbiddenCharacters.length > 0 && (+ <div className="flex flex-col">+ <span className="text-warning">+ Character restrictions for {syncOption.name}:+ </span>+ <div className="text-xs text-muted">+ The following characters are not allowed:{" "}+ {syncOption.forbiddenCharacters.split("").join(" ")}+ </div>+ </div>+ )}</div>- )}- </div>- }- isError={Boolean(error)}- isOptional={currentDestination === PkiSync.AwsElasticLoadBalancer}- errorText={error?.message}- label="Certificate Name Schema"- helperText={- currentDestination === PkiSync.AwsElasticLoadBalancer- ? "Set a Certificate Name Schema so Infisical only manages the specific certificates you intend to, keeping everything else untouched."- : "The Certificate Name Schema ensures Infisical only manages the specific certificates you intend to, keeping everything else untouched."- }- >+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Inputvalue={value || ""}onChange={(e) => onChange(e.target.value)}placeholder={syncOption?.defaultCertificateNameSchema || "INFISICAL_{{certificateId}}"}+ isError={Boolean(error)}/>- </FormControl>+ <FieldDescription>+ {currentDestination === PkiSync.AwsElasticLoadBalancer+ ? "Set a Certificate Name Schema so Infisical only manages the specific certificates you intend to, keeping everything else untouched."+ : "The Certificate Name Schema ensures Infisical only manages the specific certificates you intend to, keeping everything else untouched."}+ </FieldDescription>+ <FieldError errors={[error]} />+ </Field>)}/>)}diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PreserveArnField.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PreserveArnField.tsxnew file mode 100644index 0000000000..1ce1621c5d--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PreserveArnField.tsx@@ -0,0 +1,17 @@+import { SyncSwitchField } from "./SyncSwitchField";++export const PreserveArnField = () => (+ <SyncSwitchField+ name="syncOptions.preserveArn"+ id="preserve-arn"+ label="Preserve ARN on Renewal"+ description={+ <>+ When enabled, renewals replace the existing certificate's contents while keeping the+ same ARN, so consumers like load balancers need no manual updates. When disabled, a new ARN+ is created and the old certificate is removed.+ </>+ }+ defaultChecked+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PreserveItemOnRenewalField.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PreserveItemOnRenewalField.tsxnew file mode 100644index 0000000000..5220c02fa9--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/PreserveItemOnRenewalField.tsx@@ -0,0 +1,18 @@+import { ReactNode } from "react";++import { SyncSwitchField } from "./SyncSwitchField";++type Props = {+ label: string;+ description: ReactNode;+};++export const PreserveItemOnRenewalField = ({ label, description }: Props) => (+ <SyncSwitchField+ name="syncOptions.preserveItemOnRenewal"+ id="preserve-item-on-renewal"+ label={label}+ description={description}+ defaultChecked+ />+);diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/ServerExportFormatFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/ServerExportFormatFields.tsxnew file mode 100644index 0000000000..a18216103f--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/ServerExportFormatFields.tsx@@ -0,0 +1,190 @@+import { Controller, useFormContext } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel,+ Input,+ Label,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Switch,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { PemCertificateExtension, PkiSyncExportFormat } from "@app/hooks/api/pkiSyncs";++import { TPkiSyncForm } from "../schemas/pki-sync-schema";++type Props = {+ isUpdate?: boolean;+};++export const ServerExportFormatFields = ({ isUpdate }: Props) => {+ const { control, watch } = useFormContext<TPkiSyncForm>();++ return (+ <>+ <Controller+ control={control}+ name="syncOptions.exportFormat"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Export Format+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ PEM writes separate certificate, chain, and key files. PKCS#12 writes a single+ password-protected .pfx bundle.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select+ value={value ?? PkiSyncExportFormat.Pem}+ onValueChange={(v) => onChange(v as PkiSyncExportFormat)}+ >+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={PkiSyncExportFormat.Pem}>PEM</SelectItem>+ <SelectItem value={PkiSyncExportFormat.Pkcs12}>PKCS#12 (.pfx)</SelectItem>+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ {watch("syncOptions.exportFormat") === PkiSyncExportFormat.Pem && (+ <Controller+ control={control}+ name="syncOptions.pemCertificateExtension"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Certificate File Extension+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The extension for the certificate and chain files. Both hold the same+ PEM-encoded content; choose the one the consuming service expects.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select+ value={value ?? PemCertificateExtension.Pem}+ onValueChange={(v) => onChange(v as PemCertificateExtension)}+ >+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={PemCertificateExtension.Pem}>.pem</SelectItem>+ <SelectItem value={PemCertificateExtension.Crt}>.crt</SelectItem>+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ {watch("syncOptions.exportFormat") === PkiSyncExportFormat.Pem && (+ <Controller+ control={control}+ name="syncOptions.combineCertificateChain"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor="combine-certificate-chain">Combine Certificate and Chain</Label>+ <FieldDescription>+ When enabled, the certificate file holds the leaf certificate followed by the+ chain (a full-chain file, as nginx expects) and no separate chain file is+ written.+ </FieldDescription>+ </FieldContent>+ <Switch+ id="combine-certificate-chain"+ variant="project"+ checked={value ?? false}+ onCheckedChange={onChange}+ />+ </Field>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ {watch("syncOptions.exportFormat") === PkiSyncExportFormat.Pkcs12 && (+ <Controller+ control={control}+ name="credentials.exportPassword"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ PKCS#12 Password+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {isUpdate+ ? "Protects the .pfx bundle. Leave blank to keep the current password."+ : "Protects the .pfx bundle."}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ type="password"+ value={value ?? ""}+ onChange={onChange}+ placeholder="Enter a password"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ {watch("syncOptions.exportFormat") !== PkiSyncExportFormat.Pkcs12 && (+ <Controller+ control={control}+ name="syncOptions.includePrivateKey"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor="include-private-key">Include Private Key</Label>+ <FieldDescription>+ When enabled, the certificate's private key is written alongside the+ certificate as a .key file. The sync fails for a certificate whose key is not+ available (for example, one issued from an external CSR).+ </FieldDescription>+ </FieldContent>+ <Switch+ id="include-private-key"+ variant="project"+ checked={value ?? true}+ onCheckedChange={onChange}+ />+ </Field>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ </>+ );+};diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/SyncSwitchField.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/SyncSwitchField.tsxnew file mode 100644index 0000000000..7faa017bba--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/SyncSwitchField.tsx@@ -0,0 +1,55 @@+import { ReactNode } from "react";+import { Controller, FieldPath, useFormContext } from "react-hook-form";++import {+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ Label,+ Switch+} from "@app/components/v3";++import { TPkiSyncForm } from "../schemas/pki-sync-schema";++type Props = {+ name: FieldPath<TPkiSyncForm>;+ id: string;+ label: string;+ description: ReactNode;+ defaultChecked?: boolean;+};++export const SyncSwitchField = ({+ name,+ id,+ label,+ description,+ defaultChecked = false+}: Props) => {+ const { control } = useFormContext<TPkiSyncForm>();++ return (+ <Controller+ control={control}+ name={name}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor={id}>{label}</Label>+ <FieldDescription>{description}</FieldDescription>+ </FieldContent>+ <Switch+ id={id}+ variant="project"+ checked={(value as boolean | undefined) ?? defaultChecked}+ onCheckedChange={onChange}+ />+ </Field>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ );+};diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/WindowsServerSyncOptions.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/WindowsServerSyncOptions.tsxnew file mode 100644index 0000000000..8335d21296--- /dev/null+++ b/frontend/src/components/pki-syncs/forms/PkiSyncOptionsFields/WindowsServerSyncOptions.tsx@@ -0,0 +1,119 @@+import { Controller, useFieldArray, useFormContext } from "react-hook-form";+import { Info, Plus, Trash2 } from "lucide-react";++import {+ Button,+ Field,+ FieldError,+ FieldLabel,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { WindowsFileAccess } from "@app/hooks/api/pkiSyncs";++import { TPkiSyncForm } from "../schemas/pki-sync-schema";+import { ServerExportFormatFields } from "./ServerExportFormatFields";++type Props = {+ isUpdate?: boolean;+};++export const WindowsServerSyncOptions = ({ isUpdate }: Props) => {+ const { control } = useFormContext<TPkiSyncForm>();+ const {+ fields: accessRuleFields,+ append: appendAccessRule,+ remove: removeAccessRule+ } = useFieldArray({ control, name: "syncOptions.fileAccessRules" as never });++ return (+ <>+ <ServerExportFormatFields isUpdate={isUpdate} />+ <Field className="mb-4">+ <FieldLabel>+ File Permissions <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Grant Windows users or groups access to the delivered files (for example, restrict who+ can read the private key). Rules are added on top of the destination folder's+ inherited permissions.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <div className="flex flex-col gap-2">+ {accessRuleFields.map((ruleField, index) => (+ <div key={ruleField.id} className="flex items-start gap-2">+ <Controller+ control={control}+ name={`syncOptions.fileAccessRules.${index}.identity` as never}+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-0 flex-1">+ <Input+ {...field}+ value={(field.value as string) ?? ""}+ placeholder="DOMAIN\svc-account"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name={`syncOptions.fileAccessRules.${index}.access` as never}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-0 w-40">+ <Select+ value={(value as WindowsFileAccess) ?? WindowsFileAccess.Read}+ onValueChange={onChange}+ >+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={WindowsFileAccess.Read}>Read</SelectItem>+ <SelectItem value={WindowsFileAccess.Modify}>Modify</SelectItem>+ <SelectItem value={WindowsFileAccess.FullControl}>Full Control</SelectItem>+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Button+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove permission rule"+ className="mt-1"+ onClick={() => removeAccessRule(index)}+ >+ <Trash2 className="size-4" />+ </Button>+ </div>+ ))}+ <div>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => appendAccessRule({ identity: "", access: WindowsFileAccess.Read })}+ >+ <Plus className="size-4" /> Add Permission+ </Button>+ </div>+ </div>+ </Field>+ </>+ );+};diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncReviewFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncReviewFields.tsxindex 61bf047ba0..0ec917d934 100644--- a/frontend/src/components/pki-syncs/forms/PkiSyncReviewFields.tsx+++ b/frontend/src/components/pki-syncs/forms/PkiSyncReviewFields.tsx@@ -1,23 +1,39 @@+import { ReactNode } from "react";import { useFormContext } from "react-hook-form";import {- GenericFieldLabel,+ Badge,Table,- TableContainer,- TBody,- Td,- Th,- THead,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,Tooltip,- Tr-} from "@app/components/v2";-import { Badge } from "@app/components/v3";+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useProject } from "@app/context";-import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";+import {+ getCertificateDisplayName,+ PKI_SYNC_MAP,+ truncateCertificateSerialNumber+} from "@app/helpers/pkiSyncs";import { useListWorkspaceCertificates } from "@app/hooks/api/projects";import { TPkiSyncForm } from "./schemas/pki-sync-schema";+const ReviewFieldLabel = ({ label, children }: { label: string; children?: ReactNode }) => (+ <div className="min-w-0">+ <p className="text-xs font-medium text-muted">{label}</p>+ {children ? (+ <p className="text-sm break-words text-foreground">{children}</p>+ ) : (+ <p className="text-sm text-muted/50 italic">None</p>+ )}+ </div>+);+export const PkiSyncReviewFields = () => {const { watch } = useFormContext<TPkiSyncForm>();const { currentProject } = useProject();@@ -52,129 +68,103 @@ export const PkiSyncReviewFields = () => {return (<div className="mb-4 flex flex-col gap-6"><div className="flex flex-col gap-3">- <div className="w-full border-b border-mineshaft-600">- <span className="text-sm text-mineshaft-300">Certificates</span>+ <div className="w-full border-b border-border">+ <span className="text-sm text-muted">Certificates</span></div><div className="w-full">{selectedCertificates.length === 0 ? (- <span className="text-bunker-400">No certificates selected</span>+ <span className="text-sm text-muted/50 italic">No certificates selected</span>) : (- <TableContainer>- <Table>- <THead>- <Tr>- <Th className="w-1/2">SAN / CN</Th>- <Th className="w-1/4">Serial Number</Th>- <Th className="w-1/4">Expires At</Th>- </Tr>- </THead>- <TBody>- {selectedCertificates.map((cert) => {- let originalDisplayName = "—";- if (cert.altNames && cert.altNames.trim()) {- originalDisplayName = cert.altNames.trim();- } else if (cert.commonName && cert.commonName.trim()) {- originalDisplayName = cert.commonName.trim();- }-- let displayName = originalDisplayName;- let isTruncated = false;- if (originalDisplayName.length > 34) {- displayName = `${originalDisplayName.substring(0, 34)}...`;- isTruncated = true;- }+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead className="w-1/2">SAN / CN</TableHead>+ <TableHead className="w-1/4">Serial Number</TableHead>+ <TableHead className="w-1/4">Expires At</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {selectedCertificates.map((cert) => {+ const { originalDisplayName, displayName, isTruncated } =+ getCertificateDisplayName(cert);+ const truncatedSerial = truncateCertificateSerialNumber(cert.serialNumber);- const truncatedSerial =- cert.serialNumber.length > 8- ? `${cert.serialNumber.slice(0, 4)}...${cert.serialNumber.slice(-4)}`- : cert.serialNumber;-- return (- <Tr key={cert.id}>- <Td className="max-w-0">- {isTruncated ? (- <Tooltip content={originalDisplayName} className="max-w-lg">+ return (+ <TableRow key={cert.id}>+ <TableCell className="max-w-0">+ {isTruncated ? (+ <Tooltip>+ <TooltipTrigger asChild><div className="truncate">{displayName}</div>- </Tooltip>- ) : (- <div className="truncate">{displayName}</div>- )}- </Td>- <Td className="max-w-0">- <div- className="font-mono text-xs text-bunker-300"- title={cert.serialNumber}- >- {truncatedSerial}- </div>- </Td>- <Td className="max-w-0">- <span className="text-sm text-bunker-300">- {new Date(cert.notAfter).toLocaleDateString()}- </span>- </Td>- </Tr>- );- })}- </TBody>- </Table>- </TableContainer>+ </TooltipTrigger>+ <TooltipContent className="max-w-lg">+ {originalDisplayName}+ </TooltipContent>+ </Tooltip>+ ) : (+ <div className="truncate">{displayName}</div>+ )}+ </TableCell>+ <TableCell className="max-w-0">+ <div className="font-mono text-xs text-muted" title={cert.serialNumber}>+ {truncatedSerial}+ </div>+ </TableCell>+ <TableCell className="max-w-0">+ <span className="text-sm text-muted">+ {new Date(cert.notAfter).toLocaleDateString()}+ </span>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>)}</div></div><div className="flex flex-col gap-3">- <div className="w-full border-b border-mineshaft-600">- <span className="text-sm text-mineshaft-300">Destination</span>+ <div className="w-full border-b border-border">+ <span className="text-sm text-muted">Destination</span></div><div className="flex flex-wrap gap-x-8 gap-y-2">- <GenericFieldLabel label="Connection">{connection?.name}</GenericFieldLabel>- <GenericFieldLabel label="Service">{destinationName}</GenericFieldLabel>+ <ReviewFieldLabel label="Connection">{connection?.name}</ReviewFieldLabel>+ <ReviewFieldLabel label="Service">{destinationName}</ReviewFieldLabel>{destinationConfig && "vaultBaseUrl" in destinationConfig && (- <GenericFieldLabel label="Vault URL">- {destinationConfig.vaultBaseUrl}- </GenericFieldLabel>+ <ReviewFieldLabel label="Vault URL">{destinationConfig.vaultBaseUrl}</ReviewFieldLabel>)}</div></div><div className="flex flex-col gap-3">- <div className="w-full border-b border-mineshaft-600">- <span className="text-sm text-mineshaft-300">Sync Options</span>+ <div className="w-full border-b border-border">+ <span className="text-sm text-muted">Sync Options</span></div><div className="flex flex-wrap gap-x-8 gap-y-3">- <GenericFieldLabel label="Auto-Sync">+ <ReviewFieldLabel label="Auto-Sync"><div className="mt-1"><Badge variant={isAutoSyncEnabled ? "success" : "danger"}>{isAutoSyncEnabled ? "Enabled" : "Disabled"}</Badge></div>- </GenericFieldLabel>- {/* Hidden for now - Import certificates functionality disabled- {syncOptions?.canImportCertificates !== undefined && (- <GenericFieldLabel label="Import Certificates">- <Badge variant={syncOptions.canImportCertificates ? "success" : "danger"}>- {syncOptions.canImportCertificates ? "Enabled" : "Disabled"}- </Badge>- </GenericFieldLabel>- )}- */}+ </ReviewFieldLabel>{syncOptions?.canRemoveCertificates !== undefined && (- <GenericFieldLabel label="Remove Certificates">+ <ReviewFieldLabel label="Remove Certificates"><div className="mt-1"><Badge variant={syncOptions.canRemoveCertificates ? "success" : "danger"}>{syncOptions.canRemoveCertificates ? "Enabled" : "Disabled"}</Badge></div>- </GenericFieldLabel>+ </ReviewFieldLabel>)}</div></div><div className="flex flex-col gap-3">- <div className="w-full border-b border-mineshaft-600">- <span className="text-sm text-mineshaft-300">Details</span>+ <div className="w-full border-b border-border">+ <span className="text-sm text-muted">Details</span></div><div className="flex flex-wrap gap-x-8 gap-y-2">- <GenericFieldLabel label="Name">{name}</GenericFieldLabel>- <GenericFieldLabel label="Description">{description}</GenericFieldLabel>+ <ReviewFieldLabel label="Name">{name}</ReviewFieldLabel>+ <ReviewFieldLabel label="Description">{description}</ReviewFieldLabel></div></div></div>diff --git a/frontend/src/components/pki-syncs/forms/PkiSyncSourceFields.tsx b/frontend/src/components/pki-syncs/forms/PkiSyncSourceFields.tsxdeleted file mode 100644index ea856cfb48..0000000000--- a/frontend/src/components/pki-syncs/forms/PkiSyncSourceFields.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { Controller, useFormContext } from "react-hook-form";--import { FilterableSelect, FormControl } from "@app/components/v2";-import { useProject } from "@app/context";-import { useListWorkspacePkiSubscribers } from "@app/hooks/api";--import { TPkiSyncForm } from "./schemas/pki-sync-schema";--export const PkiSyncSourceFields = () => {- const { control } = useFormContext<TPkiSyncForm>();- const { currentProject } = useProject();-- const { data: pkiSubscribers = [], isLoading } = useListWorkspacePkiSubscribers(- currentProject?.id || ""- );-- return (- <>- <p className="mb-4 text-sm text-bunker-300">- Specify the PKI subscriber where you would like to sync certificates from.- </p>-- <Controller- control={control}- name="subscriberId"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl label="PKI Subscriber" isError={Boolean(error)} errorText={error?.message}>- <FilterableSelect- value={pkiSubscribers.find((sub) => sub.id === value)}- onChange={(selectedSubscriber) => {- if (Array.isArray(selectedSubscriber)) return;- if (- selectedSubscriber &&- !Array.isArray(selectedSubscriber) &&- "id" in selectedSubscriber- ) {- onChange(selectedSubscriber.id);- } else {- onChange(undefined);- }- }}- options={pkiSubscribers}- isLoading={isLoading}- placeholder="Select PKI subscriber..."- getOptionLabel={(option) => option?.name || ""}- getOptionValue={(option) => option?.id || ""}- />- </FormControl>- )}- />- </>- );-};diff --git a/frontend/src/components/pki-syncs/forms/WindowsServerPkiSyncFields.tsx b/frontend/src/components/pki-syncs/forms/WindowsServerPkiSyncFields.tsxindex b354d26dab..b6d0817f14 100644--- a/frontend/src/components/pki-syncs/forms/WindowsServerPkiSyncFields.tsx+++ b/frontend/src/components/pki-syncs/forms/WindowsServerPkiSyncFields.tsx@@ -1,31 +1,9 @@-import { Controller, useFormContext } from "react-hook-form";--import { FormControl, Input } from "@app/components/v2";-import { PkiSync } from "@app/hooks/api/pkiSyncs";--import { TPkiSyncForm } from "./schemas/pki-sync-schema";-import { PkiSyncConnectionField } from "./PkiSyncConnectionField";--export const WindowsServerPkiSyncFields = () => {- const { control } = useFormContext<TPkiSyncForm & { destination: PkiSync.WindowsServer }>();-- return (- <>- <PkiSyncConnectionField />- <Controller- name="destinationConfig.destinationPath"- control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Destination Directory"- tooltipText="The absolute Windows path to the directory where certificate files are written (for example C:\certs). It is created if it does not exist."- >- <Input value={value ?? ""} onChange={onChange} placeholder="C:\certs" />- </FormControl>- )}- />- </>- );-};+import { DestinationPathField } from "./DestinationPathField";++export const WindowsServerPkiSyncFields = () => (+ <DestinationPathField+ label="Destination Directory"+ tooltip="The absolute Windows path to the directory where certificate files are written (for example C:\certs). It is created if it does not exist."+ placeholder="C:\certs"+ />+);diff --git a/frontend/src/components/pki-syncs/forms/index.ts b/frontend/src/components/pki-syncs/forms/index.tsindex 5f92b599a5..243dd9c8de 100644--- a/frontend/src/components/pki-syncs/forms/index.ts+++ b/frontend/src/components/pki-syncs/forms/index.ts@@ -4,5 +4,4 @@ export { PkiSyncDestinationFields } from "./PkiSyncDestinationFields";export { PkiSyncDetailsFields } from "./PkiSyncDetailsFields";export { PkiSyncOptionsFields } from "./PkiSyncOptionsFields/PkiSyncOptionsFields";export { PkiSyncReviewFields } from "./PkiSyncReviewFields";-export { PkiSyncSourceFields } from "./PkiSyncSourceFields";export { PkiSyncFormSchema, type TPkiSyncForm } from "./schemas/pki-sync-schema";diff --git a/frontend/src/components/pki-syncs/index.ts b/frontend/src/components/pki-syncs/index.tsindex cf9aad40dc..db70024633 100644--- a/frontend/src/components/pki-syncs/index.ts+++ b/frontend/src/components/pki-syncs/index.ts@@ -6,4 +6,3 @@ export { PkiSyncImportStatusBadge } from "./PkiSyncImportStatusBadge";export { PkiSyncRemoveCertificatesModal } from "./PkiSyncRemoveCertificatesModal";export { PkiSyncRemoveStatusBadge } from "./PkiSyncRemoveStatusBadge";export { PkiSyncStatusBadge } from "./PkiSyncStatusBadge";-export { PkiSyncTable } from "./PkiSyncTable";diff --git a/frontend/src/components/pki-syncs/types/index.ts b/frontend/src/components/pki-syncs/types/index.tsdeleted file mode 100644index 954be4ff27..0000000000--- a/frontend/src/components/pki-syncs/types/index.ts+++ /dev/null@@ -1,7 +0,0 @@-export enum PkiSyncEditFields {- Details = "details",- Options = "options",- Mappings = "mappings",- Source = "source",- Destination = "destination"-}diff --git a/frontend/src/helpers/pkiSyncs.ts b/frontend/src/helpers/pkiSyncs.tsindex 6b1c6aed6b..47fcd68a2b 100644--- a/frontend/src/helpers/pkiSyncs.ts+++ b/frontend/src/helpers/pkiSyncs.ts@@ -6,58 +6,111 @@ export const PKI_SYNC_MAP: Record<{name: string;image: string;+ category: string;+ description: string;}> = {[PkiSync.AzureKeyVault]: {name: "Azure Key Vault",- image: "Microsoft Azure.png"+ image: "Microsoft Azure.png",+ category: "Azure",+ description: "Sync certificates to Azure Key Vault."},[PkiSync.AwsCertificateManager]: {name: "AWS Certificate Manager",- image: "Amazon Web Services.png"+ image: "Amazon Web Services.png",+ category: "AWS",+ description: "Sync certificates to AWS Certificate Manager (ACM)."},[PkiSync.AwsSecretsManager]: {name: "AWS Secrets Manager",- image: "Amazon Web Services.png"+ image: "Amazon Web Services.png",+ category: "AWS",+ description: "Sync certificates to AWS Secrets Manager."},[PkiSync.AwsElasticLoadBalancer]: {name: "AWS Elastic Load Balancer",- image: "Amazon Web Services.png"+ image: "Amazon Web Services.png",+ category: "AWS",+ description: "Bind certificates to AWS Elastic Load Balancer listeners."},[PkiSync.Chef]: {name: "Chef",- image: "Chef.png"+ image: "Chef.png",+ category: "Infrastructure",+ description: "Sync certificates to a Chef data bag."},[PkiSync.CloudflareCustomCertificate]: {name: "Cloudflare Custom SSL",- image: "Cloudflare.png"+ image: "Cloudflare.png",+ category: "Networking",+ description: "Upload custom SSL certificates to Cloudflare."},[PkiSync.NetScaler]: {name: "NetScaler",- image: "NetScaler.png"+ image: "NetScaler.png",+ category: "Networking",+ description: "Sync certificates to Citrix NetScaler / ADC."},[PkiSync.F5BigIp]: {name: "F5 BIG-IP",- image: "F5 BIG-IP.png"+ image: "F5 BIG-IP.png",+ category: "Networking",+ description: "Sync certificates to F5 BIG-IP."},[PkiSync.KempLoadMaster]: {name: "Kemp LoadMaster",- image: "Kemp LoadMaster.png"+ image: "Kemp LoadMaster.png",+ category: "Networking",+ description: "Sync certificates to Kemp LoadMaster."},[PkiSync.LinuxServer]: {name: "Linux Server",- image: "SSH.png"+ image: "SSH.png",+ category: "Infrastructure",+ description: "Push certificate files to a Linux server over SSH."},[PkiSync.WindowsServer]: {name: "Windows Server",- image: "Windows.png"+ image: "Windows.png",+ category: "Infrastructure",+ description: "Push certificate files to a Windows server over WinRM."},[PkiSync.NutanixPrismCentral]: {name: "Nutanix Prism Central",- image: "Nutanix.png"+ image: "Nutanix.png",+ category: "Infrastructure",+ description: "Sync certificates to Nutanix Prism Central."}};+const CERTIFICATE_DISPLAY_NAME_MAX_LENGTH = 34;+const CERTIFICATE_DISPLAY_NAME_FALLBACK = "-";++export const getCertificateDisplayName = (cert: {+ altNames?: string | null;+ commonName?: string | null;+}) => {+ let originalDisplayName = CERTIFICATE_DISPLAY_NAME_FALLBACK;+ if (cert.altNames && cert.altNames.trim()) {+ originalDisplayName = cert.altNames.trim();+ } else if (cert.commonName && cert.commonName.trim()) {+ originalDisplayName = cert.commonName.trim();+ }++ const isTruncated = originalDisplayName.length > CERTIFICATE_DISPLAY_NAME_MAX_LENGTH;+ const displayName = isTruncated+ ? `${originalDisplayName.substring(0, CERTIFICATE_DISPLAY_NAME_MAX_LENGTH)}...`+ : originalDisplayName;++ return { originalDisplayName, displayName, isTruncated };+};++export const truncateCertificateSerialNumber = (serialNumber: string) =>+ serialNumber.length > 8+ ? `${serialNumber.slice(0, 4)}...${serialNumber.slice(-4)}`+ : serialNumber;+export const PKI_SYNC_CONNECTION_MAP: Record<PkiSync, AppConnection> = {[PkiSync.AzureKeyVault]: AppConnection.AzureKeyVault,[PkiSync.AwsCertificateManager]: AppConnection.AWS,diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsxindex e188b19a42..b3c363ed9c 100644--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx@@ -12,6 +12,7 @@ import {PencilIcon,PlayIcon,PlusIcon,+ Settings2Icon,Trash2Icon} from "lucide-react";@@ -617,17 +618,22 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {}>{hasMethods ? (- <div className="flex flex-wrap gap-1.5">- {methods.map((m) => (- <Badge key={m} variant="neutral">- {m}- </Badge>- ))}- </div>+ <>+ <div className="flex flex-wrap gap-1.5">+ {methods.map((m) => (+ <Badge key={m} variant="neutral">+ {m}+ </Badge>+ ))}+ </div>+ <PencilIcon className="size-3 shrink-0 text-accent opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" />+ </>) : (- <span className="text-xs text-accent">Configure</span>+ <span className="inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-0.5 text-xs font-medium text-accent transition-colors group-hover:border-mineshaft-500 group-hover:text-foreground">+ <Settings2Icon className="size-3.5" />+ Configure+ </span>)}- <PencilIcon className="size-3 shrink-0 text-accent opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" /></button>) : hasMethods ? (<div className="flex flex-wrap gap-1.5">diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsxindex aa3e72cb57..ffdcc19c16 100644--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx@@ -31,6 +31,7 @@ import {InputGroupAddon,InputGroupButton,InputGroupInput,+ Label,Select,SelectContent,SelectItem,@@ -88,7 +89,7 @@ const SectionCard = ({className={`rounded-md border border-border bg-foreground/[0.02] ${className ?? ""}`.trim()}><header className="flex items-center justify-between gap-3 border-b border-border px-4 py-2.5">- <h3 className="text-xs font-semibold tracking-wider text-accent uppercase">{title}</h3>+ <h3 className="text-sm font-semibold text-foreground">{title}</h3>{actions ? <div className="flex items-center gap-2">{actions}</div> : null}</header><div className="space-y-4 px-4 py-4">{children}</div>@@ -263,7 +264,7 @@ const ApiPanel = ({render={({ field }) => (<div className="flex items-start justify-between gap-4"><div>- <FieldLabel>Auto-renew</FieldLabel>+ <Label>Auto-renew</Label><p className="text-xs text-accent">Automatically renew certificates issued via this profile before they expire.</p>diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsxnew file mode 100644index 0000000000..0fe9ec7dab--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsx@@ -0,0 +1,309 @@+import { Control, Controller } from "react-hook-form";+import { SingleValue } from "react-select";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";+import { TAzureDNSZone } from "@app/hooks/api/appConnections/azure-dns";+import { TCloudflareZone } from "@app/hooks/api/appConnections/cloudflare";+import { TDNSMadeEasyZone } from "@app/hooks/api/appConnections/dns-made-easy";+import { AcmeDnsProvider } from "@app/hooks/api/ca";+import {+ ACME_DNS_PROVIDER_APP_CONNECTION_MAP,+ ACME_DNS_PROVIDER_NAME_MAP+} from "@app/hooks/api/ca/constants";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { REQUIRED_EAB_DIRECTORIES } from "./constants";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ isExistingCa: boolean;+ dnsProvider?: AcmeDnsProvider;+ directoryUrl?: string;+ dnsAppConnection: { id: string; name: string };+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+ cloudflareZones: TCloudflareZone[];+ isZonesPending: boolean;+ dnsMadeEasyZones: TDNSMadeEasyZone[];+ isDNSMadeEasyZonesPending: boolean;+ azureDnsZones: TAzureDNSZone[];+ isAzureDNSZonesPending: boolean;+};++export const AcmeFields = ({+ control,+ isExistingCa,+ dnsProvider,+ directoryUrl,+ dnsAppConnection,+ availableConnections,+ isPending,+ cloudflareZones,+ isZonesPending,+ dnsMadeEasyZones,+ isDNSMadeEasyZonesPending,+ azureDnsZones,+ isAzureDNSZonesPending+}: Props) => (+ <>+ <Controller+ control={control}+ name="configuration.dnsProviderConfig.provider"+ defaultValue={AcmeDnsProvider.ROUTE53}+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>DNS Provider</FieldLabel>+ <Select value={value} onValueChange={(val) => onChange(val)} disabled={isExistingCa}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ {Object.values(AcmeDnsProvider).map((provider) => (+ <SelectItem value={String(provider)} key={provider}>+ {ACME_DNS_PROVIDER_NAME_MAP[provider]}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <AppConnectionSelectField+ control={control}+ name="configuration.dnsAppConnection"+ label="DNS App Connection"+ options={availableConnections}+ isLoading={isPending}+ tooltip={+ dnsProvider+ ? `${ACME_DNS_PROVIDER_NAME_MAP[dnsProvider]} uses the ${APP_CONNECTION_MAP[ACME_DNS_PROVIDER_APP_CONNECTION_MAP[dnsProvider]].name} App Connection. You can create one in the Organization Settings page.`+ : "Select a DNS provider first"+ }+ />+ {dnsProvider === AcmeDnsProvider.ROUTE53 && (+ <Controller+ control={control}+ defaultValue=""+ name="configuration.dnsProviderConfig.hostedZoneId"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Hosted Zone ID <span className="text-danger">*</span>+ </FieldLabel>+ <Input {...field} placeholder="Z040441124N1GOOMCQYX1" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ {dnsProvider === AcmeDnsProvider.Cloudflare && (+ <Controller+ name="configuration.dnsProviderConfig.hostedZoneId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>Zone</FieldLabel>+ <FilterableSelect+ isLoading={isZonesPending && !!dnsAppConnection.id}+ isDisabled={!dnsAppConnection.id}+ value={+ cloudflareZones.find((zone) => zone.id === value) ||+ (value ? { id: value, name: value } : null)+ }+ onChange={(option) => {+ onChange((option as SingleValue<TCloudflareZone>)?.id ?? null);+ }}+ options={cloudflareZones}+ placeholder="Select a zone..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ {dnsProvider === AcmeDnsProvider.DNSMadeEasy && (+ <Controller+ name="configuration.dnsProviderConfig.hostedZoneId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>Zone</FieldLabel>+ <FilterableSelect+ isLoading={isDNSMadeEasyZonesPending && !!dnsAppConnection.id}+ isDisabled={!dnsAppConnection.id}+ value={+ dnsMadeEasyZones.find((zone) => zone.id === value) ||+ (value ? { id: value, name: value } : null)+ }+ onChange={(option) => {+ onChange((option as SingleValue<TDNSMadeEasyZone>)?.id ?? null);+ }}+ options={dnsMadeEasyZones}+ placeholder="Select a zone..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ {dnsProvider === AcmeDnsProvider.AzureDNS && (+ <Controller+ name="configuration.dnsProviderConfig.hostedZoneId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>Zone</FieldLabel>+ <FilterableSelect+ isLoading={isAzureDNSZonesPending && !!dnsAppConnection.id}+ isDisabled={!dnsAppConnection.id}+ value={+ azureDnsZones.find((zone) => zone.id === value) ||+ (value ? { id: value, name: value } : null)+ }+ onChange={(option) => {+ onChange((option as SingleValue<TAzureDNSZone>)?.id ?? null);+ }}+ options={azureDnsZones}+ placeholder="Select a zone..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}+ <Controller+ control={control}+ defaultValue=""+ name="configuration.directoryUrl"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Directory URL <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ placeholder="https://acme-v02.api.letsencrypt.org/directory"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.accountEmail"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Account Email <span className="text-danger">*</span>+ </FieldLabel>+ <Input {...field} placeholder="[email protected]" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.eabKid"+ render={({ field, fieldState: { error } }) => {+ const eabRequired = REQUIRED_EAB_DIRECTORIES.includes(directoryUrl || "");+ return (+ <Field className="mb-4">+ <FieldLabel>+ EAB Key Identifier (KID){" "}+ {eabRequired ? (+ <span className="text-danger">*</span>+ ) : (+ <span className="text-muted">(optional)</span>+ )}+ </FieldLabel>+ <Input+ {...field}+ placeholder="abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ );+ }}+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.eabHmacKey"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ EAB HMAC Key <span className="text-muted">(optional)</span>+ </FieldLabel>+ <Input+ type="password"+ autoComplete="new-password"+ {...field}+ isError={Boolean(error)}+ placeholder={+ isExistingCa+ ? undefined+ : "dGhpc2lzYW5leGFtcGxlaG1hY2tleWZvcmRpZ2ljZXJ0YWNtZXRlc3RpbmcxMjM0NTY3ODkw"+ }+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.dnsResolver"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ DNS Resolver IP <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ A custom DNS resolver IP address used to verify DNS propagation during ACME+ challenges. Must be a valid IP (e.g. 8.8.8.8). Leave empty to use the system+ default.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="8.8.8.8" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AdcsFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AdcsFields.tsxnew file mode 100644index 0000000000..fba75f1edf--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AdcsFields.tsx@@ -0,0 +1,60 @@+import { Control, Controller } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+};++export const AdcsFields = ({ control, availableConnections, isPending }: Props) => (+ <>+ <AppConnectionSelectField+ control={control}+ name="configuration.adcsConnection"+ label="ADCS Connection"+ required+ menuPlacement="top"+ options={availableConnections}+ isLoading={isPending}+ tooltip="ADCS App Connection contains the Windows domain credentials and Gateway used to reach the AD CS server."+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.caName"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Certificate Authority <span className="text-muted">(optional)</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The AD CS certificate authority name (the CA's common name), e.g. corp-ca01-CA.+ Leave blank to discover it automatically from the CA host.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="Auto-discovered if left blank" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsxnew file mode 100644index 0000000000..728d13cd00--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsx@@ -0,0 +1,72 @@+import { ReactNode } from "react";+import { Control, Controller, FieldPath } from "react-hook-form";+import { Info } from "lucide-react";++import { AppConnectionOption } from "@app/components/app-connections";+import {+ Field,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";++import { FormData } from "./schema";++type AppConnectionValue = { id: string; name: string };++type Props = {+ control: Control<FormData>;+ name: FieldPath<FormData>;+ label: string;+ tooltip: ReactNode;+ options: TAvailableAppConnection[];+ isLoading: boolean;+ required?: boolean;+ menuPlacement?: "top" | "bottom" | "auto";+};++export const AppConnectionSelectField = ({+ control,+ name,+ label,+ tooltip,+ options,+ isLoading,+ required,+ menuPlacement+}: Props) => (+ <Controller+ control={control}+ name={name}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ {label} {required && <span className="text-danger">*</span>}+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">{tooltip}</TooltipContent>+ </Tooltip>+ </FieldLabel>+ <FilterableSelect+ {...(menuPlacement ? { menuPlacement } : {})}+ value={(value as AppConnectionValue)?.id ? (value as AppConnectionValue) : null}+ onChange={(newValue) => onChange(newValue)}+ isLoading={isLoading}+ options={options}+ placeholder="Select connection..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ components={{ Option: AppConnectionOption }}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AwsAcmPublicCaFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AwsAcmPublicCaFields.tsxnew file mode 100644index 0000000000..b9e4ab7cd6--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AwsAcmPublicCaFields.tsx@@ -0,0 +1,82 @@+import { Control, Controller } from "react-hook-form";+import { Info } from "lucide-react";++import { AwsRegionSelect } from "@app/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect";+import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+};++export const AwsAcmPublicCaFields = ({ control, availableConnections, isPending }: Props) => (+ <>+ <AppConnectionSelectField+ control={control}+ name="configuration.awsConnection"+ label="AWS Connection"+ required+ options={availableConnections}+ isLoading={isPending}+ tooltip="AWS App Connection used to issue, export, renew, and revoke certificates via AWS Certificate Manager (ACM)."+ />+ <AppConnectionSelectField+ control={control}+ name="configuration.dnsConnection"+ label="Route 53 Connection"+ required+ options={availableConnections}+ isLoading={isPending}+ tooltip="AWS App Connection used to write the ACM CNAME validation records into Route 53."+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.hostedZoneId"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Route 53 Hosted Zone ID <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The Route 53 hosted zone that owns the domain(s) you'll issue certificates for.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="Z040441124N1GOOMCQYX1" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.region"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Region <span className="text-danger">*</span>+ </FieldLabel>+ <AwsRegionSelect value={value} onChange={(v) => onChange(v || "")} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AwsPcaFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AwsPcaFields.tsxnew file mode 100644index 0000000000..e121ebb498--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AwsPcaFields.tsx@@ -0,0 +1,59 @@+import { Control, Controller } from "react-hook-form";++import { AwsRegionSelect } from "@app/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect";+import { Field, FieldError, FieldLabel, Input } from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+};++export const AwsPcaFields = ({ control, availableConnections, isPending }: Props) => (+ <>+ <AppConnectionSelectField+ control={control}+ name="configuration.awsConnection"+ label="AWS Connection"+ options={availableConnections}+ isLoading={isPending}+ tooltip="AWS App Connection provides the credentials used to communicate with AWS Private Certificate Authority."+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.certificateAuthorityArn"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Certificate Authority ARN <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ placeholder="arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/abc-123"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.region"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Region <span className="text-danger">*</span>+ </FieldLabel>+ <AwsRegionSelect value={value} onChange={(v) => onChange(v || "")} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AzureAdCsFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AzureAdCsFields.tsxnew file mode 100644index 0000000000..83a0f03082--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AzureAdCsFields.tsx@@ -0,0 +1,24 @@+import { Control } from "react-hook-form";++import { TAvailableAppConnection } from "@app/hooks/api/appConnections";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+};++export const AzureAdCsFields = ({ control, availableConnections, isPending }: Props) => (+ <AppConnectionSelectField+ control={control}+ name="configuration.azureAdcsConnection"+ label="Azure ADCS Connection"+ menuPlacement="top"+ options={availableConnections}+ isLoading={isPending}+ tooltip="Azure ADCS App Connection contains the Windows domain credentials and ADCS server URL for certificate requests."+ />+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/DigiCertFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/DigiCertFields.tsxnew file mode 100644index 0000000000..9a2b1ecb00--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/DigiCertFields.tsx@@ -0,0 +1,296 @@+import { Control, Controller, UseFormSetValue } from "react-hook-form";+import { SingleValue } from "react-select";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ FilterableSelect,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";+import { TDigiCertOrganization, TDigiCertProduct } from "@app/hooks/api/appConnections/digicert";+import { DigiCertCaPurpose } from "@app/hooks/api/ca/types";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { DigiCertProductType } from "./constants";+import { FormData } from "./schema";++const PURPOSE_OPTIONS = [+ { value: DigiCertCaPurpose.Ssl, label: "SSL / TLS" },+ { value: DigiCertCaPurpose.CodeSigning, label: "Code Signing" }+];++type Props = {+ control: Control<FormData>;+ setValue: UseFormSetValue<FormData>;+ configuration: FormData["configuration"] | undefined;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+ digicertConnectionId: string;+ digicertOrganizations: TDigiCertOrganization[];+ isDigiCertOrgsPending: boolean;+ digicertProducts: TDigiCertProduct[];+ isDigiCertProductsPending: boolean;+ csRequiresContact: boolean;+};++export const DigiCertFields = ({+ control,+ setValue,+ configuration,+ availableConnections,+ isPending,+ digicertConnectionId,+ digicertOrganizations,+ isDigiCertOrgsPending,+ digicertProducts,+ isDigiCertProductsPending,+ csRequiresContact+}: Props) => (+ <>+ <AppConnectionSelectField+ control={control}+ name="configuration.digicertConnection"+ label="DigiCert Connection"+ required+ options={availableConnections}+ isLoading={isPending}+ tooltip="DigiCert App Connection provides the CertCentral API key used to place orders."+ />+ <Controller+ control={control}+ name="configuration.organizationId"+ render={({ field: { value }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Organization <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The validated CertCentral organization that will appear on issued certificates.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <FilterableSelect+ isLoading={isDigiCertOrgsPending && !!digicertConnectionId}+ isDisabled={!digicertConnectionId}+ value={digicertOrganizations.find((org) => org.id === value) ?? null}+ onChange={(option) => {+ setValue(+ "configuration.organizationId",+ (option as SingleValue<TDigiCertOrganization>)?.id ?? 0+ );+ }}+ options={digicertOrganizations}+ placeholder="Select an organization..."+ getOptionLabel={(option) => option.displayName || option.name}+ getOptionValue={(option) => String(option.id)}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="configuration.purpose"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Purpose <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ What this CA issues. Selecting Code Signing filters the Product list to+ DigiCert's code-signing products.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <FilterableSelect+ value={+ PURPOSE_OPTIONS.find((o) => o.value === (value ?? DigiCertCaPurpose.Ssl)) ??+ PURPOSE_OPTIONS[0]+ }+ onChange={(option) => {+ const next = (option as SingleValue<{ value: DigiCertCaPurpose; label: string }>)+ ?.value;+ if (next) {+ onChange(next);+ setValue("configuration.productNameId", "");+ }+ }}+ options={PURPOSE_OPTIONS}+ getOptionLabel={(option) => option.label}+ getOptionValue={(option) => option.value}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="configuration.productNameId"+ render={({ field: { value, onChange }, fieldState: { error } }) => {+ const purpose =+ configuration && "purpose" in configuration+ ? (configuration.purpose ?? DigiCertCaPurpose.Ssl)+ : DigiCertCaPurpose.Ssl;+ const filteredProducts = digicertProducts.filter((p) => {+ if (purpose === DigiCertCaPurpose.CodeSigning)+ return p.type === DigiCertProductType.CodeSigning;+ return p.type === DigiCertProductType.Ssl || !p.type;+ });+ return (+ <Field className="mb-4">+ <FieldLabel>+ Product <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Products available are account-specific entitlements fetched from CertCentral.+ Each Infisical CA issues under exactly one product.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <FilterableSelect+ isLoading={isDigiCertProductsPending && !!digicertConnectionId}+ isDisabled={!digicertConnectionId}+ value={filteredProducts.find((product) => product.nameId === value) ?? null}+ onChange={(option) => {+ onChange((option as SingleValue<TDigiCertProduct>)?.nameId ?? "");+ }}+ options={filteredProducts}+ placeholder="Select a product..."+ getOptionLabel={(option) => `${option.name} (${option.nameId})`}+ getOptionValue={(option) => option.nameId}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ );+ }}+ />+ {csRequiresContact && (+ <div className="mt-3 mb-2 rounded-md border border-border bg-mineshaft-800 p-4">+ <div className="mb-1 text-sm font-medium text-foreground">Verified Contact</div>+ <div className="mb-4 text-xs text-muted">+ This organization has not completed DigiCert code-signing validation yet, so a verified+ contact is required. DigiCert emails this person an approval link they must click to start+ organization validation.+ </div>+ <div className="grid grid-cols-2 gap-x-3 gap-y-2">+ <Controller+ control={control}+ name="configuration.verifiedContact.firstName"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ First Name <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="John"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="configuration.verifiedContact.lastName"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Last Name <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="Doe"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="configuration.verifiedContact.email"+ render={({ field, fieldState: { error } }) => (+ <Field className="col-span-2">+ <FieldLabel>+ Email <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="[email protected]"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="configuration.verifiedContact.jobTitle"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Job Title <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="Security Engineer"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ control={control}+ name="configuration.verifiedContact.telephone"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Telephone <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Include the country code, e.g. +15551234567.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="+15551234567"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </div>+ </div>+ )}+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/ExternalCaHeader.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/ExternalCaHeader.tsxnew file mode 100644index 0000000000..ed56a121e1--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/ExternalCaHeader.tsx@@ -0,0 +1,30 @@+import { type LucideIcon } from "lucide-react";++type Props = {+ name: string;+ subtitle: string;+ image?: string;+ icon?: LucideIcon;+};++export const ExternalCaHeader = ({ name, subtitle, image, icon: Icon }: Props) => {+ return (+ <div className="flex w-full items-start gap-2">+ <div className="relative flex h-10 w-10 items-center justify-center rounded-md bg-container">+ {image ? (+ <img+ alt={`${name} logo`}+ src={`/images/integrations/${image}`}+ className="h-7 w-7 object-contain"+ />+ ) : (+ Icon && <Icon className="h-5 w-5 text-foreground" />+ )}+ </div>+ <div>+ <div className="flex items-center gap-x-2 text-mineshaft-300">{name}</div>+ <p className="text-sm leading-4 font-normal text-mineshaft-400">{subtitle}</p>+ </div>+ </div>+ );+};diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/GoDaddyFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/GoDaddyFields.tsxnew file mode 100644index 0000000000..229e02b8c7--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/GoDaddyFields.tsx@@ -0,0 +1,69 @@+import { Control, Controller } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";+import { GoDaddyProductType } from "@app/hooks/api/ca";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+};++export const GoDaddyFields = ({ control, availableConnections, isPending }: Props) => (+ <>+ <AppConnectionSelectField+ control={control}+ name="configuration.godaddyConnection"+ label="GoDaddy Connection"+ options={availableConnections}+ isLoading={isPending}+ tooltip="GoDaddy App Connection provides the API key and secret used to place certificate orders."+ />+ <Controller+ control={control}+ name="configuration.productType"+ defaultValue={GoDaddyProductType.DV_SSL}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Product <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ Domain Validated SSL product to use for issuance.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select value={value} onValueChange={(val) => onChange(val)}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={GoDaddyProductType.DV_SSL}>DV SSL</SelectItem>+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/VenafiTppFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/VenafiTppFields.tsxnew file mode 100644index 0000000000..8b0c9f0e5c--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/VenafiTppFields.tsx@@ -0,0 +1,58 @@+import { Control, Controller } from "react-hook-form";+import { Info } from "lucide-react";++import {+ Field,+ FieldError,+ FieldLabel,+ Input,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { TAvailableAppConnection } from "@app/hooks/api/appConnections";++import { AppConnectionSelectField } from "./AppConnectionSelectField";+import { FormData } from "./schema";++type Props = {+ control: Control<FormData>;+ availableConnections: TAvailableAppConnection[];+ isPending: boolean;+};++export const VenafiTppFields = ({ control, availableConnections, isPending }: Props) => (+ <>+ <AppConnectionSelectField+ control={control}+ name="configuration.venafiTppConnection"+ label="Venafi TPP Connection"+ options={availableConnections}+ isLoading={isPending}+ tooltip="Venafi TPP App Connection contains the credentials to connect to your Venafi Trust Protection Platform instance."+ />+ <Controller+ control={control}+ defaultValue=""+ name="configuration.policyDN"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Policy DN <span className="text-danger">*</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ The policy folder path in Venafi TPP where certificates will be managed (e.g.,+ \VED\Policy\Certificates).+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} placeholder="\VED\Policy\Certificates" isError={Boolean(error)} />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </>+);diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/constants.ts b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/constants.tsnew file mode 100644index 0000000000..dcbcba2309--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/constants.ts@@ -0,0 +1,16 @@+export const REQUIRED_EAB_DIRECTORIES = [+ "https://acme.digicert.com/v2/acme/directory",+ "https://acme.zerossl.com/v2/DV90",+ "https://acme.ssl.com/sslcom-dv-rsa",+ "https://acme.ssl.com/sslcom-dv-ecc",+ "https://dv.acme-v02.api.pki.goog/directory",+ "https://acme.sectigo.com/v2/OV",+ "https://acme.sectigo.com/v2/EV",+ "https://acme.cisco.com/ACMEv2/directory"+];++// DigiCert product discriminators returned by the CertCentral products endpoint.+export const DigiCertProductType = {+ CodeSigning: "code_signing_certificate",+ Ssl: "ssl_certificate"+} as const;diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/schema.ts b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/schema.tsnew file mode 100644index 0000000000..b146cd8431--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/schema.ts@@ -0,0 +1,185 @@+import { z } from "zod";++import { AcmeDnsProvider, CaStatus, CaType, GoDaddyProductType } from "@app/hooks/api/ca";+import { DigiCertCaPurpose } from "@app/hooks/api/ca/types";+import { slugSchema } from "@app/lib/schemas";++import { REQUIRED_EAB_DIRECTORIES } from "./constants";++const baseSchema = z.object({+ type: z.nativeEnum(CaType),+ name: slugSchema({+ field: "Name"+ }),+ status: z.nativeEnum(CaStatus)+});++const acmeConfigurationSchema = z+ .object({+ dnsAppConnection: z.object({+ id: z.string(),+ name: z.string()+ }),+ dnsProviderConfig: z.object({+ provider: z.nativeEnum(AcmeDnsProvider),+ hostedZoneId: z.string()+ }),+ directoryUrl: z.string(),+ accountEmail: z.string(),+ eabKid: z.string().optional(),+ eabHmacKey: z.string().optional(),+ dnsResolver: z+ .string()+ .ip({ message: "Must be a valid IP address" })+ .or(z.literal(""))+ .optional()+ })+ .superRefine((data, ctx) => {+ if (REQUIRED_EAB_DIRECTORIES.includes(data.directoryUrl)) {+ if (!data.eabKid || data.eabKid.trim() === "") {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ message: "EAB Key Identifier (KID) is required for this directory URL",+ path: ["eabKid"]+ });+ }+ }+ });++const azureAdCsConfigurationSchema = z.object({+ azureAdcsConnection: z.object({+ id: z.string(),+ name: z.string()+ })+});++const adcsConfigurationSchema = z.object({+ adcsConnection: z.object({+ id: z.string().min(1, "ADCS Connection is required"),+ name: z.string()+ }),+ caName: z.string().trim().optional()+});++const awsPcaConfigurationSchema = z.object({+ awsConnection: z.object({+ id: z.string().min(1, "AWS Connection is required"),+ name: z.string()+ }),+ certificateAuthorityArn: z.string().trim().min(1, "Certificate Authority ARN is required"),+ region: z.string().min(1, "Region is required")+});++const digicertConfigurationSchema = z+ .object({+ digicertConnection: z.object({+ id: z.string().min(1, "DigiCert Connection is required"),+ name: z.string()+ }),+ organizationId: z.coerce.number().int().positive("Organization is required"),+ productNameId: z.string().trim().min(1, "Product is required"),+ purpose: z.nativeEnum(DigiCertCaPurpose).optional(),+ csRequiresContact: z.boolean().optional(),+ verifiedContact: z+ .object({+ firstName: z.string().trim().max(128).optional(),+ lastName: z.string().trim().max(128).optional(),+ email: z.string().trim().max(255).optional(),+ jobTitle: z.string().trim().max(64).optional(),+ telephone: z.string().trim().max(32).optional()+ })+ .optional()+ })+ .superRefine((cfg, ctx) => {+ if (cfg.purpose !== DigiCertCaPurpose.CodeSigning || !cfg.csRequiresContact) return;+ const c = cfg.verifiedContact;+ const requiredFields: { key: keyof NonNullable<typeof c>; label: string }[] = [+ { key: "firstName", label: "First Name" },+ { key: "lastName", label: "Last Name" },+ { key: "email", label: "Email" },+ { key: "jobTitle", label: "Job Title" },+ { key: "telephone", label: "Telephone" }+ ];+ requiredFields.forEach(({ key, label }) => {+ if (!c?.[key] || c[key]?.length === 0) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["verifiedContact", key],+ message: `${label} is required for code signing CAs`+ });+ }+ });+ if (c?.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c.email)) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["verifiedContact", "email"],+ message: "Email must be valid"+ });+ }+ });++const awsAcmPublicCaConfigurationSchema = z.object({+ awsConnection: z.object({+ id: z.string().min(1, "AWS Connection is required"),+ name: z.string()+ }),+ dnsConnection: z.object({+ id: z.string().min(1, "Route 53 Connection is required"),+ name: z.string()+ }),+ hostedZoneId: z.string().trim().min(1, "Hosted Zone ID is required"),+ region: z.string().min(1, "Region is required")+});++const venafiTppConfigurationSchema = z.object({+ venafiTppConnection: z.object({+ id: z.string().min(1, "Venafi TPP Connection is required"),+ name: z.string()+ }),+ policyDN: z.string().trim().min(1, "Policy DN is required")+});++const godaddyConfigurationSchema = z.object({+ godaddyConnection: z.object({+ id: z.string().min(1, "GoDaddy Connection is required"),+ name: z.string()+ }),+ productType: z.nativeEnum(GoDaddyProductType)+});++export const schema = z.discriminatedUnion("type", [+ baseSchema.extend({+ type: z.literal(CaType.ACME),+ configuration: acmeConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.AZURE_AD_CS),+ configuration: azureAdCsConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.ADCS),+ configuration: adcsConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.AWS_PCA),+ configuration: awsPcaConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.DIGICERT),+ configuration: digicertConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.AWS_ACM_PUBLIC_CA),+ configuration: awsAcmPublicCaConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.VENAFI_TPP),+ configuration: venafiTppConfigurationSchema+ }),+ baseSchema.extend({+ type: z.literal(CaType.GODADDY),+ configuration: godaddyConfigurationSchema+ })+]);++export type FormData = z.infer<typeof schema>;diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsxindex 6eb522f172..d38c8b6f88 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx@@ -1,47 +1,37 @@-import { useEffect, useMemo, useRef } from "react";+import { useEffect, useMemo, useState } from "react";import { Controller, useForm } from "react-hook-form";-import { SingleValue } from "react-select";import { zodResolver } from "@hookform/resolvers/zod";-import { z } from "zod";+import { ArrowLeftIcon, Loader2Icon, Lock, type LucideIcon, Search } from "lucide-react";-import { AppConnectionOption } from "@app/components/app-connections";import { createNotification } from "@app/components/notifications";-import { AwsRegionSelect } from "@app/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect";import {Button,- FilterableSelect,- FormControl,+ Field,+ FieldError,+ FieldLabel,Input,- Modal,- ModalContent,- Select,- SelectItem-} from "@app/components/v2";+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetHeader,+ SheetTitle+} from "@app/components/v3";import { useProject } from "@app/context";-import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";import {TAvailableAppConnection,useListAvailableAppConnections} from "@app/hooks/api/appConnections";+import { useAzureDNSConnectionListZones } from "@app/hooks/api/appConnections/azure-dns";+import { useCloudflareConnectionListZones } from "@app/hooks/api/appConnections/cloudflare";import {- TAzureDNSZone,- useAzureDNSConnectionListZones-} from "@app/hooks/api/appConnections/azure-dns";-import {- TCloudflareZone,- useCloudflareConnectionListZones-} from "@app/hooks/api/appConnections/cloudflare";-import {- TDigiCertOrganization,- TDigiCertProduct,useDigiCertConnectionListOrganizations,useDigiCertConnectionListProducts,useDigiCertConnectionOrgValidation} from "@app/hooks/api/appConnections/digicert";-import {- TDNSMadeEasyZone,- useDNSMadeEasyConnectionListZones-} from "@app/hooks/api/appConnections/dns-made-easy";+import { useDNSMadeEasyConnectionListZones } from "@app/hooks/api/appConnections/dns-made-easy";import { AppConnection } from "@app/hooks/api/appConnections/enums";import {AcmeDnsProvider,@@ -53,220 +43,165 @@ import {useUpdateCa} from "@app/hooks/api/ca";import {- ACME_DNS_PROVIDER_APP_CONNECTION_MAP,- ACME_DNS_PROVIDER_NAME_MAP-} from "@app/hooks/api/ca/constants";-import { DigiCertCaPurpose } from "@app/hooks/api/ca/types";+ DigiCertCaPurpose,+ TCreateCertificateAuthorityDTO,+ TUpdateCertificateAuthorityDTO+} from "@app/hooks/api/ca/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { slugSchema } from "@app/lib/schemas";-const UNCHANGED_CREDENTIAL_SENTINEL = "__INFISICAL_UNCHANGED__";+import { AcmeFields } from "./ExternalCaFields/AcmeFields";+import { AdcsFields } from "./ExternalCaFields/AdcsFields";+import { AwsAcmPublicCaFields } from "./ExternalCaFields/AwsAcmPublicCaFields";+import { AwsPcaFields } from "./ExternalCaFields/AwsPcaFields";+import { AzureAdCsFields } from "./ExternalCaFields/AzureAdCsFields";+import { DigiCertFields } from "./ExternalCaFields/DigiCertFields";+import { ExternalCaHeader } from "./ExternalCaFields/ExternalCaHeader";+import { GoDaddyFields } from "./ExternalCaFields/GoDaddyFields";+import { FormData, schema } from "./ExternalCaFields/schema";+import { VenafiTppFields } from "./ExternalCaFields/VenafiTppFields";-const REQUIRED_EAB_DIRECTORIES = [- "https://acme.digicert.com/v2/acme/directory",- "https://acme.zerossl.com/v2/DV90",- "https://acme.ssl.com/sslcom-dv-rsa",- "https://acme.ssl.com/sslcom-dv-ecc",- "https://dv.acme-v02.api.pki.goog/directory",- "https://acme.sectigo.com/v2/OV",- "https://acme.sectigo.com/v2/EV",- "https://acme.cisco.com/ACMEv2/directory"-];+const UNCHANGED_CREDENTIAL_SENTINEL = "__INFISICAL_UNCHANGED__";-const baseSchema = z.object({- type: z.nativeEnum(CaType),- name: slugSchema({- field: "Name"- }),- status: z.nativeEnum(CaStatus)-});--const acmeConfigurationSchema = z- .object({- dnsAppConnection: z.object({- id: z.string(),- name: z.string()- }),- dnsProviderConfig: z.object({- provider: z.nativeEnum(AcmeDnsProvider),- hostedZoneId: z.string()- }),- directoryUrl: z.string(),- accountEmail: z.string(),- eabKid: z.string().optional(),- eabHmacKey: z.string().optional(),- dnsResolver: z- .string()- .ip({ message: "Must be a valid IP address" })- .or(z.literal(""))- .optional()- })- .superRefine((data, ctx) => {- if (REQUIRED_EAB_DIRECTORIES.includes(data.directoryUrl)) {- if (!data.eabKid || data.eabKid.trim() === "") {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: "EAB Key Identifier (KID) is required for this directory URL",- path: ["eabKid"]- });- }+type ExternalCaConfigurationPayload =+ | {+ dnsProviderConfig: { provider: AcmeDnsProvider; hostedZoneId: string };+ directoryUrl: string;+ accountEmail: string;+ dnsAppConnectionId: string;+ eabKid?: string;+ eabHmacKey?: string;+ dnsResolver?: string;}- });--const azureAdCsConfigurationSchema = z.object({- azureAdcsConnection: z.object({- id: z.string(),- name: z.string()- })-});--const adcsConfigurationSchema = z.object({- adcsConnection: z.object({- id: z.string().min(1, "ADCS Connection is required"),- name: z.string()- }),- caName: z.string().trim().optional()-});--const awsPcaConfigurationSchema = z.object({- awsConnection: z.object({- id: z.string().min(1, "AWS Connection is required"),- name: z.string()- }),- certificateAuthorityArn: z.string().trim().min(1, "Certificate Authority ARN is required"),- region: z.string().min(1, "Region is required")-});--const digicertConfigurationSchema = z- .object({- digicertConnection: z.object({- id: z.string().min(1, "DigiCert Connection is required"),- name: z.string()- }),- organizationId: z.coerce.number().int().positive("Organization is required"),- productNameId: z.string().trim().min(1, "Product is required"),- purpose: z.nativeEnum(DigiCertCaPurpose).optional(),- // UI-only flag (not sent): true when the org isn't code-signing validated yet, so a contact is required.- csRequiresContact: z.boolean().optional(),- verifiedContact: z- .object({- firstName: z.string().trim().max(128).optional(),- lastName: z.string().trim().max(128).optional(),- email: z.string().trim().max(255).optional(),- jobTitle: z.string().trim().max(64).optional(),- telephone: z.string().trim().max(32).optional()- })- .optional()- })- .superRefine((cfg, ctx) => {- if (cfg.purpose !== DigiCertCaPurpose.CodeSigning || !cfg.csRequiresContact) return;- const c = cfg.verifiedContact;- const requiredFields: { key: keyof NonNullable<typeof c>; label: string }[] = [- { key: "firstName", label: "First Name" },- { key: "lastName", label: "Last Name" },- { key: "email", label: "Email" },- { key: "jobTitle", label: "Job Title" },- { key: "telephone", label: "Telephone" }- ];- requiredFields.forEach(({ key, label }) => {- if (!c?.[key] || c[key]?.length === 0) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ["verifiedContact", key],- message: `${label} is required for code signing CAs`- });- }- });- if (c?.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c.email)) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: ["verifiedContact", "email"],- message: "Email must be valid"- });+ | { azureAdcsConnectionId: string }+ | { appConnectionId: string; caName?: string }+ | { appConnectionId: string; certificateAuthorityArn: string; region: string }+ | {+ appConnectionId: string;+ organizationId: number;+ productNameId: string;+ purpose: DigiCertCaPurpose;+ verifiedContact?: {+ firstName?: string;+ lastName?: string;+ email?: string;+ jobTitle?: string;+ telephone?: string;+ };}- });--const awsAcmPublicCaConfigurationSchema = z.object({- awsConnection: z.object({- id: z.string().min(1, "AWS Connection is required"),- name: z.string()- }),- dnsConnection: z.object({- id: z.string().min(1, "Route 53 Connection is required"),- name: z.string()- }),- hostedZoneId: z.string().trim().min(1, "Hosted Zone ID is required"),- region: z.string().min(1, "Region is required")-});--const venafiTppConfigurationSchema = z.object({- venafiTppConnection: z.object({- id: z.string().min(1, "Venafi TPP Connection is required"),- name: z.string()- }),- policyDN: z.string().trim().min(1, "Policy DN is required")-});--const godaddyConfigurationSchema = z.object({- godaddyConnection: z.object({- id: z.string().min(1, "GoDaddy Connection is required"),- name: z.string()- }),- productType: z.nativeEnum(GoDaddyProductType)-});--const schema = z.discriminatedUnion("type", [- baseSchema.extend({- type: z.literal(CaType.ACME),- configuration: acmeConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.AZURE_AD_CS),- configuration: azureAdCsConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.ADCS),- configuration: adcsConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.AWS_PCA),- configuration: awsPcaConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.DIGICERT),- configuration: digicertConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.AWS_ACM_PUBLIC_CA),- configuration: awsAcmPublicCaConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.VENAFI_TPP),- configuration: venafiTppConfigurationSchema- }),- baseSchema.extend({- type: z.literal(CaType.GODADDY),- configuration: godaddyConfigurationSchema- })-]);--export type FormData = z.infer<typeof schema>;+ | { appConnectionId: string; dnsAppConnectionId: string; hostedZoneId: string; region: string }+ | { appConnectionId: string; policyDN: string }+ | { appConnectionId: string; productType: GoDaddyProductType };type Props = {popUp: UsePopUpState<["ca"]>;handlePopUpToggle: (popUpName: keyof UsePopUpState<["ca"]>, state?: boolean) => void;};-const caTypes = [- { label: "ACME", value: CaType.ACME },- { label: "Microsoft ADCS", value: CaType.ADCS },- { label: "AWS Private CA (PCA)", value: CaType.AWS_PCA },- { label: "AWS ACM Public CA", value: CaType.AWS_ACM_PUBLIC_CA },- { label: "DigiCert CertCentral", value: CaType.DIGICERT },- { label: "Venafi TPP", value: CaType.VENAFI_TPP },- { label: "GoDaddy", value: CaType.GODADDY }+type ExternalCaOption = {+ type: CaType;+ name: string;+ category: string;+ description: string;+ image?: string;+ icon?: LucideIcon;+};++const EXTERNAL_CA_OPTIONS: ExternalCaOption[] = [+ {+ type: CaType.ACME,+ name: "ACME",+ category: "Protocol",+ description: "Issue certificates from any ACME directory such as Let's Encrypt or ZeroSSL.",+ icon: Lock+ },+ {+ type: CaType.ADCS,+ name: "Microsoft ADCS",+ category: "Certificates",+ description: "Issue certificates via Active Directory Certificate Services over the Gateway.",+ image: "Windows.png"+ },+ {+ type: CaType.AWS_PCA,+ name: "AWS Private CA",+ category: "AWS",+ description: "Issue certificates from AWS Private Certificate Authority.",+ image: "Amazon Web Services.png"+ },+ {+ type: CaType.AWS_ACM_PUBLIC_CA,+ name: "AWS ACM Public CA",+ category: "AWS",+ description: "Issue publicly-trusted certificates via AWS Certificate Manager.",+ image: "Amazon Web Services.png"+ },+ {+ type: CaType.DIGICERT,+ name: "DigiCert CertCentral",+ category: "Certificates",+ description: "Issue certificates from DigiCert CertCentral.",+ image: "DigiCert.png"+ },+ {+ type: CaType.VENAFI_TPP,+ name: "Venafi TPP",+ category: "Certificates",+ description: "Issue certificates from Venafi Trust Protection Platform.",+ image: "Venafi.png"+ },+ {+ type: CaType.GODADDY,+ name: "GoDaddy",+ category: "Certificates",+ description: "Issue certificates from GoDaddy.",+ image: "GoDaddy.png"+ }];+const CA_TYPE_NAME: Partial<Record<CaType, string>> = {+ ...Object.fromEntries(EXTERNAL_CA_OPTIONS.map((option) => [option.type, option.name])),+ [CaType.AZURE_AD_CS]: "Azure ADCS (Web Enrollment)"+};++const CA_TYPE_MEDIA: Partial<Record<CaType, Pick<ExternalCaOption, "image" | "icon">>> = {+ ...Object.fromEntries(+ EXTERNAL_CA_OPTIONS.map((option) => [option.type, { image: option.image, icon: option.icon }])+ ),+ [CaType.AZURE_AD_CS]: { image: "Microsoft Azure.png" }+};++const CaTypeCard = ({ option, onClick }: { option: ExternalCaOption; onClick: () => void }) => {+ const Icon = option.icon;+ return (+ <button+ type="button"+ onClick={onClick}+ className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors hover:border-mineshaft-500 hover:bg-mineshaft-700/50"+ >+ <div className="flex items-start justify-between gap-2">+ <div className="flex h-9 w-9 items-center justify-center rounded-md bg-mineshaft-700">+ {option.image ? (+ <img+ src={`/images/integrations/${option.image}`}+ alt={`${option.name} logo`}+ className="h-6 w-6 object-contain"+ />+ ) : (+ Icon && <Icon className="h-5 w-5 text-foreground" />+ )}+ </div>+ <span className="text-[10px] font-medium tracking-wider text-muted uppercase">+ {option.category}+ </span>+ </div>+ <div className="flex flex-col gap-1">+ <p className="text-sm font-semibold text-foreground">{option.name}</p>+ <p className="text-xs leading-relaxed text-muted">{option.description}</p>+ </div>+ </button>+ );+};+export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {const { currentProject } = useProject();@@ -300,132 +235,120 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {? configuration.directoryUrl: undefined;- useEffect(() => {- const initialType = (popUp?.ca?.data as { type: CaType })?.type;- if (!ca && popUp?.ca?.isOpen) {- if (initialType === CaType.AZURE_AD_CS) {- reset({+ const editCaId = (popUp?.ca?.data as { caId?: string })?.caId;+ const isEditMode = Boolean(editCaId);++ const [selectedType, setSelectedType] = useState<CaType | null>(null);+ const [search, setSearch] = useState("");++ const getInitialValuesForType = (type: CaType): FormData => {+ switch (type) {+ case CaType.AZURE_AD_CS:+ return {type: CaType.AZURE_AD_CS,name: "",status: CaStatus.ACTIVE,- configuration: {- azureAdcsConnection: {- id: "",- name: ""- }- }- });- } else if (initialType === CaType.ADCS) {- reset({+ configuration: { azureAdcsConnection: { id: "", name: "" } }+ };+ case CaType.ADCS:+ return {type: CaType.ADCS,name: "",status: CaStatus.ACTIVE,- configuration: {- adcsConnection: {- id: "",- name: ""- },- caName: ""- }- });- } else if (initialType === CaType.AWS_PCA) {- reset({+ configuration: { adcsConnection: { id: "", name: "" }, caName: "" }+ };+ case CaType.AWS_PCA:+ return {type: CaType.AWS_PCA,name: "",status: CaStatus.ACTIVE,configuration: {- awsConnection: {- id: "",- name: ""- },+ awsConnection: { id: "", name: "" },certificateAuthorityArn: "",region: ""}- });- } else if (initialType === CaType.DIGICERT) {- reset({+ };+ case CaType.DIGICERT:+ return {type: CaType.DIGICERT,name: "",status: CaStatus.ACTIVE,configuration: {- digicertConnection: {- id: "",- name: ""- },+ digicertConnection: { id: "", name: "" },organizationId: 0,productNameId: "",purpose: DigiCertCaPurpose.Ssl,verifiedContact: undefined}- });- } else if (initialType === CaType.AWS_ACM_PUBLIC_CA) {- reset({+ };+ case CaType.AWS_ACM_PUBLIC_CA:+ return {type: CaType.AWS_ACM_PUBLIC_CA,name: "",status: CaStatus.ACTIVE,configuration: {- awsConnection: {- id: "",- name: ""- },- dnsConnection: {- id: "",- name: ""- },+ awsConnection: { id: "", name: "" },+ dnsConnection: { id: "", name: "" },hostedZoneId: "",region: ""}- });- } else if (initialType === CaType.VENAFI_TPP) {- reset({+ };+ case CaType.VENAFI_TPP:+ return {type: CaType.VENAFI_TPP,name: "",status: CaStatus.ACTIVE,- configuration: {- venafiTppConnection: {- id: "",- name: ""- },- policyDN: ""- }- });- } else if (initialType === CaType.GODADDY) {- reset({+ configuration: { venafiTppConnection: { id: "", name: "" }, policyDN: "" }+ };+ case CaType.GODADDY:+ return {type: CaType.GODADDY,name: "",status: CaStatus.ACTIVE,configuration: {- godaddyConnection: {- id: "",- name: ""- },+ godaddyConnection: { id: "", name: "" },productType: GoDaddyProductType.DV_SSL}- });- } else {- reset({+ };+ case CaType.ACME:+ default:+ return {type: CaType.ACME,name: "",status: CaStatus.ACTIVE,configuration: {- dnsAppConnection: {- id: "",- name: ""- },- dnsProviderConfig: {- provider: AcmeDnsProvider.ROUTE53,- hostedZoneId: ""- },+ dnsAppConnection: { id: "", name: "" },+ dnsProviderConfig: { provider: AcmeDnsProvider.ROUTE53, hostedZoneId: "" },directoryUrl: "",accountEmail: "",eabKid: "",eabHmacKey: "",dnsResolver: ""}- });- }+ };+ }+ };++ const handleSelectType = (type: CaType) => {+ reset(getInitialValuesForType(type));+ setSelectedType(type);+ };++ useEffect(() => {+ if (popUp?.ca?.isOpen && !isEditMode) {+ setSelectedType(null);+ setSearch("");+ reset(undefined);+ }+ }, [popUp?.ca?.isOpen, isEditMode, reset]);++ useEffect(() => {+ const editType = (popUp?.ca?.data as { type?: CaType })?.type;+ if (popUp?.ca?.isOpen && isEditMode && editType) {+ reset(getInitialValuesForType(editType));}- }, [popUp?.ca?.isOpen, popUp?.ca?.data, reset, ca]);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [popUp?.ca?.isOpen, isEditMode]);const { data: availableRoute53Connections, isPending: isRoute53Pending } =useListAvailableAppConnections(AppConnection.AWS, currentProject.id, {@@ -520,10 +443,8 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {]);const isPending =- isRoute53Pending ||- isCloudflarePending ||- isDNSMadeEasyPending ||- isAzureDNSPending ||+ ((isRoute53Pending || isCloudflarePending || isDNSMadeEasyPending || isAzureDNSPending) &&+ caType === CaType.ACME) ||(isAzurePending && caType === CaType.AZURE_AD_CS) ||(isAdcsPending && caType === CaType.ADCS) ||(isAwsPending && (caType === CaType.AWS_PCA || caType === CaType.AWS_ACM_PUBLIC_CA)) ||@@ -781,7 +702,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {}: FormData) => {if (!currentProject?.slug) return;- let configPayload: any;+ let configPayload: ExternalCaConfigurationPayload;if (type === CaType.ACME && "dnsAppConnection" in formConfiguration) {configPayload = {@@ -849,14 +770,14 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {type,status,configuration: configPayload- });+ } as TUpdateCertificateAuthorityDTO);} else {await createMutateAsync({name,type,status,configuration: configPayload- });+ } as TCreateCertificateAuthorityDTO);}reset();@@ -868,879 +789,217 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {});};- const modalContainer = useRef<HTMLDivElement>(null);+ const showGrid = !isEditMode && !selectedType;+ const activeType = isEditMode ? ca?.type : selectedType;+ const activeTypeName = activeType ? CA_TYPE_NAME[activeType] : undefined;+ const activeTypeMedia = activeType ? CA_TYPE_MEDIA[activeType] : undefined;+ const headerTitle = `${isEditMode ? "Edit" : "Create"} ${+ activeTypeName ? `${activeTypeName} CA` : "External CA"+ }`;++ const filteredCaOptions = EXTERNAL_CA_OPTIONS.filter((option) => {+ const query = search.trim().toLowerCase();+ if (!query) return true;+ return (+ option.name.toLowerCase().includes(query) ||+ option.category.toLowerCase().includes(query) ||+ option.description.toLowerCase().includes(query)+ );+ });return (- <Modal- isOpen={popUp?.ca?.isOpen}+ <Sheet+ open={popUp?.ca?.isOpen}onOpenChange={(isOpen) => {- reset();+ if (!isOpen) {+ reset();+ setSelectedType(null);+ setSearch("");+ }handlePopUpToggle("ca", isOpen);}}>- <ModalContent ref={modalContainer} title={`${ca ? "Edit" : "Create"} External CA`}>- <form onSubmit={handleSubmit(onFormSubmit)}>- {ca && (- <FormControl label="CA ID">- <Input value={ca.id} isDisabled className="bg-white/[0.07]" />- </FormControl>- )}- <Controller- control={control}- name="type"- defaultValue={CaType.ACME}- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl label="CA Type" errorText={error?.message} isError={Boolean(error)}>- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => onChange(e)}- className="w-full"- isDisabled={Boolean(ca)}- >- {caTypes.map(({ label, value }) => (- <SelectItem value={String(value || "")} key={label}>- {label}- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="name"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Name"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input {...field} placeholder="my-external-ca" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- {caType === CaType.ACME && (+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 p-0 sm:max-w-2xl">+ <SheetHeader className="border-b border-border">+ {showGrid ? (+ <>+ <SheetTitle>Create External CA</SheetTitle>+ <SheetDescription>Select the certificate authority to connect to.</SheetDescription>+ </>+ ) : (<>+ {!isEditMode && (+ <button+ type="button"+ onClick={() => setSelectedType(null)}+ className="mb-1 flex w-fit cursor-pointer items-center gap-1 text-xs text-muted transition-colors hover:text-foreground hover:underline"+ >+ <ArrowLeftIcon className="size-3" />+ Select Another CA+ </button>+ )}+ <SheetTitle>+ <ExternalCaHeader+ name={headerTitle}+ subtitle="Define the connection and credentials used to issue certificates from this CA."+ image={activeTypeMedia?.image}+ icon={activeTypeMedia?.icon}+ />+ </SheetTitle>+ </>+ )}+ </SheetHeader>++ {/* eslint-disable-next-line no-nested-ternary */}+ {showGrid ? (+ <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-6">+ <InputGroup>+ <InputGroupAddon align="inline-start">+ <Search />+ </InputGroupAddon>+ <InputGroupInput+ value={search}+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Search certificate authorities..."+ />+ </InputGroup>+ <div className="grid grid-cols-2 gap-3">+ {filteredCaOptions.map((option) => (+ <CaTypeCard+ key={option.type}+ option={option}+ onClick={() => handleSelectType(option.type)}+ />+ ))}+ </div>+ </div>+ ) : isEditMode && isCaLoading ? (+ <div className="flex min-h-0 flex-1 items-center justify-center">+ <Loader2Icon className="size-8 animate-spin text-accent" />+ </div>+ ) : (+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex min-h-0 flex-1 flex-col">+ <div className="min-h-0 flex-1 overflow-y-auto px-6 py-6">+ {ca && (+ <Field className="mb-4">+ <FieldLabel>CA ID</FieldLabel>+ <Input value={ca.id} disabled />+ </Field>+ )}<Controllercontrol={control}- name="configuration.dnsProviderConfig.provider"- defaultValue={AcmeDnsProvider.ROUTE53}- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="DNS Provider"- errorText={error?.message}- isError={Boolean(error)}- >- <Select- defaultValue={field.value}+ defaultValue=""+ name="name"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Name <span className="text-danger">*</span>+ </FieldLabel>+ <Input{...field}- onValueChange={(e) => onChange(e)}- className="w-full"- isDisabled={Boolean(ca)}- >- {Object.values(AcmeDnsProvider).map((provider) => (- <SelectItem value={String(provider)} key={provider}>- {ACME_DNS_PROVIDER_NAME_MAP[provider]}- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText={- dnsProvider- ? `${ACME_DNS_PROVIDER_NAME_MAP[dnsProvider]} uses the ${APP_CONNECTION_MAP[ACME_DNS_PROVIDER_APP_CONNECTION_MAP[dnsProvider]].name} App Connection. You can create one in the Organization Settings page.`- : "Select a DNS provider first"- }- isError={Boolean(error)}- errorText={error?.message}- label="DNS App Connection"- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}+ placeholder="my-external-ca"+ disabled={Boolean(ca)}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError errors={[error]} />+ </Field>)}- control={control}- name="configuration.dnsAppConnection"/>- {dnsProvider === AcmeDnsProvider.ROUTE53 && (- <Controller+ {caType === CaType.ACME && (+ <AcmeFieldscontrol={control}- defaultValue=""- name="configuration.dnsProviderConfig.hostedZoneId"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Hosted Zone ID"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input {...field} placeholder="Z040441124N1GOOMCQYX1" />- </FormControl>- )}+ isExistingCa={Boolean(ca)}+ dnsProvider={dnsProvider}+ directoryUrl={directoryUrl}+ dnsAppConnection={dnsAppConnection}+ availableConnections={availableConnections}+ isPending={isPending}+ cloudflareZones={cloudflareZones}+ isZonesPending={isZonesPending}+ dnsMadeEasyZones={dnsMadeEasyZones}+ isDNSMadeEasyZonesPending={isDNSMadeEasyZonesPending}+ azureDnsZones={azureDnsZones}+ isAzureDNSZonesPending={isAzureDNSZonesPending}/>)}- {dnsProvider === AcmeDnsProvider.Cloudflare && (- <Controller- name="configuration.dnsProviderConfig.hostedZoneId"+ {caType === CaType.AZURE_AD_CS && (+ <AzureAdCsFieldscontrol={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- errorText={error?.message}- isError={Boolean(error?.message)}- label="Zone"- >- <FilterableSelect- isLoading={isZonesPending && !!dnsAppConnection.id}- isDisabled={!dnsAppConnection.id}- value={cloudflareZones.find((zone) => zone.id === value)}- onChange={(option) => {- onChange((option as SingleValue<TCloudflareZone>)?.id ?? null);- }}- options={cloudflareZones}- placeholder="Select a zone..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- />- </FormControl>- )}+ availableConnections={availableConnections}+ isPending={isPending}/>)}- {dnsProvider === AcmeDnsProvider.DNSMadeEasy && (- <Controller- name="configuration.dnsProviderConfig.hostedZoneId"+ {caType === CaType.ADCS && (+ <AdcsFieldscontrol={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- errorText={error?.message}- isError={Boolean(error?.message)}- label="Zone"- >- <FilterableSelect- isLoading={isDNSMadeEasyZonesPending && !!dnsAppConnection.id}- isDisabled={!dnsAppConnection.id}- value={dnsMadeEasyZones.find((zone) => zone.id === value)}- onChange={(option) => {- onChange((option as SingleValue<TDNSMadeEasyZone>)?.id ?? null);- }}- options={dnsMadeEasyZones}- placeholder="Select a zone..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- />- </FormControl>- )}+ availableConnections={availableConnections}+ isPending={isPending}/>)}- {dnsProvider === AcmeDnsProvider.AzureDNS && (- <Controller- name="configuration.dnsProviderConfig.hostedZoneId"+ {caType === CaType.AWS_PCA && (+ <AwsPcaFieldscontrol={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- errorText={error?.message}- isError={Boolean(error?.message)}- label="Zone"- >- <FilterableSelect- isLoading={isAzureDNSZonesPending && !!dnsAppConnection.id}- isDisabled={!dnsAppConnection.id}- value={azureDnsZones.find((zone) => zone.id === value)}- onChange={(option) => {- onChange((option as SingleValue<TAzureDNSZone>)?.id ?? null);- }}- options={azureDnsZones}- placeholder="Select a zone..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- />- </FormControl>- )}+ availableConnections={availableConnections}+ isPending={isPending}/>)}- <Controller- control={control}- defaultValue=""- name="configuration.directoryUrl"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Directory URL"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input- {...field}- placeholder="https://acme-v02.api.letsencrypt.org/directory"- />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.accountEmail"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Account Email"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input {...field} placeholder="[email protected]" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.eabKid"- render={({ field, fieldState: { error } }) => (- <FormControl- label="EAB Key Identifier (KID)"- isError={Boolean(error)}- errorText={error?.message}- isOptional={!REQUIRED_EAB_DIRECTORIES.includes(directoryUrl || "")}- isRequired={REQUIRED_EAB_DIRECTORIES.includes(directoryUrl || "")}- >- <Input- {...field}- placeholder="abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"- />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.eabHmacKey"- render={({ field, fieldState: { error } }) => (- <FormControl- label="EAB HMAC Key"- isError={Boolean(error)}- errorText={error?.message}- isOptional- >- <Input- type="password"- autoComplete="new-password"- {...field}- placeholder={- ca- ? undefined- : "dGhpc2lzYW5leGFtcGxlaG1hY2tleWZvcmRpZ2ljZXJ0YWNtZXRlc3RpbmcxMjM0NTY3ODkw"- }- />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.dnsResolver"- render={({ field, fieldState: { error } }) => (- <FormControl- label="DNS Resolver IP"- isError={Boolean(error)}- errorText={error?.message}- isOptional- tooltipText="A custom DNS resolver IP address used to verify DNS propagation during ACME challenges. Must be a valid IP (e.g. 8.8.8.8). Leave empty to use the system default."- >- <Input {...field} placeholder="8.8.8.8" />- </FormControl>- )}- />- </>- )}- {caType === CaType.AZURE_AD_CS && (- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="Azure ADCS App Connection contains the Windows domain credentials and ADCS server URL for certificate requests."- isError={Boolean(error)}- errorText={error?.message}- label="Azure ADCS Connection"- >- <FilterableSelect- menuPlacement="top"- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>+ {caType === CaType.DIGICERT && (+ <DigiCertFields+ control={control}+ setValue={setValue}+ configuration={configuration}+ availableConnections={availableConnections}+ isPending={isPending}+ digicertConnectionId={digicertConnectionId}+ digicertOrganizations={digicertOrganizations}+ isDigiCertOrgsPending={isDigiCertOrgsPending}+ digicertProducts={digicertProducts}+ isDigiCertProductsPending={isDigiCertProductsPending}+ csRequiresContact={csRequiresContact}+ />)}- control={control}- name="configuration.azureAdcsConnection"- />- )}- {caType === CaType.ADCS && (- <>- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="ADCS App Connection contains the Windows domain credentials and Gateway used to reach the AD CS server."- isError={Boolean(error)}- errorText={error?.message}- label="ADCS Connection"- isRequired- >- <FilterableSelect- menuPlacement="top"- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.adcsConnection"- />- <Controller- control={control}- defaultValue=""- name="configuration.caName"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Certificate Authority"- isError={Boolean(error)}- errorText={error?.message}- isOptional- tooltipText="The AD CS certificate authority name (the CA's common name), e.g. corp-ca01-CA. Leave blank to discover it automatically from the CA host."- >- <Input {...field} placeholder="Auto-discovered if left blank" />- </FormControl>- )}- />- </>- )}- {caType === CaType.AWS_PCA && (- <>- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="AWS App Connection provides the credentials used to communicate with AWS Private Certificate Authority."- isError={Boolean(error)}- errorText={error?.message}- label="AWS Connection"- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.awsConnection"- />- <Controller- control={control}- defaultValue=""- name="configuration.certificateAuthorityArn"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Certificate Authority ARN"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input- {...field}- placeholder="arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/abc-123"- />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.region"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- label="Region"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <AwsRegionSelect value={value} onChange={(v) => onChange(v || "")} />- </FormControl>- )}- />- </>- )}- {caType === CaType.DIGICERT && (- <>- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="DigiCert App Connection provides the CertCentral API key used to place orders."- isError={Boolean(error)}- errorText={error?.message}- label="DigiCert Connection"- isRequired- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.digicertConnection"- />- <Controller- control={control}- name="configuration.organizationId"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- label="Organization"- isError={Boolean(error)}- errorText={error?.message}- isRequired- tooltipText="The validated CertCentral organization that will appear on issued certificates."- >- <FilterableSelect- isLoading={isDigiCertOrgsPending && !!digicertConnectionId}- isDisabled={!digicertConnectionId}- value={digicertOrganizations.find((org) => org.id === value) ?? null}- onChange={(option) => {- onChange((option as SingleValue<TDigiCertOrganization>)?.id ?? 0);- }}- options={digicertOrganizations}- placeholder="Select an organization..."- getOptionLabel={(option) => option.displayName || option.name}- getOptionValue={(option) => String(option.id)}- menuPortalTarget={modalContainer.current}- />- </FormControl>- )}- />- <Controller- control={control}- name="configuration.purpose"- render={({ field: { value, onChange }, fieldState: { error } }) => {- const PURPOSE_OPTIONS = [- { value: DigiCertCaPurpose.Ssl, label: "SSL / TLS" },- { value: DigiCertCaPurpose.CodeSigning, label: "Code Signing" }- ];- return (- <FormControl- label="Purpose"- errorText={error?.message}- isError={Boolean(error)}- isRequired- tooltipText="What this CA issues. Selecting Code Signing filters the Product list to DigiCert's code-signing products."- >- <FilterableSelect- value={- PURPOSE_OPTIONS.find(- (o) => o.value === (value ?? DigiCertCaPurpose.Ssl)- ) ?? PURPOSE_OPTIONS[0]- }- onChange={(option) => {- const next = (- option as SingleValue<{ value: DigiCertCaPurpose; label: string }>- )?.value;- if (next) {- onChange(next);- setValue("configuration.productNameId", "");- }- }}- options={PURPOSE_OPTIONS}- getOptionLabel={(option) => option.label}- getOptionValue={(option) => option.value}- menuPortalTarget={modalContainer.current}- />- </FormControl>- );- }}- />- <Controller- control={control}- name="configuration.productNameId"- render={({ field: { value, onChange }, fieldState: { error } }) => {- const purpose =- configuration && "purpose" in configuration- ? (configuration.purpose ?? DigiCertCaPurpose.Ssl)- : DigiCertCaPurpose.Ssl;- const filteredProducts = digicertProducts.filter((p) => {- if (purpose === DigiCertCaPurpose.CodeSigning)- return p.type === "code_signing_certificate";- return p.type === "ssl_certificate" || !p.type;- });- return (- <FormControl- label="Product"- errorText={error?.message}- isError={Boolean(error)}- isRequired- tooltipText="Products available are account-specific entitlements fetched from CertCentral. Each Infisical CA issues under exactly one product."- >- <FilterableSelect- isLoading={isDigiCertProductsPending && !!digicertConnectionId}- isDisabled={!digicertConnectionId}- value={filteredProducts.find((product) => product.nameId === value) ?? null}- onChange={(option) => {- onChange((option as SingleValue<TDigiCertProduct>)?.nameId ?? "");- }}- options={filteredProducts}- placeholder="Select a product..."- getOptionLabel={(option) => `${option.name} (${option.nameId})`}- getOptionValue={(option) => option.nameId}- menuPortalTarget={modalContainer.current}- />- </FormControl>- );- }}- />- {/* Shown only when the org is not yet code-signing validated. While the check is in- flight nothing renders here — the submit button shows a loading state instead. */}- {csRequiresContact && (- <div className="mt-3 mb-2 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-4">- <div className="mb-1 text-sm font-medium text-mineshaft-100">- Verified Contact- </div>- <div className="mb-4 text-xs text-mineshaft-400">- This organization has not completed DigiCert code-signing validation yet, so a- verified contact is required. DigiCert emails this person an approval link they- must click to start organization validation.- </div>- <div className="grid grid-cols-2 gap-x-3 gap-y-2">- <Controller- control={control}- name="configuration.verifiedContact.firstName"- render={({ field, fieldState: { error } }) => (- <FormControl- label="First Name"- errorText={error?.message}- isError={Boolean(error)}- isRequired- >- <Input {...field} value={field.value ?? ""} placeholder="John" />- </FormControl>- )}- />- <Controller- control={control}- name="configuration.verifiedContact.lastName"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Last Name"- errorText={error?.message}- isError={Boolean(error)}- isRequired- >- <Input {...field} value={field.value ?? ""} placeholder="Doe" />- </FormControl>- )}- />- <Controller- control={control}- name="configuration.verifiedContact.email"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Email"- errorText={error?.message}- isError={Boolean(error)}- isRequired- className="col-span-2"- >- <Input- {...field}- value={field.value ?? ""}- placeholder="[email protected]"- />- </FormControl>- )}- />- <Controller- control={control}- name="configuration.verifiedContact.jobTitle"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Job Title"- errorText={error?.message}- isError={Boolean(error)}- isRequired- >- <Input- {...field}- value={field.value ?? ""}- placeholder="Security Engineer"- />- </FormControl>- )}- />- <Controller- control={control}- name="configuration.verifiedContact.telephone"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Telephone"- errorText={error?.message}- isError={Boolean(error)}- isRequired- tooltipText="Include the country code, e.g. +15551234567."- >- <Input {...field} value={field.value ?? ""} placeholder="+15551234567" />- </FormControl>- )}- />- </div>- </div>+ {caType === CaType.AWS_ACM_PUBLIC_CA && (+ <AwsAcmPublicCaFields+ control={control}+ availableConnections={availableConnections}+ isPending={isPending}+ />)}- </>- )}- {caType === CaType.AWS_ACM_PUBLIC_CA && (- <>- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="AWS App Connection used to issue, export, renew, and revoke certificates via AWS Certificate Manager (ACM)."- isError={Boolean(error)}- errorText={error?.message}- label="AWS Connection"- isRequired- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.awsConnection"- />- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="AWS App Connection used to write the ACM CNAME validation records into Route 53."- isError={Boolean(error)}- errorText={error?.message}- label="Route 53 Connection"- isRequired- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.dnsConnection"- />- <Controller- control={control}- defaultValue=""- name="configuration.hostedZoneId"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Route 53 Hosted Zone ID"- isError={Boolean(error)}- errorText={error?.message}- isRequired- tooltipText="The Route 53 hosted zone that owns the domain(s) you'll issue certificates for."- >- <Input {...field} placeholder="Z040441124N1GOOMCQYX1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.region"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- label="Region"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <AwsRegionSelect value={value} onChange={(v) => onChange(v || "")} />- </FormControl>- )}- />- </>- )}- {caType === CaType.VENAFI_TPP && (- <>- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="Venafi TPP App Connection contains the credentials to connect to your Venafi Trust Protection Platform instance."- isError={Boolean(error)}- errorText={error?.message}- label="Venafi TPP Connection"- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.venafiTppConnection"- />- <Controller- control={control}- defaultValue=""- name="configuration.policyDN"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Policy DN"- isError={Boolean(error)}- errorText={error?.message}- isRequired- tooltipText="The policy folder path in Venafi TPP where certificates will be managed (e.g., \VED\Policy\Certificates)."- >- <Input {...field} placeholder="\VED\Policy\Certificates" />- </FormControl>- )}- />- </>- )}- {caType === CaType.GODADDY && (- <>- <Controller- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- tooltipText="GoDaddy App Connection provides the API key and secret used to place certificate orders."- isError={Boolean(error)}- errorText={error?.message}- label="GoDaddy Connection"- >- <FilterableSelect- value={value}- onChange={(newValue) => {- onChange(newValue);- }}- isLoading={isPending}- options={availableConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- components={{ Option: AppConnectionOption }}- />- </FormControl>- )}- control={control}- name="configuration.godaddyConnection"- />- <Controller- control={control}- name="configuration.productType"- defaultValue={GoDaddyProductType.DV_SSL}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- label="Product"- isError={Boolean(error)}- errorText={error?.message}- isRequired- tooltipText="Domain Validated SSL product to use for issuance."- >- <Select- value={value}- onValueChange={(val) => onChange(val)}- className="w-full border border-mineshaft-500"- position="popper"- dropdownContainerClassName="max-w-none"- >- <SelectItem value={GoDaddyProductType.DV_SSL}>DV SSL</SelectItem>- </Select>- </FormControl>- )}- />- </>- )}- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting || isCheckingCsValidation}- isDisabled={isSubmitting || isCheckingCsValidation}- >- {popUp?.ca?.data ? "Update" : "Create"}- </Button>- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("ca", false)}- >- Cancel- </Button>- </div>- </form>- </ModalContent>- </Modal>+ {caType === CaType.VENAFI_TPP && (+ <VenafiTppFields+ control={control}+ availableConnections={availableConnections}+ isPending={isPending}+ />+ )}+ {caType === CaType.GODADDY && (+ <GoDaddyFields+ control={control}+ availableConnections={availableConnections}+ isPending={isPending}+ />+ )}+ </div>+ <div className="flex shrink-0 items-center justify-end gap-3 border-t border-border px-6 py-4">+ <Button+ type="button"+ variant="outline"+ onClick={() => handlePopUpToggle("ca", false)}+ >+ Cancel+ </Button>+ <Button+ type="submit"+ variant="project"+ isPending={isSubmitting || isCheckingCsValidation}+ isDisabled={isSubmitting || isCheckingCsValidation}+ >+ {isEditMode ? "Update" : "Create"}+ </Button>+ </div>+ </form>+ )}+ </SheetContent>+ </Sheet>);};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsxindex 73e91e6afb..0ccbec4cbe 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx@@ -1,7 +1,17 @@+import { ReactNode } from "react";import { Control, Controller } from "react-hook-form";-import { FormControl, Select, SelectItem } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ Field,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "@app/components/v3";import { useSubscription } from "@app/context";import { isPqcAlgorithm } from "@app/hooks/api/certificates/constants";@@ -10,6 +20,59 @@ type AlgorithmOption = {label: string;};+const NONE_VALUE = "__none__";++type AlgorithmSelectProps = {+ control: Control<any>;+ name: string;+ label: string;+ options: AlgorithmOption[];+ error?: string;+ shouldUnregister?: boolean;+ isRequired: boolean;+ nonePlaceholder?: string;+ selectPlaceholder: string;+ renderOptions: (options: AlgorithmOption[]) => ReactNode;+};++const AlgorithmSelect = ({+ control,+ name,+ label,+ options,+ error,+ shouldUnregister,+ isRequired,+ nonePlaceholder,+ selectPlaceholder,+ renderOptions+}: AlgorithmSelectProps) => (+ <Controller+ control={control}+ name={name}+ shouldUnregister={shouldUnregister}+ render={({ field: { onChange, value } }) => (+ <Field>+ <FieldLabel>+ {label} {isRequired && <span className="text-danger">*</span>}+ </FieldLabel>+ <Select+ value={value ?? (nonePlaceholder ? NONE_VALUE : "")}+ onValueChange={(e) => onChange(e === NONE_VALUE ? null : e)}+ >+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue+ placeholder={options.length > 0 ? selectPlaceholder : "No algorithms available"}+ />+ </SelectTrigger>+ <SelectContent position="popper">{renderOptions(options)}</SelectContent>+ </Select>+ <FieldError>{error}</FieldError>+ </Field>+ )}+ />+);+type AlgorithmSelectorsProps = {control: Control<any>;availableSignatureAlgorithms: AlgorithmOption[];@@ -24,8 +87,6 @@ type AlgorithmSelectorsProps = {hideSignatureAlgorithm?: boolean;};-const NONE_VALUE = "__none__";-export const AlgorithmSelectors = ({control,availableSignatureAlgorithms,@@ -40,101 +101,53 @@ export const AlgorithmSelectors = ({hideSignatureAlgorithm = false}: AlgorithmSelectorsProps) => {const { subscription } = useSubscription();++ const renderOptions = (options: AlgorithmOption[]): ReactNode => (+ <>+ {nonePlaceholder && <SelectItem value={NONE_VALUE}>{nonePlaceholder}</SelectItem>}+ {options.map((algorithm) => {+ const isGated = isPqcAlgorithm(algorithm.value) && !subscription?.pkiPqc;+ return (+ <SelectItem key={algorithm.value} value={algorithm.value} disabled={isGated}>+ <span className="flex items-center gap-2">+ {algorithm.label}+ {isGated && <Badge variant="info">Enterprise</Badge>}+ </span>+ </SelectItem>+ );+ })}+ </>+ );+return (<div className={hideSignatureAlgorithm ? "grid grid-cols-1 gap-4" : "grid grid-cols-2 gap-4"}>{!hideSignatureAlgorithm && (- <div>- <Controller- control={control}- name={signatureFieldName}- shouldUnregister={shouldUnregister}- render={({ field: { onChange, value, ...field } }) => (- <FormControl- label="Signature Algorithm"- errorText={signatureError}- isError={Boolean(signatureError)}- isRequired={isRequired}- >- <Select- defaultValue=""- {...field}- value={value ?? (nonePlaceholder ? NONE_VALUE : "")}- onValueChange={(e) => onChange(e === NONE_VALUE ? null : e)}- className="w-full"- placeholder={- availableSignatureAlgorithms.length > 0- ? "Select signature algorithm"- : "No algorithms available"- }- position="popper"- >- {nonePlaceholder && <SelectItem value={NONE_VALUE}>{nonePlaceholder}</SelectItem>}- {availableSignatureAlgorithms.map((algorithm) => (- <SelectItem- key={algorithm.value}- value={algorithm.value}- isDisabled={isPqcAlgorithm(algorithm.value) && !subscription?.pkiPqc}- >- <div className="flex items-center gap-2">- {algorithm.label}- {isPqcAlgorithm(algorithm.value) && !subscription?.pkiPqc && (- <Badge variant="info">Enterprise</Badge>- )}- </div>- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- </div>- )}-- <div>- <Controller+ <AlgorithmSelectcontrol={control}- name={keyFieldName}+ name={signatureFieldName}+ label="Signature Algorithm"+ options={availableSignatureAlgorithms}+ error={signatureError}shouldUnregister={shouldUnregister}- render={({ field: { onChange, value, ...field } }) => (- <FormControl- label="Key Algorithm"- errorText={keyError}- isError={Boolean(keyError)}- isRequired={isRequired}- >- <Select- defaultValue=""- {...field}- value={value ?? (nonePlaceholder ? NONE_VALUE : "")}- onValueChange={(e) => onChange(e === NONE_VALUE ? null : e)}- className="w-full"- placeholder={- availableKeyAlgorithms.length > 0- ? "Select key algorithm"- : "No algorithms available"- }- position="popper"- >- {nonePlaceholder && <SelectItem value={NONE_VALUE}>{nonePlaceholder}</SelectItem>}- {availableKeyAlgorithms.map((algorithm) => (- <SelectItem- key={algorithm.value}- value={algorithm.value}- isDisabled={isPqcAlgorithm(algorithm.value) && !subscription?.pkiPqc}- >- <div className="flex items-center gap-2">- {algorithm.label}- {isPqcAlgorithm(algorithm.value) && !subscription?.pkiPqc && (- <Badge variant="info">Enterprise</Badge>- )}- </div>- </SelectItem>- ))}- </Select>- </FormControl>- )}+ isRequired={isRequired}+ nonePlaceholder={nonePlaceholder}+ selectPlaceholder="Select signature algorithm"+ renderOptions={renderOptions}/>- </div>+ )}++ <AlgorithmSelect+ control={control}+ name={keyFieldName}+ label="Key Algorithm"+ options={availableKeyAlgorithms}+ error={keyError}+ shouldUnregister={shouldUnregister}+ isRequired={isRequired}+ nonePlaceholder={nonePlaceholder}+ selectPlaceholder="Select key algorithm"+ renderOptions={renderOptions}+ /></div>);};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsxindex a45fba50af..74bb7af97b 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx@@ -1,30 +1,41 @@-import { useCallback, useEffect, useMemo, useRef } from "react";-import { Controller, useForm } from "react-hook-form";-import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { Controller, useFieldArray, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { useNavigate } from "@tanstack/react-router";+import { FileBadge, Plus, Tags, Trash2 } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,Button,Checkbox,- FormControl,- FormLabel,+ DocumentationLinkBadge,+ Empty,+ EmptyContent,+ EmptyMedia,+ EmptyTitle,+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel,Input,- Modal,- ModalContent,Select,+ SelectContent,SelectItem,- TextArea,- Tooltip-} from "@app/components/v2";+ SelectTrigger,+ SelectValue,+ Sheet,+ SheetContent,+ SheetHeader,+ SheetTitle,+ Stepper,+ StepperList,+ StepperStep,+ TextArea+} from "@app/components/v3";import { useOrganization, useProject } from "@app/context";+import { isIPv4, isIPv6 } from "@app/helpers/ip";import { useGetCert } from "@app/hooks/api";import { CaType } from "@app/hooks/api/ca";import { useGetCertificatePolicyById } from "@app/hooks/api/certificatePolicies";@@ -37,14 +48,14 @@ import {import { useUnifiedCertificateIssuance } from "@app/hooks/api/certificates/mutations";import { useListPkiApplicationProfiles } from "@app/hooks/api/pkiApplications";import { UsePopUpState } from "@app/hooks/usePopUp";+import { PkiDocsUrls } from "@app/pages/cert-manager/pki-docs-urls";import {CertSubjectAlternativeNameType,CertSubjectAttributeType} from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";-import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";import { AlgorithmSelectors } from "./AlgorithmSelectors";-import { filterUsages, formatSubjectAltNames } from "./certificateUtils";+import { buildManagedRequest } from "./buildManagedRequest";import { KeyUsageSection } from "./KeyUsageSection";import { SubjectAltNamesField } from "./SubjectAltNamesField";import { SubjectAttributesField } from "./SubjectAttributesField";@@ -156,6 +167,81 @@ type Props = {applicationName?: string;};+type IssuanceStepKey = "profile" | "csr" | "subject" | "options" | "metadata";++const STEP_META: Record<+ IssuanceStepKey,+ {+ name: string;+ shortDescription: string;+ title: string;+ subtitle: string;+ rightLabel: string;+ rightDescription: string;+ }+> = {+ profile: {+ name: "Profile",+ shortDescription: "Method and profile",+ title: "Profile",+ subtitle: "Choose how to request the certificate and which profile to use.",+ rightLabel: "PROFILE",+ rightDescription:+ "The certificate profile determines the issuing CA and the policy that constrains what this certificate may contain. Choose Managed to have Infisical generate the key pair for you, or CSR to supply your own certificate signing request."+ },+ csr: {+ name: "Signing Request",+ shortDescription: "Provide your CSR",+ title: "Certificate Signing Request",+ subtitle: "Paste the certificate signing request to submit for signing.",+ rightLabel: "SIGNING REQUEST",+ rightDescription:+ "The subject, key, and extensions are taken from your CSR. The profile's policy still validates the request at issuance."+ },+ subject: {+ name: "Subject",+ shortDescription: "Names and SANs",+ title: "Subject",+ subtitle: "Set the subject attributes and alternative names for this certificate.",+ rightLabel: "SUBJECT",+ rightDescription:+ "Subject attributes and alternative names identify the certificate. The available fields are constrained by the profile's policy."+ },+ options: {+ name: "Options",+ shortDescription: "Validity and key usage",+ title: "Certificate Options",+ subtitle: "Set validity, algorithms, and key usages within the profile's policy.",+ rightLabel: "OPTIONS",+ rightDescription:+ "These values are validated against the profile's policy at issuance. Fields that the profile or an external CA fully controls are hidden or read-only."+ },+ metadata: {+ name: "Metadata",+ shortDescription: "Optional key-values",+ title: "Metadata",+ subtitle: "Attach optional metadata key-value pairs to this certificate.",+ rightLabel: "METADATA",+ rightDescription:+ "Metadata is stored alongside the certificate for your own tracking and automation. It does not affect the issued certificate."+ }+};++const STEP_FIELDS: Record<IssuanceStepKey, string[]> = {+ profile: ["requestMethod", "profileId"],+ csr: ["csr", "ttl"],+ subject: ["subjectAttributes", "subjectAltNames"],+ options: [+ "ttl",+ "signatureAlgorithm",+ "keyAlgorithm",+ "keyUsages",+ "extendedKeyUsages",+ "basicConstraints"+ ],+ metadata: ["metadata"]+};+export const CertificateIssuanceModal = ({popUp,handlePopUpToggle,@@ -167,6 +253,8 @@ export const CertificateIssuanceModal = ({const { currentOrg } = useOrganization();const navigate = useNavigate();+ const [step, setStep] = useState(0);+const inputSerialNumber =(popUp?.issueCertificate?.data as { serialNumber: string })?.serialNumber || "";const sanitizedSerialNumber = inputSerialNumber.replace(/[^a-fA-F0-9:]/g, "");@@ -226,6 +314,12 @@ export const CertificateIssuanceModal = ({}});+ const {+ fields: metadataFields,+ append: appendMetadata,+ remove: removeMetadata+ } = useFieldArray({ control, name: "metadata" });+const requestMethod = watch("requestMethod");const actualSelectedProfileId = watch("profileId");@@ -267,6 +361,28 @@ export const CertificateIssuanceModal = ({reset();}, [reset, resetConstraints]);+ const stepKeys = useMemo<IssuanceStepKey[]>(() => {+ const keys: IssuanceStepKey[] = ["profile"];+ if (requestMethod === RequestMethod.CSR) {+ keys.push("csr");+ } else {+ if (constraints.shouldShowSubjectSection || constraints.shouldShowSanSection) {+ keys.push("subject");+ }+ keys.push("options");+ }+ keys.push("metadata");+ return keys;+ }, [requestMethod, constraints.shouldShowSubjectSection, constraints.shouldShowSanSection]);++ const currentStepKey = stepKeys[Math.min(step, stepKeys.length - 1)];+ const currentStepMeta = STEP_META[currentStepKey];+ const isLastStep = step === stepKeys.length - 1;++ useEffect(() => {+ if (step > stepKeys.length - 1) setStep(stepKeys.length - 1);+ }, [stepKeys.length, step]);+useEffect(() => {if (cert) {const subjectAttrs: Array<{ type: CertSubjectAttributeType; value: string }> = [];@@ -285,7 +401,7 @@ export const CertificateIssuanceModal = ({const trimmed = name.trim();if (trimmed.includes("@"))return { type: CertSubjectAlternativeNameType.EMAIL, value: trimmed };- if (trimmed.match(/^\d+\.\d+\.\d+\.\d+$/))+ if (isIPv4(trimmed) || isIPv6(trimmed))return { type: CertSubjectAlternativeNameType.IP_ADDRESS, value: trimmed };if (trimmed.startsWith("http"))return { type: CertSubjectAlternativeNameType.URI, value: trimmed };@@ -309,6 +425,10 @@ export const CertificateIssuanceModal = ({}}, [popUp?.issueCertificate?.isOpen, profileId, cert, setValue]);+ useEffect(() => {+ if (popUp?.issueCertificate?.isOpen) setStep(0);+ }, [popUp?.issueCertificate?.isOpen]);+const onFormSubmit = useCallback(async (formData: FormData) => {if (!currentProject?.slug || !currentProject?.id) {@@ -380,134 +500,13 @@ export const CertificateIssuanceModal = ({return;}- const {- subjectAttributes,- subjectAltNames,- basicConstraints,- signatureAlgorithm,- keyAlgorithm,- keyUsages,- extendedKeyUsages,- metadata: formMetadata- } = formData;-- const managedMetadataEntries = formMetadata?.filter((m) => m.key);- const request: any = {- profileId: formProfileId,- ...(applicationId && { applicationId }),- attributes: {- keyAlgorithm: keyAlgorithm || "",- ...(!isAdcsProfile && {- ttl,- signatureAlgorithm: signatureAlgorithm || "",- keyUsages: filterUsages(keyUsages) as CertKeyUsage[],- extendedKeyUsages: filterUsages(extendedKeyUsages) as CertExtendedKeyUsage[]- })- },- ...(managedMetadataEntries?.length && { metadata: managedMetadataEntries })- };-- if (constraints.shouldShowSubjectSection) {- const defaults = actualSelectedProfile?.defaults;-- if (subjectAttributes && subjectAttributes.length > 0) {- const cnAttr = subjectAttributes.find(- (attr) => attr.type === CertSubjectAttributeType.COMMON_NAME- );- if (cnAttr?.value) {- request.attributes.commonName = cnAttr.value;- } else if (defaults?.commonName) {- request.attributes.commonName = null;- }-- const orgAttr = subjectAttributes.find(- (attr) => attr.type === CertSubjectAttributeType.ORGANIZATION- );- if (orgAttr?.value) {- request.attributes.organization = orgAttr.value;- } else if (defaults?.organization) {- request.attributes.organization = null;- }-- const ouAttr = subjectAttributes.find(- (attr) => attr.type === CertSubjectAttributeType.ORGANIZATIONAL_UNIT- );- if (ouAttr?.value) {- request.attributes.organizationalUnit = ouAttr.value;- } else if (defaults?.organizationalUnit) {- request.attributes.organizationalUnit = null;- }-- const countryAttr = subjectAttributes.find(- (attr) => attr.type === CertSubjectAttributeType.COUNTRY- );- if (countryAttr?.value) {- request.attributes.country = countryAttr.value;- } else if (defaults?.country) {- request.attributes.country = null;- }-- const stateAttr = subjectAttributes.find(- (attr) => attr.type === CertSubjectAttributeType.STATE- );- if (stateAttr?.value) {- request.attributes.state = stateAttr.value;- } else if (defaults?.state) {- request.attributes.state = null;- }-- const localityAttr = subjectAttributes.find(- (attr) => attr.type === CertSubjectAttributeType.LOCALITY- );- if (localityAttr?.value) {- request.attributes.locality = localityAttr.value;- } else if (defaults?.locality) {- request.attributes.locality = null;- }-- // Domain components are multi-valued: collect every DC row (order preserved).- const domainComponents = subjectAttributes- .filter((attr) => attr.type === CertSubjectAttributeType.DOMAIN_COMPONENT)- .map((attr) => attr.value.trim())- .filter((val) => val.length > 0);- if (domainComponents.length > 0) {- request.attributes.domainComponents = domainComponents;- }- } else if (defaults) {- // No subject attributes provided; send null overrides for profile defaults- if (defaults.commonName) request.attributes.commonName = null;- if (defaults.organization) request.attributes.organization = null;- if (defaults.organizationalUnit) request.attributes.organizationalUnit = null;- if (defaults.country) request.attributes.country = null;- if (defaults.state) request.attributes.state = null;- if (defaults.locality) request.attributes.locality = null;- }- }-- if (constraints.shouldShowSanSection) {- if (subjectAltNames && subjectAltNames.length > 0) {- const formattedSans = formatSubjectAltNames(subjectAltNames);- if (formattedSans && formattedSans.length > 0) {- request.attributes.altNames = formattedSans;- }- } else {- request.attributes.altNames = [];- }- }-- if (!isAdcsProfile) {- if (- (constraints.templateAllowsCA && basicConstraints?.isCA) ||- constraints.templateRequiresCA- ) {- request.attributes.basicConstraints = {- isCA: true,- pathLength: basicConstraints?.pathLength ?? undefined- };- } else if (constraints.templateAllowsCA) {- request.attributes.basicConstraints = { isCA: false };- }- }+ const request = buildManagedRequest({+ formData,+ applicationId,+ isAdcsProfile,+ constraints,+ defaults: actualSelectedProfile?.defaults+ });const response = await issueCertificate(request);handleIssuanceResponse(response);@@ -523,11 +522,10 @@ export const CertificateIssuanceModal = ({currentProject?.id,currentOrg?.id,issueCertificate,- constraints.shouldShowSubjectSection,- constraints.shouldShowSanSection,- constraints.templateAllowsCA,- constraints.templateRequiresCA,+ constraints,actualSelectedProfile?.defaults,+ applicationId,+ applicationName,isAdcsProfile,handlePopUpToggle,navigate,@@ -545,9 +543,29 @@ export const CertificateIssuanceModal = ({return "Request a new certificate using a certificate profile";};+ const selectedProfileReady = Boolean(profileId || actualSelectedProfileId);++ const goBack = () => setStep((s) => Math.max(0, s - 1));+ const goNext = () => {+ if (currentStepKey === "profile" && !selectedProfileReady) return;+ setStep((s) => Math.min(stepKeys.length - 1, s + 1));+ };++ const onFormInvalid = (errors: Record<string, unknown>) => {+ const errorKeys = Object.keys(errors);+ const idx = stepKeys.findIndex((key) =>+ STEP_FIELDS[key].some((fieldName) => errorKeys.includes(fieldName))+ );+ if (idx >= 0) setStep(idx);+ createNotification({+ text: "Please fix the highlighted fields before requesting.",+ type: "error"+ });+ };+return (- <Modal- isOpen={popUp?.issueCertificate?.isOpen}+ <Sheet+ open={popUp?.issueCertificate?.isOpen}onOpenChange={(isOpen) => {handlePopUpToggle("issueCertificate", isOpen);if (!isOpen) {@@ -555,372 +573,482 @@ export const CertificateIssuanceModal = ({}}}>- <ModalContent title={getModalTitle()} subTitle={getModalSubTitle()}>- {cert && (- <div className="space-y-4">- <div>- <h4 className="text-sm font-medium text-mineshaft-300">Certificate Details</h4>- <p className="text-sm text-mineshaft-400">Serial Number: {cert.serialNumber}</p>- <p className="text-sm text-mineshaft-400">Certificate Id: {cert.id}</p>- <p className="text-sm text-mineshaft-400">Common Name: {cert.commonName}</p>- <p className="text-sm text-mineshaft-400">Status: {cert.status}</p>+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 p-0 sm:max-w-[1100px]">+ <SheetHeader className="border-b border-border">+ <SheetTitle>+ <div className="flex w-full items-start gap-2">+ <div className="flex h-10 w-10 items-center justify-center rounded-md bg-project/10 text-project">+ <FileBadge className="h-5 w-5" />+ </div>+ <div>+ <div className="flex items-center gap-x-2 text-foreground">{getModalTitle()}</div>+ <p className="text-sm leading-4 text-muted">{getModalSubTitle()}</p>+ </div></div>+ </SheetTitle>+ </SheetHeader>++ {cert ? (+ <div className="min-h-0 flex-1 overflow-y-auto px-6 py-6">+ <h4 className="text-sm font-medium text-foreground">Certificate Details</h4>+ <p className="mt-1 text-sm text-muted">Serial Number: {cert.serialNumber}</p>+ <p className="text-sm text-muted">Certificate Id: {cert.id}</p>+ <p className="text-sm text-muted">Common Name: {cert.commonName}</p>+ <p className="text-sm text-muted">Status: {cert.status}</p></div>- )}- {!cert && (- <form onSubmit={handleSubmit(onFormSubmit)}>- <Controller- control={control}- name="requestMethod"- render={({ field: { onChange, value } }) => (- <FormControl- label={- <FormLabel- label="Request Method"- icon={- <Tooltip- content={- <div className="space-y-2">- <p>- <strong>Managed:</strong> We generate and manage the private key for- you.- </p>- <p>- <strong>CSR:</strong> Provide your own Certificate Signing Request.- Use this when you need to manage your own private key.- </p>- </div>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- }- />- }+ ) : (+ <form onSubmit={(e) => e.preventDefault()} className="flex min-h-0 flex-1 flex-col">+ <div className="flex min-h-0 flex-1 overflow-hidden">+ <aside className="flex w-60 shrink-0 flex-col border-r border-border px-5 py-6">+ <p className="mb-5 text-[11px] font-medium tracking-wider text-muted uppercase">+ Setup steps+ </p>+ <Stepper+ activeStep={step}+ orientation="vertical"+ onStepChange={(i) => {+ if (isSubmitting) return;+ if (i < step) setStep(i);+ }}>- <Select- value={value}- onValueChange={(val) => onChange(val as RequestMethod)}- className="w-full"- >- <SelectItem value={RequestMethod.MANAGED}>Managed</SelectItem>- <SelectItem value={RequestMethod.CSR}>- Certificate Signing Request (CSR)- </SelectItem>- </Select>- </FormControl>- )}- />-- {!profileId && (- <Controller- control={control}- name="profileId"- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="Certificate Profile"- errorText={error?.message}- isError={Boolean(error)}- isRequired- >- <Select- defaultValue=""- {...field}- onValueChange={(e) => onChange(e)}- className="w-full"- placeholder="Select a certificate profile"- position="popper"- dropdownContainerClassName="max-w-none"- >- {availableProfiles.length === 0 && applicationId ? (- <div className="px-3 py-3 text-xs leading-snug whitespace-normal text-mineshaft-300">- Only profiles with API enrollment configured on this Application are- listed here. Configure API enrollment under this Application's- Settings tab.- </div>- ) : (- availableProfiles.map((profile) => (- <SelectItem key={profile.id} value={profile.id}>- {profile.slug}- </SelectItem>- ))- )}- </Select>- </FormControl>- )}- />- )}-- {(actualSelectedProfile || profileId) && (- <>- {requestMethod === RequestMethod.CSR && (- <Controller- control={control}- name="csr"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Certificate Signing Request (CSR)"- isRequired- errorText={error?.message}- isError={Boolean(error)}- >- <TextArea- {...field}- spellCheck={false}- placeholder={- "-----BEGIN CERTIFICATE REQUEST-----\n" +- "MIIByDCCAU4CAQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\n" +- "FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEjAQBgNVBAoMCURlbW8gQ29ycDEUMBIG\n" +- "A1UECwwLRW5naW5lZXJpbmcxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTB2MBAG\n" +- "ByqGSM49AgEGBSuBBAAiA2IABDHV5yengUugeBcpjsw+iAaxSkCr16LMr3ITyvlM\n" +- "lDv+AE0Ddc6FsFXJicBfTalM3AKl5F14OCBRfI2jugWJOGCLcKYqRDTDevxQmgCI\n" +- "IfpRM6+jzPkqe0PsuLhYiRfbFKBRME8GCSqGSIb3DQEJDjFCMEAwPgYDVR0RBDcw\n" +- "NYIPYXBwLmV4YW1wbGUuY29tghEqLmFwcC5leGFtcGxlLmNvbYIJbG9jYWxob3N0\n" +- "hwR/AAABMAoGCCqGSM49BAMCA2gAMGUCMGQQYs4lTSc3r/5MlabDx4m+sWaAtDhO\n" +- "17c3TaoDZOMG6r45mgUskPGTripXV9ItTQIxAJypXNlHnMvks7MO4LmicPqku4MF\n" +- "IeFqqXMFzC9uAO3iQ8/ji6ukvT6a9A3DE9LLIg==\n" +- "-----END CERTIFICATE REQUEST-----"- }- rows={13}- className="w-full font-mono text-xs"- />- </FormControl>- )}- />- )}+ <StepperList>+ {stepKeys.map((key, i) => (+ <StepperStep+ key={key}+ index={i}+ title={STEP_META[key].name}+ description={STEP_META[key].shortDescription}+ />+ ))}+ </StepperList>+ </Stepper>+ </aside>++ <div className="flex min-w-0 flex-1 flex-col gap-y-2 overflow-y-auto px-8 py-6">+ <div className="mb-6">+ <h2 className="text-lg font-semibold text-foreground">{currentStepMeta.title}</h2>+ <p className="mt-1 text-sm text-muted">{currentStepMeta.subtitle}</p>+ </div>- {requestMethod === RequestMethod.MANAGED &&- constraints.shouldShowSubjectSection && (- <SubjectAttributesField+ {currentStepKey === "profile" && (+ <div className="space-y-5">+ <Controllercontrol={control}- allowedAttributeTypes={constraints.allowedSubjectAttributeTypes}- error={- (formState.errors as { subjectAttributes?: { message?: string } })- .subjectAttributes?.message- }+ name="requestMethod"+ render={({ field: { onChange, value } }) => (+ <Field>+ <FieldLabel>Request Method</FieldLabel>+ <FieldContent>+ <Select+ value={value}+ onValueChange={(val) => onChange(val as RequestMethod)}+ >+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={RequestMethod.MANAGED}>Managed</SelectItem>+ <SelectItem value={RequestMethod.CSR}>+ Certificate Signing Request (CSR)+ </SelectItem>+ </SelectContent>+ </Select>+ <FieldDescription>+ Managed generates and manages the private key for you. CSR lets you+ provide your own certificate signing request when you need to manage+ your own private key.+ </FieldDescription>+ </FieldContent>+ </Field>+ )}/>- )}-- {requestMethod === RequestMethod.MANAGED && constraints.shouldShowSanSection && (- <SubjectAltNamesField- control={control}- allowedSanTypes={constraints.allowedSanTypes}- error={- (formState.errors as { subjectAltNames?: { message?: string } })- .subjectAltNames?.message- }- />- )}- {!isAdcsProfile && (- <Controller- control={control}- name="ttl"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Time to Live (TTL)"- isRequired- errorText={error?.message}- isError={Boolean(error)}- >- <Input {...field} placeholder="30d, 1y, 8760h" />- </FormControl>+ {!profileId && (+ <Controller+ control={control}+ name="profileId"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Certificate Profile <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <Select value={value || ""} onValueChange={(val) => onChange(val)}>+ <SelectTrigger className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a certificate profile" />+ </SelectTrigger>+ <SelectContent position="popper">+ {availableProfiles.length === 0 && applicationId ? (+ <div className="px-3 py-3 text-xs leading-snug whitespace-normal text-muted">+ Only profiles with API enrollment configured on this+ Application are listed here. Configure API enrollment under+ this Application's Settings tab.+ </div>+ ) : (+ availableProfiles.map((profile) => (+ <SelectItem key={profile.id} value={profile.id}>+ {profile.slug}+ </SelectItem>+ ))+ )}+ </SelectContent>+ </Select>+ {isAdcsProfile && (+ <FieldDescription>{externalCaHint}</FieldDescription>+ )}+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />)}- />+ </div>)}- {requestMethod === RequestMethod.MANAGED && (- <>- <AlgorithmSelectors- control={control}- availableSignatureAlgorithms={availableSignatureAlgorithms}- availableKeyAlgorithms={availableKeyAlgorithms}- hideSignatureAlgorithm={isAdcsProfile}- signatureError={- (formState.errors as { signatureAlgorithm?: { message?: string } })- .signatureAlgorithm?.message- }- keyError={- (formState.errors as { keyAlgorithm?: { message?: string } }).keyAlgorithm- ?.message- }- />-- {isAdcsProfile && (+ {currentStepKey !== "profile" && (actualSelectedProfile || profileId) && (+ <div className="space-y-4">+ {currentStepKey === "options" && profileId && isAdcsProfile && (<p className="mb-4 text-xs text-mineshaft-400">{externalCaHint}</p>)}- {!isAdcsProfile && (- <Accordion type="single" collapsible className="w-full">- <KeyUsageSection+ {currentStepKey === "csr" && (+ <Controller+ control={control}+ name="csr"+ render={({ field: { value, ...field }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Certificate Signing Request (CSR){" "}+ <span className="text-danger">*</span>+ </FieldLabel>+ <TextArea+ {...field}+ value={value ?? ""}+ spellCheck={false}+ isError={Boolean(error)}+ placeholder={+ "-----BEGIN CERTIFICATE REQUEST-----\n" ++ "MIIByDCCAU4CAQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\n" ++ "FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEjAQBgNVBAoMCURlbW8gQ29ycDEUMBIG\n" ++ "A1UECwwLRW5naW5lZXJpbmcxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTB2MBAG\n" ++ "ByqGSM49AgEGBSuBBAAiA2IABDHV5yengUugeBcpjsw+iAaxSkCr16LMr3ITyvlM\n" ++ "lDv+AE0Ddc6FsFXJicBfTalM3AKl5F14OCBRfI2jugWJOGCLcKYqRDTDevxQmgCI\n" ++ "IfpRM6+jzPkqe0PsuLhYiRfbFKBRME8GCSqGSIb3DQEJDjFCMEAwPgYDVR0RBDcw\n" ++ "NYIPYXBwLmV4YW1wbGUuY29tghEqLmFwcC5leGFtcGxlLmNvbYIJbG9jYWxob3N0\n" ++ "hwR/AAABMAoGCCqGSM49BAMCA2gAMGUCMGQQYs4lTSc3r/5MlabDx4m+sWaAtDhO\n" ++ "17c3TaoDZOMG6r45mgUskPGTripXV9ItTQIxAJypXNlHnMvks7MO4LmicPqku4MF\n" ++ "IeFqqXMFzC9uAO3iQ8/ji6ukvT6a9A3DE9LLIg==\n" ++ "-----END CERTIFICATE REQUEST-----"+ }+ rows={13}+ className="w-full font-mono text-xs"+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}++ {currentStepKey === "subject" && constraints.shouldShowSubjectSection && (+ <SubjectAttributesField+ control={control}+ allowedAttributeTypes={constraints.allowedSubjectAttributeTypes}+ error={+ (formState.errors as { subjectAttributes?: { message?: string } })+ .subjectAttributes?.message+ }+ />+ )}++ {currentStepKey === "subject" && constraints.shouldShowSanSection && (+ <SubjectAltNamesField+ control={control}+ allowedSanTypes={constraints.allowedSanTypes}+ error={+ (formState.errors as { subjectAltNames?: { message?: string } })+ .subjectAltNames?.message+ }+ />+ )}++ {(currentStepKey === "csr" || currentStepKey === "options") &&+ !isAdcsProfile && (+ <Controllercontrol={control}- title="Key Usages"- accordionValue="key-usages"- namePrefix="keyUsages"- options={filteredKeyUsages}- requiredUsages={constraints.requiredKeyUsages}+ name="ttl"+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>+ Time to Live (TTL) <span className="text-danger">*</span>+ </FieldLabel>+ <Input+ {...field}+ placeholder="30d, 1y, 8760h"+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}/>- <KeyUsageSection+ )}++ {currentStepKey === "options" && (+ <>+ <AlgorithmSelectorscontrol={control}- title="Extended Key Usages"- accordionValue="extended-key-usages"- namePrefix="extendedKeyUsages"- options={filteredExtendedKeyUsages}- requiredUsages={constraints.requiredExtendedKeyUsages}+ availableSignatureAlgorithms={availableSignatureAlgorithms}+ availableKeyAlgorithms={availableKeyAlgorithms}+ hideSignatureAlgorithm={isAdcsProfile}+ signatureError={+ (formState.errors as { signatureAlgorithm?: { message?: string } })+ .signatureAlgorithm?.message+ }+ keyError={+ (formState.errors as { keyAlgorithm?: { message?: string } })+ .keyAlgorithm?.message+ }/>- {constraints.templateAllowsCA && (- <AccordionItem value="basic-constraints">- <AccordionTrigger>Basic Constraints</AccordionTrigger>- <AccordionContent forceMount className="data-[state=closed]:hidden">- <div className="space-y-4 pl-2">- <Controller- control={control}- name="basicConstraints.isCA"- render={({ field: { value, onChange } }) => (- <div className="flex items-center gap-3">- <Checkbox- id="isCA"- isChecked={constraints.templateRequiresCA || value || false}- isDisabled={constraints.templateRequiresCA}- onCheckedChange={(checked) => {- if (!constraints.templateRequiresCA) {- onChange(checked);- if (!checked) {- setValue("basicConstraints.pathLength", null);- }- }- }}- />- <div className="space-y-1">- <FormLabel- id="isCA"- className="cursor-pointer text-sm font-medium text-mineshaft-100"- label="Issue as Certificate Authority"- />- <p className="text-xs text-bunker-300">- This certificate will be issued with the CA:TRUE extension- </p>- </div>- </div>- )}- />- {watchedIsCA && (+ {!isAdcsProfile && (+ <div className="mt-4 space-y-6">+ <KeyUsageSection+ control={control}+ title="Key Usages"+ namePrefix="keyUsages"+ options={filteredKeyUsages}+ requiredUsages={constraints.requiredKeyUsages}+ />+ <KeyUsageSection+ control={control}+ title="Extended Key Usages"+ namePrefix="extendedKeyUsages"+ options={filteredExtendedKeyUsages}+ requiredUsages={constraints.requiredExtendedKeyUsages}+ />+ {constraints.templateAllowsCA && (+ <div>+ <p className="text-sm font-medium text-foreground">+ Basic Constraints+ </p>+ <div className="mt-4 space-y-4"><Controllercontrol={control}- name="basicConstraints.pathLength"- render={({ field, fieldState: { error } }) => {- const isPathLengthRequired =- typeof constraints.maxPathLength === "number" &&- constraints.maxPathLength !== -1;- return (- <FormControl- label={- <div>- <FormLabel- isRequired={isPathLengthRequired}- label="Path Length"- icon={- <Tooltip- content={- <div className="max-w-xs">- <p className="font-medium">Values:</p>- <ul className="mt-1 list-disc pl-4 text-xs">- <li>- <strong>Empty</strong> = Unlimited depth- </li>- <li>- <strong>0</strong> = Can only sign- end-entity certs- </li>- <li>- <strong>1+</strong> = CA levels allowed- beneath- </li>- </ul>- </div>- }- >- <FontAwesomeIcon- icon={faQuestionCircle}- size="sm"- />- </Tooltip>- }- />- </div>+ name="basicConstraints.isCA"+ render={({ field: { value, onChange } }) => (+ <div className="flex items-start gap-3">+ <Checkbox+ id="isCA"+ variant="project"+ isChecked={+ constraints.templateRequiresCA || value || false}- isError={Boolean(error)}- errorText={error?.message}- helperText="Sets the pathLen for this CA certificate. Controls how many levels of sub-CAs can exist below."- >- <Input- {...field}- type="number"- min={0}- placeholder={- isPathLengthRequired- ? "Enter path length (required)"- : "Leave empty for no constraint"- }- className="w-full"- value={field.value ?? ""}- onChange={(e) => {- const val = e.target.value;- if (val === "") {- field.onChange(null);- } else {- const numVal = parseInt(val, 10);- field.onChange(- Number.isNaN(numVal) ? null : numVal- );+ isDisabled={constraints.templateRequiresCA}+ onCheckedChange={(checked) => {+ if (!constraints.templateRequiresCA) {+ onChange(checked);+ if (!checked) {+ setValue("basicConstraints.pathLength", null);}- }}- />- </FormControl>- );- }}+ }+ }}+ />+ <span className="text-sm text-foreground">+ Issue as Certificate Authority+ <span className="mt-1 block text-xs text-muted">+ This certificate will be issued with the CA:TRUE+ extension.+ </span>+ </span>+ </div>+ )}/>- )}++ {watchedIsCA && (+ <Controller+ control={control}+ name="basicConstraints.pathLength"+ render={({ field, fieldState: { error } }) => {+ const isPathLengthRequired =+ typeof constraints.maxPathLength === "number" &&+ constraints.maxPathLength !== -1;+ return (+ <Field>+ <FieldLabel>+ Path Length{" "}+ {isPathLengthRequired && (+ <span className="text-danger">*</span>+ )}+ </FieldLabel>+ <Input+ {...field}+ type="number"+ min={0}+ isError={Boolean(error)}+ placeholder={+ isPathLengthRequired+ ? "Enter path length (required)"+ : "Leave empty for no constraint"+ }+ value={field.value ?? ""}+ onChange={(e) => {+ const val = e.target.value;+ if (val === "") {+ field.onChange(null);+ } else {+ const numVal = parseInt(val, 10);+ field.onChange(+ Number.isNaN(numVal) ? null : numVal+ );+ }+ }}+ />+ <FieldDescription>+ Sets the pathLen for this CA certificate. Controls how+ many levels of sub-CAs can exist below. Empty means+ unlimited; 0 means it can only sign end-entity+ certificates.+ </FieldDescription>+ <FieldError errors={[error]} />+ </Field>+ );+ }}+ />+ )}+ </div></div>- </AccordionContent>- </AccordionItem>+ )}+ </div>)}- </Accordion>+ </>)}- </>- )}- <div className="mt-4">- <MetadataForm control={control} />+ {currentStepKey === "metadata" && (+ <div>+ <p className="text-sm font-medium text-foreground">Metadata</p>+ {metadataFields.length === 0 ? (+ <Empty className="mt-3 border py-8">+ <EmptyMedia variant="icon">+ <Tags />+ </EmptyMedia>+ <EmptyTitle>No metadata added</EmptyTitle>+ <EmptyContent>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => appendMetadata({ key: "", value: "" })}+ >+ <Plus className="size-4" /> Add entry+ </Button>+ </EmptyContent>+ </Empty>+ ) : (+ <div className="mt-3 space-y-2">+ {metadataFields.map((metaField, index) => (+ <div key={metaField.id} className="flex items-start gap-2">+ <Controller+ control={control}+ name={`metadata.${index}.key`}+ render={({ field, fieldState: { error } }) => (+ <Input+ {...field}+ placeholder="Key"+ className="flex-1"+ isError={Boolean(error)}+ />+ )}+ />+ <Controller+ control={control}+ name={`metadata.${index}.value`}+ render={({ field }) => (+ <Input+ {...field}+ value={field.value ?? ""}+ placeholder="Value (optional)"+ className="flex-1"+ />+ )}+ />+ <Button+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove metadata entry"+ onClick={() => removeMetadata(index)}+ >+ <Trash2 className="size-4" />+ </Button>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => appendMetadata({ key: "", value: "" })}+ >+ <Plus className="size-4" /> Add entry+ </Button>+ </div>+ )}+ </div>+ )}+ </div>+ )}+ </div>++ <aside className="hidden w-80 shrink-0 flex-col gap-4 overflow-y-auto border-l border-border px-6 py-6 lg:flex">+ <div className="mb-auto">+ <div className="flex items-center justify-between gap-2">+ <p className="text-[11px] font-medium tracking-wider text-muted uppercase">+ Step {step + 1} · {currentStepMeta.rightLabel}+ </p>+ <DocumentationLinkBadge href={PkiDocsUrls.applications.certificates} />+ </div>+ <p className="mt-4 text-sm font-semibold text-foreground">What this step does</p>+ <p className="mt-2 text-sm leading-relaxed text-muted">+ {currentStepMeta.rightDescription}+ </p></div>- </>- )}-- <div className="mt-7 flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting || (!actualSelectedProfile && !profileId)}- >- {cert ? "Update" : "Request Certificate"}- </Button>- <Button- colorSchema="secondary"- variant="plain"- onClick={() => {- handlePopUpToggle("issueCertificate", false);- resetAllState();- }}- >- Cancel- </Button>+ </aside>+ </div>++ <div className="flex shrink-0 items-center justify-between gap-3 border-t border-border px-6 py-4">+ <span className="text-xs text-muted" />+ <div className="flex items-center gap-3">+ <span className="text-xs text-muted">+ Step {step + 1} of {stepKeys.length}+ </span>+ {step > 0 && (+ <Button type="button" variant="outline" onClick={goBack}>+ Back+ </Button>+ )}+ {isLastStep ? (+ <Button+ type="button"+ variant="project"+ isPending={isSubmitting}+ isDisabled={isSubmitting || (!actualSelectedProfile && !profileId)}+ onClick={handleSubmit(onFormSubmit, onFormInvalid)}+ >+ Request Certificate+ </Button>+ ) : (+ <Button+ type="button"+ variant="project"+ isDisabled={!selectedProfileReady}+ onClick={goNext}+ >+ Continue+ </Button>+ )}+ </div></div></form>)}- </ModalContent>- </Modal>+ </SheetContent>+ </Sheet>);};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsxindex e177da92bd..c35fbf555d 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsx@@ -1,12 +1,6 @@import { Control, Controller } from "react-hook-form";-import {- AccordionContent,- AccordionItem,- AccordionTrigger,- Checkbox,- FormLabel-} from "@app/components/v2";+import { Checkbox, Field, FieldLabel } from "@app/components/v3";type KeyUsageOption = {label: string;@@ -16,7 +10,6 @@ type KeyUsageOption = {type KeyUsageSectionProps = {control: Control<any>;title: string;- accordionValue: string;namePrefix: string;options: KeyUsageOption[];requiredUsages: string[];@@ -26,7 +19,6 @@ type KeyUsageSectionProps = {export const KeyUsageSection = ({control,title,- accordionValue,namePrefix,options,requiredUsages,@@ -35,47 +27,41 @@ export const KeyUsageSection = ({if (options.length === 0) return null;return (- <AccordionItem value={accordionValue}>- <AccordionTrigger>{title}</AccordionTrigger>- <AccordionContent forceMount className="data-[state=closed]:hidden">- <div className="grid grid-cols-2 gap-2 pl-2">- {options.map(({ label, value }) => {- const isRequired = requiredUsages.includes(value);- return (- <Controller- key={label}- control={control}- name={`${namePrefix}.${value}` as any}- shouldUnregister={shouldUnregister}- render={({ field }) => (- <div className="flex items-center space-x-3">- <Checkbox- id={`${namePrefix}-${value}`}- isChecked={field.value || false}- onCheckedChange={(checked) => {- if (!isRequired) {- field.onChange(checked);- }- }}- isDisabled={isRequired}- />- <div className="flex items-center gap-2">- <FormLabel- id={`${namePrefix}-${value}`}- className={`text-sm ${- isRequired ? "text-mineshaft-200" : "cursor-pointer text-mineshaft-300"- }`}- label={label}- />- {isRequired && <span className="text-xs">(Required)</span>}- </div>- </div>- )}- />- );- })}- </div>- </AccordionContent>- </AccordionItem>+ <Field className="mb-4">+ <FieldLabel>{title}</FieldLabel>+ <div className="grid grid-cols-2 gap-3">+ {options.map(({ label, value }) => {+ const isRequired = requiredUsages.includes(value);+ return (+ <Controller+ key={value}+ control={control}+ name={`${namePrefix}.${value}` as any}+ shouldUnregister={shouldUnregister}+ render={({ field }) => (+ <div className="flex items-center gap-3">+ <Checkbox+ id={`${namePrefix}-${value}`}+ variant="project"+ isChecked={isRequired || Boolean(field.value)}+ isDisabled={isRequired}+ onCheckedChange={(checked) => {+ if (!isRequired) field.onChange(checked);+ }}+ />+ <label+ htmlFor={`${namePrefix}-${value}`}+ className="flex cursor-pointer items-center gap-2 text-sm text-foreground"+ >+ {label}+ {isRequired && <span className="text-xs text-muted">(Required)</span>}+ </label>+ </div>+ )}+ />+ );+ })}+ </div>+ </Field>);};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsxindex a3a88677ff..6b4ee35d78 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx@@ -1,8 +1,18 @@import { Control, Controller } from "react-hook-form";-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { Plus, Trash2 } from "lucide-react";-import { Button, FormControl, IconButton, Input, Select, SelectItem } from "@app/components/v2";+import {+ Button,+ Field,+ FieldError,+ FieldLabel,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "@app/components/v3";import { CertSubjectAlternativeNameType } from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";import { getSanPlaceholder, getSanTypeLabels, SubjectAltName } from "./certificateUtils";@@ -30,17 +40,14 @@ export const SubjectAltNamesField = ({name={namePrefix}shouldUnregister={shouldUnregister}render={({ field: { onChange, value } }) => {- const currentValues = value || [];+ const currentValues: SubjectAltName[] = value || [];return (- <FormControl- label="Subject Alternative Names (SANs)"- errorText={error}- isError={Boolean(error)}- >+ <Field className="mb-4">+ <FieldLabel>Subject Alternative Names (SANs)</FieldLabel><div className="space-y-2">- {currentValues.map((san: SubjectAltName, index: number) => (+ {currentValues.map((san, index) => (// eslint-disable-next-line react/no-array-index-key- <div key={`subject-alt-name-${index}`} className="flex items-center gap-2">+ <div key={`subject-alt-name-${index}`} className="flex items-start gap-2"><Selectvalue={san.type}onValueChange={(newType) => {@@ -51,13 +58,17 @@ export const SubjectAltNamesField = ({};onChange(newValue);}}- className="w-24">- {allowedSanTypes.map((sanType) => (- <SelectItem key={sanType} value={sanType}>- {sanTypeLabels[sanType]}- </SelectItem>- ))}+ <SelectTrigger className="w-32">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ {allowedSanTypes.map((sanType) => (+ <SelectItem key={sanType} value={sanType}>+ {sanTypeLabels[sanType]}+ </SelectItem>+ ))}+ </SelectContent></Select><Inputvalue={san.value}@@ -69,24 +80,20 @@ export const SubjectAltNamesField = ({placeholder={getSanPlaceholder(san.type)}className="flex-1"/>- <IconButton- ariaLabel="Remove SAN"- variant="plain"+ <Button+ type="button"+ variant="ghost"size="sm"- onClick={() => {- const newValue = currentValues.filter((_: any, i: number) => i !== index);- onChange(newValue);- }}+ onClick={() => onChange(currentValues.filter((_, i) => i !== index))}>- <FontAwesomeIcon icon={faTrash} />- </IconButton>+ <Trash2 className="size-4" />+ </Button></div>))}<Buttontype="button"- variant="outline_bg"- size="xs"- leftIcon={<FontAwesomeIcon icon={faPlus} />}+ variant="outline"+ size="sm"onClick={() => {const defaultType =allowedSanTypes.length > 0@@ -94,12 +101,12 @@ export const SubjectAltNamesField = ({: CertSubjectAlternativeNameType.DNS_NAME;onChange([...currentValues, { type: defaultType, value: "" }]);}}- className="w-full">- Add SAN+ <Plus className="size-4" /> Add SAN</Button></div>- </FormControl>+ <FieldError>{error}</FieldError>+ </Field>);}}/>diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsxindex d54df7bbf1..c1b833cb77 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsx@@ -1,8 +1,18 @@import { Control, Controller } from "react-hook-form";-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { Plus, Trash2 } from "lucide-react";-import { Button, FormControl, IconButton, Input, Select, SelectItem } from "@app/components/v2";+import {+ Button,+ Field,+ FieldError,+ FieldLabel,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "@app/components/v3";import { CertSubjectAttributeType } from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";export type SubjectAttribute = {@@ -63,8 +73,8 @@ export const SubjectAttributesField = ({name={namePrefix}shouldUnregister={shouldUnregister}render={({ field: { onChange, value } }) => {- const currentValues = value || [];- const usedTypes = currentValues.map((attr: SubjectAttribute) => attr.type);+ const currentValues: SubjectAttribute[] = value || [];+ const usedTypes = currentValues.map((attr) => attr.type);// Domain components are multi-valued, so they may appear in more than one row.const isMultiValued = (type: CertSubjectAttributeType) =>type === CertSubjectAttributeType.DOMAIN_COMPONENT;@@ -74,9 +84,10 @@ export const SubjectAttributesField = ({const canAddMore = availableTypes.length > 0;return (- <FormControl label="Subject Attributes" errorText={error} isError={Boolean(error)}>+ <Field className="mb-4">+ <FieldLabel>Subject Attributes</FieldLabel><div className="space-y-2">- {currentValues.map((attr: SubjectAttribute, index: number) => {+ {currentValues.map((attr, index) => {const selectableTypes = allowedAttributeTypes.filter((type) => type === attr.type || isMultiValued(type) || !usedTypes.includes(type));@@ -85,25 +96,26 @@ export const SubjectAttributesField = ({<div// eslint-disable-next-line react/no-array-index-keykey={`subject-attr-${attr.type}-${index}`}- className="flex items-center gap-2"+ className="flex items-start gap-2"><Selectvalue={attr.type}onValueChange={(newType) => {const newValue = [...currentValues];- newValue[index] = {- ...attr,- type: newType as CertSubjectAttributeType- };+ newValue[index] = { ...attr, type: newType as CertSubjectAttributeType };onChange(newValue);}}- className="w-44">- {selectableTypes.map((attrType) => (- <SelectItem key={attrType} value={attrType}>- {SUBJECT_ATTRIBUTE_LABELS[attrType]}- </SelectItem>- ))}+ <SelectTrigger className="w-52">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ {selectableTypes.map((attrType) => (+ <SelectItem key={attrType} value={attrType}>+ {SUBJECT_ATTRIBUTE_LABELS[attrType]}+ </SelectItem>+ ))}+ </SelectContent></Select><Inputvalue={attr.value}@@ -115,39 +127,32 @@ export const SubjectAttributesField = ({placeholder={getSubjectAttributePlaceholder(attr.type)}className="flex-1"/>- <IconButton- ariaLabel="Remove attribute"- variant="plain"+ <Button+ type="button"+ variant="ghost"size="sm"- onClick={() => {- const newValue = currentValues.filter(- (_: SubjectAttribute, i: number) => i !== index- );- onChange(newValue);- }}+ onClick={() => onChange(currentValues.filter((_, i) => i !== index))}>- <FontAwesomeIcon icon={faTrash} />- </IconButton>+ <Trash2 className="size-4" />+ </Button></div>);})}{canAddMore && (<Buttontype="button"- variant="outline_bg"- size="xs"- leftIcon={<FontAwesomeIcon icon={faPlus} />}- onClick={() => {- const nextType = availableTypes[0];- onChange([...currentValues, { type: nextType, value: "" }]);- }}- className="w-full"+ variant="outline"+ size="sm"+ onClick={() =>+ onChange([...currentValues, { type: availableTypes[0], value: "" }])+ }>- Add Subject Attribute+ <Plus className="size-4" /> Add Subject Attribute</Button>)}</div>- </FormControl>+ <FieldError>{error}</FieldError>+ </Field>);}}/>diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/buildManagedRequest.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/buildManagedRequest.tsnew file mode 100644index 0000000000..a5717a158c--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/buildManagedRequest.ts@@ -0,0 +1,133 @@+import { TCertificateProfileDefaults } from "@app/hooks/api/certificateProfiles/types";+import { CertExtendedKeyUsage, CertKeyUsage } from "@app/hooks/api/certificates/enums";+import { TUnifiedCertificateIssuanceDTO } from "@app/hooks/api/certificates/types";+import { CertSubjectAttributeType } from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";++import type { FormData } from "./CertificateIssuanceModal";+import { filterUsages, formatSubjectAltNames } from "./certificateUtils";+import type { TemplateConstraints } from "./useCertificatePolicy";++type ManagedFormData = Extract<FormData, { requestMethod: "managed" }>;++type ManagedIssuanceRequest = Omit<TUnifiedCertificateIssuanceDTO, "attributes"> & {+ attributes: NonNullable<TUnifiedCertificateIssuanceDTO["attributes"]> & {+ basicConstraints?: { isCA: boolean; pathLength?: number };+ };+};++type SubjectAttrKey =+ | "commonName"+ | "organization"+ | "organizationalUnit"+ | "country"+ | "state"+ | "locality";++const SUBJECT_ATTR_MAP: { attrType: CertSubjectAttributeType; requestKey: SubjectAttrKey }[] = [+ { attrType: CertSubjectAttributeType.COMMON_NAME, requestKey: "commonName" },+ { attrType: CertSubjectAttributeType.ORGANIZATION, requestKey: "organization" },+ { attrType: CertSubjectAttributeType.ORGANIZATIONAL_UNIT, requestKey: "organizationalUnit" },+ { attrType: CertSubjectAttributeType.COUNTRY, requestKey: "country" },+ { attrType: CertSubjectAttributeType.STATE, requestKey: "state" },+ { attrType: CertSubjectAttributeType.LOCALITY, requestKey: "locality" }+];++type BuildManagedRequestParams = {+ formData: ManagedFormData;+ applicationId?: string;+ isAdcsProfile: boolean;+ constraints: TemplateConstraints;+ defaults?: TCertificateProfileDefaults | null;+};++export const buildManagedRequest = ({+ formData,+ applicationId,+ isAdcsProfile,+ constraints,+ defaults+}: BuildManagedRequestParams): ManagedIssuanceRequest => {+ const {+ profileId,+ ttl,+ subjectAttributes,+ subjectAltNames,+ basicConstraints,+ signatureAlgorithm,+ keyAlgorithm,+ keyUsages,+ extendedKeyUsages,+ metadata+ } = formData;++ const managedMetadataEntries = metadata?.filter((m) => m.key);++ const request: ManagedIssuanceRequest = {+ profileId,+ ...(applicationId && { applicationId }),+ attributes: {+ keyAlgorithm: keyAlgorithm || "",+ ...(!isAdcsProfile && {+ ttl,+ signatureAlgorithm: signatureAlgorithm || "",+ keyUsages: filterUsages(keyUsages) as CertKeyUsage[],+ extendedKeyUsages: filterUsages(extendedKeyUsages) as CertExtendedKeyUsage[]+ })+ },+ ...(managedMetadataEntries?.length && { metadata: managedMetadataEntries })+ };++ if (constraints.shouldShowSubjectSection) {+ if (subjectAttributes && subjectAttributes.length > 0) {+ SUBJECT_ATTR_MAP.forEach(({ attrType, requestKey }) => {+ const attr = subjectAttributes.find((a) => a.type === attrType);+ if (attr?.value) {+ request.attributes[requestKey] = attr.value;+ } else if (defaults?.[requestKey]) {+ request.attributes[requestKey] = null;+ }+ });++ // Domain components are multi-valued: collect every DC row (order preserved).+ const domainComponents = subjectAttributes+ .filter((attr) => attr.type === CertSubjectAttributeType.DOMAIN_COMPONENT)+ .map((attr) => attr.value.trim())+ .filter((val) => val.length > 0);+ if (domainComponents.length > 0) {+ request.attributes.domainComponents = domainComponents;+ }+ } else if (defaults) {+ // No subject attributes provided; send null overrides for profile defaults+ SUBJECT_ATTR_MAP.forEach(({ requestKey }) => {+ if (defaults[requestKey]) request.attributes[requestKey] = null;+ });+ }+ }++ if (constraints.shouldShowSanSection) {+ if (subjectAltNames && subjectAltNames.length > 0) {+ const formattedSans = formatSubjectAltNames(subjectAltNames);+ if (formattedSans && formattedSans.length > 0) {+ request.attributes.altNames = formattedSans;+ }+ } else {+ request.attributes.altNames = [];+ }+ }++ if (!isAdcsProfile) {+ if (+ (constraints.templateAllowsCA && basicConstraints?.isCA) ||+ constraints.templateRequiresCA+ ) {+ request.attributes.basicConstraints = {+ isCA: true,+ pathLength: basicConstraints?.pathLength ?? undefined+ };+ } else if (constraints.templateAllowsCA) {+ request.attributes.basicConstraints = { isCA: false };+ }+ }++ return request;+};diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsxindex 3f798666ab..9919699ebe 100644--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx@@ -102,11 +102,8 @@ export const PkiSyncRow = ({type: "info"});- const timer = setTimeout(() => setIsIdCopied.off(), 2000);-- // eslint-disable-next-line consistent-return- return () => clearTimeout(timer);- }, [isIdCopied]);+ setTimeout(() => setIsIdCopied.off(), 2000);+ }, [id, setIsIdCopied]);const failureMessage = useMemo(() => {if (syncStatus === PkiSyncStatus.Failed) {@@ -152,7 +149,7 @@ export const PkiSyncRow = ({<imgalt={`${destinationDetails.name} sync`}src={`/images/integrations/${destinationDetails.image}`}- className="min-w-7"+ className="w-5 min-w-5"/></TableCell><TableCell className="max-w-0 min-w-32!">@@ -225,7 +222,7 @@ export const PkiSyncRow = ({) : (<TooltipclassName="text-xs"- content="This sync has not run yet — no certificates have been pushed to the destination."+ content="This sync has not run yet. No certificates have been pushed to the destination."><Badge variant="neutral">Not Synced</Badge></Tooltip>diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsxindex 1a4f5bab50..f59e4069b0 100644--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx@@ -1,7 +1,5 @@import { useMemo, useState } from "react";import {- faArrowDown,- faArrowUp,faCheck,faCheckCircle,faFilter,@@ -9,7 +7,7 @@ import {faWarning} from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { SearchIcon } from "lucide-react";+import { ChevronDownIcon, SearchIcon } from "lucide-react";import { twMerge } from "tailwind-merge";import { createNotification } from "@app/components/notifications";@@ -202,11 +200,15 @@ export const PkiSyncsTable = ({ pkiSyncs, applicationName }: Props) => {setOrderDirection(OrderByDirection.ASC);};- const getClassName = (col: PkiSyncsOrderBy) =>- twMerge("ml-2", orderBy === col ? "" : "opacity-30");-- const getColSortIcon = (col: PkiSyncsOrderBy) =>- orderDirection === OrderByDirection.DESC && orderBy === col ? faArrowUp : faArrowDown;+ const renderSortIcon = (col: PkiSyncsOrderBy) => (+ <ChevronDownIcon+ className={twMerge(+ orderDirection === OrderByDirection.DESC && orderBy === col && "rotate-180",+ orderBy !== col && "opacity-30",+ "transition-transform"+ )}+ />+ );const isTableFiltered = Boolean(filters.destinations.length || filters.status.length);@@ -352,47 +354,26 @@ export const PkiSyncsTable = ({ pkiSyncs, applicationName }: Props) => {<TableHeader><TableRow><TableHead className="w-2" />- <TableHead className="w-1/2">- <div className="flex items-center">- Name- <IconButton- variant="ghost"- size="xs"- className={getClassName(PkiSyncsOrderBy.Name)}- aria-label="sort"- onClick={() => handleSort(PkiSyncsOrderBy.Name)}- >- <FontAwesomeIcon icon={getColSortIcon(PkiSyncsOrderBy.Name)} />- </IconButton>- </div>+ <TableHead+ className="w-1/2 cursor-pointer"+ onClick={() => handleSort(PkiSyncsOrderBy.Name)}+ >+ Name+ {renderSortIcon(PkiSyncsOrderBy.Name)}</TableHead>- <TableHead className="w-1/4">- <div className="flex items-center">- Destination- <IconButton- variant="ghost"- size="xs"- className={getClassName(PkiSyncsOrderBy.Destination)}- aria-label="sort"- onClick={() => handleSort(PkiSyncsOrderBy.Destination)}- >- <FontAwesomeIcon icon={getColSortIcon(PkiSyncsOrderBy.Destination)} />- </IconButton>- </div>+ <TableHead+ className="w-1/4 cursor-pointer"+ onClick={() => handleSort(PkiSyncsOrderBy.Destination)}+ >+ Destination+ {renderSortIcon(PkiSyncsOrderBy.Destination)}</TableHead>- <TableHead className="w-1/4 min-w-42">- <div className="flex items-center">- Status- <IconButton- variant="ghost"- size="xs"- className={getClassName(PkiSyncsOrderBy.Status)}- aria-label="sort"- onClick={() => handleSort(PkiSyncsOrderBy.Status)}- >- <FontAwesomeIcon icon={getColSortIcon(PkiSyncsOrderBy.Status)} />- </IconButton>- </div>+ <TableHead+ className="w-1/4 min-w-42 cursor-pointer"+ onClick={() => handleSort(PkiSyncsOrderBy.Status)}+ >+ Status+ {renderSortIcon(PkiSyncsOrderBy.Status)}</TableHead><TableHead className="w-5" /></TableRow>diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsxindex d816ccd75f..a3c848e964 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/PkiSyncDetailsByIDPage.tsx@@ -1,11 +1,25 @@import { Helmet } from "react-helmet";-import { faBan, faChevronLeft } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useNavigate, useParams, useSearch } from "@tanstack/react-router";+import { BanIcon, ChevronLeftIcon } from "lucide-react";-import { EditPkiSyncModal } from "@app/components/pki-syncs";-import { PkiSyncEditFields } from "@app/components/pki-syncs/types";-import { Button, ContentLoader, EmptyState } from "@app/components/v2";+import {+ EditPkiSyncModal,+ PkiSyncImportStatusBadge,+ PkiSyncRemoveStatusBadge+} from "@app/components/pki-syncs";+import {+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ DetailGroup,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader+} from "@app/components/v3";import { ROUTE_PATHS } from "@app/const/routes";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";import { usePopUp } from "@app/hooks";@@ -41,86 +55,93 @@ const PageContent = () => {);if (isPending) {- return (- <div className="flex h-full w-full items-center justify-center">- <ContentLoader />- </div>- );+ return <PageLoader />;}if (!pkiSync) {return (<div className="flex h-full w-full items-center justify-center px-20">- <EmptyState- className="max-w-2xl rounded-md text-center"- icon={faBan}- title={`Could not find PKI Sync with ID ${syncId}`}- />+ <Empty className="max-w-2xl">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find PKI Sync with ID {syncId}</EmptyTitle>+ </EmptyHeader>+ </Empty></div>);}const destinationDetails = PKI_SYNC_MAP[pkiSync.destination];- const handleEditDetails = () => handlePopUpOpen("editSync", PkiSyncEditFields.Details);- const handleEditOptions = () => handlePopUpOpen("editSync", PkiSyncEditFields.Options);- const handleEditMappings = () => handlePopUpOpen("editSync", PkiSyncEditFields.Mappings);- const handleEditDestination = () => handlePopUpOpen("editSync", PkiSyncEditFields.Destination);+ const handleBack = () => {+ if (applicationName) {+ navigate({+ to: "/organizations/$orgId/projects/cert-manager/$projectId/applications/$applicationName",+ params: { orgId, projectId, applicationName },+ search: { selectedTab: "syncs" }+ });+ return;+ }+ navigate({+ to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,+ params: { projectId, orgId },+ search: { selectedTab: IntegrationsListPageTabs.PkiSyncs }+ });+ };++ const handleEdit = () => handlePopUpOpen("editSync");return (<>- <div className="mx-auto flex flex-col justify-between bg-bunker-800 font-inter text-white">+ <div className="container mx-auto flex flex-col justify-between bg-bunker-800 font-inter text-white"><div className="mx-auto mb-6 w-full max-w-8xl">- <Button- variant="link"- type="submit"- leftIcon={<FontAwesomeIcon icon={faChevronLeft} />}- onClick={() => {- if (applicationName) {- navigate({- to: "/organizations/$orgId/projects/cert-manager/$projectId/applications/$applicationName",- params: { orgId, projectId, applicationName },- search: { selectedTab: "syncs" }- });- return;- }- navigate({- to: ROUTE_PATHS.CertManager.IntegrationsListPage.path,- params: {- projectId,- orgId- },- search: {- selectedTab: IntegrationsListPageTabs.PkiSyncs- }- });- }}+ <button+ type="button"+ onClick={handleBack}+ className="mb-4 flex w-fit cursor-pointer items-center gap-x-1 text-sm text-mineshaft-400 transition duration-100 hover:text-mineshaft-400/80">+ <ChevronLeftIcon className="size-4" />{applicationName ? "Back to Application" : "PKI Syncs"}- </Button>+ </button><div className="mb-6 flex w-full items-center gap-3"><imgalt={`${destinationDetails.name} sync`}src={`/images/integrations/${destinationDetails.image}`}- className="mt-3 ml-1 w-16"+ className="mt-1.5 ml-1 w-12"/><div className="min-w-0">- <p className="truncate text-3xl font-medium text-white">{pkiSync.name}</p>- <p className="leading-3 text-bunker-300">{destinationDetails.name} PKI Sync</p>+ <p className="truncate text-2xl font-medium text-white">{pkiSync.name}</p>+ <p className="mt-1 leading-3 text-accent">+ {pkiSync.description || `${destinationDetails.name} PKI Sync`}+ </p>+ </div>+ <div className="ml-auto flex shrink-0 flex-wrap items-center justify-end gap-2">+ <PkiSyncImportStatusBadge pkiSync={pkiSync} />+ <PkiSyncRemoveStatusBadge pkiSync={pkiSync} /></div>- <PkiSyncActionTriggers pkiSync={pkiSync} /></div><div className="flex justify-center">- <div className="mr-4 flex w-72 flex-col gap-4">- <PkiSyncDetailsSection pkiSync={pkiSync} onEditDetails={handleEditDetails} />- <PkiSyncOptionsSection pkiSync={pkiSync} onEditOptions={handleEditOptions} />- <PkiSyncFieldMappingsSection pkiSync={pkiSync} onEditMappings={handleEditMappings} />+ <div className="mr-4 w-80">+ <Card>+ <CardHeader className="grid-cols-[1fr_auto] border-b">+ <CardTitle>Details</CardTitle>+ <CardAction className="col-start-2 row-start-1 self-start justify-self-end">+ <PkiSyncActionTriggers pkiSync={pkiSync} onEdit={handleEdit} />+ </CardAction>+ </CardHeader>+ <CardContent>+ <DetailGroup>+ <PkiSyncDetailsSection pkiSync={pkiSync} />+ <PkiSyncDestinationSection pkiSync={pkiSync} />+ <PkiSyncFieldMappingsSection pkiSync={pkiSync} />+ </DetailGroup>+ <PkiSyncOptionsSection pkiSync={pkiSync} />+ </CardContent>+ </Card></div><div className="flex flex-1 flex-col gap-4">- <PkiSyncDestinationSection- pkiSync={pkiSync}- onEditDestination={handleEditDestination}- /><PkiSyncCertificatesSection pkiSync={pkiSync} /><PkiSyncAuditLogsSection pkiSync={pkiSync} /></div>@@ -130,7 +151,6 @@ const PageContent = () => {<EditPkiSyncModalisOpen={popUp.editSync.isOpen}onOpenChange={(isOpen) => handlePopUpToggle("editSync", isOpen)}- fields={popUp.editSync.data}pkiSync={pkiSync}/></>diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsxindex b36f43f406..a71f03ef5a 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncActionTriggers.tsx@@ -1,38 +1,36 @@import { useCallback } from "react";-import {- faCheck,- faCopy,- faDownload,- faEllipsisV,- faEraser,- faInfoCircle,- faRotate,- faToggleOff,- faToggleOn,- faTrash-} from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useNavigate } from "@tanstack/react-router";-import { BanIcon, RefreshCwIcon } from "lucide-react";+import {+ CheckIcon,+ CopyIcon,+ DownloadIcon,+ EllipsisIcon,+ EraserIcon,+ InfoIcon,+ PencilIcon,+ RefreshCwIcon,+ ToggleLeftIcon,+ ToggleRightIcon,+ Trash2Icon+} from "lucide-react";import { createNotification } from "@app/components/notifications";import {DeletePkiSyncModal,PkiSyncImportCertificatesModal,- PkiSyncImportStatusBadge,- PkiSyncRemoveCertificatesModal,- PkiSyncRemoveStatusBadge+ PkiSyncRemoveCertificatesModal} from "@app/components/pki-syncs";import {- Button,DropdownMenu,DropdownMenuContent,DropdownMenuItem,+ DropdownMenuSeparator,DropdownMenuTrigger,IconButton,- Tooltip-} from "@app/components/v2";-import { Badge } from "@app/components/v3";+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { ROUTE_PATHS } from "@app/const/routes";import { useOrganization } from "@app/context";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";@@ -48,9 +46,10 @@ import { IntegrationsListPageTabs } from "@app/types/integrations";type Props = {pkiSync: TPkiSync;+ onEdit: () => void;};-export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {+export const PkiSyncActionTriggers = ({ pkiSync, onEdit }: Props) => {const { destination, projectId, id } = pkiSync;const navigate = useNavigate();@@ -69,7 +68,6 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {const [isIdCopied, setIsIdCopied] = useToggle(false);- // API mutationsconst triggerSyncMutation = useTriggerPkiSyncSyncCertificates();const updatePkiSyncMutation = useUpdatePkiSync();@@ -114,120 +112,89 @@ export const PkiSyncActionTriggers = ({ pkiSync }: Props) => {text: `Auto-sync ${pkiSync.isAutoSyncEnabled ? "disabled" : "enabled"} successfully`,type: "success"});- }, [updatePkiSyncMutation, id, projectId, pkiSync.isAutoSyncEnabled]);+ }, [updatePkiSyncMutation, id, projectId, destination, pkiSync.isAutoSyncEnabled]);return (<>- <div className="mt-4 ml-auto flex shrink-0 flex-wrap items-center justify-end gap-2">- {syncOption?.canImportCertificates && <PkiSyncImportStatusBadge pkiSync={pkiSync} />}- <PkiSyncRemoveStatusBadge pkiSync={pkiSync} />- {pkiSync.isAutoSyncEnabled ? (- <Badge variant="info">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton variant="ghost" size="xs" aria-label="Sync options">+ <EllipsisIcon />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={onEdit} isDisabled={!canEditSync}>+ <PencilIcon />+ Edit Sync+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem onClick={handleTriggerSync} isDisabled={!canTriggerSync}><RefreshCwIcon />- Auto-Sync Enabled- </Badge>- ) : (- <Tooltip- className="text-xs"- content="Auto-Sync is disabled. Certificate changes in this application will not be automatically synced to the destination."+ Trigger Sync+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={(e) => {+ e.stopPropagation();+ handleCopyId();+ }}>- <Badge variant="neutral">- <BanIcon />- Auto-Sync Disabled- </Badge>- </Tooltip>- )}- <div>- <Button- variant="outline_bg"- leftIcon={<FontAwesomeIcon icon={faRotate} />}- className="h-9 rounded-r-none bg-mineshaft-500"- isDisabled={!canTriggerSync || triggerSyncMutation.isPending}- isLoading={triggerSyncMutation.isPending}- onClick={handleTriggerSync}+ {isIdCopied ? <CheckIcon /> : <CopyIcon />}+ Copy Sync ID+ </DropdownMenuItem>+ {syncOption?.canImportCertificates && (+ <DropdownMenuItem+ onClick={() => handlePopUpOpen("importCertificates")}+ isDisabled={!canImportCertificates}+ >+ <DownloadIcon />+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="flex h-full w-full items-center justify-between gap-1">+ <span>Import Certificates</span>+ <InfoIcon className="size-3.5 text-muted" />+ </div>+ </TooltipTrigger>+ <TooltipContent side="right" sideOffset={14}>+ Import certificates from this {destinationName} destination into Infisical.+ </TooltipContent>+ </Tooltip>+ </DropdownMenuItem>+ )}+ <DropdownMenuItem+ onClick={() => handlePopUpOpen("removeCertificates")}+ isDisabled={!canRemoveCertificates}>- Trigger Sync- </Button>- <DropdownMenu>- <DropdownMenuTrigger asChild>- <IconButton- ariaLabel="add-folder-or-import"- variant="outline_bg"- className="h-9 w-10 rounded-l-none border-l-2 border-mineshaft border-l-mineshaft-700 bg-mineshaft-500"- >- <FontAwesomeIcon icon={faEllipsisV} />- </IconButton>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem- icon={<FontAwesomeIcon icon={isIdCopied ? faCheck : faCopy} />}- onClick={(e) => {- e.stopPropagation();- handleCopyId();- }}- >- Copy Sync ID- </DropdownMenuItem>-- {syncOption?.canImportCertificates && (- <DropdownMenuItem- icon={<FontAwesomeIcon icon={faDownload} />}- onClick={() => handlePopUpOpen("importCertificates")}- isDisabled={!canImportCertificates}- >- <Tooltip- position="left"- sideOffset={42}- content={`Import certificates from this ${destinationName} destination into Infisical.`}- >- <div className="flex h-full w-full items-center justify-between gap-1">- <span>Import Certificates</span>- <FontAwesomeIcon className="text-bunker-300" size="sm" icon={faInfoCircle} />- </div>- </Tooltip>- </DropdownMenuItem>- )}-- {syncOption?.canRemoveCertificates && (- <DropdownMenuItem- icon={<FontAwesomeIcon icon={faEraser} />}- onClick={() => handlePopUpOpen("removeCertificates")}- isDisabled={!canRemoveCertificates}- >- <Tooltip- position="left"- sideOffset={42}- content={`Remove certificates synced by Infisical from this ${destinationName} destination.`}- >- <div className="flex h-full w-full items-center justify-between gap-1">- <span>Remove Certificates</span>- <FontAwesomeIcon className="text-bunker-300" size="sm" icon={faInfoCircle} />- </div>- </Tooltip>- </DropdownMenuItem>- )}-- <DropdownMenuItem- isDisabled={!canEditSync || updatePkiSyncMutation.isPending}- icon={- <FontAwesomeIcon icon={pkiSync.isAutoSyncEnabled ? faToggleOff : faToggleOn} />- }- onClick={handleToggleAutoSync}- >- {pkiSync.isAutoSyncEnabled ? "Disable" : "Enable"} Auto-Sync- </DropdownMenuItem>-- <DropdownMenuItem- isDisabled={!canDeleteSync}- icon={<FontAwesomeIcon icon={faTrash} />}- onClick={() => handlePopUpOpen("deleteSync")}- >- Delete Sync- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- </div>- </div>+ <EraserIcon />+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="flex h-full w-full items-center justify-between gap-1">+ <span>Remove Certificates</span>+ <InfoIcon className="ml-0.5 size-3.5 text-muted" />+ </div>+ </TooltipTrigger>+ <TooltipContent side="right" sideOffset={14}>+ Remove certificates synced by Infisical from this {destinationName} destination.+ </TooltipContent>+ </Tooltip>+ </DropdownMenuItem>+ <DropdownMenuItem+ isDisabled={!canEditSync || updatePkiSyncMutation.isPending}+ onClick={handleToggleAutoSync}+ >+ {pkiSync.isAutoSyncEnabled ? <ToggleLeftIcon /> : <ToggleRightIcon />}+ {pkiSync.isAutoSyncEnabled ? "Disable" : "Enable"} Auto-Sync+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ isDisabled={!canDeleteSync}+ onClick={() => handlePopUpOpen("deleteSync")}+ variant="danger"+ >+ <Trash2Icon />+ Delete Sync+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>{syncOption?.canImportCertificates && (<PkiSyncImportCertificatesModaldiff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsxindex e6d1af9504..20cf7966ac 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx@@ -1,7 +1,7 @@-import { faFingerprint } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { Link } from "@tanstack/react-router";+import { FingerprintIcon } from "lucide-react";+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";import { useOrganization, useProject, useSubscription } from "@app/context";import { EventType } from "@app/hooks/api/auditLogs/enums";import { TPkiSync } from "@app/hooks/api/pkiSyncs";@@ -24,60 +24,61 @@ export const PkiSyncAuditLogsSection = ({ pkiSync }: Props) => {const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;return (- <div className="flex max-h-full w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="text-lg font-medium text-mineshaft-100">Sync Logs</h3>+ <Card className="max-h-full">+ <CardHeader className="border-b">+ <CardTitle>Sync Logs</CardTitle>{subscription.auditLogs && (- <p className="text-xs text-bunker-300">+ <CardDescription>Displaying audit logs from the last {Math.min(auditLogsRetentionDays, 60)} days- </p>+ </CardDescription>)}- </div>- {subscription.auditLogs ? (- <LogsSection- refetchInterval={15_000}- showFilters={false}- project={currentProject}- presets={{- eventMetadata: { syncId: pkiSync.id },- startDate: new Date(- new Date().setDate(new Date().getDate() - Math.min(auditLogsRetentionDays, 60))- ),- eventType: PKI_SYNC_EVENTS- }}- />- ) : (- <div className="flex h-full items-center justify-center rounded-lg bg-mineshaft-800 text-sm text-mineshaft-200">- <div className="flex flex-col items-center gap-4 py-20">- <FontAwesomeIcon size="2x" icon={faFingerprint} />- <p>- Please{" "}- {subscription && subscription.slug !== null ? (- <Link- to="/organizations/$orgId/billing"- params={{ orgId: currentOrg.id }}- target="_blank"- rel="noopener noreferrer"- >- <span className="cursor-pointer underline transition-all hover:text-white">+ </CardHeader>+ <CardContent>+ {subscription.auditLogs ? (+ <LogsSection+ refetchInterval={15_000}+ showFilters={false}+ project={currentProject}+ presets={{+ eventMetadata: { syncId: pkiSync.id },+ startDate: new Date(+ new Date().setDate(new Date().getDate() - Math.min(auditLogsRetentionDays, 60))+ ),+ eventType: PKI_SYNC_EVENTS+ }}+ />+ ) : (+ <div className="flex h-full items-center justify-center rounded-lg bg-mineshaft-800 text-sm text-mineshaft-200">+ <div className="flex flex-col items-center gap-4 py-20">+ <FingerprintIcon className="size-8" />+ <p>+ Please{" "}+ {subscription && subscription.slug !== null ? (+ <Link+ to="/organizations/$orgId/billing"+ params={{ orgId: currentOrg.id }}+ target="_blank"+ rel="noopener noreferrer"+ className="cursor-pointer underline transition-all hover:text-white"+ >upgrade your subscription- </span>- </Link>- ) : (- <a- href="https://infisical.com/scheduledemo"- target="_blank"- rel="noopener noreferrer"- className="cursor-pointer underline transition-all hover:text-white"- >- upgrade your subscription- </a>- )}{" "}- to view sync logs.- </p>+ </Link>+ ) : (+ <a+ href="https://infisical.com/scheduledemo"+ target="_blank"+ rel="noopener noreferrer"+ className="cursor-pointer underline transition-all hover:text-white"+ >+ upgrade your subscription+ </a>+ )}{" "}+ to view sync logs.+ </p>+ </div></div>- </div>- )}- </div>+ )}+ </CardContent>+ </Card>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncCertificatesSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncCertificatesSection.tsxindex 841be21076..dda2b75203 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncCertificatesSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncCertificatesSection.tsx@@ -1,12 +1,5 @@import { useState } from "react";-import {- faCertificate,- faClockRotateLeft,- faEdit,- faEllipsisV,- faTrash-} from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { EllipsisIcon, HistoryIcon, PencilIcon, ScrollTextIcon, Trash2Icon } from "lucide-react";import { createNotification } from "@app/components/notifications";import { CertificateManagementModal } from "@app/components/pki-syncs/CertificateManagementModal";@@ -14,25 +7,34 @@ import {CertificateDisplayName,getCertificateDisplayName} from "@app/components/utilities/certificateDisplayUtils";+import { DeleteActionModal } from "@app/components/v2";import {- DeleteActionModal,+ Badge,+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ CopyButton,DropdownMenu,DropdownMenuContent,DropdownMenuItem,DropdownMenuTrigger,- EmptyState,+ Empty,+ EmptyMedia,+ EmptyTitle,IconButton,Pagination,Table,- TableContainer,- TBody,- Td,- Th,- THead,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,Tooltip,- Tr-} from "@app/components/v2";-import { Badge, CopyButton } from "@app/components/v3";+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import {useClearDefaultCertificate,useListPkiSyncCertificates,@@ -54,7 +56,7 @@ const getSyncStatusVariant = (status?: CertificateSyncStatus | null) => {if (status === CertificateSyncStatus.Succeeded) return "success";if (status === CertificateSyncStatus.Failed) return "danger";if (status === CertificateSyncStatus.Running) return "neutral";- return "project";+ return "info";};const getSyncStatusText = (status?: CertificateSyncStatus | null) => {@@ -65,11 +67,8 @@ const getSyncStatusText = (status?: CertificateSyncStatus | null) => {return "Unknown";};-const getCertificateStatusVariant = (isExpired: boolean, isRevoked: boolean) => {- if (isRevoked) return "danger";- if (isExpired) return "danger";- return "success";-};+const getCertificateStatusVariant = (isExpired: boolean, isRevoked: boolean) =>+ isRevoked || isExpired ? "danger" : "success";const getCertificateStatusText = (isExpired: boolean, isRevoked: boolean) => {if (isRevoked) return "Revoked";@@ -77,6 +76,12 @@ const getCertificateStatusText = (isExpired: boolean, isRevoked: boolean) => {return "Active";};+const truncateSerialNumber = (serial?: string | null) => {+ if (!serial || serial === "Unknown") return "Unknown";+ if (serial.length <= 8) return serial;+ return `${serial.substring(0, 4)}...${serial.substring(serial.length - 4)}`;+};+export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {const [isManageModalOpen, setIsManageModalOpen] = useState(false);const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);@@ -97,7 +102,6 @@ export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {const setCertificateAsDefault = useSetCertificateAsDefault();const clearDefaultCertificate = useClearDefaultCertificate();- // Check if this sync type supports per-certificate default settingconst supportsDefaultCertificate = pkiSync.destination === PkiSync.AwsElasticLoadBalancer;const { canEdit } = usePkiSyncPermissions(pkiSync);@@ -174,47 +178,52 @@ export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {}};- const totalPages = Math.ceil(totalCount / pageSize);-return (- <div>- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="text-lg font-medium text-mineshaft-100">Certificates</h3>- <IconButton- variant="plain"- colorSchema="secondary"- isDisabled={!canEdit}- ariaLabel="Edit certificates"- onClick={() => setIsManageModalOpen(true)}- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </div>-- <div>- <div className="space-y-4">- <TableContainer>+ <>+ <Card>+ <CardHeader className="border-b">+ <CardTitle>Certificates</CardTitle>+ <CardAction>+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Manage certificates"+ isDisabled={!canEdit}+ onClick={() => setIsManageModalOpen(true)}+ >+ <PencilIcon />+ </IconButton>+ </CardAction>+ </CardHeader>+ <CardContent>+ {syncCertificates.length === 0 ? (+ <Empty className="border py-8">+ <EmptyMedia variant="icon">+ <ScrollTextIcon />+ </EmptyMedia>+ <EmptyTitle>No certificates are part of this certificate sync</EmptyTitle>+ </Empty>+ ) : (+ <><Table>- <THead>- <Tr>- <Th className="w-3/16">SAN / CN</Th>- <Th className="w-1/8">Certificate Status</Th>- <Th className="w-1/8">Serial Number</Th>- <Th className="w-3/16">External ID</Th>- <Th className="w-1/8">Sync Status</Th>- <Th className="w-1/8">Expires At</Th>- <Th className="w-1/8" />- </Tr>- </THead>- <TBody>+ <TableHeader>+ <TableRow>+ <TableHead>SAN / CN</TableHead>+ <TableHead>Certificate Status</TableHead>+ <TableHead>Serial Number</TableHead>+ <TableHead>External ID</TableHead>+ <TableHead>Sync Status</TableHead>+ <TableHead>Expires At</TableHead>+ <TableHead />+ </TableRow>+ </TableHeader>+ <TableBody>{syncCertificates.map((syncCert) => {const isExpired = syncCert.certificateNotAfter? new Date(syncCert.certificateNotAfter) < new Date(): false;const isRevoked = syncCert.certificateStatus === "revoked";- // Calculate auto-renewal timelineconst hasAutoRenewal = Boolean(syncCert.certificateRenewBeforeDays &&syncCert.certificateRenewBeforeDays > 0 &&@@ -248,8 +257,8 @@ export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {const isDefaultCertificate = syncCert.syncMetadata?.isDefault === true;return (- <Tr key={syncCert.id}>- <Td className="max-w-0">+ <TableRow key={syncCert.id}>+ <TableCell isTruncatable><div className="flex items-center gap-2"><CertificateDisplayNamecert={{@@ -263,35 +272,32 @@ export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {<Badge variant="neutral">Default</Badge>)}</div>- </Td>- <Td>+ </TableCell>+ <TableCell><Badge variant={getCertificateStatusVariant(isExpired, isRevoked)}>{getCertificateStatusText(isExpired, isRevoked)}</Badge>- </Td>- <Td className="max-w-0">+ </TableCell>+ <TableCell isTruncatable><divclassName="truncate text-xs"title={syncCert.certificateSerialNumber || "Unknown"}>- {(() => {- const serial = syncCert.certificateSerialNumber;- if (!serial || serial === "Unknown") return "Unknown";- if (serial.length <= 8) return serial;- return `${serial.substring(0, 4)}...${serial.substring(serial.length - 4)}`;- })()}+ {truncateSerialNumber(syncCert.certificateSerialNumber)}</div>- </Td>- <Td className="max-w-0">+ </TableCell>+ <TableCell isTruncatable>{syncCert.externalIdentifier ? (<div className="flex items-center gap-1">- <Tooltip- content={syncCert.externalIdentifier}- className="max-w-none whitespace-nowrap"- >- <span className="truncate text-xs text-bunker-300">+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="truncate text-xs text-muted">+ {syncCert.externalIdentifier}+ </span>+ </TooltipTrigger>+ <TooltipContent className="max-w-none whitespace-nowrap">{syncCert.externalIdentifier}- </span>+ </TooltipContent></Tooltip><CopyButtonvalue={syncCert.externalIdentifier}@@ -299,101 +305,101 @@ export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {/></div>) : (- <span className="text-xs text-bunker-400">-</span>+ <span className="text-xs text-muted">-</span>)}- </Td>- <Td>+ </TableCell>+ <TableCell>{syncCert.lastSyncMessage &&syncCert.syncStatus === CertificateSyncStatus.Failed ? (- <Tooltip content={syncCert.lastSyncMessage}>- <Badge variant="danger">Failed</Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="inline-block">+ <Badge variant="danger">Failed</Badge>+ </span>+ </TooltipTrigger>+ <TooltipContent>{syncCert.lastSyncMessage}</TooltipContent></Tooltip>) : (<Badge variant={getSyncStatusVariant(syncCert.syncStatus)}>{getSyncStatusText(syncCert.syncStatus)}</Badge>)}- </Td>- <Td>- <span- className={`text-sm ${isExpired ? "text-red-400" : "text-bunker-300"}`}- >+ </TableCell>+ <TableCell>+ <span className={isExpired ? "text-danger" : "text-muted"}>{syncCert.certificateNotAfter? new Date(syncCert.certificateNotAfter).toLocaleDateString(): "Unknown"}</span>- </Td>- <Td className="flex items-center justify-end gap-2 pr-4">- {hasAutoRenewal && daysUntilRenewal !== null && (- <Tooltip content={`Auto-renews in ${daysUntilRenewal}d`}>- <div className="text-primary-500">- <FontAwesomeIcon icon={faClockRotateLeft} size="sm" />- </div>- </Tooltip>- )}- <DropdownMenu>- <DropdownMenuTrigger asChild>- <IconButton- size="xs"- variant="plain"- colorSchema="secondary"- ariaLabel="Certificate actions"- isDisabled={!canEdit}- >- <FontAwesomeIcon icon={faEllipsisV} />- </IconButton>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {supportsDefaultCertificate && !isDefaultCertificate && (+ </TableCell>+ <TableCell>+ <div className="flex items-center justify-end gap-2">+ {hasAutoRenewal && daysUntilRenewal !== null && (+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="inline-block text-accent">+ <HistoryIcon className="size-3.5" />+ </span>+ </TooltipTrigger>+ <TooltipContent>Auto-renews in {daysUntilRenewal}d</TooltipContent>+ </Tooltip>+ )}+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ size="xs"+ variant="ghost"+ aria-label="Certificate actions"+ isDisabled={!canEdit}+ >+ <EllipsisIcon />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ {supportsDefaultCertificate && !isDefaultCertificate && (+ <DropdownMenuItem+ onClick={() => handleSetAsDefault(syncCert.certificateId)}+ >+ Set as Default+ </DropdownMenuItem>+ )}+ {supportsDefaultCertificate && isDefaultCertificate && (+ <DropdownMenuItem onClick={handleClearDefault}>+ Unset Default+ </DropdownMenuItem>+ )}<DropdownMenuItem- onClick={() => handleSetAsDefault(syncCert.certificateId)}+ variant="danger"+ onClick={() =>+ handleDeleteClick(syncCert.certificateId, originalDisplayName)+ }>- Set as Default- </DropdownMenuItem>- )}- {supportsDefaultCertificate && isDefaultCertificate && (- <DropdownMenuItem onClick={handleClearDefault}>- Unset Default+ <Trash2Icon />+ Remove from Sync</DropdownMenuItem>- )}- <DropdownMenuItem- onClick={() =>- handleDeleteClick(syncCert.certificateId, originalDisplayName)- }- icon={<FontAwesomeIcon icon={faTrash} className="text-red-500" />}- >- <span className="text-red-500">Remove from Sync</span>- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- </Td>- </Tr>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </TableCell>+ </TableRow>);})}- </TBody>+ </TableBody></Table>- {syncCertificates.length === 0 && (- <EmptyState- title="No certificates are part of this certificate sync"- icon={faCertificate}- />- )}- </TableContainer>- {/* Pagination */}- {totalPages > 1 && (- <div className="flex justify-center">+ {totalCount > pageSize && (<Pagination+ className="mt-4"count={totalCount}page={currentPage}perPage={pageSize}onChangePage={(page: number) => setCurrentPage(page)}onChangePerPage={() => {}}/>- </div>- )}- </div>- </div>- </div>+ )}+ </>+ )}+ </CardContent>+ </Card><CertificateManagementModalpkiSync={pkiSync}@@ -420,6 +426,6 @@ export const PkiSyncCertificatesSection = ({ pkiSync }: Props) => {}}buttonText="Remove Certificate"/>- </div>+ </>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsxindex 1831c9c359..aa003b021f 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection.tsx@@ -1,11 +1,8 @@-/* eslint-disable jsx-a11y/label-has-associated-control */import { ReactNode } from "react";-import { faEdit } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { IconButton } from "@app/components/v2";+import { Detail, DetailGroupHeader, DetailLabel, DetailValue } from "@app/components/v3";import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";-import { PkiSync, TPkiSync, usePkiSyncPermissions } from "@app/hooks/api/pkiSyncs";+import { PkiSync, TPkiSync } from "@app/hooks/api/pkiSyncs";import {AwsCertificateManagerPkiSyncDestinationSection,@@ -21,19 +18,11 @@ import {WindowsServerPkiSyncDestinationSection} from "./PkiSyncDestinationSection/index";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TPkiSync;- onEditDestination: VoidFunction;};-export const PkiSyncDestinationSection = ({ pkiSync, onEditDestination }: Props) => {+export const PkiSyncDestinationSection = ({ pkiSync }: Props) => {const { destination } = pkiSync;const destinationDetails = PKI_SYNC_MAP[destination];@@ -74,32 +63,17 @@ export const PkiSyncDestinationSection = ({ pkiSync, onEditDestination }: Props)DestinationComponents = <NutanixPrismCentralPkiSyncDestinationSection pkiSync={pkiSync} />;break;default:- // For future destinations, return null (no additional fields to show)DestinationComponents = null;}- const { canEdit } = usePkiSyncPermissions(pkiSync);-return (- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="text-lg font-medium text-mineshaft-100">Destination Configuration</h3>- <IconButton- variant="plain"- colorSchema="secondary"- isDisabled={!canEdit}- ariaLabel="Edit destination"- onClick={onEditDestination}- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </div>- <div className="flex w-full flex-wrap gap-8 pt-2">- <GenericFieldLabel label={`${destinationDetails.name} Connection`}>- {pkiSync.appConnectionName || "Default Connection"}- </GenericFieldLabel>- {DestinationComponents}- </div>- </div>+ <>+ <DetailGroupHeader>Destination Configuration</DetailGroupHeader>+ <Detail>+ <DetailLabel>{`${destinationDetails.name} Connection`}</DetailLabel>+ <DetailValue>{pkiSync.appConnectionName || "Default Connection"}</DetailValue>+ </Detail>+ {DestinationComponents}+ </>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsCertificateManagerPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsCertificateManagerPkiSyncDestinationSection.tsxindex 88ffbbb93d..e65e97fad1 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsCertificateManagerPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsCertificateManagerPkiSyncDestinationSection.tsx@@ -1,12 +1,6 @@+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { TPkiSync } from "@app/hooks/api/pkiSyncs";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TPkiSync;};@@ -17,5 +11,10 @@ export const AwsCertificateManagerPkiSyncDestinationSection = ({ pkiSync }: Prop? pkiSync.destinationConfig.region: undefined;- return <GenericFieldLabel label="AWS Region">{region || "Not specified"}</GenericFieldLabel>;+ return (+ <Detail>+ <DetailLabel>AWS Region</DetailLabel>+ <DetailValue>{region || "Not specified"}</DetailValue>+ </Detail>+ );};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsElasticLoadBalancerPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsElasticLoadBalancerPkiSyncDestinationSection.tsxindex 478be00a8f..e877d6be88 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsElasticLoadBalancerPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsElasticLoadBalancerPkiSyncDestinationSection.tsx@@ -1,13 +1,6 @@-import { Tag } from "@app/components/v2";+import { Badge, Detail, DetailLabel, DetailValue } from "@app/components/v3";import { TPkiSync } from "@app/hooks/api/pkiSyncs";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type ListenerConfig = {listenerArn: string;port: number;@@ -41,23 +34,32 @@ export const AwsElasticLoadBalancerPkiSyncDestinationSection = ({ pkiSync }: Proreturn (<>- <GenericFieldLabel label="AWS Region">{region || "Not specified"}</GenericFieldLabel>- <GenericFieldLabel label="Load Balancer">- {loadBalancerArn ? getLoadBalancerName(loadBalancerArn) : "Not specified"}- </GenericFieldLabel>- <GenericFieldLabel label="Listeners">- {listeners.length === 0 ? (- <span className="text-mineshaft-400">No listeners configured</span>- ) : (- <div className="flex flex-wrap gap-1">- {listeners.map((listener) => (- <Tag key={listener.listenerArn} size="xs">- {listener.protocol}:{listener.port}- </Tag>- ))}- </div>- )}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>AWS Region</DetailLabel>+ <DetailValue>{region || "Not specified"}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Load Balancer</DetailLabel>+ <DetailValue>+ {loadBalancerArn ? getLoadBalancerName(loadBalancerArn) : "Not specified"}+ </DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Listeners</DetailLabel>+ <DetailValue>+ {listeners.length === 0 ? (+ <span className="text-muted">No listeners configured</span>+ ) : (+ <div className="flex flex-wrap gap-1">+ {listeners.map((listener) => (+ <Badge key={listener.listenerArn} variant="neutral">+ {listener.protocol}:{listener.port}+ </Badge>+ ))}+ </div>+ )}+ </DetailValue>+ </Detail></>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsSecretsManagerPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsSecretsManagerPkiSyncDestinationSection.tsxindex ba97b73cf7..d30ce6cf76 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsSecretsManagerPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AwsSecretsManagerPkiSyncDestinationSection.tsx@@ -1,12 +1,6 @@+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { TAwsSecretsManagerPkiSync, TPkiSync } from "@app/hooks/api/pkiSyncs";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TPkiSync;};@@ -17,11 +11,15 @@ export const AwsSecretsManagerPkiSyncDestinationSection = ({ pkiSync }: Props) =return (<>- <GenericFieldLabel label="AWS Region">- {destinationConfig.region || "us-east-1"}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>AWS Region</DetailLabel>+ <DetailValue>{destinationConfig.region || "us-east-1"}</DetailValue>+ </Detail>{destinationConfig.keyId && (- <GenericFieldLabel label="KMS Key">{destinationConfig.keyId}</GenericFieldLabel>+ <Detail>+ <DetailLabel>KMS Key</DetailLabel>+ <DetailValue>{destinationConfig.keyId}</DetailValue>+ </Detail>)}</>);diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AzureKeyVaultPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AzureKeyVaultPkiSyncDestinationSection.tsxindex b9bc7462c8..1c4485e302 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AzureKeyVaultPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/AzureKeyVaultPkiSyncDestinationSection.tsx@@ -1,21 +1,15 @@-/* eslint-disable jsx-a11y/label-has-associated-control */+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { TAzureKeyVaultPkiSync } from "@app/hooks/api/pkiSyncs/types/azure-key-vault-sync";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TAzureKeyVaultPkiSync;};export const AzureKeyVaultPkiSyncDestinationSection = ({ pkiSync }: Props) => {return (- <GenericFieldLabel label="Key Vault URL">- {pkiSync.destinationConfig.vaultBaseUrl}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>Key Vault URL</DetailLabel>+ <DetailValue>{pkiSync.destinationConfig.vaultBaseUrl}</DetailValue>+ </Detail>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/ChefPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/ChefPkiSyncDestinationSection.tsxindex 7d29c91c19..35a109a54b 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/ChefPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/ChefPkiSyncDestinationSection.tsx@@ -1,12 +1,6 @@+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { TPkiSync } from "@app/hooks/api/pkiSyncs";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TPkiSync;};@@ -18,8 +12,9 @@ export const ChefPkiSyncDestinationSection = ({ pkiSync }: Props) => {: undefined;return (- <GenericFieldLabel label="Chef Data Bag Name">- {dataBagName || "Not specified"}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>Chef Data Bag Name</DetailLabel>+ <DetailValue>{dataBagName || "Not specified"}</DetailValue>+ </Detail>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/F5BigIpPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/F5BigIpPkiSyncDestinationSection.tsxindex 0540c612d7..73bef829ca 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/F5BigIpPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/F5BigIpPkiSyncDestinationSection.tsx@@ -1,13 +1,6 @@-/* eslint-disable jsx-a11y/label-has-associated-control */+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { F5BigIpProfileType, TF5BigIpPkiSync } from "@app/hooks/api/pkiSyncs/types/f5-big-ip-sync";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-const PROFILE_TYPE_LABELS: Record<F5BigIpProfileType, string> = {[F5BigIpProfileType.None]: "None",[F5BigIpProfileType.ClientSsl]: "Client SSL Profile",@@ -26,26 +19,35 @@ export const F5BigIpPkiSyncDestinationSection = ({ pkiSync }: Props) => {return (<>- <GenericFieldLabel label="Partition">{partition || "Common"}</GenericFieldLabel>- <GenericFieldLabel label="Profile Binding">- {PROFILE_TYPE_LABELS[resolvedProfileType]}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>Partition</DetailLabel>+ <DetailValue>{partition || "Common"}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Profile Binding</DetailLabel>+ <DetailValue>{PROFILE_TYPE_LABELS[resolvedProfileType]}</DetailValue>+ </Detail>{hasProfileBinding && profileName ? (- <GenericFieldLabel- label={- resolvedProfileType === F5BigIpProfileType.ServerSsl+ <Detail>+ <DetailLabel>+ {resolvedProfileType === F5BigIpProfileType.ServerSsl? "Server SSL Profile Name"- : "Client SSL Profile Name"- }- >- {profileName}- </GenericFieldLabel>+ : "Client SSL Profile Name"}+ </DetailLabel>+ <DetailValue>{profileName}</DetailValue>+ </Detail>) : null}{hasProfileBinding && createProfileIfMissing ? (- <GenericFieldLabel label="Create profile if missing">Yes</GenericFieldLabel>+ <Detail>+ <DetailLabel>Create profile if missing</DetailLabel>+ <DetailValue>Yes</DetailValue>+ </Detail>) : null}{hasProfileBinding && createProfileIfMissing && parentProfile ? (- <GenericFieldLabel label="Parent Profile">{parentProfile}</GenericFieldLabel>+ <Detail>+ <DetailLabel>Parent Profile</DetailLabel>+ <DetailValue>{parentProfile}</DetailValue>+ </Detail>) : null}</>);diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/LinuxServerPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/LinuxServerPkiSyncDestinationSection.tsxindex dc02875823..873572c6cd 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/LinuxServerPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/LinuxServerPkiSyncDestinationSection.tsx@@ -1,14 +1,7 @@-/* eslint-disable jsx-a11y/label-has-associated-control */+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { PkiSyncExportFormat } from "@app/hooks/api/pkiSyncs";import { TLinuxServerPkiSync } from "@app/hooks/api/pkiSyncs/types/linux-server-sync";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TLinuxServerPkiSync;};@@ -18,12 +11,16 @@ export const LinuxServerPkiSyncDestinationSection = ({ pkiSync }: Props) => {return (<>- <GenericFieldLabel label="Destination Directory">- {pkiSync.destinationConfig.destinationPath}- </GenericFieldLabel>- <GenericFieldLabel label="Export Format">- {exportFormat === PkiSyncExportFormat.Pkcs12 ? "PKCS#12 (.pfx)" : "PEM"}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>Destination Directory</DetailLabel>+ <DetailValue>{pkiSync.destinationConfig.destinationPath}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Export Format</DetailLabel>+ <DetailValue>+ {exportFormat === PkiSyncExportFormat.Pkcs12 ? "PKCS#12 (.pfx)" : "PEM"}+ </DetailValue>+ </Detail></>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/NetScalerPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/NetScalerPkiSyncDestinationSection.tsxindex a8f7e32b70..5756f4e2ff 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/NetScalerPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/NetScalerPkiSyncDestinationSection.tsx@@ -1,13 +1,6 @@-/* eslint-disable jsx-a11y/label-has-associated-control */+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { TNetScalerPkiSync } from "@app/hooks/api/pkiSyncs/types/netscaler-sync";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TNetScalerPkiSync;};@@ -18,8 +11,9 @@ export const NetScalerPkiSyncDestinationSection = ({ pkiSync }: Props) => {}return (- <GenericFieldLabel label="SSL vServer Name">- {pkiSync.destinationConfig.vserverName}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>SSL vServer Name</DetailLabel>+ <DetailValue>{pkiSync.destinationConfig.vserverName}</DetailValue>+ </Detail>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/WindowsServerPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/WindowsServerPkiSyncDestinationSection.tsxindex 67c3b43ff7..d44175bfb9 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/WindowsServerPkiSyncDestinationSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/WindowsServerPkiSyncDestinationSection.tsx@@ -1,14 +1,7 @@-/* eslint-disable jsx-a11y/label-has-associated-control */+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";import { PkiSyncExportFormat } from "@app/hooks/api/pkiSyncs";import { TWindowsServerPkiSync } from "@app/hooks/api/pkiSyncs/types/windows-server-sync";-const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div className="mb-4">- <p className="text-sm font-medium text-mineshaft-300">{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);-type Props = {pkiSync: TWindowsServerPkiSync;};@@ -18,12 +11,16 @@ export const WindowsServerPkiSyncDestinationSection = ({ pkiSync }: Props) => {return (<>- <GenericFieldLabel label="Destination Directory">- {pkiSync.destinationConfig.destinationPath}- </GenericFieldLabel>- <GenericFieldLabel label="Export Format">- {exportFormat === PkiSyncExportFormat.Pkcs12 ? "PKCS#12 (.pfx)" : "PEM"}- </GenericFieldLabel>+ <Detail>+ <DetailLabel>Destination Directory</DetailLabel>+ <DetailValue>{pkiSync.destinationConfig.destinationPath}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Export Format</DetailLabel>+ <DetailValue>+ {exportFormat === PkiSyncExportFormat.Pkcs12 ? "PKCS#12 (.pfx)" : "PEM"}+ </DetailValue>+ </Detail></>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDetailsSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDetailsSection.tsxindex c7a82f3828..ddc0dc4603 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDetailsSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDetailsSection.tsx@@ -1,37 +1,17 @@-/* eslint-disable jsx-a11y/label-has-associated-control */import { useMemo } from "react";-import { faEdit } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { format } from "date-fns";+import { BanIcon, RefreshCwIcon } from "lucide-react";import { PkiSyncStatusBadge } from "@app/components/pki-syncs";-import { IconButton } from "@app/components/v2";-import { PkiSyncStatus, TPkiSync, usePkiSyncPermissions } from "@app/hooks/api/pkiSyncs";--const GenericFieldLabel = ({- label,- children,- labelClassName,- truncate-}: {- label: string;- children: React.ReactNode;- labelClassName?: string;- truncate?: boolean;-}) => (- <div className="mb-4">- <p className={`text-sm font-medium text-mineshaft-300 ${labelClassName || ""}`}>{label}</p>- <div className={`text-sm text-mineshaft-300 ${truncate ? "truncate" : ""}`}>{children}</div>- </div>-);+import { Badge, Detail, DetailLabel, DetailValue } from "@app/components/v3";+import { PkiSyncStatus, TPkiSync } from "@app/hooks/api/pkiSyncs";type Props = {pkiSync: TPkiSync;- onEditDetails: VoidFunction;};-export const PkiSyncDetailsSection = ({ pkiSync, onEditDetails }: Props) => {- const { syncStatus, lastSyncMessage, lastSyncedAt, name, description, subscriber } = pkiSync;+export const PkiSyncDetailsSection = ({ pkiSync }: Props) => {+ const { syncStatus, lastSyncMessage, lastSyncedAt, isAutoSyncEnabled } = pkiSync;const failureMessage = useMemo(() => {if (syncStatus === PkiSyncStatus.Failed) {@@ -47,46 +27,46 @@ export const PkiSyncDetailsSection = ({ pkiSync, onEditDetails }: Props) => {return null;}, [syncStatus, lastSyncMessage]);- const { canEdit } = usePkiSyncPermissions(pkiSync);-return (- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="text-lg font-medium text-mineshaft-100">Details</h3>- <IconButton- variant="plain"- colorSchema="secondary"- isDisabled={!canEdit}- ariaLabel="Edit sync details"- onClick={onEditDetails}- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </div>- <div className="pt-2">- <GenericFieldLabel label="Name" truncate>- {name}- </GenericFieldLabel>- <GenericFieldLabel label="Description">{description || "None"}</GenericFieldLabel>- {subscriber && (- <GenericFieldLabel label="Source Subscriber">{subscriber.name}</GenericFieldLabel>- )}- {syncStatus && (- <GenericFieldLabel label="Status">+ <>+ {syncStatus && (+ <Detail>+ <DetailLabel>Status</DetailLabel>+ <DetailValue><PkiSyncStatusBadge status={syncStatus} />- </GenericFieldLabel>- )}- {lastSyncedAt && (- <GenericFieldLabel label="Last Synced">- {format(new Date(lastSyncedAt), "yyyy-MM-dd, h:mm aaa")}- </GenericFieldLabel>- )}- {syncStatus === PkiSyncStatus.Failed && failureMessage && (- <GenericFieldLabel labelClassName="text-red" label="Last Sync Error">+ </DetailValue>+ </Detail>+ )}+ <Detail>+ <DetailLabel>Auto-Sync</DetailLabel>+ <DetailValue>+ {isAutoSyncEnabled ? (+ <Badge variant="info">+ <RefreshCwIcon />+ Enabled+ </Badge>+ ) : (+ <Badge variant="neutral">+ <BanIcon />+ Disabled+ </Badge>+ )}+ </DetailValue>+ </Detail>+ {lastSyncedAt && (+ <Detail>+ <DetailLabel>Last Synced</DetailLabel>+ <DetailValue>{format(new Date(lastSyncedAt), "yyyy-MM-dd, hh:mm aaa")}</DetailValue>+ </Detail>+ )}+ {syncStatus === PkiSyncStatus.Failed && failureMessage && (+ <Detail>+ <DetailLabel className="text-red">Last Sync Error</DetailLabel>+ <DetailValue><p className="rounded-sm bg-mineshaft-600 p-2 text-xs break-words">{failureMessage}</p>- </GenericFieldLabel>- )}- </div>- </div>+ </DetailValue>+ </Detail>+ )}+ </>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncFieldMappingsSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncFieldMappingsSection.tsxindex 1f41e665ff..afe156fc3c 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncFieldMappingsSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncFieldMappingsSection.tsx@@ -1,81 +1,52 @@-import { faEdit } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";--import { IconButton } from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { PkiSync, TPkiSync, usePkiSyncPermissions } from "@app/hooks/api/pkiSyncs";--const GenericFieldLabel = ({- label,- children,- labelClassName-}: {- label: string;- children: React.ReactNode;- labelClassName?: string;-}) => (- <div className="mb-3">- <p className={`mb-1 text-sm font-medium text-mineshaft-300 ${labelClassName || ""}`}>{label}</p>- <div className="text-sm text-mineshaft-400">{children}</div>- </div>-);+import { Badge, Detail, DetailGroupHeader, DetailLabel, DetailValue } from "@app/components/v3";+import { PkiSync, TPkiSync } from "@app/hooks/api/pkiSyncs";type Props = {pkiSync: TPkiSync;- onEditMappings: VoidFunction;};-export const PkiSyncFieldMappingsSection = ({ pkiSync, onEditMappings }: Props) => {+export const PkiSyncFieldMappingsSection = ({ pkiSync }: Props) => {const fieldMappings = pkiSync.syncOptions?.fieldMappings;- const { canEdit } = usePkiSyncPermissions(pkiSync);if (pkiSync.destination !== PkiSync.Chef && pkiSync.destination !== PkiSync.AwsSecretsManager) {return null;}return (- <div>- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="text-lg font-medium text-mineshaft-100">Field Mappings</h3>- <IconButton- variant="plain"- colorSchema="secondary"- isDisabled={!canEdit}- ariaLabel="Edit field mappings"- onClick={onEditMappings}- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </div>- <div className="pt-1">- <div className="space-y-3">- <GenericFieldLabel label="Certificate Field">- <Badge variant="neutral" className="max-w-full truncate">- {fieldMappings?.certificate || "certificate"}- </Badge>- </GenericFieldLabel>-- <GenericFieldLabel label="Private Key Field">- <Badge variant="neutral" className="max-w-full truncate">- {fieldMappings?.privateKey || "private_key"}- </Badge>- </GenericFieldLabel>-- <GenericFieldLabel label="Certificate Chain Field">- <Badge variant="neutral" className="max-w-full truncate">- {fieldMappings?.certificateChain || "certificate_chain"}- </Badge>- </GenericFieldLabel>-- <GenericFieldLabel label="CA Certificate Field">- <Badge variant="neutral" className="max-w-full truncate">- {fieldMappings?.caCertificate || "ca_certificate"}- </Badge>- </GenericFieldLabel>- </div>- </div>- </div>- </div>+ <>+ <DetailGroupHeader>Field Mappings</DetailGroupHeader>+ <Detail>+ <DetailLabel>Certificate Field</DetailLabel>+ <DetailValue>+ <Badge variant="neutral" className="max-w-full truncate">+ {fieldMappings?.certificate || "certificate"}+ </Badge>+ </DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Private Key Field</DetailLabel>+ <DetailValue>+ <Badge variant="neutral" className="max-w-full truncate">+ {fieldMappings?.privateKey || "private_key"}+ </Badge>+ </DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Certificate Chain Field</DetailLabel>+ <DetailValue>+ <Badge variant="neutral" className="max-w-full truncate">+ {fieldMappings?.certificateChain || "certificate_chain"}+ </Badge>+ </DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>CA Certificate Field</DetailLabel>+ <DetailValue>+ <Badge variant="neutral" className="max-w-full truncate">+ {fieldMappings?.caCertificate || "ca_certificate"}+ </Badge>+ </DetailValue>+ </Detail>+ </>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncOptionsSection/PkiSyncOptionsSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncOptionsSection/PkiSyncOptionsSection.tsxindex ef164bfbed..806e24a9a6 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncOptionsSection/PkiSyncOptionsSection.tsx+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncOptionsSection/PkiSyncOptionsSection.tsx@@ -1,59 +1,97 @@-import { faEdit } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";--import { IconButton } from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { TPkiSync, usePkiSyncPermissions } from "@app/hooks/api/pkiSyncs";--const GenericFieldLabel = ({- label,- children,- labelClassName-}: {- label: string;- children: React.ReactNode;- labelClassName?: string;-}) => (- <div className="mb-4">- <p className={`text-sm font-medium text-mineshaft-300 ${labelClassName || ""}`}>{label}</p>- <div className="text-sm text-mineshaft-300">{children}</div>- </div>-);+import {+ Accordion,+ AccordionContent,+ AccordionItem,+ AccordionTrigger,+ Badge,+ Detail,+ DetailGroup,+ DetailLabel,+ DetailValue,+ Separator+} from "@app/components/v3";+import { TPkiSync } from "@app/hooks/api/pkiSyncs";type Props = {pkiSync: TPkiSync;- onEditOptions: VoidFunction;};-export const PkiSyncOptionsSection = ({ pkiSync, onEditOptions }: Props) => {+const EnabledBadge = ({ enabled }: { enabled: boolean }) => (+ <Badge variant={enabled ? "success" : "neutral"}>{enabled ? "Enabled" : "Disabled"}</Badge>+);++export const PkiSyncOptionsSection = ({ pkiSync }: Props) => {const {- syncOptions: { canRemoveCertificates: removeCertificatesEnabled }+ syncOptions: {+ canRemoveCertificates,+ certificateNameSchema,+ preserveArn,+ enableVersioning,+ preserveItemOnRenewal,+ updateExistingCertificates+ }} = pkiSync;- const { canEdit } = usePkiSyncPermissions(pkiSync);return (- <div>- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="text-lg font-medium text-mineshaft-100">Sync Options</h3>- <IconButton- variant="plain"- colorSchema="secondary"- isDisabled={!canEdit}- ariaLabel="Edit sync options"- onClick={onEditOptions}- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </div>- <div className="pt-1">- <GenericFieldLabel label="Inactive Certificate Removal" labelClassName="mb-1">- <Badge variant={removeCertificatesEnabled ? "success" : "danger"}>- {removeCertificatesEnabled ? "Enabled" : "Disabled"}- </Badge>- </GenericFieldLabel>- </div>- </div>- </div>+ <>+ <Separator className="mt-4" />+ <Accordion type="multiple" variant="ghost">+ <AccordionItem value="sync-options">+ <AccordionTrigger>Sync Options</AccordionTrigger>+ <AccordionContent>+ <DetailGroup>+ <Detail>+ <DetailLabel>Inactive Certificate Removal</DetailLabel>+ <DetailValue>+ <EnabledBadge enabled={canRemoveCertificates} />+ </DetailValue>+ </Detail>+ {certificateNameSchema && (+ <Detail>+ <DetailLabel>Certificate Name Schema</DetailLabel>+ <DetailValue>+ <Badge variant="neutral" className="max-w-full truncate">+ {certificateNameSchema}+ </Badge>+ </DetailValue>+ </Detail>+ )}+ {preserveArn !== undefined && (+ <Detail>+ <DetailLabel>Preserve ARN</DetailLabel>+ <DetailValue>+ <EnabledBadge enabled={preserveArn} />+ </DetailValue>+ </Detail>+ )}+ {enableVersioning !== undefined && (+ <Detail>+ <DetailLabel>Versioning</DetailLabel>+ <DetailValue>+ <EnabledBadge enabled={enableVersioning} />+ </DetailValue>+ </Detail>+ )}+ {preserveItemOnRenewal !== undefined && (+ <Detail>+ <DetailLabel>Preserve Item on Renewal</DetailLabel>+ <DetailValue>+ <EnabledBadge enabled={preserveItemOnRenewal} />+ </DetailValue>+ </Detail>+ )}+ {updateExistingCertificates !== undefined && (+ <Detail>+ <DetailLabel>Update Existing Certificates</DetailLabel>+ <DetailValue>+ <EnabledBadge enabled={updateExistingCertificates} />+ </DetailValue>+ </Detail>+ )}+ </DetailGroup>+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </>);};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncSourceSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncSourceSection.tsxdeleted file mode 100644index c3ef25be2e..0000000000--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncSourceSection.tsx+++ /dev/null@@ -1,61 +0,0 @@-/* eslint-disable jsx-a11y/label-has-associated-control */-import { faEdit } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { AlertTriangleIcon } from "lucide-react";--import { IconButton, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { TPkiSync, usePkiSyncPermissions } from "@app/hooks/api/pkiSyncs";--const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (- <div>- <label className="text-sm text-bunker-300">{label}</label>- <div className="mt-1">{children}</div>- </div>-);--type Props = {- pkiSync: TPkiSync;- onEditSource: VoidFunction;-};--export const PkiSyncSourceSection = ({ pkiSync, onEditSource }: Props) => {- const { subscriberId, subscriber } = pkiSync;- const { canEdit } = usePkiSyncPermissions(pkiSync);-- return (- <div>- <div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">- <div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">- <h3 className="font-medium text-mineshaft-100">Source</h3>- <div>- {!subscriberId && (- <Tooltip content="The PKI subscriber for this sync has been deleted. Configure a new source or remove this sync.">- <Badge variant="danger" className="mr-1">- <AlertTriangleIcon />- Source Deleted- </Badge>- </Tooltip>- )}- <IconButton- variant="plain"- colorSchema="secondary"- isDisabled={!canEdit}- ariaLabel="Edit sync source"- onClick={onEditSource}- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </div>- </div>- <div>- <div className="space-y-3">- <GenericFieldLabel label="PKI Subscriber">- {subscriber ? subscriber.name : "Deleted"}- </GenericFieldLabel>- </div>- </div>- </div>- </div>- );-};diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/index.ts b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/index.tsindex 5e6baa9736..04cb273a2a 100644--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/index.ts+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/index.ts@@ -5,4 +5,3 @@ export { PkiSyncDestinationSection } from "./PkiSyncDestinationSection";export { PkiSyncDetailsSection } from "./PkiSyncDetailsSection";export { PkiSyncFieldMappingsSection } from "./PkiSyncFieldMappingsSection";export { PkiSyncOptionsSection } from "./PkiSyncOptionsSection";-export { PkiSyncSourceSection } from "./PkiSyncSourceSection";diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsxindex b2631f09b2..db40d2945d 100644--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx@@ -1,34 +1,37 @@import { useEffect, useMemo, useState } from "react";import { Control, Controller, useForm } from "react-hook-form";import { SingleValue } from "react-select";-import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { Tab } from "@headlessui/react";import { zodResolver } from "@hookform/resolvers/zod";import { useQueryClient } from "@tanstack/react-query";import { Link, useParams } from "@tanstack/react-router";+import { FileBadge } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,Button,- Checkbox,- EmptyState,+ DocumentationLinkBadge,+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel,FilterableSelect,- FormControl,- FormLabel,Input,- Modal,- ModalContent,Select,+ SelectContent,SelectItem,- TextArea,- Tooltip-} from "@app/components/v2";+ SelectTrigger,+ SelectValue,+ Sheet,+ SheetContent,+ SheetHeader,+ SheetTitle,+ Stepper,+ StepperList,+ StepperStep,+ TextArea+} from "@app/components/v3";import { useProject, useProjectPermission } from "@app/context";import {ProjectPermissionCertificatePolicyActions,@@ -61,11 +64,7 @@ import {KEY_USAGES_OPTIONS,SIGNATURE_ALGORITHMS_OPTIONS} from "@app/hooks/api/certificates/constants";-import { AlgorithmSelectors } from "@app/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors";import { filterUsages } from "@app/pages/cert-manager/CertificatesPage/components/certificateUtils";-import { KeyUsageSection } from "@app/pages/cert-manager/CertificatesPage/components/KeyUsageSection";-import { SubjectAltNamesField } from "@app/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField";-import { SubjectAttributesField } from "@app/pages/cert-manager/CertificatesPage/components/SubjectAttributesField";import {CertPolicyState,CertSubjectAlternativeNameType,@@ -74,7 +73,9 @@ import {mapPolicySignatureAlgorithmToApi} from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";+import { PkiDocsUrls } from "../../../pki-docs-urls";import { CreatePolicyModal } from "../CertificatePoliciesTab/CreatePolicyModal";+import { PolicyConstraints, ProfileDefaultsStep } from "./CreateProfileModal/ProfileDefaultsStep";import { CertificatePolicyOption } from "./CertificatePolicyOption";const certificateDefaultsSchema = z@@ -84,7 +85,7 @@ const certificateDefaultsSchema = z.array(z.object({type: z.nativeEnum(CertSubjectAttributeType),- value: z.string().min(1, "Value is required")+ value: z.string()})).optional(),@@ -92,7 +93,7 @@ const certificateDefaultsSchema = z.array(z.object({type: z.nativeEnum(CertSubjectAlternativeNameType),- value: z.string().min(1, "Value is required")+ value: z.string()})).optional(),@@ -102,7 +103,10 @@ const certificateDefaultsSchema = zextendedKeyUsages: z.record(z.boolean().optional()).optional(),basicConstraints: z.object({- isCA: z.boolean().default(false),+ isCA: z+ .boolean()+ .nullish()+ .transform((v) => v ?? false),pathLength: z.number().min(0).nullable().optional()}).nullable()@@ -110,27 +114,46 @@ const certificateDefaultsSchema = z}).optional();-const configurationFields = [- "slug",- "description",- "issuerType",- "certificateAuthorityId",- "certificatePolicyId",- "externalConfigs"-] as const;--const FORM_STEPS = [+const STEPS = [+ {+ name: "Details",+ key: "details",+ shortDescription: "Name and description",+ title: "Details",+ subtitle: "Name this profile and describe what it is used for.",+ rightLabel: "DETAILS",+ rightDescription:+ "A clear name and description help your team identify what this profile issues. The name is used to reference the profile when requesting certificates.",+ fields: ["slug", "description"] as string[]+ },{- name: "Configuration",- key: "configuration",- fields: configurationFields as unknown as string[]+ name: "Issuer",+ key: "issuer",+ shortDescription: "CA and policy",+ title: "Issuer",+ subtitle: "Choose how certificates are issued and which policy governs them.",+ rightLabel: "ISSUER",+ rightDescription:+ "Choose this profile's issuer. A Certificate Authority issues from an existing CA in your organization, while Self-Signed produces standalone certificates. The certificate policy defines the rules every certificate issued from this profile must satisfy.",+ fields: [+ "issuerType",+ "certificateAuthorityId",+ "certificatePolicyId",+ "externalConfigs"+ ] as string[]},{name: "Certificate Defaults",key: "certificate-defaults",+ shortDescription: "Default values",+ title: "Certificate Defaults",+ subtitle: "Set default values applied when a request omits its own.",+ rightLabel: "CERTIFICATE DEFAULTS",+ rightDescription:+ "These defaults pre-fill certificate requests issued from this profile. A request can override any of them, within the bounds of the selected policy. Leave a field empty to apply no default.",fields: ["defaults"] as string[]}-];+] as const;const slugSchema = z.string()@@ -148,83 +171,59 @@ const descriptionSchema = z.max(1000, "Description must be less than 1000 characters").optional();-const createSchema = z- .object({- slug: slugSchema,- description: descriptionSchema,- issuerType: z.nativeEnum(IssuerType),- certificateAuthorityId: z.string().nullable().optional(),- certificatePolicyId: z.string().min(1, "Certificate Policy is required"),- externalConfigs: z- .object({- template: z.string().min(1, "Azure ADCS template is required")- })- .optional(),- defaults: certificateDefaultsSchema- })- .refine(- (data) => {- if (data.issuerType === IssuerType.CA) {- return !!data.certificateAuthorityId;+const baseProfileSchema = z.object({+ slug: slugSchema,+ description: descriptionSchema,+ issuerType: z.nativeEnum(IssuerType),+ certificateAuthorityId: z.string().nullable().optional(),+ certificatePolicyId: z.string().min(1, "Certificate Policy is required"),+ externalConfigs: z+ .object({+ template: z.string().min(1, "Azure ADCS template is required")+ })+ .optional(),+ defaults: certificateDefaultsSchema+});++const applyIssuerRefinements = <T extends z.ZodTypeAny>(schema: T) =>+ schema+ .refine(+ (data: { issuerType: IssuerType; certificateAuthorityId?: string | null }) => {+ if (data.issuerType === IssuerType.CA) {+ return !!data.certificateAuthorityId;+ }+ return true;+ },+ {+ message: "Certificate Authority is required",+ path: ["certificateAuthorityId"]}- return true;- },- {- message: "Certificate Authority is required",- path: ["certificateAuthorityId"]- }- )- .refine(- (data) => {- if (data.issuerType === IssuerType.SELF_SIGNED) {- return !data.certificateAuthorityId;+ )+ .refine(+ (data: { issuerType: IssuerType; certificateAuthorityId?: string | null }) => {+ if (data.issuerType === IssuerType.SELF_SIGNED) {+ return !data.certificateAuthorityId;+ }+ return true;+ },+ {+ message: "Self-signed issuer type cannot have a certificate authority",+ path: ["certificateAuthorityId"]}- return true;- },- {- message: "Self-signed issuer type cannot have a certificate authority",- path: ["certificateAuthorityId"]- }- );+ );-const editSchema = z- .object({- slug: slugSchema,- description: descriptionSchema,- issuerType: z.nativeEnum(IssuerType),- certificateAuthorityId: z.string().nullable().optional(),+const createSchema = applyIssuerRefinements(baseProfileSchema);++const editSchema = applyIssuerRefinements(+ baseProfileSchema.extend({certificatePolicyId: z.string().optional(),externalConfigs: z.object({template: z.string().optional()})- .optional(),- defaults: certificateDefaultsSchema+ .optional()})- .refine(- (data) => {- if (data.issuerType === IssuerType.CA) {- return !!data.certificateAuthorityId;- }- return true;- },- {- message: "Certificate Authority is required",- path: ["certificateAuthorityId"]- }- )- .refine(- (data) => {- if (data.issuerType === IssuerType.SELF_SIGNED) {- return !data.certificateAuthorityId;- }- return true;- },- {- message: "Self-signed issuer type cannot have a certificate authority",- path: ["certificateAuthorityId"]- }- );+);export type FormData = z.infer<typeof createSchema>;@@ -245,29 +244,34 @@ const ExternalCaTemplateSelect = ({control={control}name="externalConfigs.template"render={({ field: { onChange, value }, fieldState: { error } }) => (- <FormControl- label="Windows ADCS Template"- isRequired- isError={Boolean(error)}- errorText={error?.message}- >- <FilterableSelect- value={templates.find((template) => template[valueKey] === value) || null}- onChange={(selected) => {- const option = Array.isArray(selected) ? selected[0] : selected;- onChange(- option && typeof option === "object" && valueKey in option- ? option[valueKey] || ""- : ""- );- }}- getOptionLabel={(template) => template.name}- getOptionValue={(template) => template[valueKey]}- options={templates}- placeholder={placeholder}- className="w-full"- />- </FormControl>+ <Field>+ <FieldLabel>+ Windows ADCS Template <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <FilterableSelect+ value={+ templates.find((template) => template[valueKey] === value) ||+ (value ? { id: value, name: value } : null)+ }+ onChange={(selected) => {+ const option = Array.isArray(selected) ? selected[0] : selected;+ onChange(+ option && typeof option === "object" && valueKey in option+ ? option[valueKey] || ""+ : ""+ );+ }}+ getOptionLabel={(template) => template.name}+ getOptionValue={(template) => template[valueKey]}+ options={templates}+ placeholder={placeholder}+ isError={Boolean(error)}+ className="w-full"+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>)}/>);@@ -372,41 +376,45 @@ const convertFormToDefaults = (// Subject attributes → flat fieldsif (formDefaults.subjectAttributes && formDefaults.subjectAttributes.length > 0) {const domainComponents: string[] = [];- formDefaults.subjectAttributes.forEach((attr) => {- if (!attr.value) return;- switch (attr.type) {- case CertSubjectAttributeType.COMMON_NAME:- result.commonName = attr.value;- break;- case CertSubjectAttributeType.ORGANIZATION:- result.organization = attr.value;- break;- case CertSubjectAttributeType.ORGANIZATIONAL_UNIT:- result.organizationalUnit = attr.value;- break;- case CertSubjectAttributeType.COUNTRY:- result.country = attr.value;- break;- case CertSubjectAttributeType.STATE:- result.state = attr.value;- break;- case CertSubjectAttributeType.LOCALITY:- result.locality = attr.value;- break;- case CertSubjectAttributeType.DOMAIN_COMPONENT:- domainComponents.push(attr.value);- break;- default:- break;+ formDefaults.subjectAttributes.forEach(+ (attr: { type: CertSubjectAttributeType; value: string }) => {+ if (!attr.value) return;+ switch (attr.type) {+ case CertSubjectAttributeType.COMMON_NAME:+ result.commonName = attr.value;+ break;+ case CertSubjectAttributeType.ORGANIZATION:+ result.organization = attr.value;+ break;+ case CertSubjectAttributeType.ORGANIZATIONAL_UNIT:+ result.organizationalUnit = attr.value;+ break;+ case CertSubjectAttributeType.COUNTRY:+ result.country = attr.value;+ break;+ case CertSubjectAttributeType.STATE:+ result.state = attr.value;+ break;+ case CertSubjectAttributeType.LOCALITY:+ result.locality = attr.value;+ break;+ case CertSubjectAttributeType.DOMAIN_COMPONENT:+ domainComponents.push(attr.value);+ break;+ default:+ break;+ }}- });+ );if (domainComponents.length > 0) {result.domainComponents = domainComponents;}}if (formDefaults.subjectAltNames && formDefaults.subjectAltNames.length > 0) {- const sans = formDefaults.subjectAltNames.filter((san) => san.value?.trim());+ const sans = formDefaults.subjectAltNames.filter(+ (san: { type: CertSubjectAlternativeNameType; value: string }) => san.value?.trim()+ );if (sans.length > 0) result.subjectAltNames = sans;}@@ -468,6 +476,7 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }const queryClient = useQueryClient();const [selectedStepIndex, setSelectedStepIndex] = useState(0);+ const currentStep = STEPS[selectedStepIndex];const canCreatePolicy = permission.can(ProjectPermissionCertificatePolicyActions.Create,@@ -485,11 +494,11 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }const isEdit = mode === "edit" && profile;const isClone = mode === "clone" && profile;- const isFinalStep = selectedStepIndex === FORM_STEPS.length - 1;+ const isFinalStep = selectedStepIndex === STEPS.length - 1;const certificateAuthorities = (allCaData || []).map((ca) => ({...ca,- groupType: ca.type === "internal" ? "internal" : "external"+ groupType: ca.type === CaType.INTERNAL ? "internal" : "external"}));const certificatePolicies = policyData?.certificatePolicies || [];@@ -532,54 +541,52 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }const watchedIssuerType = watch("issuerType");const watchedCertificateAuthorityId = watch("certificateAuthorityId");const watchedPolicyId = watch("certificatePolicyId");- const watchedDefaultsIsCA = watch("defaults.basicConstraints.isCA") || false;-- // Fetch the policy for the defaults tabconst { data: selectedPolicyData } = useGetCertificatePolicyById({policyId: watchedPolicyId || ""});- // Compute constraints from the policy for the defaults tab- const policyConstraints = useMemo(() => {- const templateData = selectedPolicyData;- if (!templateData) {+ const policyConstraints = useMemo<PolicyConstraints>(() => {+ if (!selectedPolicyData) {return {- allowedKeyUsages: [] as string[],- allowedExtendedKeyUsages: [] as string[],- requiredKeyUsages: [] as string[],- requiredExtendedKeyUsages: [] as string[],- allowedSignatureAlgorithms: [] as Array<{ value: string; label: string }>,- allowedKeyAlgorithms: [] as Array<{ value: string; label: string }>,- allowedSubjectAttributeTypes: [] as CertSubjectAttributeType[],+ allowedKeyUsages: [],+ allowedExtendedKeyUsages: [],+ requiredKeyUsages: [],+ requiredExtendedKeyUsages: [],+ allowedSignatureAlgorithms: [],+ allowedKeyAlgorithms: [],+ allowedSubjectAttributeTypes: [],shouldShowSubjectSection: false,- allowedSanTypes: [] as CertSubjectAlternativeNameType[],+ allowedSanTypes: [],shouldShowSanSection: false,- templateAllowsCA: false,- maxPathLength: undefined as number | undefined+ policyAllowsCA: false,+ maxPathLength: undefined};}const isCaPolicy =- (templateData.basicConstraints?.isCA as CertPolicyState) || CertPolicyState.DENIED;- const templateAllowsCA =+ (selectedPolicyData.basicConstraints?.isCA as CertPolicyState) || CertPolicyState.DENIED;+ const policyAllowsCA =isCaPolicy === CertPolicyState.ALLOWED || isCaPolicy === CertPolicyState.REQUIRED;- const hasKeyUsagePolicy = Boolean(templateData.keyUsages);+ const hasKeyUsagePolicy = Boolean(selectedPolicyData.keyUsages);const allowedKeyUsages = hasKeyUsagePolicy- ? [...(templateData.keyUsages?.required || []), ...(templateData.keyUsages?.allowed || [])]+ ? [+ ...(selectedPolicyData.keyUsages?.required || []),+ ...(selectedPolicyData.keyUsages?.allowed || [])+ ]: KEY_USAGES_OPTIONS.map((option) => option.value);- const hasExtendedKeyUsagePolicy = Boolean(templateData.extendedKeyUsages);+ const hasExtendedKeyUsagePolicy = Boolean(selectedPolicyData.extendedKeyUsages);const allowedExtendedKeyUsages = hasExtendedKeyUsagePolicy? [- ...(templateData.extendedKeyUsages?.required || []),- ...(templateData.extendedKeyUsages?.allowed || [])+ ...(selectedPolicyData.extendedKeyUsages?.required || []),+ ...(selectedPolicyData.extendedKeyUsages?.allowed || [])]: EXTENDED_KEY_USAGES_OPTIONS.map((option) => option.value);- const allowedSignatureAlgorithms = templateData.algorithms?.signature?.length- ? templateData.algorithms.signature.map((templateAlgorithm: string) => {- const apiAlgorithm = mapPolicySignatureAlgorithmToApi(templateAlgorithm);+ const allowedSignatureAlgorithms = selectedPolicyData.algorithms?.signature?.length+ ? selectedPolicyData.algorithms.signature.map((policyAlgorithm: string) => {+ const apiAlgorithm = mapPolicySignatureAlgorithmToApi(policyAlgorithm);return { value: apiAlgorithm, label: apiAlgorithm };}): SIGNATURE_ALGORITHMS_OPTIONS.map((option) => ({@@ -587,17 +594,17 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }label: option.label}));- const allowedKeyAlgorithms = templateData.algorithms?.keyAlgorithm?.length- ? templateData.algorithms.keyAlgorithm.map((templateAlgorithm: string) => {- const apiAlgorithm = mapPolicyKeyAlgorithmToApi(templateAlgorithm);+ const allowedKeyAlgorithms = selectedPolicyData.algorithms?.keyAlgorithm?.length+ ? selectedPolicyData.algorithms.keyAlgorithm.map((policyAlgorithm: string) => {+ const apiAlgorithm = mapPolicyKeyAlgorithmToApi(policyAlgorithm);return { value: apiAlgorithm, label: apiAlgorithm };}): certKeyAlgorithms.map((option) => ({ value: option.value as string, label: option.label }));let allowedSubjectAttributeTypes: CertSubjectAttributeType[];- if (templateData.subject) {+ if (selectedPolicyData.subject) {const subjectTypes: CertSubjectAttributeType[] = [];- templateData.subject.forEach((subjectPolicy: { type: string }) => {+ selectedPolicyData.subject.forEach((subjectPolicy: { type: string }) => {if (!subjectTypes.includes(subjectPolicy.type as CertSubjectAttributeType)) {subjectTypes.push(subjectPolicy.type as CertSubjectAttributeType);}@@ -611,9 +618,9 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }const shouldShowSubjectSection = true;let allowedSanTypes: CertSubjectAlternativeNameType[];- if (templateData.sans) {+ if (selectedPolicyData.sans) {const sanTypes: CertSubjectAlternativeNameType[] = [];- templateData.sans.forEach((sanPolicy: { type: string }) => {+ selectedPolicyData.sans.forEach((sanPolicy: { type: string }) => {if (!sanTypes.includes(sanPolicy.type as CertSubjectAlternativeNameType)) {sanTypes.push(sanPolicy.type as CertSubjectAlternativeNameType);}@@ -629,44 +636,25 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }return {allowedKeyUsages,allowedExtendedKeyUsages,- requiredKeyUsages: (templateData.keyUsages?.required || []) as string[],- requiredExtendedKeyUsages: (templateData.extendedKeyUsages?.required || []) as string[],+ requiredKeyUsages: (selectedPolicyData.keyUsages?.required || []) as string[],+ requiredExtendedKeyUsages: (selectedPolicyData.extendedKeyUsages?.required || []) as string[],allowedSignatureAlgorithms,allowedKeyAlgorithms,allowedSubjectAttributeTypes,shouldShowSubjectSection,allowedSanTypes,shouldShowSanSection,- templateAllowsCA,- maxPathLength: templateData.basicConstraints?.maxPathLength as number | undefined+ policyAllowsCA,+ maxPathLength: selectedPolicyData.basicConstraints?.maxPathLength as number | undefined};}, [selectedPolicyData]);- const filteredKeyUsages = useMemo(() => {- return KEY_USAGES_OPTIONS.filter(({ value }) =>- policyConstraints.allowedKeyUsages.includes(value)- );- }, [policyConstraints.allowedKeyUsages]);-- const filteredExtendedKeyUsages = useMemo(() => {- return EXTENDED_KEY_USAGES_OPTIONS.filter(({ value }) =>- policyConstraints.allowedExtendedKeyUsages.includes(value)- );- }, [policyConstraints.allowedExtendedKeyUsages]);-- // Get the selected CA to check if it's Azure ADCSconst selectedCa = certificateAuthorities.find((ca) => ca.id === watchedCertificateAuthorityId);const isAzureAdcsCa = selectedCa?.type === CaType.AZURE_AD_CS;const isAdcsCa = selectedCa?.type === CaType.ADCS;- // Combined flag for external ADCS CAs - these control validity, key usages, etc. via their templates- const isExternalAdcsCa = isAzureAdcsCa || isAdcsCa;// ACM Public CA issues certificates with a fixed 198-day validity, so pin the TTL default.const isAwsAcmPublicCa = selectedCa?.type === CaType.AWS_ACM_PUBLIC_CA;- const externalCaHint =- "Validity, key usages, extended key usages and basic constraints are controlled by the external CA's certificate template.";-- // Fetch Azure ADCS templates if neededconst { data: azureAdcsTemplatesData } = useGetAzureAdcsTemplates({caId: watchedCertificateAuthorityId || "",isAzureAdcsCa@@ -677,7 +665,6 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }isAdcsCa});- // Reset step to 0 when modal opens/closesuseEffect(() => {if (isOpen) {setSelectedStepIndex(0);@@ -688,7 +675,7 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }if ((isEdit || isClone) && profile) {reset(buildFormValuesFromProfile(profile, Boolean(isClone)));}- }, [isEdit, isClone, profile, reset, allCaData]);+ }, [isEdit, isClone, profile, reset]);// Re-apply the saved template once the external CA's templates have loaded (edit/clone).useEffect(() => {@@ -717,7 +704,7 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }setValue]);- // Pin TTL to 198 days when the selected CA is AWS ACM Public CA — backend rejects any other value.+ // Pin TTL to 198 days when the selected CA is AWS ACM Public CA. Backend rejects any other value.// Also re-applies when the user lands on the Defaults tab (policy selected) so the field shows 198// even if the TTL Controller was unmounted when the CA first got picked.useEffect(() => {@@ -738,7 +725,27 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }return;}- const serializedDefaults = convertFormToDefaults(data.defaults);+ let effectiveDefaults = data.defaults;+ if (effectiveDefaults) {+ const nextDefaults = { ...effectiveDefaults };+ if (policyConstraints.requiredKeyUsages.length) {+ const keyUsages = { ...(nextDefaults.keyUsages || {}) };+ policyConstraints.requiredKeyUsages.forEach((usage) => {+ keyUsages[usage] = true;+ });+ nextDefaults.keyUsages = keyUsages;+ }+ if (policyConstraints.requiredExtendedKeyUsages.length) {+ const extendedKeyUsages = { ...(nextDefaults.extendedKeyUsages || {}) };+ policyConstraints.requiredExtendedKeyUsages.forEach((usage) => {+ extendedKeyUsages[usage] = true;+ });+ nextDefaults.extendedKeyUsages = extendedKeyUsages;+ }+ effectiveDefaults = nextDefaults;+ }++ const serializedDefaults = convertFormToDefaults(effectiveDefaults);if (isEdit) {const updateData: TUpdateCertificateProfileDTO = {@@ -792,501 +799,389 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }onClose();};- // Step validation and navigation (PolicyModal pattern)const isStepValid = async (index: number) => {- const { fields } = FORM_STEPS[index];+ const { fields } = STEPS[index];if (fields.length === 0) return true;return trigger(fields as any);};- const handleNext = async () => {- if (isFinalStep) {- await handleSubmit(onFormSubmit)();- return;- }+ const goNext = async () => {const isValid = await isStepValid(selectedStepIndex);if (!isValid) return;- setSelectedStepIndex((prev) => prev + 1);+ setSelectedStepIndex((prev) => Math.min(prev + 1, STEPS.length - 1));};- const handlePrev = () => {- if (selectedStepIndex === 0) {- handlePopUpToggle("createPolicy", false);- reset();- onClose();- return;- }- setSelectedStepIndex((prev) => prev - 1);+ const goBack = () => {+ if (selectedStepIndex > 0) setSelectedStepIndex((prev) => prev - 1);};- const isTabEnabled = async (index: number) => {- let isEnabled = true;- for (let i = index - 1; i >= 0; i -= 1) {- // eslint-disable-next-line no-await-in-loop- isEnabled = isEnabled && (await isStepValid(i));- }- return isEnabled;+ const handleClose = () => {+ handlePopUpToggle("createPolicy", false);+ reset();+ setSelectedStepIndex(0);+ onClose();};+ const isSubmitting = createProfile.isPending || updateProfile.isPending;+return (- <Modal- isOpen={isOpen}+ <Sheet+ open={isOpen}onOpenChange={(open) => {if (!open) {- reset();- setSelectedStepIndex(0);+ handleClose();}- onClose();}}>- <ModalContent- title={- // eslint-disable-next-line no-nested-ternary- isEdit- ? "Edit Certificate Profile"- : isClone- ? "Clone Certificate Profile"- : "Create Certificate Profile"- }- subTitle={- // eslint-disable-next-line no-nested-ternary- isEdit- ? `Update configuration for ${profile?.slug}`- : isClone- ? `Create a new profile based on ${profile?.slug}`- : "Define the CA and policy used to issue certificates from this profile"- }- >- <form>- <Tab.Group selectedIndex={selectedStepIndex} onChange={setSelectedStepIndex}>- <Tab.List className="-pb-1 mb-6 w-full border-b-2 border-mineshaft-600">- {FORM_STEPS.map((step, index) => (- <Tab- onClick={async (e) => {- e.preventDefault();- const isEnabled = await isTabEnabled(index);- setSelectedStepIndex((prev) => (isEnabled ? index : prev));- }}- className={({ selected }) =>- `-mb-[0.14rem] whitespace-nowrap ${index > selectedStepIndex ? "opacity-30" : ""} px-4 py-2 text-sm font-medium outline-hidden disabled:opacity-60 ${- selected- ? "border-b-2 border-mineshaft-300 text-mineshaft-200"- : "text-bunker-300"- }`- }- key={step.key}- >- {index + 1}. {step.name}- </Tab>- ))}- </Tab.List>- <Tab.Panels>- {/* Tab 1: Configuration */}- <Tab.Panel>- <Controller- control={control}- name="slug"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Name"- isRequired- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="your-profile-name" />- </FormControl>- )}- />-- <Controller- control={control}- name="description"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Description"- isError={Boolean(error)}- errorText={error?.message}- >- <TextArea {...field} placeholder="Enter profile description" rows={3} />- </FormControl>- )}- />-- <Controller- control={control}- name="issuerType"- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="Issuer Type"- tooltipText="Choose how certificates are signed. Certificate Authority issues from an existing CA in your organization, which is the standard path for production use. Self-Signed produces standalone certificates with no CA chain, suitable for testing or one-off identities only"- isRequired- isError={Boolean(error)}- errorText={error?.message}- >- <Select- {...field}- onValueChange={(value) => {- if (value === "self-signed") {- setValue("certificateAuthorityId", "");- }- onChange(value);- }}- className="w-full"- position="popper"- isDisabled={Boolean(isEdit)}- >- <SelectItem value="ca">Certificate Authority</SelectItem>- <SelectItem value="self-signed">Self-Signed</SelectItem>- </Select>- </FormControl>- )}- />-- {watchedIssuerType === "ca" && (+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 p-0 sm:max-w-[1100px]">+ <SheetHeader className="border-b border-border">+ <SheetTitle>+ <div className="flex w-full items-start gap-2">+ <div className="flex h-10 w-10 items-center justify-center rounded-md bg-project/10 text-project">+ <FileBadge className="h-5 w-5" />+ </div>+ <div>+ <div className="flex items-center gap-x-2 text-foreground">+ {/* eslint-disable-next-line no-nested-ternary */}+ {isEdit+ ? "Edit Certificate Profile"+ : isClone+ ? "Clone Certificate Profile"+ : "Create Certificate Profile"}+ <DocumentationLinkBadge href={PkiDocsUrls.settings.profiles} />+ </div>+ <p className="text-sm leading-4 text-muted">+ {/* eslint-disable-next-line no-nested-ternary */}+ {isEdit+ ? `Update configuration for ${profile?.slug}`+ : isClone+ ? `Create a new profile based on ${profile?.slug}`+ : "Define the CA and policy used to issue certificates from this profile"}+ </p>+ </div>+ </div>+ </SheetTitle>+ </SheetHeader>++ <form onSubmit={(e) => e.preventDefault()} className="flex min-h-0 flex-1 flex-col">+ <div className="flex min-h-0 flex-1 overflow-hidden">+ <aside className="flex w-60 shrink-0 flex-col border-r border-border px-5 py-6">+ <p className="mb-5 text-[11px] font-medium tracking-wider text-muted uppercase">+ Setup steps+ </p>+ <Stepper+ activeStep={selectedStepIndex}+ orientation="vertical"+ onStepChange={(i) => {+ if (i < selectedStepIndex) setSelectedStepIndex(i);+ }}+ >+ <StepperList>+ {STEPS.map((s, i) => (+ <StepperStep+ key={s.key}+ index={i}+ title={s.name}+ description={s.shortDescription}+ />+ ))}+ </StepperList>+ </Stepper>+ </aside>++ <div className="flex min-w-0 flex-1 flex-col gap-y-2 overflow-y-auto px-8 py-6">+ <div className="mb-6">+ <h2 className="text-lg font-semibold text-foreground">{currentStep.title}</h2>+ <p className="mt-1 text-sm text-muted">{currentStep.subtitle}</p>+ </div>++ {selectedStepIndex === 0 && (+ <div className="space-y-5"><Controllercontrol={control}- name="certificateAuthorityId"- render={({ field: { onChange, value }, fieldState: { error } }) => {- const hasCas = certificateAuthorities.length > 0;- return (- <div>- <FormControl- label="Certificate Authority"- isRequired+ name="slug"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Name <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <Input+ {...field}+ placeholder="your-profile-name"isError={Boolean(error)}- errorText={error?.message}- >- <FilterableSelect- value={certificateAuthorities.find((ca) => ca.id === value) || null}- onChange={(selectedCaValue) => {- if (Array.isArray(selectedCaValue)) {- onChange(selectedCaValue[0]?.id || "");- } else if (- selectedCaValue &&- typeof selectedCaValue === "object" &&- "id" in selectedCaValue- ) {- onChange(selectedCaValue.id || "");- } else {- onChange("");- }- }}- getOptionLabel={(ca) => ca.name}- getOptionValue={(ca) => ca.id}- options={certificateAuthorities}- groupBy={hasCas ? "groupType" : undefined}- getGroupHeaderLabel={hasCas ? getGroupHeaderLabel : undefined}- placeholder="Select a certificate authority"- isDisabled={Boolean(isEdit)}- className="w-full"- />- </FormControl>- {!hasCas && (- <p className="-mt-2 mb-4 text-xs text-yellow-500">- No certificate authorities available.{" "}- <Link- to="/organizations/$orgId/projects/cert-manager/$projectId/certificate-authorities"- params={{ orgId: orgId ?? "", projectId: projectId ?? "" }}- className="underline hover:text-yellow-400"- >- Create one in Certificate Authorities- </Link>- </p>- )}- </div>- );- }}+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}/>- )}- {isAzureAdcsCa && (- <ExternalCaTemplateSelect+ <Controllercontrol={control}- templates={azureAdcsTemplatesData?.templates || []}- valueKey="id"- placeholder="Select an Azure ADCS certificate template"+ name="description"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Description</FieldLabel>+ <FieldContent>+ <TextArea+ {...field}+ value={field.value ?? ""}+ placeholder="Enter profile description"+ rows={3}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}/>- )}+ </div>+ )}- {isAdcsCa && (- <ExternalCaTemplateSelect+ {selectedStepIndex === 1 && (+ <div className="space-y-5">+ <Controllercontrol={control}- templates={adcsTemplatesData?.templates || []}- valueKey="name"- placeholder="Select an ADCS certificate template"+ name="issuerType"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Issuer Type <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <Select+ value={value}+ disabled={Boolean(isEdit)}+ onValueChange={(next) => {+ if (next === IssuerType.SELF_SIGNED) {+ setValue("certificateAuthorityId", "");+ }+ onChange(next);+ }}+ >+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={IssuerType.CA}>Certificate Authority</SelectItem>+ <SelectItem value={IssuerType.SELF_SIGNED}>Self-Signed</SelectItem>+ </SelectContent>+ </Select>+ <FieldDescription>+ Certificate Authority issues from an existing CA in your organization,+ which is the standard path for production use. Self-Signed produces+ standalone certificates with no CA chain, suitable for testing or+ one-off identities only.+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}/>- )}- <Controller- control={control}- name="certificatePolicyId"- render={({ field: { onChange, value }, fieldState: { error } }) => (- <FormControl- label="Certificate Policy"- tooltipText="The rules that govern certificates issued from this profile — allowed key/signature algorithms, key usages, TTL bounds, and subject constraints. Pick an existing policy or create a new one to enforce your organization's standards."- isRequired- isError={Boolean(error)}- errorText={error?.message}- >- <FilterableSelect- value={certificatePolicies.find((p) => p.id === value) ?? null}- onChange={(newValue) => {- const selected = newValue as SingleValue<PolicyOption>;- if (selected?.id === "_create") {- handlePopUpOpen("createPolicy");- return;- }- onChange(selected?.id || "");-- // Reset defaults when policy changes- setValue("defaults", undefined);- }}- options={policyOptions}- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- placeholder={- certificatePolicies.length === 0 && !canCreatePolicy- ? "No certificate policies available"- : "Select a certificate policy"- }- isDisabled={Boolean(isEdit)}- components={{ Option: CertificatePolicyOption }}- />- </FormControl>- )}- />- </Tab.Panel>-- {/* Tab 2: Certificate Defaults */}- <Tab.Panel>- {!watchedPolicyId ? (- <EmptyState title="Select a certificate policy on the Configuration tab to configure defaults." />- ) : (- <div>- <p className="mb-4 text-sm text-bunker-300">- Set default values for certificates issued under this profile. These defaults- are used when a certificate request does not specify its own values.- </p>- {/* TTL — simple days number input (hidden for ADCS CAs) */}- {!isExternalAdcsCa && (- <Controller- name="defaults.ttlDays"- control={control}- render={({ field, fieldState: { error } }) => (- <FormControl- label={- <FormLabel- label="Time to Live (TTL) in Days"- icon={- <Tooltip- content={- isAwsAcmPublicCa- ? "AWS ACM Public CA issues certificates with a fixed 198-day validity — this field cannot be changed."- : "Fallback validity period used when not explicitly specified in certificate request. Leave empty for no TTL default."- }- >- <FontAwesomeIcon- icon={faQuestionCircle}- className="cursor-help text-mineshaft-400 hover:text-mineshaft-300"- size="sm"- />- </Tooltip>- }+ {watchedIssuerType === IssuerType.CA && (+ <Controller+ control={control}+ name="certificateAuthorityId"+ render={({ field: { onChange, value }, fieldState: { error } }) => {+ const hasCas = certificateAuthorities.length > 0;+ return (+ <Field>+ <FieldLabel>+ Certificate Authority <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <FilterableSelect+ value={certificateAuthorities.find((ca) => ca.id === value) || null}+ onChange={(selectedCaValue) => {+ if (Array.isArray(selectedCaValue)) {+ onChange(selectedCaValue[0]?.id || "");+ } else if (+ selectedCaValue &&+ typeof selectedCaValue === "object" &&+ "id" in selectedCaValue+ ) {+ onChange(selectedCaValue.id || "");+ } else {+ onChange("");+ }+ }}+ getOptionLabel={(ca) => ca.name}+ getOptionValue={(ca) => ca.id}+ options={certificateAuthorities}+ groupBy={hasCas ? "groupType" : undefined}+ getGroupHeaderLabel={hasCas ? getGroupHeaderLabel : undefined}+ placeholder="Select a certificate authority"+ isDisabled={Boolean(isEdit)}+ isError={Boolean(error)}+ className="w-full"/>- }- isError={Boolean(error)}- errorText={error?.message}- >- <Input- type="number"- placeholder="e.g. 365"- value={field.value == null ? "" : field.value}- isDisabled={isAwsAcmPublicCa}- onChange={(e) => {- const val = e.target.value;- field.onChange(val === "" ? null : Number(val));- }}- />- </FormControl>- )}- />- )}+ <FieldError errors={[error]} />+ {!hasCas && (+ <FieldDescription className="text-yellow-500">+ No certificate authorities available.{" "}+ <Link+ to="/organizations/$orgId/projects/cert-manager/$projectId/certificate-authorities"+ params={{ orgId: orgId ?? "", projectId: projectId ?? "" }}+ className="underline hover:text-yellow-400"+ >+ Create one in Certificate Authorities+ </Link>+ </FieldDescription>+ )}+ </FieldContent>+ </Field>+ );+ }}+ />+ )}- {/* Subject Attributes — only if policy allows subject fields */}- {policyConstraints.shouldShowSubjectSection && (- <SubjectAttributesField- control={control}- allowedAttributeTypes={policyConstraints.allowedSubjectAttributeTypes}- namePrefix="defaults.subjectAttributes"- />- )}+ {isAzureAdcsCa && (+ <ExternalCaTemplateSelect+ control={control}+ templates={azureAdcsTemplatesData?.templates || []}+ valueKey="id"+ placeholder="Select an Azure ADCS certificate template"+ />+ )}- {/* Subject Alternative Names — only if policy allows SANs */}- {policyConstraints.shouldShowSanSection && (- <SubjectAltNamesField- control={control}- allowedSanTypes={policyConstraints.allowedSanTypes}- namePrefix="defaults.subjectAltNames"- />- )}+ {isAdcsCa && (+ <ExternalCaTemplateSelect+ control={control}+ templates={adcsTemplatesData?.templates || []}+ valueKey="name"+ placeholder="Select an ADCS certificate template"+ />+ )}- {/* Algorithms — filtered to policy-allowed values, with "None" option */}- {(policyConstraints.allowedSignatureAlgorithms.length > 0 ||- policyConstraints.allowedKeyAlgorithms.length > 0) && (- <AlgorithmSelectors- control={control}- signatureFieldName="defaults.signatureAlgorithm"- keyFieldName="defaults.keyAlgorithm"- availableSignatureAlgorithms={policyConstraints.allowedSignatureAlgorithms}- availableKeyAlgorithms={policyConstraints.allowedKeyAlgorithms}- isRequired={false}- nonePlaceholder="No default"- hideSignatureAlgorithm={isExternalAdcsCa}- />+ <Controller+ control={control}+ name="certificatePolicyId"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel>+ Certificate Policy <span className="text-danger">*</span>+ </FieldLabel>+ <FieldContent>+ <FilterableSelect+ value={certificatePolicies.find((p) => p.id === value) ?? null}+ onChange={(newValue) => {+ const selected = newValue as SingleValue<PolicyOption>;+ if (selected?.id === "_create") {+ handlePopUpOpen("createPolicy");+ return;+ }+ onChange(selected?.id || "");++ setValue("defaults", undefined);+ }}+ options={policyOptions}+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ placeholder={+ certificatePolicies.length === 0 && !canCreatePolicy+ ? "No certificate policies available"+ : "Select a certificate policy"+ }+ isDisabled={Boolean(isEdit)}+ isError={Boolean(error)}+ components={{ Option: CertificatePolicyOption }}+ className="w-full"+ />+ <FieldDescription>+ The rules that govern certificates issued from this profile: allowed+ key/signature algorithms, key usages, TTL bounds, and subject+ constraints.+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>)}+ />+ </div>+ )}- {isExternalAdcsCa && (- <p className="mb-4 text-xs text-mineshaft-400">{externalCaHint}</p>- )}+ {selectedStepIndex === 2 && (+ <ProfileDefaultsStep+ control={control}+ watch={watch}+ setValue={setValue}+ policyConstraints={policyConstraints}+ isAwsAcmPublicCa={isAwsAcmPublicCa}+ />+ )}+ </div>++ <aside className="hidden w-80 shrink-0 flex-col gap-4 overflow-y-auto border-l border-border px-6 py-6 lg:flex">+ <div className="mb-auto">+ <div className="flex items-center justify-between gap-2">+ <p className="text-[11px] font-medium tracking-wider text-muted uppercase">+ Step {selectedStepIndex + 1} · {currentStep.rightLabel}+ </p>+ <DocumentationLinkBadge href={PkiDocsUrls.settings.profiles} />+ </div>+ <p className="mt-4 text-sm font-semibold text-foreground">What this step does</p>+ <p className="mt-2 text-sm leading-relaxed text-muted">+ {currentStep.rightDescription}+ </p>+ </div>+ </aside>+ </div>- {/* Key Usages, Ext Key Usages, Basic Constraints — in Accordion (hidden for ADCS CAs) */}- {!isExternalAdcsCa &&- (filteredKeyUsages.length > 0 ||- filteredExtendedKeyUsages.length > 0 ||- policyConstraints.templateAllowsCA) && (- <Accordion type="single" collapsible className="w-full">- {filteredKeyUsages.length > 0 && (- <KeyUsageSection- control={control}- title="Key Usages"- accordionValue="key-usages"- namePrefix="defaults.keyUsages"- options={filteredKeyUsages as Array<{ value: string; label: string }>}- requiredUsages={[]}- />- )}- {filteredExtendedKeyUsages.length > 0 && (- <KeyUsageSection- control={control}- title="Extended Key Usages"- accordionValue="extended-key-usages"- namePrefix="defaults.extendedKeyUsages"- options={- filteredExtendedKeyUsages as Array<{ value: string; label: string }>- }- requiredUsages={[]}- />- )}- {policyConstraints.templateAllowsCA && (- <AccordionItem value="basic-constraints">- <AccordionTrigger>Basic Constraints</AccordionTrigger>- <AccordionContent>- <div className="space-y-4 pl-2">- <Controller- control={control}- name="defaults.basicConstraints.isCA"- render={({ field: { value, onChange } }) => (- <div className="flex items-center gap-3">- <Checkbox- id="defaults-isCA"- isChecked={value || false}- onCheckedChange={(checked) => {- onChange(checked);- if (!checked) {- setValue(- "defaults.basicConstraints.pathLength",- undefined- );- }- }}- />- <div className="space-y-1">- <FormLabel- id="defaults-isCA"- className="cursor-pointer text-sm font-medium text-mineshaft-100"- label="Issue as Certificate Authority"- />- <p className="text-xs text-bunker-300">- Certificates will default to CA:TRUE extension- </p>- </div>- </div>- )}- />-- {watchedDefaultsIsCA && (- <Controller- control={control}- name="defaults.basicConstraints.pathLength"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Path Length"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- {...field}- type="number"- min={0}- placeholder="Leave empty for no constraint"- className="w-full"- value={field.value ?? ""}- onChange={(e) => {- const val = e.target.value;- if (val === "") {- field.onChange(null);- } else {- const numVal = parseInt(val, 10);- field.onChange(- Number.isNaN(numVal) ? null : numVal- );- }- }}- />- </FormControl>- )}- />- )}- </div>- </AccordionContent>- </AccordionItem>- )}- </Accordion>- )}- </div>- )}- </Tab.Panel>- </Tab.Panels>- </Tab.Group>-- {/* Next/Back buttons OUTSIDE tabs — always visible */}- <div className="mt-6 flex justify-between border-t border-mineshaft-600 pt-4">- <Button type="button" variant="outline_bg" onClick={handlePrev}>- {selectedStepIndex === 0 ? "Cancel" : "Back"}- </Button>- <Button- type="button"- onClick={handleNext}- isLoading={createProfile.isPending || updateProfile.isPending}- isDisabled={createProfile.isPending || updateProfile.isPending}- >- {isFinalStep && (isEdit ? "Update" : "Create")}- {!isFinalStep && "Next"}- </Button>+ <div className="flex shrink-0 items-center justify-between gap-3 border-t border-border px-6 py-4">+ <span className="text-xs text-muted" />+ <div className="flex items-center gap-3">+ <span className="text-xs text-muted">+ Step {selectedStepIndex + 1} of {STEPS.length}+ </span>+ {selectedStepIndex > 0 && (+ <Button type="button" variant="outline" onClick={goBack}>+ Back+ </Button>+ )}+ {isFinalStep ? (+ <Button+ key="submit-cta"+ type="button"+ variant="project"+ isPending={isSubmitting}+ isDisabled={isSubmitting}+ onClick={handleSubmit(onFormSubmit, (errors) => {+ const errorKeys = Object.keys(errors);+ const stepIndex = STEPS.findIndex((s) =>+ s.fields.some((fld) => errorKeys.includes(fld))+ );+ if (stepIndex >= 0) setSelectedStepIndex(stepIndex);+ createNotification({+ text: "Please fix the highlighted errors before saving.",+ type: "error"+ });+ })}+ >+ {isEdit ? "Save Changes" : "Create Profile"}+ </Button>+ ) : (+ <Button key="continue-cta" type="button" variant="project" onClick={goNext}>+ Continue+ </Button>+ )}+ </div></div></form>- <CreatePolicyModal- isOpen={popUp.createPolicy.isOpen}- onClose={() => handlePopUpToggle("createPolicy", false)}- onComplete={async (createdPolicy) => {- await queryClient.refetchQueries({- queryKey: ["list-certificate-policies", currentProject?.id]- });- setValue("certificatePolicyId", createdPolicy.id, { shouldValidate: true });- handlePopUpToggle("createPolicy", false);- }}- />- </ModalContent>- </Modal>+ </SheetContent>++ <CreatePolicyModal+ isOpen={popUp.createPolicy.isOpen}+ onClose={() => handlePopUpToggle("createPolicy", false)}+ onComplete={async (createdPolicy) => {+ await queryClient.refetchQueries({+ queryKey: ["list-certificate-policies", currentProject?.id]+ });+ setValue("certificatePolicyId", createdPolicy.id, { shouldValidate: true });+ handlePopUpToggle("createPolicy", false);+ }}+ />+ </Sheet>);};diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal/ProfileDefaultsStep.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal/ProfileDefaultsStep.tsxnew file mode 100644index 0000000000..bd9718abdc--- /dev/null+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal/ProfileDefaultsStep.tsx@@ -0,0 +1,535 @@+import { useMemo } from "react";+import { Control, Controller, UseFormSetValue, UseFormWatch } from "react-hook-form";+import { FileBadge, Plus, Trash2 } from "lucide-react";++import {+ Button,+ Checkbox,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "@app/components/v3";+import {+ EXTENDED_KEY_USAGES_OPTIONS,+ KEY_USAGES_OPTIONS+} from "@app/hooks/api/certificates/constants";+import {+ CertSubjectAlternativeNameType,+ CertSubjectAttributeType,+ formatSANType,+ formatSubjectAttributeType+} from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";++import type { FormData } from "../CreateProfileModal";++export type PolicyConstraints = {+ allowedKeyUsages: string[];+ allowedExtendedKeyUsages: string[];+ requiredKeyUsages: string[];+ requiredExtendedKeyUsages: string[];+ allowedSignatureAlgorithms: Array<{ value: string; label: string }>;+ allowedKeyAlgorithms: Array<{ value: string; label: string }>;+ allowedSubjectAttributeTypes: CertSubjectAttributeType[];+ shouldShowSubjectSection: boolean;+ allowedSanTypes: CertSubjectAlternativeNameType[];+ shouldShowSanSection: boolean;+ policyAllowsCA: boolean;+ maxPathLength: number | undefined;+};++const NO_DEFAULT = "__none__";++const isMultiValuedAttribute = (type: CertSubjectAttributeType) =>+ type === CertSubjectAttributeType.DOMAIN_COMPONENT;++const subjectAttrPlaceholder = (type: CertSubjectAttributeType): string => {+ switch (type) {+ case CertSubjectAttributeType.COMMON_NAME:+ return "example.com";+ case CertSubjectAttributeType.ORGANIZATION:+ return "Acme Inc.";+ case CertSubjectAttributeType.ORGANIZATIONAL_UNIT:+ return "Engineering";+ case CertSubjectAttributeType.COUNTRY:+ return "US";+ case CertSubjectAttributeType.STATE:+ return "California";+ case CertSubjectAttributeType.LOCALITY:+ return "San Francisco";+ case CertSubjectAttributeType.DOMAIN_COMPONENT:+ return "example";+ default:+ return "";+ }+};++const SectionHeading = ({ title, description }: { title: string; description: string }) => (+ <div>+ <p className="text-sm font-medium text-foreground">{title}</p>+ <p className="mt-0.5 text-xs text-muted">{description}</p>+ </div>+);++type EditableEntry<T extends string> = { type: T; value: string };++type AttributeListEditorProps<T extends string> = {+ title: string;+ description: string;+ emptyMessage: string;+ keyPrefix: string;+ selectTriggerClassName: string;+ items: EditableEntry<T>[];+ getSelectableTypes: (entry: EditableEntry<T>, index: number) => T[];+ formatType: (type: T) => string;+ getPlaceholder: (type: T) => string;+ onItemsChange: (next: EditableEntry<T>[]) => void;+ showAddButton: boolean;+ addButtonLabel: string;+ onAdd: () => void;+};++const AttributeListEditor = <T extends string>({+ title,+ description,+ emptyMessage,+ keyPrefix,+ selectTriggerClassName,+ items,+ getSelectableTypes,+ formatType,+ getPlaceholder,+ onItemsChange,+ showAddButton,+ addButtonLabel,+ onAdd+}: AttributeListEditorProps<T>) => (+ <div>+ <SectionHeading title={title} description={description} />+ <div className="mt-4 space-y-3">+ {items.length === 0 && <p className="text-xs text-muted">{emptyMessage}</p>}+ {items.map((entry, index) => {+ const selectableTypes = getSelectableTypes(entry, index);+ return (+ // eslint-disable-next-line react/no-array-index-key+ <div key={`${keyPrefix}${index}`} className="flex items-start gap-2">+ <Select+ value={entry.type}+ onValueChange={(value) => {+ const next = [...items];+ next[index] = { ...entry, type: value as T };+ onItemsChange(next);+ }}+ >+ <SelectTrigger className={selectTriggerClassName}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ {selectableTypes.map((type) => (+ <SelectItem key={type} value={type}>+ {formatType(type)}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <Input+ placeholder={getPlaceholder(entry.type)}+ value={entry.value}+ className="flex-1"+ onChange={(e) => {+ const next = [...items];+ next[index] = { ...entry, value: e.target.value };+ onItemsChange(next);+ }}+ />+ <Button+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => onItemsChange(items.filter((_, i) => i !== index))}+ >+ <Trash2 className="size-4" />+ </Button>+ </div>+ );+ })}+ {showAddButton && (+ <Button type="button" variant="outline" size="sm" onClick={onAdd}>+ <Plus className="size-4" /> {addButtonLabel}+ </Button>+ )}+ </div>+ </div>+);++type KeyUsageGridProps = {+ title: string;+ description: string;+ idPrefix: string;+ options: ReadonlyArray<{ value: string; label: string }>;+ requiredUsages: string[];+ values: Record<string, boolean | undefined>;+ onChange: (next: Record<string, boolean>) => void;+};++const KeyUsageGrid = ({+ title,+ description,+ idPrefix,+ options,+ requiredUsages,+ values,+ onChange+}: KeyUsageGridProps) => (+ <div>+ <SectionHeading title={title} description={description} />+ <div className="mt-4 grid grid-cols-2 gap-3">+ {options.map((option) => {+ const isRequired = requiredUsages.includes(option.value);+ return (+ <div key={option.value} className="flex items-center gap-3">+ <Checkbox+ id={`${idPrefix}${option.value}`}+ variant="project"+ isChecked={isRequired || Boolean(values[option.value])}+ isDisabled={isRequired}+ onCheckedChange={(checked) => {+ if (isRequired) return;+ onChange({ ...values, [option.value]: Boolean(checked) } as Record<+ string,+ boolean+ >);+ }}+ />+ <label+ htmlFor={`${idPrefix}${option.value}`}+ className="flex cursor-pointer items-center gap-2 text-sm text-foreground"+ >+ {option.label}+ {isRequired && <span className="text-xs text-muted">(Required)</span>}+ </label>+ </div>+ );+ })}+ </div>+ </div>+);++type Props = {+ control: Control<FormData>;+ watch: UseFormWatch<FormData>;+ setValue: UseFormSetValue<FormData>;+ policyConstraints: PolicyConstraints;+ isAwsAcmPublicCa: boolean;+};++export const ProfileDefaultsStep = ({+ control,+ watch,+ setValue,+ policyConstraints,+ isAwsAcmPublicCa+}: Props) => {+ const watchedPolicyId = watch("certificatePolicyId");+ const watchedDefaultsIsCA = watch("defaults.basicConstraints.isCA") || false;+ const watchedDefaultSubjectAttrs = watch("defaults.subjectAttributes") || [];+ const watchedDefaultSans = watch("defaults.subjectAltNames") || [];+ const watchedDefaultSigAlg = watch("defaults.signatureAlgorithm") ?? null;+ const watchedDefaultKeyAlg = watch("defaults.keyAlgorithm") ?? null;+ const watchedDefaultKeyUsages = watch("defaults.keyUsages") || {};+ const watchedDefaultExtKeyUsages = watch("defaults.extendedKeyUsages") || {};++ const filteredKeyUsages = useMemo(+ () =>+ KEY_USAGES_OPTIONS.filter(({ value }) => policyConstraints.allowedKeyUsages.includes(value)),+ [policyConstraints.allowedKeyUsages]+ );++ const filteredExtendedKeyUsages = useMemo(+ () =>+ EXTENDED_KEY_USAGES_OPTIONS.filter(({ value }) =>+ policyConstraints.allowedExtendedKeyUsages.includes(value)+ ),+ [policyConstraints.allowedExtendedKeyUsages]+ );++ const usedAttributeTypes = watchedDefaultSubjectAttrs.map(+ (attr: { type: CertSubjectAttributeType; value: string }) => attr.type+ );+ const availableAttributeTypes = policyConstraints.allowedSubjectAttributeTypes.filter(+ (type) => isMultiValuedAttribute(type) || !usedAttributeTypes.includes(type)+ );++ if (!watchedPolicyId) {+ return (+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <FileBadge />+ </EmptyMedia>+ <EmptyTitle>+ Select a certificate policy on the Issuer step to configure defaults.+ </EmptyTitle>+ </EmptyHeader>+ </Empty>+ );+ }++ return (+ <div className="space-y-8">+ <Controller+ name="defaults.ttlDays"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Time to Live (TTL) in Days</FieldLabel>+ <FieldContent>+ <Input+ type="number"+ placeholder="e.g. 365"+ value={field.value == null ? "" : field.value}+ isError={Boolean(error)}+ disabled={isAwsAcmPublicCa}+ onChange={(e) => {+ const val = e.target.value;+ field.onChange(val === "" ? null : Number(val));+ }}+ />+ <FieldDescription>+ {isAwsAcmPublicCa+ ? "AWS ACM Public CA issues certificates with a fixed 198-day validity. This field cannot be changed."+ : "Fallback validity period used when not explicitly specified in a certificate request. Leave empty for no TTL default."}+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />++ {policyConstraints.shouldShowSubjectSection && (+ <AttributeListEditor<CertSubjectAttributeType>+ title="Subject Attributes"+ description="Default subject attribute values applied when a request omits them."+ emptyMessage="No subject attribute defaults configured."+ keyPrefix="def-attr-"+ selectTriggerClassName="w-52"+ items={watchedDefaultSubjectAttrs}+ getSelectableTypes={(attr) =>+ policyConstraints.allowedSubjectAttributeTypes.filter(+ (type) =>+ type === attr.type ||+ isMultiValuedAttribute(type) ||+ !usedAttributeTypes.includes(type)+ )+ }+ formatType={formatSubjectAttributeType}+ getPlaceholder={subjectAttrPlaceholder}+ onItemsChange={(next) => setValue("defaults.subjectAttributes", next)}+ showAddButton={availableAttributeTypes.length > 0}+ addButtonLabel="Add attribute"+ onAdd={() =>+ setValue("defaults.subjectAttributes", [+ ...watchedDefaultSubjectAttrs,+ { type: availableAttributeTypes[0], value: "" }+ ])+ }+ />+ )}++ {policyConstraints.shouldShowSanSection && (+ <AttributeListEditor<CertSubjectAlternativeNameType>+ title="Subject Alternative Names"+ description="Default subject alternative names applied when a request omits them."+ emptyMessage="No SAN defaults configured."+ keyPrefix="def-san-"+ selectTriggerClassName="w-40"+ items={watchedDefaultSans}+ getSelectableTypes={() => policyConstraints.allowedSanTypes}+ formatType={formatSANType}+ getPlaceholder={() => "example.com or *.example.com"}+ onItemsChange={(next) => setValue("defaults.subjectAltNames", next)}+ showAddButton+ addButtonLabel="Add SAN"+ onAdd={() =>+ setValue("defaults.subjectAltNames", [+ ...watchedDefaultSans,+ {+ type:+ policyConstraints.allowedSanTypes[0] ?? CertSubjectAlternativeNameType.DNS_NAME,+ value: ""+ }+ ])+ }+ />+ )}++ {(policyConstraints.allowedSignatureAlgorithms.length > 0 ||+ policyConstraints.allowedKeyAlgorithms.length > 0) && (+ <div>+ <SectionHeading+ title="Algorithms"+ description="Default signature and key algorithms applied when a request omits them."+ />+ <div className="mt-4 flex gap-3">+ {policyConstraints.allowedSignatureAlgorithms.length > 0 && (+ <Field className="flex-1">+ <FieldLabel>Signature Algorithm</FieldLabel>+ <FieldContent>+ <Select+ value={watchedDefaultSigAlg ?? NO_DEFAULT}+ onValueChange={(value) =>+ setValue("defaults.signatureAlgorithm", value === NO_DEFAULT ? null : value)+ }+ >+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={NO_DEFAULT}>No default</SelectItem>+ {policyConstraints.allowedSignatureAlgorithms.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FieldContent>+ </Field>+ )}+ {policyConstraints.allowedKeyAlgorithms.length > 0 && (+ <Field className="flex-1">+ <FieldLabel>Key Algorithm</FieldLabel>+ <FieldContent>+ <Select+ value={watchedDefaultKeyAlg ?? NO_DEFAULT}+ onValueChange={(value) =>+ setValue("defaults.keyAlgorithm", value === NO_DEFAULT ? null : value)+ }+ >+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value={NO_DEFAULT}>No default</SelectItem>+ {policyConstraints.allowedKeyAlgorithms.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FieldContent>+ </Field>+ )}+ </div>+ </div>+ )}++ {filteredKeyUsages.length > 0 && (+ <KeyUsageGrid+ title="Key Usages"+ description="Key usages applied by default to issued certificates."+ idPrefix="def-ku-"+ options={filteredKeyUsages}+ requiredUsages={policyConstraints.requiredKeyUsages}+ values={watchedDefaultKeyUsages}+ onChange={(next) => setValue("defaults.keyUsages", next)}+ />+ )}++ {filteredExtendedKeyUsages.length > 0 && (+ <KeyUsageGrid+ title="Extended Key Usages"+ description="Extended key usages applied by default to issued certificates."+ idPrefix="def-eku-"+ options={filteredExtendedKeyUsages}+ requiredUsages={policyConstraints.requiredExtendedKeyUsages}+ values={watchedDefaultExtKeyUsages}+ onChange={(next) => setValue("defaults.extendedKeyUsages", next)}+ />+ )}++ {policyConstraints.policyAllowsCA && (+ <div>+ <SectionHeading+ title="Basic Constraints"+ description="Control whether issued certificates act as a CA by default."+ />+ <div className="mt-4 space-y-4">+ <Controller+ control={control}+ name="defaults.basicConstraints.isCA"+ render={({ field: { value, onChange } }) => (+ <div className="flex items-start gap-3">+ <Checkbox+ id="defaults-isCA"+ variant="project"+ isChecked={value || false}+ onCheckedChange={(checked) => {+ onChange(checked);+ if (!checked) {+ setValue("defaults.basicConstraints.pathLength", undefined);+ }+ }}+ />+ <span className="text-sm text-foreground">+ Issue as Certificate Authority+ <span className="mt-1 block text-xs text-muted">+ Certificates will default to the CA:TRUE extension.+ </span>+ </span>+ </div>+ )}+ />++ {watchedDefaultsIsCA && (+ <Controller+ control={control}+ name="defaults.basicConstraints.pathLength"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Path Length</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ type="number"+ min={0}+ placeholder="Leave empty for no constraint"+ isError={Boolean(error)}+ value={field.value ?? ""}+ onChange={(e) => {+ const val = e.target.value;+ if (val === "") {+ field.onChange(null);+ } else {+ const numVal = parseInt(val, 10);+ field.onChange(Number.isNaN(numVal) ? null : numVal);+ }+ }}+ />+ <FieldDescription>+ How many sub-CA levels can exist below this certificate.+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ )}+ </div>+ </div>+ )}+ </div>+ );+};