mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-28 11:43:03 +00:00
Move site down
This commit is contained in:
@@ -802,8 +802,83 @@ export function InternalResourceForm({
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2 mb-4">
|
||||
<div className="grid grid-cols-3 gap-4 items-start">
|
||||
<div className="min-w-0 col-span-1">
|
||||
<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={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
|
||||
control={form.control}
|
||||
name="siteIds"
|
||||
@@ -852,9 +927,7 @@ export function InternalResourceForm({
|
||||
);
|
||||
field.onChange(
|
||||
sites.map(
|
||||
(
|
||||
s
|
||||
) =>
|
||||
(s) =>
|
||||
s.siteId
|
||||
)
|
||||
);
|
||||
@@ -867,92 +940,6 @@ export function InternalResourceForm({
|
||||
)}
|
||||
/>
|
||||
</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" && (
|
||||
<div className="min-w-0">
|
||||
<FormField
|
||||
@@ -998,7 +985,9 @@ export function InternalResourceForm({
|
||||
<div
|
||||
className={cn(
|
||||
mode === "cidr" && "col-span-1",
|
||||
(mode === "http" || mode === "host") &&
|
||||
(mode === "http" ||
|
||||
mode === "host" ||
|
||||
mode === "ssh") &&
|
||||
"min-w-0"
|
||||
)}
|
||||
>
|
||||
@@ -1025,7 +1014,7 @@ export function InternalResourceForm({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{mode === "host" && (
|
||||
{(mode === "host" || mode === "ssh") && (
|
||||
<div className="min-w-0">
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -1237,6 +1226,8 @@ export function InternalResourceForm({
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{mode !== "ssh" && (
|
||||
<>
|
||||
<div className="my-8">
|
||||
<label className="font-medium block">
|
||||
{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">
|
||||
{t("editInternalResourceDialogTcp")}
|
||||
{t(
|
||||
"editInternalResourceDialogTcp"
|
||||
)}
|
||||
</FormLabel>
|
||||
</div>
|
||||
<div
|
||||
@@ -1280,7 +1273,9 @@ export function InternalResourceForm({
|
||||
<FormItem>
|
||||
<div className="flex items-center gap-2">
|
||||
<Select
|
||||
value={tcpPortMode}
|
||||
value={
|
||||
tcpPortMode
|
||||
}
|
||||
onValueChange={(
|
||||
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">
|
||||
{t("editInternalResourceDialogUdp")}
|
||||
{t(
|
||||
"editInternalResourceDialogUdp"
|
||||
)}
|
||||
</FormLabel>
|
||||
</div>
|
||||
<div
|
||||
@@ -1386,7 +1383,9 @@ export function InternalResourceForm({
|
||||
<FormItem>
|
||||
<div className="flex items-center gap-2">
|
||||
<Select
|
||||
value={udpPortMode}
|
||||
value={
|
||||
udpPortMode
|
||||
}
|
||||
onValueChange={(
|
||||
v: PortMode
|
||||
) =>
|
||||
@@ -1509,8 +1508,12 @@ export function InternalResourceForm({
|
||||
</FormControl>
|
||||
<span className="text-sm text-muted-foreground">
|
||||
{field.value
|
||||
? t("blocked")
|
||||
: t("allowed")}
|
||||
? t(
|
||||
"blocked"
|
||||
)
|
||||
: t(
|
||||
"allowed"
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<FormMessage />
|
||||
@@ -1519,6 +1522,8 @@ export function InternalResourceForm({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user