Add DHCP, DNS and NTP definitions

This commit is contained in:
Samuel Lorch 2023-11-04 14:57:37 +01:00
parent 17851a92e6
commit d264624e35

View file

@ -294,43 +294,51 @@ export const editTypes: { [key: string]: { [key: string]: any } } = {
'dhcp_servers': { 'dhcp_servers': {
name: 'DHCP Server', name: 'DHCP Server',
idType: 'Number', idType: 'Number',
validationSchema: toFormValidator( fields: {
zod.object({ interface: { is: 'SingleSelect', label: 'Interface', props: { searchProvider: GetInterfaces} },
}), pool: { is: 'MultiSelect', label: 'Pool', props: { searchProvider: GetAddresses} },
), gateway_mode: { is: 'EnumInput', label: 'Gateway Mode', props: { variants: {
sections: [ 'none': { display: 'None' },
{ 'interface': { display: 'Interface' },
fields: [ 'specify': {
{ key: 'interface', label: 'Interface', as: 'SingleSelect', props: { searchProvider: GetInterfaces } }, display: 'Specify',
{ key: 'pool', label: 'Pool', as: 'MultiSelect', props: { searchProvider: GetAddresses } }, fields: {
{ key: 'gateway_mode', label: 'Gateway Mode', as: 'PillBar', props: { options: { none: { display: 'None' }, interface: { display: 'Interface' }, specify: { display: 'Specify' } } } }, gateway: { is: 'SingleSelect', label: 'Gateway', props: { searchProvider: GetAddresses} },
{ key: 'gateway', label: 'Gateway', as: 'SingleSelect', enabled: (values: any) => (values['gateway_mode'] == 'specify'), props: { searchProvider: GetAddresses } }, },
{ key: 'dns_server_mode', label: 'DNS Server Mode', as: 'PillBar', props: { options: { none: { display: 'None' }, interface: { display: 'Interface' }, specify: { display: 'Specify' } } } }, },
{ key: 'dns_servers', label: 'DNS Servers', as: 'MultiSelect', enabled: (values: any) => (values['dns_server_mode'] == 'specify'), props: { searchProvider: GetAddresses } }, }}},
{ key: 'ntp_server_mode', label: 'NTP Server Mode', as: 'PillBar', props: { options: { none: { display: 'None' }, interface: { display: 'Interface' }, specify: { display: 'Specify' } } } }, dns_server_mode: { is: 'EnumInput', label: 'DNS Server Mode', props: { variants: {
{ key: 'ntp_servers', label: 'NTP Servers', as: 'MultiSelect', enabled: (values: any) => (values['ntp_server_mode'] == 'specify'), props: { searchProvider: GetAddresses } }, 'none': { display: 'None' },
{ key: 'default_lease_time', label: 'Default Lease Time', as: 'NumberBox' }, 'interface': { display: 'Interface' },
{ key: 'max_lease_time', label: 'Max Lease Time', as: 'NumberBox' }, 'specify': {
{ key: 'comment', label: 'Comment', as: 'MultilineTextBox' }, display: 'Specify',
], fields: {
}, servers: { is: 'MultiSelect', label: 'DNS Servers', props: { searchProvider: GetAddresses} },
], },
},
}}},
ntp_server_mode: { is: 'EnumInput', label: 'NTP Server Mode', props: { variants: {
'none': { display: 'None' },
'interface': { display: 'Interface' },
'specify': {
display: 'Specify',
fields: {
servers: { is: 'MultiSelect', label: 'NTP Servers', props: { searchProvider: GetAddresses} },
},
},
}}},
default_lease_time: { is: 'NumberBox', label: 'Default Lease Time'},
max_lease_time: { is: 'NumberBox', label: 'Max Lease Time'},
comment: { is: 'MultilineTextBox', label: 'Comment'},
},
}, },
'ntp_servers': { 'ntp_servers': {
name: 'NTP Server', name: 'NTP Server',
idType: 'Number', idType: 'Number',
validationSchema: toFormValidator( fields: {
zod.object({ interface: { is: 'SingleSelect', label: 'Interface', props: { searchProvider: GetInterfaces} },
}), comment: { is: 'MultilineTextBox', label: 'Comment'},
), },
sections: [
{
fields: [
{ key: 'interface', label: 'Interface', as: 'SingleSelect', props: { searchProvider: GetInterfaces } },
{ key: 'comment', label: 'Comment', as: 'MultilineTextBox' },
],
},
],
}, },
'dns_servers': { 'dns_servers': {
name: 'DNS Server', name: 'DNS Server',
@ -339,14 +347,10 @@ export const editTypes: { [key: string]: { [key: string]: any } } = {
zod.object({ zod.object({
}), }),
), ),
sections: [ fields: {
{ interface: { is: 'SingleSelect', label: 'Interface', props: { searchProvider: GetInterfaces} },
fields: [ comment: { is: 'MultilineTextBox', label: 'Comment'},
{ key: 'interface', label: 'Interface', as: 'SingleSelect', props: { searchProvider: GetInterfaces } }, },
{ key: 'comment', label: 'Comment', as: 'MultilineTextBox' },
],
},
],
}, },
}, },
'vpn': { 'vpn': {