From 114da3cd1c2ec2133a41c713f5c9abcc681465a6 Mon Sep 17 00:00:00 2001 From: Matthew Grotke Date: Mon, 8 Jun 2026 10:48:44 -0400 Subject: [PATCH] Development --- docker/routlin-dash/app/factory.py | 10 ++++++++++ .../app/pages/clientcredentials/content.json | 13 ++++++++++--- .../app/pages/clientcredentials/view.py | 14 +++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docker/routlin-dash/app/factory.py b/docker/routlin-dash/app/factory.py index 4e3aa51..03ceed5 100644 --- a/docker/routlin-dash/app/factory.py +++ b/docker/routlin-dash/app/factory.py @@ -925,6 +925,16 @@ def build_table_cell(value, render_fn, col_class='', field='', row_idx=None, inner = 'Disabled' return f'{td_open}{inner}' + if render_fn == 'badge_account_status': + v = str(value) + if v == 'Active': + inner = 'Active' + elif v == 'Expired': + inner = 'Expired' + else: + inner = 'Disabled' + return f'{td_open}{inner}' + if render_fn == 'badge_yes_no': opts = render_options or {} if str(value).lower() in ('true', '1', 'yes', 'enabled'): diff --git a/docker/routlin-dash/app/pages/clientcredentials/content.json b/docker/routlin-dash/app/pages/clientcredentials/content.json index f08bfd5..6a92fb4 100644 --- a/docker/routlin-dash/app/pages/clientcredentials/content.json +++ b/docker/routlin-dash/app/pages/clientcredentials/content.json @@ -38,6 +38,13 @@ "value": "all", "filter_col": "vlan", "options": "%CRED_VLAN_FILTER_OPTIONS%" + }, + { + "type": "select", + "name": "status_filter", + "value": "all", + "filter_col": "account_status", + "options": "%STATUS_FILTER_OPTIONS%" } ] }, @@ -72,10 +79,10 @@ "class": "col-narrow" }, { - "label": "Active", - "field": "active", + "label": "Status", + "field": "account_status", "class": "col-narrow", - "render": "badge_yes_no" + "render": "badge_account_status" } ], "row_actions": [ diff --git a/docker/routlin-dash/app/pages/clientcredentials/view.py b/docker/routlin-dash/app/pages/clientcredentials/view.py index dacf200..fbd4652 100644 --- a/docker/routlin-dash/app/pages/clientcredentials/view.py +++ b/docker/routlin-dash/app/pages/clientcredentials/view.py @@ -92,6 +92,13 @@ def collect_tokens(cfg): '' ) + tokens['STATUS_FILTER_OPTIONS'] = ( + '' + '' + '' + '' + ) + vlans = [v for v in cfg.get('vlans', []) if not v.get('is_vpn')] tokens['CRED_VLAN_FILTER_OPTIONS'] = ( '' + @@ -130,7 +137,12 @@ def collect_tokens(cfg): expires_seconds = r.get('expires_seconds', 0) is_expired = (expires_seconds > 0 and (r.get('date_set', 0) + expires_seconds) <= int(time.time())) - r['active'] = r.get('enabled', 0) == 1 and not is_expired + if r.get('enabled', 0) != 1: + r['account_status'] = 'Disabled' + elif is_expired: + r['account_status'] = 'Expired' + else: + r['account_status'] = 'Active' display_rows.append(r) content = factory.load_json(f'{factory.PAGES_DIR}/clientcredentials/content.json')