添加网关类型GOST
This commit is contained in:
@@ -14,7 +14,8 @@ export async function createGateway(data: {
|
||||
host?: string
|
||||
type: number
|
||||
status: number
|
||||
secret: string
|
||||
secret?: string
|
||||
port?: number
|
||||
}) {
|
||||
return callByUser<Gateway>("/api/admin/proxy/create", data)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ const schema = z.object({
|
||||
.or(z.literal("")),
|
||||
type: z.string().optional(),
|
||||
status: z.string().optional(),
|
||||
secret: z.string().min(1, "请填写密钥"),
|
||||
secret: z.string().optional(),
|
||||
proxy_port: z.string().optional(),
|
||||
})
|
||||
|
||||
export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
@@ -63,6 +64,7 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
type: "1",
|
||||
status: "0",
|
||||
secret: "",
|
||||
proxy_port: "",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -75,7 +77,8 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
host: data?.host.trim(),
|
||||
type: data.type ? Number(data.type) : 0,
|
||||
status: data.status ? Number(data.status) : 0,
|
||||
secret: data.secret.trim(),
|
||||
secret: data.secret?.trim() ?? "",
|
||||
port: Number(data.proxy_port?.trim()) ?? "",
|
||||
}
|
||||
|
||||
const res = await createGateway(payload)
|
||||
@@ -110,6 +113,7 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
const typeOptions = [
|
||||
{ value: "1", label: "自有" },
|
||||
{ value: "2", label: "白银" },
|
||||
{ value: "3", label: "GOST" },
|
||||
]
|
||||
|
||||
return (
|
||||
@@ -186,6 +190,24 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="proxy_port"
|
||||
render={({ field, fieldState }) => (
|
||||
<Field>
|
||||
<FieldLabel htmlFor="gateway-create-host">端口:</FieldLabel>
|
||||
<Input
|
||||
id="gateway-create-host"
|
||||
placeholder="请输入端口,如:8080"
|
||||
{...field}
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
{fieldState.invalid && fieldState.error && (
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
)}
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="secret"
|
||||
|
||||
@@ -83,6 +83,7 @@ export default function GatewayPage() {
|
||||
accessorKey: "host",
|
||||
},
|
||||
{ header: "IP地址", accessorKey: "ip" },
|
||||
{ header: "端口", accessorKey: "port" },
|
||||
{
|
||||
header: "MAC地址",
|
||||
accessorKey: "mac",
|
||||
@@ -94,7 +95,14 @@ export default function GatewayPage() {
|
||||
{
|
||||
header: "类型",
|
||||
accessorKey: "type",
|
||||
cell: ({ row }) => (row.original.type === 1 ? "自有" : "白银"),
|
||||
cell: ({ row }) => {
|
||||
const typeMap: Record<number, string> = {
|
||||
1: "自有",
|
||||
2: "白银",
|
||||
3: "GOST",
|
||||
}
|
||||
return typeMap[row.original.type] ?? ""
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "状态",
|
||||
|
||||
Reference in New Issue
Block a user