mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-10 20:06:37 +00:00
fix domain picker
This commit is contained in:
@@ -163,15 +163,18 @@ export default function DomainPicker({
|
|||||||
domainId: firstOrExistingDomain.domainId
|
domainId: firstOrExistingDomain.domainId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const base = firstOrExistingDomain.baseDomain;
|
||||||
|
const sub =
|
||||||
|
firstOrExistingDomain.type !== "cname"
|
||||||
|
? defaultSubdomain?.trim() || undefined
|
||||||
|
: undefined;
|
||||||
|
|
||||||
onDomainChange?.({
|
onDomainChange?.({
|
||||||
domainId: firstOrExistingDomain.domainId,
|
domainId: firstOrExistingDomain.domainId,
|
||||||
type: "organization",
|
type: "organization",
|
||||||
subdomain:
|
subdomain: sub,
|
||||||
firstOrExistingDomain.type !== "cname"
|
fullDomain: sub ? `${sub}.${base}` : base,
|
||||||
? defaultSubdomain || undefined
|
baseDomain: base
|
||||||
: undefined,
|
|
||||||
fullDomain: firstOrExistingDomain.baseDomain,
|
|
||||||
baseDomain: firstOrExistingDomain.baseDomain
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ export function InternalResourceForm({
|
|||||||
alias: null,
|
alias: null,
|
||||||
httpHttpsPort: null,
|
httpHttpsPort: null,
|
||||||
scheme: "http",
|
scheme: "http",
|
||||||
ssl: false,
|
ssl: true,
|
||||||
httpConfigSubdomain: null,
|
httpConfigSubdomain: null,
|
||||||
httpConfigDomainId: null,
|
httpConfigDomainId: null,
|
||||||
httpConfigFullDomain: null,
|
httpConfigFullDomain: null,
|
||||||
@@ -548,7 +548,7 @@ export function InternalResourceForm({
|
|||||||
alias: null,
|
alias: null,
|
||||||
httpHttpsPort: null,
|
httpHttpsPort: null,
|
||||||
scheme: "http",
|
scheme: "http",
|
||||||
ssl: false,
|
ssl: true,
|
||||||
httpConfigSubdomain: null,
|
httpConfigSubdomain: null,
|
||||||
httpConfigDomainId: null,
|
httpConfigDomainId: null,
|
||||||
httpConfigFullDomain: null,
|
httpConfigFullDomain: null,
|
||||||
@@ -732,7 +732,9 @@ export function InternalResourceForm({
|
|||||||
name="siteId"
|
name="siteId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex flex-col">
|
<FormItem className="flex flex-col">
|
||||||
<FormLabel>{t("site")}</FormLabel>
|
<FormLabel>
|
||||||
|
{t("site")}
|
||||||
|
</FormLabel>
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@@ -888,7 +890,10 @@ export function InternalResourceForm({
|
|||||||
{t(destinationLabelKey)}
|
{t(destinationLabelKey)}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} className="w-full" />
|
<Input
|
||||||
|
{...field}
|
||||||
|
className="w-full"
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@@ -947,16 +952,16 @@ export function InternalResourceForm({
|
|||||||
const raw =
|
const raw =
|
||||||
e.target
|
e.target
|
||||||
.value;
|
.value;
|
||||||
if (raw === "") {
|
if (
|
||||||
|
raw === ""
|
||||||
|
) {
|
||||||
field.onChange(
|
field.onChange(
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const n =
|
const n =
|
||||||
Number(
|
Number(raw);
|
||||||
raw
|
|
||||||
);
|
|
||||||
field.onChange(
|
field.onChange(
|
||||||
Number.isFinite(
|
Number.isFinite(
|
||||||
n
|
n
|
||||||
@@ -986,29 +991,6 @@ export function InternalResourceForm({
|
|||||||
{t(httpConfigurationDescriptionKey)}
|
{t(httpConfigurationDescriptionKey)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="ssl"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormControl>
|
|
||||||
<SwitchInput
|
|
||||||
id="internal-resource-ssl"
|
|
||||||
label={t(
|
|
||||||
enableSslLabelKey
|
|
||||||
)}
|
|
||||||
description={t(
|
|
||||||
enableSslDescriptionKey
|
|
||||||
)}
|
|
||||||
checked={!!field.value}
|
|
||||||
onCheckedChange={
|
|
||||||
field.onChange
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<DomainPicker
|
<DomainPicker
|
||||||
key={
|
key={
|
||||||
variant === "edit" && siteResourceId
|
variant === "edit" && siteResourceId
|
||||||
@@ -1059,6 +1041,27 @@ export function InternalResourceForm({
|
|||||||
form.setValue("alias", res.fullDomain);
|
form.setValue("alias", res.fullDomain);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="ssl"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormControl>
|
||||||
|
<SwitchInput
|
||||||
|
id="internal-resource-ssl"
|
||||||
|
label={t(enableSslLabelKey)}
|
||||||
|
description={t(
|
||||||
|
enableSslDescriptionKey
|
||||||
|
)}
|
||||||
|
checked={!!field.value}
|
||||||
|
onCheckedChange={
|
||||||
|
field.onChange
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user