Fix onboard WebKit preview and archive board telemetry locally

This commit is contained in:
DCCONSTRUCTIONS
2026-09-08 01:37:52 +03:00
parent d8afb61229
commit f0802d2713
46 changed files with 2623 additions and 40 deletions
+15
View File
@@ -51,6 +51,21 @@ class AddRequest(BaseModel):
router = APIRouter(prefix="/api/v1/fleet", tags=["fleet"])
@router.get("/{vehicle_id}/monitor")
def board_monitor(vehicle_id: str, response: Response,
fleet: Annotated[FleetRegistry, Depends(local_operator)],
metric: str = "cpu.usage", window: int = 900, end: float | None = None):
response.headers["Cache-Control"] = "no-store"
try:
with fleet.lock:
node_id = fleet.find(vehicle_id)["node_id"]
return fleet.monitor.query(node_id, metric, window, end)
except PairingError as error:
raise HTTPException(404, str(error)) from None
except ValueError:
raise HTTPException(400, "Выберите доступный период и показатель.") from None
@router.get("")
def fleet_list(response: Response, fleet: Annotated[FleetRegistry, Depends(local_operator)]):
response.headers["Cache-Control"] = "no-store"