🐛 fix(node): Add country and city fields to the form schema and localization files
This commit is contained in:
@@ -92,6 +92,8 @@ const protocolConfigSchema = z.discriminatedUnion('protocol', [
|
||||
const baseFormSchema = z.object({
|
||||
name: z.string(),
|
||||
tags: z.array(z.string()).nullish().default([]),
|
||||
country: z.string().nullish(),
|
||||
city: z.string().nullish(),
|
||||
server_addr: z.string(),
|
||||
speed_limit: z.number().nullish(),
|
||||
traffic_ratio: z.number().default(1),
|
||||
|
||||
@@ -160,23 +160,61 @@ export default function NodeForm<T extends { [x: string]: any }>({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='tags'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.tags')}</FormLabel>
|
||||
<FormControl>
|
||||
<TagInput
|
||||
placeholder={t('form.tagsPlaceholder')}
|
||||
value={field.value || []}
|
||||
onChange={(value) => form.setValue(field.name, value)}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className='grid grid-cols-5 gap-2'>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='tags'
|
||||
render={({ field }) => (
|
||||
<FormItem className='col-span-3'>
|
||||
<FormLabel>{t('form.tags')}</FormLabel>
|
||||
<FormControl>
|
||||
<TagInput
|
||||
placeholder={t('form.tagsPlaceholder')}
|
||||
value={field.value || []}
|
||||
onChange={(value) => form.setValue(field.name, value)}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='country'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.country')}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
{...field}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='city'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.city')}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
{...field}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className='grid grid-cols-3 gap-2'>
|
||||
<FormField
|
||||
control={form.control}
|
||||
|
||||
@@ -123,6 +123,16 @@ export default function NodeTable() {
|
||||
{
|
||||
accessorKey: 'server_addr',
|
||||
header: t('serverAddr'),
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<div className='flex gap-1'>
|
||||
<Badge variant='outline'>
|
||||
{row.original.country} - {row.original.city}
|
||||
</Badge>
|
||||
<Badge variant='outline'>{row.getValue('server_addr')}</Badge>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: 'status',
|
||||
|
||||
Reference in New Issue
Block a user