Development

This commit is contained in:
Matthew Grotke 2026-06-07 19:15:03 -04:00
parent d78209e18d
commit ec4f7dd90e
2 changed files with 10 additions and 3 deletions

View file

@ -21,7 +21,11 @@
{ {
"type": "info_bar", "type": "info_bar",
"variant": "info", "variant": "info",
"text": "%RADIUS_CLIENT_STATUS_TEXT%" "text": "You should only enable RADIUS if you also configure your managed switch and/or Wireless Access Points to consult RADIUS. RADIUS will be disabled if there are no RADIUS Clients (authenticators) specified on the DHCP Reservations page."
},
{
"type": "raw_html",
"html": "%RADIUS_STATUS_BAR%"
}, },
{ {
"type": "card", "type": "card",

View file

@ -104,9 +104,12 @@ def collect_tokens(cfg):
all_radius_clients = [r for r in cfg.get('dhcp_reservations', []) if r.get('radius_client') is True] all_radius_clients = [r for r in cfg.get('dhcp_reservations', []) if r.get('radius_client') is True]
n = len(all_radius_clients) n = len(all_radius_clients)
if n > 0: if n > 0:
tokens['RADIUS_CLIENT_STATUS_TEXT'] = f"RADIUS will be disabled if there are no RADIUS Clients (authenticators) specified on the DHCP Reservations page. There are currently {n} RADIUS Client{'s' if n != 1 else ''}. RADIUS is enabled." variant = 'success'
text = f"There are currently {n} RADIUS Client{'s' if n != 1 else ''}. RADIUS is enabled."
else: else:
tokens['RADIUS_CLIENT_STATUS_TEXT'] = "RADIUS will be disabled if there are no RADIUS Clients (authenticators) specified on the DHCP Reservations page. There are currently 0 RADIUS Clients. RADIUS is disabled." variant = 'warning'
text = "There are currently 0 RADIUS Clients. RADIUS is disabled."
tokens['RADIUS_STATUS_BAR'] = f'<div class="info-bar info-bar-inline info-bar-{variant}">{text}</div>'
radius_client_reservations = [ radius_client_reservations = [
r for r in all_radius_clients r for r in all_radius_clients