Buckets:

download
raw
1.94 kB
# src/veronica/ui/router.py
"""FastAPI router for serving the Veronica web UI static files."""
from __future__ import annotations
from pathlib import Path
from fastapi import APIRouter
from fastapi.responses import FileResponse, RedirectResponse
from fastapi.staticfiles import StaticFiles
STATIC_DIR = Path(__file__).parent / "static"
router = APIRouter(tags=["ui"])
def mount_static(app: object) -> None:
"""Mount static files on the FastAPI app (call after app creation)."""
app.mount("/ui/static", StaticFiles(directory=str(STATIC_DIR)), name="ui_static") # type: ignore[attr-defined]
@router.get("/", include_in_schema=False)
async def root_redirect() -> RedirectResponse:
"""Redirect root to the dashboard UI."""
return RedirectResponse(url="/ui/")
@router.get("/ui/", include_in_schema=False)
async def dashboard_index() -> FileResponse:
"""Serve the dashboard HTML."""
return FileResponse(str(STATIC_DIR / "index.html"))
@router.get("/ui/events", include_in_schema=False)
async def events_page() -> FileResponse:
"""Serve the event log HTML."""
return FileResponse(str(STATIC_DIR / "events.html"))
@router.get("/ui/incident", include_in_schema=False)
async def incident_page() -> FileResponse:
"""Serve the incident detail HTML."""
return FileResponse(str(STATIC_DIR / "incident.html"))
@router.get("/ui/policies", include_in_schema=False)
async def policies_page() -> FileResponse:
"""Serve the policy editor HTML."""
return FileResponse(str(STATIC_DIR / "policies.html"))
@router.get("/ui/replay", include_in_schema=False)
async def replay_page() -> FileResponse:
"""Serve the incident replay HTML."""
return FileResponse(str(STATIC_DIR / "replay.html"))
@router.get("/ui/rollouts", include_in_schema=False)
async def rollouts_page() -> FileResponse:
"""Serve the rollout pipeline HTML."""
return FileResponse(str(STATIC_DIR / "rollouts.html"))

Xet Storage Details

Size:
1.94 kB
·
Xet hash:
a330c93058522b154e613611b90e3fa63640f5d65bfa597c33695c6e8c3391b6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.