Development

This commit is contained in:
Matthew Grotke 2026-05-24 00:47:43 -04:00
parent 62fe75d7fd
commit c5d1c7890a
10 changed files with 24 additions and 21 deletions

View file

@ -5,12 +5,10 @@ import sanitize
import validation as validate
from datetime import datetime, timezone
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
from config_utils import core_hash, get_pending_entries, get_dashboard_pending, _seconds_until_next_run, _format_timing, _is_locked, _lock_mtime, PRODUCT_DISPLAY_NAME
from config_utils import core_hash, get_pending_entries, get_dashboard_pending, _seconds_until_next_run, _format_timing, _is_locked, _lock_mtime, PRODUCT_DISPLAY_NAME, CONFIGS_DIR, DATA_DIR
bp = Blueprint('view_page', __name__)
DATA_DIR = '/data'
CONFIGS_DIR = '/routlin_location'
LEVEL_RANK = {'nothing': 0, 'viewer': 1, 'administrator': 2, 'manager': 3}
@ -1485,16 +1483,25 @@ def render_layout(view_id, content_html, tokens):
try:
import json as _j
st = _j.load(open(f'{CONFIGS_DIR}/.status'))
grouped = {'error': [], 'warning': []}
for section in ('configurations', 'logs'):
for item in st.get(section, []):
if item.get('status') == 'problem':
sev = item.get('severity', 'error')
cls = 'info-bar-danger' if sev == 'error' else 'info-bar-warning'
text = e(item.get('detail', item.get('name', '')))
tip = item.get('suggestion', '')
if tip:
text += f' <span style="opacity:0.75">{e(tip)}</span>'
problem_bars += f'<div class="info-bar {cls}">{text}</div>\n'
grouped.setdefault(sev, []).append(text)
for sev, items in grouped.items():
if not items:
continue
cls = 'info-bar-danger' if sev == 'error' else 'info-bar-warning'
if len(items) == 1:
content = items[0]
else:
content = '<ul style="margin:0;padding-left:1.25em">' + ''.join(f'<li>{t}</li>' for t in items) + '</ul>'
problem_bars += f'<div class="info-bar {cls}">{content}</div>\n'
except Exception:
pass