Add graph filter by entity type/running state and fix duplicate API calls

- Add entity type toggle pills and running/stopped filter to graph filter bar
- DataCache: return cached data if fresh, skip redundant fetches on page load
- Entity events: use force-fetch instead of invalidate+fetch to avoid stale gap
- Add no-cache middleware for static JS/CSS/JSON to prevent stale browser cache
- Reduces API calls on page load from ~70 to ~30

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-14 21:56:46 +03:00
parent a922c6e052
commit dd92af9913
8 changed files with 157 additions and 26 deletions

View File

@@ -276,6 +276,14 @@ async def pwa_service_worker():
)
# Middleware: no-cache for static JS/CSS (development convenience)
@app.middleware("http")
async def _no_cache_static(request: Request, call_next):
response = await call_next(request)
if request.url.path.startswith("/static/") and request.url.path.endswith((".js", ".css", ".json")):
response.headers["Cache-Control"] = "no-cache, must-revalidate"
return response
# Mount static files
static_path = Path(__file__).parent / "static"
if static_path.exists():