Replace the analytics-style dashboard (stack-health funnel, uptime %, operations/day grid, AI pill) with an attention-driven fleet cockpit: - New /api/dashboard/fleet endpoint: server-side fan-out across the local host and every agent into one payload — a prioritized "needs attention" list, headline KPIs, an honest stack-status breakdown and a per-host resource rollup. Each agent uses its own DB session so the fan-out is concurrency-safe; failures degrade to "offline" instead of stalling. - New frontend: AttentionStrip, FleetKpiRow, StackStatusBar and HostResourceTable; Dashboard.tsx rewritten around them. - Remove the funnel/summary endpoints, the uptime sampler loop and the ops-activity machinery; delete the now-unused chart components. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
767 B
Python
24 lines
767 B
Python
"""Dashboard aggregation endpoint (fleet-wide cockpit data)."""
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlmodel import Session
|
|
|
|
from auth import get_current_user
|
|
from database import get_session
|
|
from models.user import User
|
|
from services import dashboard_service
|
|
|
|
router = APIRouter(prefix="/api/dashboard", tags=["dashboard"])
|
|
|
|
|
|
@router.get("/fleet")
|
|
async def fleet(
|
|
refresh: bool = False,
|
|
session: Session = Depends(get_session),
|
|
_user: User = Depends(get_current_user),
|
|
) -> dict:
|
|
"""Fleet-wide 'needs attention' list, KPIs and per-host rollup across the
|
|
local host and every agent — the data behind the operator cockpit."""
|
|
return await dashboard_service.compute_fleet(session, refresh=refresh)
|