From e52fe9bf8a79efe90d51980f3506508f943ae1b5 Mon Sep 17 00:00:00 2001 From: Matthew Grotke Date: Sun, 7 Jun 2026 21:51:40 -0400 Subject: [PATCH] Development --- .../app/pages/captiveportal/content.json | 6 +++++- .../routlin-dash/app/pages/captiveportal/view.py | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docker/routlin-dash/app/pages/captiveportal/content.json b/docker/routlin-dash/app/pages/captiveportal/content.json index 949fd33..640422d 100644 --- a/docker/routlin-dash/app/pages/captiveportal/content.json +++ b/docker/routlin-dash/app/pages/captiveportal/content.json @@ -17,7 +17,11 @@ { "type": "info_bar", "variant": "info", - "text": "%CAPTIVE_STATUS_TEXT%" + "text": "Captive portal will be disabled if there are no VLANs specified as \"Restricted VLAN\" type \"Captive Portal\" on the Network Layout page." + }, + { + "type": "raw_html", + "html": "%CAPTIVE_STATUS_BAR%" }, { "type": "card", diff --git a/docker/routlin-dash/app/pages/captiveportal/view.py b/docker/routlin-dash/app/pages/captiveportal/view.py index b360a20..6daf492 100644 --- a/docker/routlin-dash/app/pages/captiveportal/view.py +++ b/docker/routlin-dash/app/pages/captiveportal/view.py @@ -9,14 +9,14 @@ def collect_tokens(cfg): cp = cfg.get('captive_portal', {}) captive_vlans = [v for v in cfg.get('vlans', []) if v.get('restricted_vlan') == 'c'] - if captive_vlans: - names = ', '.join(v['name'] for v in captive_vlans) - tokens['CAPTIVE_STATUS_TEXT'] = f"Captive portal active on: {names}." + n = len(captive_vlans) + if n > 0: + variant = 'success' + text = f'There are currently {n} captive portal VLAN{"s" if n != 1 else ""}. Captive portal is enabled.' else: - tokens['CAPTIVE_STATUS_TEXT'] = ( - 'No captive portal VLANs configured. ' - 'Set Restricted VLAN = Captive Portal on the Network Layout page.' - ) + variant = 'warning' + text = 'There are currently 0 captive portal VLANs. Captive portal is disabled.' + tokens['CAPTIVE_STATUS_BAR'] = f'
{text}
' tokens['CAPTIVE_HTTP_PORT'] = str(cp.get('http_port', 25328)) tokens['CAPTIVE_HTTPS_DOMAIN'] = cp.get('https_domain', '')