Update get cert to now allow restarting

This commit is contained in:
Owen
2026-04-27 16:14:20 -07:00
parent 08e9cb862d
commit 7affaf63d0
3 changed files with 7 additions and 5 deletions

View File

@@ -40,6 +40,8 @@ async function query(domainId: string, domain: string) {
throw new Error(`Domain with ID ${domainId} not found`); throw new Error(`Domain with ID ${domainId} not found`);
} }
const domainType = domainRecord.type;
let existing: any[] = []; let existing: any[] = [];
if (domainRecord.type == "ns" || domainRecord.type == "wildcard") { if (domainRecord.type == "ns" || domainRecord.type == "wildcard") {
const domainLevelDown = domain.split(".").slice(1).join("."); const domainLevelDown = domain.split(".").slice(1).join(".");
@@ -98,7 +100,7 @@ async function query(domainId: string, domain: string) {
); );
} }
return existing.length > 0 ? existing[0] : null; return existing.length > 0 ? { ...existing[0], domainType } : null;
} }
registry.registerPath({ registry.registerPath({

View File

@@ -3,6 +3,7 @@ export type GetCertificateResponse = {
domain: string; domain: string;
domainId: string; domainId: string;
wildcard: boolean; wildcard: boolean;
domainType: string;
status: string; // pending, requested, valid, expired, failed status: string; // pending, requested, valid, expired, failed
expiresAt: string | null; expiresAt: string | null;
lastRenewalAttempt: Date | null; lastRenewalAttempt: Date | null;
@@ -10,4 +11,4 @@ export type GetCertificateResponse = {
updatedAt: number; updatedAt: number;
errorMessage?: string | null; errorMessage?: string | null;
renewalCount: number; renewalCount: number;
}; };

View File

@@ -12,7 +12,6 @@ type CertificateStatusProps = {
autoFetch?: boolean; autoFetch?: boolean;
showLabel?: boolean; showLabel?: boolean;
className?: string; className?: string;
disableRestartButton?: boolean;
onRefresh?: () => void; onRefresh?: () => void;
polling?: boolean; polling?: boolean;
pollingInterval?: number; pollingInterval?: number;
@@ -24,7 +23,6 @@ export default function CertificateStatus({
fullDomain, fullDomain,
autoFetch = true, autoFetch = true,
showLabel = true, showLabel = true,
disableRestartButton = false,
className = "", className = "",
onRefresh, onRefresh,
polling = false, polling = false,
@@ -120,6 +118,7 @@ export default function CertificateStatus({
} }
const isPending = cert.status === "pending"; const isPending = cert.status === "pending";
const disableRestartButton = cert.domainType === "wildcard";
return ( return (
<div className={`flex items-center gap-2 ${className}`}> <div className={`flex items-center gap-2 ${className}`}>
@@ -133,7 +132,7 @@ export default function CertificateStatus({
variant="ghost" variant="ghost"
className={`h-auto p-0 text-sm ${getStatusColor(cert.status)}`} className={`h-auto p-0 text-sm ${getStatusColor(cert.status)}`}
onClick={handleRefresh} onClick={handleRefresh}
disabled={refreshing} disabled={refreshing || disableRestartButton}
title={t("restartCertificate", { title={t("restartCertificate", {
defaultValue: "Restart Certificate" defaultValue: "Restart Certificate"
})} })}