feat (health): voeg helper socket check toe, drie visuele states

Backend (/api/health):
- Importeer HELPER_SOCKET uit common.py
- Voeg helper-check toe: connect() op /run/podman-helper.sock, timeout=2s
- ok blijft true als alleen de helper ontbreekt (waarschuwing, geen fout)
- Nieuwe response key: "helper": {"ok": bool}

Frontend (pingApi / setApiState):
- pingApi() roept nu /api/health aan i.p.v. /pods-dashboard
- setApiState(state, msg) accepteert 'ok' / 'warn' / 'error'
- Gele dot met --warn kleur als helper.ok=false maar core OK
- refreshActive() delegeert statusupdate aan pingApi()
- Detailbericht bij fout: toont welk component (podman/systemd) faalt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 08:06:38 +01:00
parent e469508570
commit 5e7d1b887c
2 changed files with 31 additions and 10 deletions
+12
View File
@@ -1,8 +1,10 @@
import os
import socket
import subprocess
from fastapi import APIRouter, HTTPException
from common import (
HELPER_SOCKET,
_helper_call,
_podman_get_json as _common_podman_get_json,
_systemctl as _common_systemctl,
@@ -40,11 +42,21 @@ def init_system_router(session, podman_api_base: str, workloads_dir: str) -> API
except Exception:
systemd_reachable = False
helper_ok = False
try:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
s.settimeout(2)
s.connect(HELPER_SOCKET)
helper_ok = True
except Exception:
helper_ok = False
ok = podman_ok and systemd_reachable
return {
"ok": ok,
"podman": {"ok": podman_ok},
"systemd_user": {"reachable": systemd_reachable},
"helper": {"ok": helper_ok},
}
@router.get("/test-hybrid")