Use a records for the wildcard

This commit is contained in:
Owen
2025-07-17 16:17:01 -07:00
parent e562946308
commit 0a2b1d9e53
3 changed files with 247 additions and 202 deletions

View File

@@ -1266,6 +1266,7 @@
"createDomainName": "Name:", "createDomainName": "Name:",
"createDomainValue": "Value:", "createDomainValue": "Value:",
"createDomainCnameRecords": "CNAME Records", "createDomainCnameRecords": "CNAME Records",
"createDomainARecords": "A Records",
"createDomainRecordNumber": "Record {number}", "createDomainRecordNumber": "Record {number}",
"createDomainTxtRecords": "TXT Records", "createDomainTxtRecords": "TXT Records",
"createDomainSaveTheseRecords": "Save These Records", "createDomainSaveTheseRecords": "Save These Records",

View File

@@ -29,6 +29,7 @@ export type CreateDomainResponse = {
domainId: string; domainId: string;
nsRecords?: string[]; nsRecords?: string[];
cnameRecords?: { baseDomain: string; value: string }[]; cnameRecords?: { baseDomain: string; value: string }[];
aRecords?: { baseDomain: string; value: string }[];
txtRecords?: { baseDomain: string; value: string }[]; txtRecords?: { baseDomain: string; value: string }[];
}; };
@@ -97,6 +98,7 @@ export async function createOrgDomain(
} }
let numOrgDomains: OrgDomains[] | undefined; let numOrgDomains: OrgDomains[] | undefined;
let aRecords: CreateDomainResponse["aRecords"];
let cnameRecords: CreateDomainResponse["cnameRecords"]; let cnameRecords: CreateDomainResponse["cnameRecords"];
let txtRecords: CreateDomainResponse["txtRecords"]; let txtRecords: CreateDomainResponse["txtRecords"];
let nsRecords: CreateDomainResponse["nsRecords"]; let nsRecords: CreateDomainResponse["nsRecords"];
@@ -239,7 +241,7 @@ export async function createOrgDomain(
} }
]; ];
} else if (type === "wildcard") { } else if (type === "wildcard") {
cnameRecords = [ aRecords = [
{ {
value: `Server IP Address`, value: `Server IP Address`,
baseDomain: `*.${baseDomain}` baseDomain: `*.${baseDomain}`
@@ -271,7 +273,8 @@ export async function createOrgDomain(
domainId: returned.domainId, domainId: returned.domainId,
cnameRecords, cnameRecords,
txtRecords, txtRecords,
nsRecords nsRecords,
aRecords
}, },
success: true, success: true,
error: false, error: false,

View File

@@ -205,225 +205,266 @@ export default function CreateDomainForm({
</Alert> </Alert>
<div className="space-y-4"> <div className="space-y-4">
{domainType === "ns" && {createdDomain.nsRecords &&
createdDomain.nsRecords && ( createdDomain.nsRecords.length > 0 && (
<div> <div>
<h3 className="font-medium mb-3"> <h3 className="font-medium mb-3">
{t("createDomainNsRecords")} {t("createDomainNsRecords")}
</h3> </h3>
<InfoSections cols={1}> <InfoSections cols={1}>
<InfoSection> <InfoSection>
<InfoSectionTitle> <InfoSectionTitle>
{t( {t("createDomainRecord")}
"createDomainRecord" </InfoSectionTitle>
)} <InfoSectionContent>
</InfoSectionTitle> <div className="space-y-2">
<InfoSectionContent> <div className="flex justify-between items-center">
<div className="space-y-2">
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainType"
)}
</span>
<span className="text-sm font-mono">
NS
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainName"
)}
</span>
<span className="text-sm font-mono">
{baseDomain}
</span>
</div>
<span className="text-sm font-medium"> <span className="text-sm font-medium">
{t( {t(
"createDomainValue" "createDomainType"
)} )}
</span> </span>
{createdDomain.nsRecords.map( <span className="text-sm font-mono">
( NS
nsRecord, </span>
index </div>
) => ( <div className="flex justify-between items-center">
<div <span className="text-sm font-medium">
className="flex justify-between items-center" {t(
key={ "createDomainName"
index )}
</span>
<span className="text-sm font-mono">
{baseDomain}
</span>
</div>
<span className="text-sm font-medium">
{t(
"createDomainValue"
)}
</span>
{createdDomain.nsRecords.map(
(
nsRecord,
index
) => (
<div
className="flex justify-between items-center"
key={index}
>
<CopyToClipboard
text={
nsRecord
} }
> />
</div>
)
)}
</div>
</InfoSectionContent>
</InfoSection>
</InfoSections>
</div>
)}
{createdDomain.cnameRecords &&
createdDomain.cnameRecords.length > 0 && (
<div>
<h3 className="font-medium mb-3">
{t("createDomainCnameRecords")}
</h3>
<InfoSections cols={1}>
{createdDomain.cnameRecords.map(
(cnameRecord, index) => (
<InfoSection
key={index}
>
<InfoSectionTitle>
{t(
"createDomainRecordNumber",
{
number:
index +
1
}
)}
</InfoSectionTitle>
<InfoSectionContent>
<div className="space-y-2">
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainType"
)}
</span>
<span className="text-sm font-mono">
CNAME
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainName"
)}
</span>
<span className="text-sm font-mono">
{
cnameRecord.baseDomain
}
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainValue"
)}
</span>
<CopyToClipboard <CopyToClipboard
text={ text={
nsRecord cnameRecord.value
} }
/> />
</div> </div>
) </div>
)} </InfoSectionContent>
</div> </InfoSection>
</InfoSectionContent> )
</InfoSection> )}
</InfoSections> </InfoSections>
</div> </div>
)} )}
{(domainType == "cname" || {createdDomain.aRecords &&
domainType == "wildcard") && ( createdDomain.aRecords.length > 0 && (
<> <div>
{createdDomain.cnameRecords && <h3 className="font-medium mb-3">
createdDomain.cnameRecords {t("createDomainARecords")}
.length > 0 && ( </h3>
<div> <InfoSections cols={1}>
<h3 className="font-medium mb-3"> {createdDomain.aRecords.map(
{t( (aRecord, index) => (
"createDomainCnameRecords" <InfoSection
)} key={index}
</h3> >
<InfoSections cols={1}> <InfoSectionTitle>
{createdDomain.cnameRecords.map( {t(
( "createDomainRecordNumber",
cnameRecord, {
index number:
) => ( index +
<InfoSection 1
key={ }
index )}
} </InfoSectionTitle>
> <InfoSectionContent>
<InfoSectionTitle> <div className="space-y-2">
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t( {t(
"createDomainRecordNumber", "createDomainType"
{
number:
index +
1
}
)} )}
</InfoSectionTitle> </span>
<InfoSectionContent> <span className="text-sm font-mono">
<div className="space-y-2"> A
<div className="flex justify-between items-center"> </span>
<span className="text-sm font-medium"> </div>
{t( <div className="flex justify-between items-center">
"createDomainType" <span className="text-sm font-medium">
)}
</span>
<span className="text-sm font-mono">
CNAME
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainName"
)}
</span>
<span className="text-sm font-mono">
{
cnameRecord.baseDomain
}
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainValue"
)}
</span>
<CopyToClipboard
text={
cnameRecord.value
}
/>
</div>
</div>
</InfoSectionContent>
</InfoSection>
)
)}
</InfoSections>
</div>
)}
{createdDomain.txtRecords &&
createdDomain.txtRecords
.length > 0 && (
<div>
<h3 className="font-medium mb-3">
{t(
"createDomainTxtRecords"
)}
</h3>
<InfoSections cols={1}>
{createdDomain.txtRecords.map(
(
txtRecord,
index
) => (
<InfoSection
key={
index
}
>
<InfoSectionTitle>
{t( {t(
"createDomainRecordNumber", "createDomainName"
{
number:
index +
1
}
)} )}
</InfoSectionTitle> </span>
<InfoSectionContent> <span className="text-sm font-mono">
<div className="space-y-2"> {
<div className="flex justify-between items-center"> aRecord.baseDomain
<span className="text-sm font-medium"> }
{t( </span>
"createDomainType" </div>
)} <div className="flex justify-between items-center">
</span> <span className="text-sm font-medium">
<span className="text-sm font-mono"> {t(
TXT "createDomainValue"
</span> )}
</div> </span>
<div className="flex justify-between items-center"> <span className="text-sm font-mono">
<span className="text-sm font-medium"> {
{t( aRecord.value
"createDomainName" }
)} </span>
</span> </div>
<span className="text-sm font-mono"> </div>
{ </InfoSectionContent>
txtRecord.baseDomain </InfoSection>
} )
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainValue"
)}
</span>
<CopyToClipboard
text={
txtRecord.value
}
/>
</div>
</div>
</InfoSectionContent>
</InfoSection>
)
)}
</InfoSections>
</div>
)} )}
</> </InfoSections>
</div>
)}
{createdDomain.txtRecords &&
createdDomain.txtRecords.length > 0 && (
<div>
<h3 className="font-medium mb-3">
{t("createDomainTxtRecords")}
</h3>
<InfoSections cols={1}>
{createdDomain.txtRecords.map(
(txtRecord, index) => (
<InfoSection
key={index}
>
<InfoSectionTitle>
{t(
"createDomainRecordNumber",
{
number:
index +
1
}
)}
</InfoSectionTitle>
<InfoSectionContent>
<div className="space-y-2">
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainType"
)}
</span>
<span className="text-sm font-mono">
TXT
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainName"
)}
</span>
<span className="text-sm font-mono">
{
txtRecord.baseDomain
}
</span>
</div>
<div className="flex justify-between items-center">
<span className="text-sm font-medium">
{t(
"createDomainValue"
)}
</span>
<CopyToClipboard
text={
txtRecord.value
}
/>
</div>
</div>
</InfoSectionContent>
</InfoSection>
)
)}
</InfoSections>
</div>
)} )}
</div> </div>