From c9c5b93ef8e44d77dc97f7874ecdb9c093079a0d Mon Sep 17 00:00:00 2001 From: gx Date: Thu, 21 May 2026 06:04:48 +0100 Subject: [PATCH] controller: GET /layouts/{instance} + UI fetch dynamic layout list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UI loadLayouts() теперь fetches /layouts/{inst} — берёт actual layout_map из config'а (не hardcoded), показывает только existing layouts. Co-Authored-By: Claude Opus 4.7 --- controller/cuda_grid_controller/http_api.py | 9 ++++++++ .../cuda_grid_controller/static/index.html | 23 +++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/controller/cuda_grid_controller/http_api.py b/controller/cuda_grid_controller/http_api.py index fc3ad86..8f6f897 100644 --- a/controller/cuda_grid_controller/http_api.py +++ b/controller/cuda_grid_controller/http_api.py @@ -85,6 +85,15 @@ def create_app( await dispatcher.handle(instance, "layout.set", req.layout) return {"ok": True, "instance": instance, "layout": req.layout} + @app.get("/layouts/{instance}") + async def layouts_for_instance(instance: str) -> dict[str, Any]: + inst = _check_instance(instance) + return { + "instance": instance, + "layouts": list(inst.layout_map.keys()), + "current": await state.get_layout(instance), + } + # ─── Overlays ────────────────────────────────────────────────── @app.post("/overlay/{instance}/add") diff --git a/controller/cuda_grid_controller/static/index.html b/controller/cuda_grid_controller/static/index.html index a6f4b2e..826b3b9 100644 --- a/controller/cuda_grid_controller/static/index.html +++ b/controller/cuda_grid_controller/static/index.html @@ -4,7 +4,7 @@ cuda-grid control - +