diff --git a/docker/routlin-dash/app/action_apply_dhcp_reservations.py b/docker/routlin-dash/app/action_apply_dhcp_reservations.py index 5f2dbac..f6fb336 100644 --- a/docker/routlin-dash/app/action_apply_dhcp_reservations.py +++ b/docker/routlin-dash/app/action_apply_dhcp_reservations.py @@ -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) diff --git a/docker/routlin-dash/data/page_content.json b/docker/routlin-dash/data/page_content.json index c129b6c..f6865ee 100644 --- a/docker/routlin-dash/data/page_content.json +++ b/docker/routlin-dash/data/page_content.json @@ -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",