mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-28 11:43:03 +00:00
Revert to the mode on top and make it 2 x 2
This commit is contained in:
@@ -802,83 +802,8 @@ export function InternalResourceForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2 mb-4">
|
<div className="space-y-2 mb-4">
|
||||||
<FormField
|
<div className="grid grid-cols-3 gap-4 items-start">
|
||||||
control={form.control}
|
<div className="min-w-0 col-span-1">
|
||||||
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"
|
||||||
@@ -927,7 +852,9 @@ export function InternalResourceForm({
|
|||||||
);
|
);
|
||||||
field.onChange(
|
field.onChange(
|
||||||
sites.map(
|
sites.map(
|
||||||
(s) =>
|
(
|
||||||
|
s
|
||||||
|
) =>
|
||||||
s.siteId
|
s.siteId
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -940,6 +867,93 @@ 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={2}
|
||||||
|
/>
|
||||||
|
<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" || mode === "ssh") &&
|
||||||
|
"grid-cols-2"
|
||||||
|
)}
|
||||||
|
>
|
||||||
{mode === "http" && (
|
{mode === "http" && (
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<FormField
|
<FormField
|
||||||
|
|||||||
Reference in New Issue
Block a user