fix domain picker

This commit is contained in:
miloschwartz
2026-04-09 22:48:43 -04:00
parent 73482c2a05
commit 8a47d69d0d
2 changed files with 43 additions and 37 deletions

View File

@@ -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
}); });
} }
} }

View File

@@ -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">