Development
This commit is contained in:
parent
91d8b950b7
commit
ba74852d8a
2 changed files with 17 additions and 11 deletions
|
|
@ -39,8 +39,7 @@ def _flat_index_to_vlan_res(vlans, flat_idx):
|
|||
def _parse_ip():
|
||||
raw = request.form.get('ip', '').strip()
|
||||
if not raw:
|
||||
flash('The configuration has not been saved because an IP address is required.', 'error')
|
||||
return None
|
||||
return 'dynamic'
|
||||
ip = validate.ip(raw)
|
||||
if not ip:
|
||||
flash(f'The configuration has not been saved because "{raw}" is not a valid IP address.', 'error')
|
||||
|
|
@ -49,6 +48,8 @@ def _parse_ip():
|
|||
|
||||
|
||||
def _check_ip_conflicts(ip, vlan):
|
||||
if ip == 'dynamic':
|
||||
return None
|
||||
dhcp = vlan.get('dhcp_information', {})
|
||||
pool_start = dhcp.get('dynamic_pool_start')
|
||||
pool_end = dhcp.get('dynamic_pool_end')
|
||||
|
|
@ -117,7 +118,7 @@ def add_dhcp_reservation():
|
|||
cfg,
|
||||
path=f'vlans.{vlan_name}.reservations', key=mac, operation='add',
|
||||
before=None, after=entry,
|
||||
description=f'Added DHCP reservation: {hostname or mac} ({ip})',
|
||||
description=f'Added DHCP reservation: {hostname or mac} ({ip or "dynamic"})',
|
||||
), 'success')
|
||||
return redirect(VIEW)
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ def edit_dhcp_reservation():
|
|||
cfg,
|
||||
path=f'vlans.{vlan_name}.reservations', key=mac, operation='edit',
|
||||
before=before, after=copy.deepcopy(res),
|
||||
description=f'Edited DHCP reservation: {hostname or mac} ({ip})',
|
||||
description=f'Edited DHCP reservation: {hostname or mac} ({ip or "dynamic"})',
|
||||
), 'success')
|
||||
return redirect(VIEW)
|
||||
|
||||
|
|
|
|||
|
|
@ -2073,6 +2073,12 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "info_bar",
|
||||
"variant": "info",
|
||||
"text": "This page assigns fixed or dynamic IPs to devices and authorizes them to be placed on a specified VLAN.",
|
||||
"client_requirement": "client_is_administrator+"
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"datasource": "live:dhcp_leases",
|
||||
|
|
@ -2176,8 +2182,7 @@
|
|||
},
|
||||
{
|
||||
"col": "ip",
|
||||
"input_type": "text",
|
||||
"validate": "ipv4"
|
||||
"input_type": "text"
|
||||
},
|
||||
{
|
||||
"col": "radius_client",
|
||||
|
|
@ -2203,7 +2208,7 @@
|
|||
{
|
||||
"type": "card",
|
||||
"id": "add-form",
|
||||
"label": "Add Reservation",
|
||||
"label": "Add Reservation/Authorization",
|
||||
"client_requirement": "client_is_administrator+",
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -2247,15 +2252,15 @@
|
|||
"label": "IP Address",
|
||||
"name": "ip",
|
||||
"input_type": "text",
|
||||
"validate": "ipv4",
|
||||
"placeholder": "e.g. 192.168.10.50"
|
||||
"placeholder": "e.g. 192.168.10.50",
|
||||
"hint": "Leave blank to authorize device on this VLAN dynamically."
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"label": "RADIUS Client",
|
||||
"name": "radius_client",
|
||||
"input_type": "checkbox",
|
||||
"hint": "Authenticate this device via RADIUS."
|
||||
"hint": "This device acts as a RADIUS authenticator, verifying credentials of other devices on the network."
|
||||
},
|
||||
{
|
||||
"type": "button_row",
|
||||
|
|
@ -2264,7 +2269,7 @@
|
|||
"type": "button_primary",
|
||||
"action": "/action/add_dhcp_reservation",
|
||||
"method": "post",
|
||||
"text": "Add Reservation"
|
||||
"text": "Add"
|
||||
},
|
||||
{
|
||||
"type": "button_cancel",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue