Development

This commit is contained in:
Matthew Grotke 2026-05-24 01:13:45 -04:00
parent e72676eac5
commit 80390334fb
2 changed files with 75 additions and 45 deletions

View file

@ -1495,12 +1495,25 @@ def render_layout(view_id, content_html, tokens):
grouped.setdefault(sev, []).append(text)
for item in st.get('services', []):
if item.get('status') == 'problem':
parts = []
name = item.get('name', '')
utype = 'timer' if name.endswith('.timer') else 'service' if name.endswith('.service') else 'unit'
exp_parts, act_parts, fix_parts = [], [], []
if not item.get('active_ok'):
parts.append(f"active: {item.get('active')} (expected {item.get('expected_active')})")
exp_parts.append(item.get('expected_active', 'active'))
act_parts.append(item.get('active', 'unknown'))
fix_parts.append('activate')
if not item.get('enabled_ok'):
parts.append(f"enabled: {item.get('enabled')} (expected {item.get('expected_enabled')})")
grouped['error'].append(e(f"{item.get('name')}: {', '.join(parts)}"))
exp_parts.append(item.get('expected_enabled', 'enabled'))
act_parts.append(item.get('enabled', 'unknown'))
fix_parts.append('enable')
detail = (f"The {utype} `{name}` is expected to be "
f"{' and '.join(exp_parts)} but is {' and '.join(act_parts)}.")
tip = f"Run `sudo python3 core.py --apply` to {' and '.join(reversed(fix_parts))} it."
sev = item.get('severity', 'error')
text = e(detail)
if tip:
text += f' <span style="opacity:0.75">{e(tip)}</span>'
grouped.setdefault(sev, []).append(text)
for sev, items in grouped.items():
if not items:
continue