CI / changes (push) Successful in 10s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 25s
CI / web (push) Successful in 36s
CI / go (push) Successful in 49s
CI / bird2 (push) Successful in 17s
CI / release (push) Successful in 3m59s
- Merged birdSettingsSchema and revisionSettingsSchema into settingsKnownSchema, marking the previous schema as deprecated. - Updated emptySettingsKnownForm to utilize emptyBirdSettingsForm and emptyRevisionSettingsForm. - Refactored layout and page components to streamline theme management and improve tab synchronization in network and operations pages. - Introduced new system settings tab in operations and updated settings page to manage theme preferences.
25 lines
838 B
TypeScript
25 lines
838 B
TypeScript
import { z } from 'zod';
|
|
import { optionalIPv4, optionalIPv6 } from './ip-validation.js';
|
|
|
|
export const birdSettingsSchema = z.object({
|
|
bird_router_id: optionalIPv4('router id'),
|
|
bird_local_ipv4: optionalIPv4('local IPv4'),
|
|
bird_local_ipv6: optionalIPv6('local IPv6'),
|
|
bird_local_asn: z.string().refine((v) => v.trim() === '' || /^[1-9]\d*$/.test(v.trim()), {
|
|
message: 'ASN должен быть целым числом больше 0'
|
|
}),
|
|
bird_bgp_source_ipv4: optionalIPv4('BGP source IPv4'),
|
|
bird_bgp_source_ipv6: optionalIPv6('BGP source IPv6')
|
|
});
|
|
|
|
export type BirdSettingsForm = z.infer<typeof birdSettingsSchema>;
|
|
|
|
export const emptyBirdSettingsForm = (): BirdSettingsForm => ({
|
|
bird_router_id: '',
|
|
bird_local_ipv4: '',
|
|
bird_local_ipv6: '',
|
|
bird_local_asn: '',
|
|
bird_bgp_source_ipv4: '',
|
|
bird_bgp_source_ipv6: ''
|
|
});
|