From 6e36b692dce2e4a70befea37d6d81db4cb150e7f Mon Sep 17 00:00:00 2001 From: Matthew Grotke Date: Sat, 13 Jun 2026 12:48:01 -0400 Subject: [PATCH] Development --- docker/routlin-dash/app/factory.py | 15 +++++++++++++-- docker/routlin-dash/app/navbar.json | 7 ++++--- .../app/pages/accountlogin/content.json | 3 ++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docker/routlin-dash/app/factory.py b/docker/routlin-dash/app/factory.py index 2e30379..044f7c9 100644 --- a/docker/routlin-dash/app/factory.py +++ b/docker/routlin-dash/app/factory.py @@ -359,7 +359,7 @@ def collect_form_specs(items): t = item.get('type', '') if t == 'field': itype = item.get('input_type', 'text') - if item.get('validate') or itype == 'checkbox' or itype == 'number': + if item.get('validate') or itype in ('checkbox', 'number', 'password'): fields.append(item) elif t == 'subnet_row': fields.append(item) @@ -386,6 +386,7 @@ def build_form_script(field_specs, submit_sel): subnet_items = [] validate_items = [] checkbox_only = [] + password_items = [] gate_vars = [] for spec in field_specs: @@ -414,6 +415,9 @@ def build_form_script(field_specs, submit_sel): gate_vars.append(f'{vn} && {vn}._valid') else: checkbox_only.append(vn) + elif itype == 'password': + password_items.append(vn) + gate_vars.append(f'{vn} && {vn}.value.trim()') else: validate_items.append((vn, nm)) if spec.get('optional'): @@ -450,6 +454,9 @@ def build_form_script(field_specs, submit_sel): for vn in checkbox_only: lines.append(f" if ({vn}) {vn}.addEventListener('change', _upd);") + for vn in password_items: + lines.append(f" if ({vn}) {vn}.addEventListener('input', _upd);") + lines.append('}());') return '' @@ -1134,6 +1141,8 @@ def build_items(items, tokens, inherited_req=None): level = client_level() parts = [] for item in items: + if item.get('multi_user_only') and settings.is_single_user(): + continue req = item.get('client_requirement', inherited_req) if not passes(req, level): continue @@ -1544,7 +1553,7 @@ def build_item(item, tokens, inherited_req=None): def render_layout(view_id, content_html, tokens, page_name=None, suppress_pending_bar=False): level = client_level() - has_pending_alert = not config_utils._apply_changes_immediately() and bool(config_utils.get_dashboard_pending()) + has_pending_alert = level != 'nothing' and not config_utils._apply_changes_immediately() and bool(config_utils.get_dashboard_pending()) titlebar_html = f'
{config_utils.WEB_APP_DISPLAY_NAME}
' navbar_html = build_navbar(view_id, level, tokens, pending_alert=has_pending_alert) footer_html = f'' @@ -1712,6 +1721,8 @@ def build_navbar(active_view, level, tokens, pending_alert=False): def build_nav_item(item, active_view, level, in_dropdown=False, inherited_req=None, pending_alert=False): + if item.get('multi_user_only') and settings.is_single_user(): + return '' req = item.get('client_requirement', inherited_req) t = item.get('type', '') diff --git a/docker/routlin-dash/app/navbar.json b/docker/routlin-dash/app/navbar.json index 27e3904..19e9b77 100644 --- a/docker/routlin-dash/app/navbar.json +++ b/docker/routlin-dash/app/navbar.json @@ -42,8 +42,8 @@ "client_requirement": "client_is_viewer+", "items": [ { "type": "nav_item", "label": "Preferences", "map_to": "preferences" }, - { "type": "nav_item", "label": "Manage Accounts", "map_to": "accountmanage", "client_requirement": "client_is_manager+" }, - { "type": "nav_action", "label": "Log Out", "action": "log_out" } + { "type": "nav_item", "label": "Manage Accounts", "map_to": "accountmanage", "client_requirement": "client_is_manager+", "multi_user_only": true }, + { "type": "nav_action", "label": "Log Out", "action": "accountlogout/logout" } ] }, { @@ -58,7 +58,8 @@ "label": "Create Account", "map_to": "accountcreate", "align": "right", - "client_requirement": "client_is_nothing=" + "client_requirement": "client_is_nothing=", + "multi_user_only": true } ] } diff --git a/docker/routlin-dash/app/pages/accountlogin/content.json b/docker/routlin-dash/app/pages/accountlogin/content.json index 0e9216c..ebb853a 100644 --- a/docker/routlin-dash/app/pages/accountlogin/content.json +++ b/docker/routlin-dash/app/pages/accountlogin/content.json @@ -54,7 +54,8 @@ "link": { "action": "/accountcreate", "text": "Create Account" - } + }, + "multi_user_only": true } ] }