From 9e290d958a5cf6c513da6493f9f8f354c1370014 Mon Sep 17 00:00:00 2001 From: Matthew Grotke Date: Wed, 27 May 2026 03:28:44 -0400 Subject: [PATCH] Development --- docker/routlin-dash/app/action_networklayout.py | 14 +++++++++++++- docker/routlin-dash/app/view_page.py | 3 +++ docker/routlin-dash/data/page_content.json | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docker/routlin-dash/app/action_networklayout.py b/docker/routlin-dash/app/action_networklayout.py index 371a1a6..de75c31 100644 --- a/docker/routlin-dash/app/action_networklayout.py +++ b/docker/routlin-dash/app/action_networklayout.py @@ -199,6 +199,12 @@ def networklayout_tablevlans_edit(): entry.pop('hostname', None) new_identities.append(entry) + gateway_raw = sanitize.ip(request.form.get('gateway', '')) + inferred_gw = (min(identity_ips, key=lambda ip: int(ip.split('.')[-1])) + if identity_ips else '') + new_stored_gw = gateway_raw if (gateway_raw and gateway_raw != inferred_gw) else '' + existing_gw = existing.get('dhcp_information', {}).get('explicit_overrides', {}).get('gateway', '') + _ids_unchanged = ( len(new_identities) == len(old_identities) and all( @@ -215,7 +221,8 @@ def networklayout_tablevlans_edit(): and radius_default == bool(existing.get('radius_default', False)) and mdns_reflection == bool(existing.get('mdns_reflection', False)) and sorted(use_blocklists) == sorted(existing.get('use_blocklists', [])) - and _ids_unchanged): + and _ids_unchanged + and new_stored_gw == existing_gw): flash('No changes were made.', 'info') return redirect(VIEW) @@ -231,6 +238,11 @@ def networklayout_tablevlans_edit(): 'use_blocklists': use_blocklists, 'server_identities': new_identities, }) + dhcp_overrides = existing.setdefault('dhcp_information', {}).setdefault('explicit_overrides', {}) + if new_stored_gw: + dhcp_overrides['gateway'] = new_stored_gw + else: + dhcp_overrides.pop('gateway', None) errors = validate.validate_config(cfg) if errors: for msg in errors: diff --git a/docker/routlin-dash/app/view_page.py b/docker/routlin-dash/app/view_page.py index 18ef05d..103835b 100644 --- a/docker/routlin-dash/app/view_page.py +++ b/docker/routlin-dash/app/view_page.py @@ -322,6 +322,9 @@ def _config_datasource(name): row['server_identity_hostnames'] = json.dumps([ s.get('hostname', '') for s in v.get('server_identities', []) if s.get('ip') ]) + row['server_identity_gateway'] = ( + v.get('dhcp_information', {}).get('explicit_overrides', {}).get('gateway', '') + ) rows.append(row) return rows diff --git a/docker/routlin-dash/data/page_content.json b/docker/routlin-dash/data/page_content.json index 18cf3d5..e4d88f5 100644 --- a/docker/routlin-dash/data/page_content.json +++ b/docker/routlin-dash/data/page_content.json @@ -1585,7 +1585,8 @@ "pair_label": "Description (Opt)", "pair_col2": "server_identity_hostnames", "pair_label2": "Hostname (Opt)", - "pair_validate2": "networkname" + "pair_validate2": "networkname", + "gateway_col": "server_identity_gateway" }, { "col": "radius_default",