From 812b23d2d068b57f2aa97446b017756a6258a904 Mon Sep 17 00:00:00 2001 From: Echo Date: Wed, 6 May 2026 01:58:32 +0000 Subject: [PATCH] fix: simplify host cert section to only show agent deployment files - Remove client cert/key from KeyDisplayDialog on host detail page - Bundle download now only contains ca.crt, server.crt, server.key - Rename bundle to {hostname}-agent-certs.zip - Remove standalone client cert download button - Update dialog title and warning text - The main Certificates page still has all certs available --- frontend/src/pages/HostDetailPage.tsx | 65 ++++----------------------- 1 file changed, 9 insertions(+), 56 deletions(-) diff --git a/frontend/src/pages/HostDetailPage.tsx b/frontend/src/pages/HostDetailPage.tsx index 472f471..edb6324 100644 --- a/frontend/src/pages/HostDetailPage.tsx +++ b/frontend/src/pages/HostDetailPage.tsx @@ -320,10 +320,10 @@ interface KeyDisplayDialogProps { } function KeyDisplayDialog({ open, cert, hostname, onClose }: KeyDisplayDialogProps) { - const [copiedField, setCopiedField] = useState<'ca' | 'cert' | 'key' | 'server-cert' | 'server-key' | null>(null) + const [copiedField, setCopiedField] = useState<'ca' | 'server-cert' | 'server-key' | null>(null) const [downloading, setDownloading] = useState(false) - const handleCopy = async (text: string, field: 'ca' | 'cert' | 'key' | 'server-cert' | 'server-key') => { + const handleCopy = async (text: string, field: 'ca' | 'server-cert' | 'server-key') => { await navigator.clipboard.writeText(text) setCopiedField(field) setTimeout(() => setCopiedField(null), 2000) @@ -335,15 +335,13 @@ function KeyDisplayDialog({ open, cert, hostname, onClose }: KeyDisplayDialogPro try { const zip = new JSZip() zip.file('ca.crt', cert.ca_root_pem) - zip.file('client.crt', cert.cert_pem) - zip.file('client.key', cert.key_pem) zip.file('server.crt', cert.server_cert_pem) zip.file('server.key', cert.server_key_pem) const blob = await zip.generateAsync({ type: 'blob' }) const url = URL.createObjectURL(blob) const a = document.createElement('a') a.href = url - a.download = `${hostname || 'host'}-certs.zip` + a.download = `${hostname || 'host'}-agent-certs.zip` a.click() URL.revokeObjectURL(url) } finally { @@ -365,16 +363,15 @@ function KeyDisplayDialog({ open, cert, hostname, onClose }: KeyDisplayDialogPro return ( - Agent Certificate Bundle Issued — Save Your Private Keys + Agent Certificates Issued — Save Your Private Key - Private keys will NOT be shown again. Copy and store them securely - before closing this dialog. + The server private key will NOT be shown again. Download the bundle or copy it now. {cert && ( <> - Client Serial: {cert.serial_number}  |  Server Serial: {cert.server_serial_number}  |  Expires: {new Date(cert.expires_at).toLocaleDateString()} + Server Serial: {cert.server_serial_number}  |  Expires: {new Date(cert.expires_at).toLocaleDateString()} {/* CA Root Certificate */} @@ -390,31 +387,7 @@ function KeyDisplayDialog({ open, cert, hostname, onClose }: KeyDisplayDialogPro {cert.ca_root_pem} - {/* Client Certificate (mTLS) */} - - - Client Certificate — mTLS (client.crt) - - - - - {cert.cert_pem} - - {/* Client Private Key */} - - - Client Private Key (client.key) - - - - - {cert.key_pem} - {/* Server Certificate (Agent TLS) */} @@ -450,9 +423,9 @@ function KeyDisplayDialog({ open, cert, hostname, onClose }: KeyDisplayDialogPro onClick={handleDownloadBundle} disabled={downloading || !cert} > - {downloading ? : 'Download Bundle (.zip)'} + {downloading ? : 'Download Agent Bundle (.zip)'} - + ) @@ -726,22 +699,6 @@ export default function HostDetailPage() { } } - // ── Download client cert ───────────────────────────────────────────────── - const handleDownloadClientCert = async () => { - if (!id) return - try { - const res = await certsApi.downloadClientCert(id) - const url = URL.createObjectURL(res.data as Blob) - const a = document.createElement('a') - a.href = url - a.download = 'client.crt' - a.click() - URL.revokeObjectURL(url) - } catch { - showSnack('No client certificate found for this host', 'error') - } - } - // ── Issue client certificate ────────────────────────────────────────────── const handleOpenIssueCert = () => { setIssueCertHostname(String(host?.fqdn ?? '')) @@ -930,11 +887,7 @@ export default function HostDetailPage() { Re-issue Certificate )} - - - - - +