diff --git a/docker/routlin-dash/app/view_page.py b/docker/routlin-dash/app/view_page.py index 9aba857..ac8e194 100644 --- a/docker/routlin-dash/app/view_page.py +++ b/docker/routlin-dash/app/view_page.py @@ -591,6 +591,24 @@ def collect_tokens(): tokens['GENERAL_DAILY_EXECUTE_TIME'] = str(dns_blk_gen.get('daily_execute_time_24hr_local', '-')) tokens['GENERAL_APPLY_ON_SAVE'] = 'true' if session.get('apply_changes_immediately', False) else 'false' + # Queue health fix before building the pending table so it appears immediately. + _level = _client_level() + if _level >= LEVEL_RANK['administrator']: + try: + import json as _hj + _st = _hj.load(open(f'{CONFIGS_DIR}/.health')) + _has_problems = any( + item.get('status') == 'problem' + for section in ('configurations', 'logs', 'services') + for item in _st.get(section, []) + ) + if _has_problems: + _fix_uuid, _ = _find_cmd_in_queues('fix problems') + if _fix_uuid is None: + queue_command('fix problems', user=session.get('email_address', '')) + except Exception: + pass + all_snaps = load_all_snapshots() _snap_uuid_set = {s.get('uuid') for s in all_snaps} pending_items = get_dashboard_pending() @@ -1710,8 +1728,6 @@ def render_layout(view_id, content_html, tokens): fix_suffix = 'Please contact an administrator.' else: fix_uuid, fix_ts = _find_cmd_in_queues('fix problems') - if fix_uuid is None: - fix_uuid, fix_ts = queue_command('fix problems', user=current_user) if _apply_changes_immediately(): if _is_locked(): mtime = _lock_mtime()