From 1ca807dcbe9252ddabdd77cfe692ed7983f1baa8 Mon Sep 17 00:00:00 2001 From: jze9 Date: Tue, 7 Jul 2026 00:57:02 +0500 Subject: [PATCH] Embed per-run plots and flight animation in the web dashboard Clicking a config in the dashboard now shows its velocity/field/current plots (rendered on the fly by /api/run//plot/.png) plus an on-demand GIF of the slug flying through the coils (/api/run//anim.gif). Matplotlib rendering is serialized behind a lock since the Agg pyplot state machine isn't thread-safe and the server is threaded. Verified end to end: endpoints return real PNG/GIF bytes. Co-Authored-By: Claude Sonnet 5 --- src/gausse/web/page.py | 34 +++++++++++++++- src/gausse/web/render.py | 84 ++++++++++++++++++++++++++++++++++++++++ src/gausse/web/server.py | 29 ++++++++++++++ tests/test_web.py | 36 +++++++++++++++++ 4 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 src/gausse/web/render.py diff --git a/src/gausse/web/page.py b/src/gausse/web/page.py index 13f1198..f182874 100644 --- a/src/gausse/web/page.py +++ b/src/gausse/web/page.py @@ -34,9 +34,15 @@ PAGE_HTML = r""" white-space:pre-wrap; max-height:320px; overflow:auto; line-height:1.5; } .pill { display:inline-block; padding:1px 7px; border-radius:10px; font-size:11px; background:#21262d; } #detail { margin-top:20px; background:#161b22; border:1px solid #30363d; border-radius:8px; padding:16px; display:none; } - #detail pre { white-space:pre-wrap; font-family: ui-monospace, monospace; font-size:12px; margin:0; } + #detail pre { white-space:pre-wrap; font-family: ui-monospace, monospace; font-size:12px; margin:0; + max-height:340px; overflow:auto; background:#0a0d12; padding:10px; border-radius:6px; } .close { float:right; cursor:pointer; color:#8b949e; } a { color:#58a6ff; } + .plots { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; margin:12px 0; } + .plots img { width:100%; border:1px solid #30363d; border-radius:6px; background:#fff; } + .btn { display:inline-block; margin:8px 0; padding:6px 12px; background:#238636; color:#fff; + border:none; border-radius:6px; cursor:pointer; font-size:13px; } + #gifbox img { max-width:100%; border:1px solid #30363d; border-radius:6px; margin-top:8px; } @@ -77,7 +83,13 @@ PAGE_HTML = r"""
✕ закрыть -

+

+
+ +
+

Полная детализация (расстояния, батарея, физика, результат)

+

+