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,129 +802,53 @@ 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}
|
||||||
<FormField
|
name="mode"
|
||||||
control={form.control}
|
render={({ field }) => {
|
||||||
name="siteIds"
|
const modeOptions: OptionSelectOption<InternalResourceMode>[] =
|
||||||
render={({ field }) => (
|
[
|
||||||
<FormItem className="flex flex-col">
|
{
|
||||||
<FormLabel>
|
value: "host",
|
||||||
{t("sites")}
|
label: t(modeHostKey)
|
||||||
</FormLabel>
|
},
|
||||||
<Popover>
|
{
|
||||||
<PopoverTrigger asChild>
|
value: "cidr",
|
||||||
<FormControl>
|
label: t(modeCidrKey)
|
||||||
<Button
|
},
|
||||||
variant="outline"
|
...(!disableEnterpriseFeatures
|
||||||
role="combobox"
|
? [
|
||||||
className={cn(
|
{
|
||||||
"w-full justify-between",
|
value: "http" as const,
|
||||||
selectedSites.length ===
|
label: t(
|
||||||
0 &&
|
modeHttpKey
|
||||||
"text-muted-foreground"
|
)
|
||||||
)}
|
},
|
||||||
>
|
{
|
||||||
<span className="truncate text-left">
|
value: "ssh" as const,
|
||||||
{formatMultiSitesSelectorLabel(
|
label: t(
|
||||||
selectedSites,
|
modeSshKey
|
||||||
t
|
)
|
||||||
)}
|
}
|
||||||
</span>
|
]
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
: [])
|
||||||
</Button>
|
];
|
||||||
</FormControl>
|
return (
|
||||||
</PopoverTrigger>
|
<FormItem>
|
||||||
<PopoverContent className="w-full p-0">
|
<FormLabel>
|
||||||
<MultiSitesSelector
|
{t(modeLabelKey)}
|
||||||
orgId={orgId}
|
</FormLabel>
|
||||||
selectedSites={
|
<OptionSelect<InternalResourceMode>
|
||||||
selectedSites
|
options={modeOptions}
|
||||||
}
|
value={field.value}
|
||||||
filterTypes={[
|
onChange={field.onChange}
|
||||||
"newt"
|
cols={4}
|
||||||
]}
|
/>
|
||||||
onSelectionChange={(
|
<FormMessage />
|
||||||
sites
|
</FormItem>
|
||||||
) => {
|
);
|
||||||
setSelectedSites(
|
}}
|
||||||
sites
|
/>
|
||||||
);
|
|
||||||
field.onChange(
|
|
||||||
sites.map(
|
|
||||||
(
|
|
||||||
s
|
|
||||||
) =>
|
|
||||||
s.siteId
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</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 && (
|
{selectedSites.length > 1 && (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{t(
|
{t(
|
||||||
@@ -948,11 +872,74 @@ export function InternalResourceForm({
|
|||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"grid gap-4 items-start",
|
"grid gap-4 items-start",
|
||||||
mode === "cidr" && "grid-cols-1",
|
mode === "cidr" && "grid-cols-2",
|
||||||
mode === "http" && "grid-cols-3",
|
mode === "http" && "grid-cols-4",
|
||||||
mode === "host" && "grid-cols-2"
|
(mode === "host" || mode === "ssh") &&
|
||||||
|
"grid-cols-3"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
<div className="min-w-0">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="siteIds"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="flex flex-col">
|
||||||
|
<FormLabel>
|
||||||
|
{t("sites")}
|
||||||
|
</FormLabel>
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<FormControl>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
role="combobox"
|
||||||
|
className={cn(
|
||||||
|
"w-full justify-between",
|
||||||
|
selectedSites.length ===
|
||||||
|
0 &&
|
||||||
|
"text-muted-foreground"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="truncate text-left">
|
||||||
|
{formatMultiSitesSelectorLabel(
|
||||||
|
selectedSites,
|
||||||
|
t
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
|
</Button>
|
||||||
|
</FormControl>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-full p-0">
|
||||||
|
<MultiSitesSelector
|
||||||
|
orgId={orgId}
|
||||||
|
selectedSites={
|
||||||
|
selectedSites
|
||||||
|
}
|
||||||
|
filterTypes={[
|
||||||
|
"newt"
|
||||||
|
]}
|
||||||
|
onSelectionChange={(
|
||||||
|
sites
|
||||||
|
) => {
|
||||||
|
setSelectedSites(
|
||||||
|
sites
|
||||||
|
);
|
||||||
|
field.onChange(
|
||||||
|
sites.map(
|
||||||
|
(s) =>
|
||||||
|
s.siteId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{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,288 +1226,304 @@ export function InternalResourceForm({
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="my-8">
|
{mode !== "ssh" && (
|
||||||
<label className="font-medium block">
|
<>
|
||||||
{t("portRestrictions")}
|
<div className="my-8">
|
||||||
</label>
|
<label className="font-medium block">
|
||||||
<div className="text-sm text-muted-foreground">
|
{t("portRestrictions")}
|
||||||
{t(
|
</label>
|
||||||
"editInternalResourceDialogPortRestrictionsDescription"
|
<div className="text-sm text-muted-foreground">
|
||||||
)}
|
{t(
|
||||||
</div>
|
"editInternalResourceDialogPortRestrictionsDescription"
|
||||||
</div>
|
)}
|
||||||
<div
|
</div>
|
||||||
className={cn(
|
</div>
|
||||||
"grid gap-4 items-start",
|
<div
|
||||||
mode === "cidr"
|
className={cn(
|
||||||
? "grid-cols-4"
|
"grid gap-4 items-start",
|
||||||
: "grid-cols-12"
|
mode === "cidr"
|
||||||
)}
|
? "grid-cols-4"
|
||||||
>
|
: "grid-cols-12"
|
||||||
<div
|
)}
|
||||||
className={
|
>
|
||||||
mode === "cidr"
|
<div
|
||||||
? "col-span-1"
|
className={
|
||||||
: "col-span-3"
|
mode === "cidr"
|
||||||
}
|
? "col-span-1"
|
||||||
>
|
: "col-span-3"
|
||||||
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
}
|
||||||
{t("editInternalResourceDialogTcp")}
|
>
|
||||||
</FormLabel>
|
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
||||||
</div>
|
{t(
|
||||||
<div
|
"editInternalResourceDialogTcp"
|
||||||
className={
|
)}
|
||||||
mode === "cidr"
|
</FormLabel>
|
||||||
? "col-span-3"
|
</div>
|
||||||
: "col-span-9"
|
<div
|
||||||
}
|
className={
|
||||||
>
|
mode === "cidr"
|
||||||
<FormField
|
? "col-span-3"
|
||||||
control={form.control}
|
: "col-span-9"
|
||||||
name="tcpPortRangeString"
|
}
|
||||||
render={() => (
|
>
|
||||||
<FormItem>
|
<FormField
|
||||||
<div className="flex items-center gap-2">
|
control={form.control}
|
||||||
<Select
|
name="tcpPortRangeString"
|
||||||
value={tcpPortMode}
|
render={() => (
|
||||||
onValueChange={(
|
<FormItem>
|
||||||
v: PortMode
|
<div className="flex items-center gap-2">
|
||||||
) =>
|
<Select
|
||||||
setTcpPortMode(
|
|
||||||
v
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<FormControl>
|
|
||||||
<SelectTrigger className="w-[110px]">
|
|
||||||
<SelectValue />
|
|
||||||
</SelectTrigger>
|
|
||||||
</FormControl>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="all">
|
|
||||||
{t(
|
|
||||||
"allPorts"
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
|
||||||
<SelectItem value="blocked">
|
|
||||||
{t(
|
|
||||||
"blocked"
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
|
||||||
<SelectItem value="custom">
|
|
||||||
{t(
|
|
||||||
"custom"
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
{tcpPortMode ===
|
|
||||||
"custom" ? (
|
|
||||||
<FormControl>
|
|
||||||
<Input
|
|
||||||
placeholder="80,443,8000-9000"
|
|
||||||
value={
|
value={
|
||||||
tcpCustomPorts
|
tcpPortMode
|
||||||
}
|
}
|
||||||
onChange={(
|
onValueChange={(
|
||||||
e
|
v: PortMode
|
||||||
) =>
|
) =>
|
||||||
setTcpCustomPorts(
|
setTcpPortMode(
|
||||||
e
|
v
|
||||||
.target
|
|
||||||
.value
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
>
|
||||||
</FormControl>
|
<FormControl>
|
||||||
) : (
|
<SelectTrigger className="w-[110px]">
|
||||||
<Input
|
<SelectValue />
|
||||||
disabled
|
</SelectTrigger>
|
||||||
placeholder={
|
</FormControl>
|
||||||
tcpPortMode ===
|
<SelectContent>
|
||||||
"all"
|
<SelectItem value="all">
|
||||||
? t(
|
{t(
|
||||||
"allPortsAllowed"
|
"allPorts"
|
||||||
)
|
)}
|
||||||
: t(
|
</SelectItem>
|
||||||
"allPortsBlocked"
|
<SelectItem value="blocked">
|
||||||
)
|
{t(
|
||||||
}
|
"blocked"
|
||||||
/>
|
)}
|
||||||
)}
|
</SelectItem>
|
||||||
</div>
|
<SelectItem value="custom">
|
||||||
<FormMessage />
|
{t(
|
||||||
</FormItem>
|
"custom"
|
||||||
|
)}
|
||||||
|
</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{tcpPortMode ===
|
||||||
|
"custom" ? (
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="80,443,8000-9000"
|
||||||
|
value={
|
||||||
|
tcpCustomPorts
|
||||||
|
}
|
||||||
|
onChange={(
|
||||||
|
e
|
||||||
|
) =>
|
||||||
|
setTcpCustomPorts(
|
||||||
|
e
|
||||||
|
.target
|
||||||
|
.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
) : (
|
||||||
|
<Input
|
||||||
|
disabled
|
||||||
|
placeholder={
|
||||||
|
tcpPortMode ===
|
||||||
|
"all"
|
||||||
|
? t(
|
||||||
|
"allPortsAllowed"
|
||||||
|
)
|
||||||
|
: t(
|
||||||
|
"allPortsBlocked"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"grid gap-4 items-start",
|
||||||
|
mode === "cidr"
|
||||||
|
? "grid-cols-4"
|
||||||
|
: "grid-cols-12"
|
||||||
)}
|
)}
|
||||||
/>
|
>
|
||||||
</div>
|
<div
|
||||||
</div>
|
className={
|
||||||
<div
|
mode === "cidr"
|
||||||
className={cn(
|
? "col-span-1"
|
||||||
"grid gap-4 items-start",
|
: "col-span-3"
|
||||||
mode === "cidr"
|
}
|
||||||
? "grid-cols-4"
|
>
|
||||||
: "grid-cols-12"
|
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
||||||
)}
|
{t(
|
||||||
>
|
"editInternalResourceDialogUdp"
|
||||||
<div
|
)}
|
||||||
className={
|
</FormLabel>
|
||||||
mode === "cidr"
|
</div>
|
||||||
? "col-span-1"
|
<div
|
||||||
: "col-span-3"
|
className={
|
||||||
}
|
mode === "cidr"
|
||||||
>
|
? "col-span-3"
|
||||||
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
: "col-span-9"
|
||||||
{t("editInternalResourceDialogUdp")}
|
}
|
||||||
</FormLabel>
|
>
|
||||||
</div>
|
<FormField
|
||||||
<div
|
control={form.control}
|
||||||
className={
|
name="udpPortRangeString"
|
||||||
mode === "cidr"
|
render={() => (
|
||||||
? "col-span-3"
|
<FormItem>
|
||||||
: "col-span-9"
|
<div className="flex items-center gap-2">
|
||||||
}
|
<Select
|
||||||
>
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="udpPortRangeString"
|
|
||||||
render={() => (
|
|
||||||
<FormItem>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Select
|
|
||||||
value={udpPortMode}
|
|
||||||
onValueChange={(
|
|
||||||
v: PortMode
|
|
||||||
) =>
|
|
||||||
setUdpPortMode(
|
|
||||||
v
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<FormControl>
|
|
||||||
<SelectTrigger className="w-[110px]">
|
|
||||||
<SelectValue />
|
|
||||||
</SelectTrigger>
|
|
||||||
</FormControl>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="all">
|
|
||||||
{t(
|
|
||||||
"allPorts"
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
|
||||||
<SelectItem value="blocked">
|
|
||||||
{t(
|
|
||||||
"blocked"
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
|
||||||
<SelectItem value="custom">
|
|
||||||
{t(
|
|
||||||
"custom"
|
|
||||||
)}
|
|
||||||
</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
{udpPortMode ===
|
|
||||||
"custom" ? (
|
|
||||||
<FormControl>
|
|
||||||
<Input
|
|
||||||
placeholder="53,123,500-600"
|
|
||||||
value={
|
value={
|
||||||
udpCustomPorts
|
udpPortMode
|
||||||
}
|
}
|
||||||
onChange={(
|
onValueChange={(
|
||||||
e
|
v: PortMode
|
||||||
) =>
|
) =>
|
||||||
setUdpCustomPorts(
|
setUdpPortMode(
|
||||||
e
|
v
|
||||||
.target
|
|
||||||
.value
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
>
|
||||||
</FormControl>
|
<FormControl>
|
||||||
) : (
|
<SelectTrigger className="w-[110px]">
|
||||||
<Input
|
<SelectValue />
|
||||||
disabled
|
</SelectTrigger>
|
||||||
placeholder={
|
</FormControl>
|
||||||
udpPortMode ===
|
<SelectContent>
|
||||||
"all"
|
<SelectItem value="all">
|
||||||
|
{t(
|
||||||
|
"allPorts"
|
||||||
|
)}
|
||||||
|
</SelectItem>
|
||||||
|
<SelectItem value="blocked">
|
||||||
|
{t(
|
||||||
|
"blocked"
|
||||||
|
)}
|
||||||
|
</SelectItem>
|
||||||
|
<SelectItem value="custom">
|
||||||
|
{t(
|
||||||
|
"custom"
|
||||||
|
)}
|
||||||
|
</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{udpPortMode ===
|
||||||
|
"custom" ? (
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="53,123,500-600"
|
||||||
|
value={
|
||||||
|
udpCustomPorts
|
||||||
|
}
|
||||||
|
onChange={(
|
||||||
|
e
|
||||||
|
) =>
|
||||||
|
setUdpCustomPorts(
|
||||||
|
e
|
||||||
|
.target
|
||||||
|
.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
) : (
|
||||||
|
<Input
|
||||||
|
disabled
|
||||||
|
placeholder={
|
||||||
|
udpPortMode ===
|
||||||
|
"all"
|
||||||
|
? t(
|
||||||
|
"allPortsAllowed"
|
||||||
|
)
|
||||||
|
: t(
|
||||||
|
"allPortsBlocked"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"grid gap-4 items-start",
|
||||||
|
mode === "cidr"
|
||||||
|
? "grid-cols-4"
|
||||||
|
: "grid-cols-12"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
mode === "cidr"
|
||||||
|
? "col-span-1"
|
||||||
|
: "col-span-3"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
||||||
|
{t(
|
||||||
|
"editInternalResourceDialogIcmp"
|
||||||
|
)}
|
||||||
|
</FormLabel>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
mode === "cidr"
|
||||||
|
? "col-span-3"
|
||||||
|
: "col-span-9"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="disableIcmp"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<FormControl>
|
||||||
|
<Switch
|
||||||
|
checked={
|
||||||
|
!field.value
|
||||||
|
}
|
||||||
|
onCheckedChange={(
|
||||||
|
checked
|
||||||
|
) =>
|
||||||
|
field.onChange(
|
||||||
|
!checked
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<span className="text-sm text-muted-foreground">
|
||||||
|
{field.value
|
||||||
? t(
|
? t(
|
||||||
"allPortsAllowed"
|
"blocked"
|
||||||
)
|
)
|
||||||
: t(
|
: t(
|
||||||
"allPortsBlocked"
|
"allowed"
|
||||||
)
|
)}
|
||||||
}
|
</span>
|
||||||
/>
|
</div>
|
||||||
)}
|
<FormMessage />
|
||||||
</div>
|
</FormItem>
|
||||||
<FormMessage />
|
)}
|
||||||
</FormItem>
|
/>
|
||||||
)}
|
</div>
|
||||||
/>
|
</div>
|
||||||
</div>
|
</>
|
||||||
</div>
|
)}
|
||||||
<div
|
|
||||||
className={cn(
|
|
||||||
"grid gap-4 items-start",
|
|
||||||
mode === "cidr"
|
|
||||||
? "grid-cols-4"
|
|
||||||
: "grid-cols-12"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
mode === "cidr"
|
|
||||||
? "col-span-1"
|
|
||||||
: "col-span-3"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<FormLabel className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
|
||||||
{t(
|
|
||||||
"editInternalResourceDialogIcmp"
|
|
||||||
)}
|
|
||||||
</FormLabel>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
mode === "cidr"
|
|
||||||
? "col-span-3"
|
|
||||||
: "col-span-9"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="disableIcmp"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<FormControl>
|
|
||||||
<Switch
|
|
||||||
checked={
|
|
||||||
!field.value
|
|
||||||
}
|
|
||||||
onCheckedChange={(
|
|
||||||
checked
|
|
||||||
) =>
|
|
||||||
field.onChange(
|
|
||||||
!checked
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
<span className="text-sm text-muted-foreground">
|
|
||||||
{field.value
|
|
||||||
? t("blocked")
|
|
||||||
: t("allowed")}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user