From 1226b0654e4f3bba8a3334c6d67b33425a60a845 Mon Sep 17 00:00:00 2001 From: kodi Date: Sat, 28 Feb 2026 11:58:55 +0100 Subject: [PATCH] refactor(api): move /test-hybrid into app_system router --- control/app.py | 28 +--------------------------- control/app_system.py | 27 ++++++++++++++++++++++++++- webui/html/assets/css/app.css | 4 ++++ webui/html/index.html | 2 +- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/control/app.py b/control/app.py index b994d5f..a80c82d 100644 --- a/control/app.py +++ b/control/app.py @@ -1,4 +1,3 @@ -import os import subprocess from app_images import init_images_router from app_files import init_files_router @@ -9,7 +8,6 @@ from app_system import init_system_router from fastapi import FastAPI, HTTPException import requests_unixsocket from common import ( - _podman_get_json as _common_podman_get_json, _systemctl as _common_systemctl, ) import uvicorn @@ -32,7 +30,7 @@ def _run_systemctl_action(action: str, unit: str): # --- ROUTERS --- # Images API lives in dedicated modules to keep this file from growing further. -app.include_router(init_system_router(SESSION, PODMAN_API_BASE)) +app.include_router(init_system_router(SESSION, PODMAN_API_BASE, WORKLOADS_DIR)) app.include_router(init_images_router(SESSION, PODMAN_API_BASE)) app.include_router(init_files_router(SESSION, PODMAN_API_BASE, WORKLOADS_DIR)) app.include_router(init_networks_router(SESSION, PODMAN_API_BASE)) @@ -50,30 +48,6 @@ app.include_router(init_pods_router( )) -@app.get("/test-hybrid") -def test_hybrid(): - # 1. Check filesystem - try: - bestanden = [] - for root, _, files in os.walk(WORKLOADS_DIR): - for f in files: - bestanden.append(os.path.join(root, f)) - except Exception as e: - bestanden = f"FS Fout: {str(e)}" - - # 2. Check Podman API - try: - api_containers = _common_podman_get_json(SESSION, f"{PODMAN_API_BASE}/libpod/containers/json?all=true") - except Exception as e: - api_containers = f"API Fout: {str(e)}" - - return { - "bestanden_gevonden": bestanden if isinstance(bestanden, list) else [], - "api_containers_aantal": len(api_containers) if isinstance(api_containers, list) else -1, - "api_raw_sample": api_containers[0] if isinstance(api_containers, list) and api_containers else api_containers, - } - - @app.post("/daemon-reload") def api_daemon_reload(): try: diff --git a/control/app_system.py b/control/app_system.py index 23afe60..50787b2 100644 --- a/control/app_system.py +++ b/control/app_system.py @@ -1,9 +1,11 @@ +import os import subprocess from fastapi import APIRouter +from common import _podman_get_json as _common_podman_get_json -def init_system_router(session, podman_api_base: str) -> APIRouter: +def init_system_router(session, podman_api_base: str, workloads_dir: str) -> APIRouter: router = APIRouter(tags=["system"]) @router.get("/health") @@ -40,4 +42,27 @@ def init_system_router(session, podman_api_base: str) -> APIRouter: "systemd_user": {"reachable": systemd_reachable}, } + @router.get("/test-hybrid") + def test_hybrid(): + # 1. Check filesystem + try: + bestanden = [] + for root, _, files in os.walk(workloads_dir): + for f in files: + bestanden.append(os.path.join(root, f)) + except Exception as e: + bestanden = f"FS Fout: {str(e)}" + + # 2. Check Podman API + try: + api_containers = _common_podman_get_json(session, f"{podman_api_base}/libpod/containers/json?all=true") + except Exception as e: + api_containers = f"API Fout: {str(e)}" + + return { + "bestanden_gevonden": bestanden if isinstance(bestanden, list) else [], + "api_containers_aantal": len(api_containers) if isinstance(api_containers, list) else -1, + "api_raw_sample": api_containers[0] if isinstance(api_containers, list) and api_containers else api_containers, + } + return router diff --git a/webui/html/assets/css/app.css b/webui/html/assets/css/app.css index c353f56..6df1bbf 100644 --- a/webui/html/assets/css/app.css +++ b/webui/html/assets/css/app.css @@ -83,6 +83,10 @@ header{ box-shadow: var(--shadow); overflow:hidden; } +/* Allow container actions dropdown to render outside the card bounds */ +.card--menu-overflow{ + overflow: visible; +} .card.half{min-height: 240px;} .cardHeader{ display:flex; align-items:center; justify-content:space-between; diff --git a/webui/html/index.html b/webui/html/index.html index 62ddbc1..4db1234 100644 --- a/webui/html/index.html +++ b/webui/html/index.html @@ -85,7 +85,7 @@