mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-02 00:36:38 +00:00
🚸 trigger null domain change if the user switches from another domain type to free domain option to prevent the modal from registering it as a valid value
This commit is contained in:
@@ -506,13 +506,17 @@ export default function GeneralForm() {
|
|||||||
}
|
}
|
||||||
defaultFullDomain={resourceFullDomainName}
|
defaultFullDomain={resourceFullDomainName}
|
||||||
onDomainChange={(res) => {
|
onDomainChange={(res) => {
|
||||||
const selected = {
|
const selected =
|
||||||
domainId: res.domainId,
|
res === null
|
||||||
subdomain: res.subdomain,
|
? null
|
||||||
fullDomain: res.fullDomain,
|
: {
|
||||||
baseDomain: res.baseDomain,
|
domainId: res.domainId,
|
||||||
domainNamespaceId: res.domainNamespaceId
|
subdomain: res.subdomain,
|
||||||
};
|
fullDomain: res.fullDomain,
|
||||||
|
baseDomain: res.baseDomain,
|
||||||
|
domainNamespaceId:
|
||||||
|
res.domainNamespaceId
|
||||||
|
};
|
||||||
setSelectedDomain(selected);
|
setSelectedDomain(selected);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1396,6 +1396,8 @@ export default function Page() {
|
|||||||
<DomainPicker
|
<DomainPicker
|
||||||
orgId={orgId as string}
|
orgId={orgId as string}
|
||||||
onDomainChange={(res) => {
|
onDomainChange={(res) => {
|
||||||
|
if (!res) return;
|
||||||
|
|
||||||
httpForm.setValue(
|
httpForm.setValue(
|
||||||
"subdomain",
|
"subdomain",
|
||||||
res.subdomain
|
res.subdomain
|
||||||
|
|||||||
@@ -64,14 +64,16 @@ type DomainOption = {
|
|||||||
|
|
||||||
interface DomainPickerProps {
|
interface DomainPickerProps {
|
||||||
orgId: string;
|
orgId: string;
|
||||||
onDomainChange?: (domainInfo: {
|
onDomainChange?: (
|
||||||
domainId: string;
|
domainInfo: {
|
||||||
domainNamespaceId?: string;
|
domainId: string;
|
||||||
type: "organization" | "provided";
|
domainNamespaceId?: string;
|
||||||
subdomain?: string;
|
type: "organization" | "provided";
|
||||||
fullDomain: string;
|
subdomain?: string;
|
||||||
baseDomain: string;
|
fullDomain: string;
|
||||||
}) => void;
|
baseDomain: string;
|
||||||
|
} | null
|
||||||
|
) => void;
|
||||||
cols?: number;
|
cols?: number;
|
||||||
hideFreeDomain?: boolean;
|
hideFreeDomain?: boolean;
|
||||||
defaultFullDomain?: string | null;
|
defaultFullDomain?: string | null;
|
||||||
@@ -374,16 +376,21 @@ export default function DomainPicker({
|
|||||||
|
|
||||||
const fullDomain = sub ? `${sub}.${option.domain}` : option.domain;
|
const fullDomain = sub ? `${sub}.${option.domain}` : option.domain;
|
||||||
|
|
||||||
onDomainChange?.({
|
if (option.type === "provided-search") {
|
||||||
domainId: option.domainId || "",
|
onDomainChange?.(null); // prevent the modal from closing with `<subdomain>.Free Provided domain`
|
||||||
domainNamespaceId: option.domainNamespaceId,
|
} else {
|
||||||
type:
|
onDomainChange?.({
|
||||||
option.type === "provided-search" ? "provided" : "organization",
|
domainId: option.domainId || "",
|
||||||
subdomain:
|
domainNamespaceId: option.domainNamespaceId,
|
||||||
option.domainType !== "cname" ? sub || undefined : undefined,
|
type: "organization",
|
||||||
fullDomain,
|
subdomain:
|
||||||
baseDomain: option.domain
|
option.domainType !== "cname"
|
||||||
});
|
? sub || undefined
|
||||||
|
: undefined,
|
||||||
|
fullDomain,
|
||||||
|
baseDomain: option.domain
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleProvidedDomainSelect = (option: AvailableOption) => {
|
const handleProvidedDomainSelect = (option: AvailableOption) => {
|
||||||
|
|||||||
@@ -519,12 +519,15 @@ const AuthPageSettings = forwardRef<AuthPageSettingsRef, AuthPageSettingsProps>(
|
|||||||
loginPage?.subdomain
|
loginPage?.subdomain
|
||||||
}
|
}
|
||||||
onDomainChange={(res) => {
|
onDomainChange={(res) => {
|
||||||
const selected = {
|
const selected =
|
||||||
domainId: res.domainId,
|
res === null
|
||||||
subdomain: res.subdomain,
|
? null
|
||||||
fullDomain: res.fullDomain,
|
: {
|
||||||
baseDomain: res.baseDomain
|
domainId: res.domainId,
|
||||||
};
|
subdomain: res.subdomain,
|
||||||
|
fullDomain: res.fullDomain,
|
||||||
|
baseDomain: res.baseDomain
|
||||||
|
};
|
||||||
setSelectedDomain(selected);
|
setSelectedDomain(selected);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user