Move site down

This commit is contained in:
Owen
2026-05-26 20:16:54 -07:00
parent aa7004b2ff
commit 6e6c91a27c
+104 -99
View File
@@ -802,8 +802,83 @@ export function InternalResourceForm({
</div> </div>
</div> </div>
<div className="space-y-2 mb-4"> <div className="space-y-2 mb-4">
<div className="grid grid-cols-3 gap-4 items-start"> <FormField
<div className="min-w-0 col-span-1"> control={form.control}
name="mode"
render={({ field }) => {
const modeOptions: OptionSelectOption<InternalResourceMode>[] =
[
{
value: "host",
label: t(modeHostKey)
},
{
value: "cidr",
label: t(modeCidrKey)
},
...(!disableEnterpriseFeatures
? [
{
value: "http" as const,
label: t(
modeHttpKey
)
},
{
value: "ssh" as const,
label: t(
modeSshKey
)
}
]
: [])
];
return (
<FormItem>
<FormLabel>
{t(modeLabelKey)}
</FormLabel>
<OptionSelect<InternalResourceMode>
options={modeOptions}
value={field.value}
onChange={field.onChange}
cols={4}
/>
<FormMessage />
</FormItem>
);
}}
/>
{selectedSites.length > 1 && (
<p className="text-sm text-muted-foreground">
{t(
"internalResourceFormMultiSiteRoutingHelp"
)}{" "}
<a
href="https://docs.pangolin.net/manage/resources/private/multi-site-routing"
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline inline-flex items-center gap-1"
>
{t(
"internalResourceFormMultiSiteRoutingHelpLearnMore"
)}
<ExternalLink className="size-3.5 shrink-0" />
</a>
.
</p>
)}
</div>
<div
className={cn(
"grid gap-4 items-start",
mode === "cidr" && "grid-cols-2",
mode === "http" && "grid-cols-4",
(mode === "host" || mode === "ssh") &&
"grid-cols-3"
)}
>
<div className="min-w-0">
<FormField <FormField
control={form.control} control={form.control}
name="siteIds" name="siteIds"
@@ -852,9 +927,7 @@ export function InternalResourceForm({
); );
field.onChange( field.onChange(
sites.map( sites.map(
( (s) =>
s
) =>
s.siteId s.siteId
) )
); );
@@ -867,92 +940,6 @@ export function InternalResourceForm({
)} )}
/> />
</div> </div>
<div className="min-w-0 col-span-2">
<FormField
control={form.control}
name="mode"
render={({ field }) => {
const modeOptions: OptionSelectOption<InternalResourceMode>[] =
[
{
value: "host",
label: t(
modeHostKey
)
},
{
value: "cidr",
label: t(
modeCidrKey
)
},
...(!disableEnterpriseFeatures
? [
{
value: "http" as const,
label: t(
modeHttpKey
)
},
{
value: "ssh" as const,
label: t(
modeSshKey
)
}
]
: [])
];
return (
<FormItem>
<FormLabel>
{t(modeLabelKey)}
</FormLabel>
<OptionSelect<InternalResourceMode>
options={
modeOptions
}
value={field.value}
onChange={
field.onChange
}
cols={3}
/>
<FormMessage />
</FormItem>
);
}}
/>
</div>
</div>
{selectedSites.length > 1 && (
<p className="text-sm text-muted-foreground">
{t(
"internalResourceFormMultiSiteRoutingHelp"
)}{" "}
<a
href="https://docs.pangolin.net/manage/resources/private/multi-site-routing"
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline inline-flex items-center gap-1"
>
{t(
"internalResourceFormMultiSiteRoutingHelpLearnMore"
)}
<ExternalLink className="size-3.5 shrink-0" />
</a>
.
</p>
)}
</div>
<div
className={cn(
"grid gap-4 items-start",
mode === "cidr" && "grid-cols-1",
mode === "http" && "grid-cols-3",
mode === "host" && "grid-cols-2"
)}
>
{mode === "http" && ( {mode === "http" && (
<div className="min-w-0"> <div className="min-w-0">
<FormField <FormField
@@ -998,7 +985,9 @@ export function InternalResourceForm({
<div <div
className={cn( className={cn(
mode === "cidr" && "col-span-1", mode === "cidr" && "col-span-1",
(mode === "http" || mode === "host") && (mode === "http" ||
mode === "host" ||
mode === "ssh") &&
"min-w-0" "min-w-0"
)} )}
> >
@@ -1025,7 +1014,7 @@ export function InternalResourceForm({
)} )}
/> />
</div> </div>
{mode === "host" && ( {(mode === "host" || mode === "ssh") && (
<div className="min-w-0"> <div className="min-w-0">
<FormField <FormField
control={form.control} control={form.control}
@@ -1237,6 +1226,8 @@ export function InternalResourceForm({
</div> </div>
) : ( ) : (
<div className="space-y-4"> <div className="space-y-4">
{mode !== "ssh" && (
<>
<div className="my-8"> <div className="my-8">
<label className="font-medium block"> <label className="font-medium block">
{t("portRestrictions")} {t("portRestrictions")}
@@ -1263,7 +1254,9 @@ export function InternalResourceForm({
} }
> >
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"> <FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
{t("editInternalResourceDialogTcp")} {t(
"editInternalResourceDialogTcp"
)}
</FormLabel> </FormLabel>
</div> </div>
<div <div
@@ -1280,7 +1273,9 @@ export function InternalResourceForm({
<FormItem> <FormItem>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Select <Select
value={tcpPortMode} value={
tcpPortMode
}
onValueChange={( onValueChange={(
v: PortMode v: PortMode
) => ) =>
@@ -1369,7 +1364,9 @@ export function InternalResourceForm({
} }
> >
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"> <FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
{t("editInternalResourceDialogUdp")} {t(
"editInternalResourceDialogUdp"
)}
</FormLabel> </FormLabel>
</div> </div>
<div <div
@@ -1386,7 +1383,9 @@ export function InternalResourceForm({
<FormItem> <FormItem>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Select <Select
value={udpPortMode} value={
udpPortMode
}
onValueChange={( onValueChange={(
v: PortMode v: PortMode
) => ) =>
@@ -1509,8 +1508,12 @@ export function InternalResourceForm({
</FormControl> </FormControl>
<span className="text-sm text-muted-foreground"> <span className="text-sm text-muted-foreground">
{field.value {field.value
? t("blocked") ? t(
: t("allowed")} "blocked"
)
: t(
"allowed"
)}
</span> </span>
</div> </div>
<FormMessage /> <FormMessage />
@@ -1519,6 +1522,8 @@ export function InternalResourceForm({
/> />
</div> </div>
</div> </div>
</>
)}
</div> </div>
)} )}
</div> </div>