File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ import { useTranslation } from "react-i18next"
2929import { toast } from "sonner"
3030import { KeyedMutator } from "swr"
3131import { z } from "zod"
32+ import { Checkbox } from "./ui/checkbox"
33+ import { Label } from "./ui/label"
3234
3335interface NATCardProps {
3436 data ?: ModelNAT
@@ -37,6 +39,7 @@ interface NATCardProps {
3739
3840const natFormSchema = z . object ( {
3941 name : z . string ( ) . min ( 1 ) ,
42+ enabled : z . boolean ( ) ,
4043 server_id : z . coerce . number ( ) . int ( ) ,
4144 host : z . string ( ) ,
4245 domain : z . string ( ) ,
@@ -50,6 +53,7 @@ export const NATCard: React.FC<NATCardProps> = ({ data, mutate }) => {
5053 ? data
5154 : {
5255 name : "" ,
56+ enabled : false ,
5357 server_id : 0 ,
5458 host : "" ,
5559 domain : "" ,
@@ -148,6 +152,26 @@ export const NATCard: React.FC<NATCardProps> = ({ data, mutate }) => {
148152 </ FormItem >
149153 ) }
150154 />
155+ < FormField
156+ control = { form . control }
157+ name = "enabled"
158+ render = { ( { field } ) => (
159+ < FormItem className = "flex items-center space-x-2" >
160+ < FormControl >
161+ < div className = "flex items-center gap-2" >
162+ < Checkbox
163+ checked = { field . value }
164+ onCheckedChange = { field . onChange }
165+ />
166+ < Label className = "text-sm" >
167+ { t ( "Enable" ) }
168+ </ Label >
169+ </ div >
170+ </ FormControl >
171+ < FormMessage />
172+ </ FormItem >
173+ ) }
174+ />
151175 < DialogFooter className = "justify-end" >
152176 < DialogClose asChild >
153177 < Button type = "button" className = "my-2" variant = "secondary" >
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ export default function NATPage() {
6161 accessorKey : "id" ,
6262 accessorFn : ( row ) => row . id ,
6363 } ,
64+ {
65+ header : t ( "Enabled" ) ,
66+ accessorKey : "enabled" ,
67+ accessorFn : ( row ) => row . enabled ,
68+ } ,
6469 {
6570 header : t ( "Name" ) ,
6671 accessorKey : "name" ,
Original file line number Diff line number Diff line change @@ -401,6 +401,7 @@ export interface ModelLoginResponse {
401401export interface ModelNAT {
402402 created_at : string
403403 domain : string
404+ enabled : boolean
404405 host : string
405406 id : number
406407 name : string
You can’t perform that action at this time.
0 commit comments