Phase 16: volumes page, multi-host (0.17.0)

Adds a dedicated Volumes page (sidebar) with per-host sections (local + each
online agent), matching the Networks/Images layout. Lists volumes with driver,
owning stack, in-use containers and mountpoint; admins can delete (with an
in-use warning + force option) and prune unused, plus an "only unused" filter.

- agent_app.py: /agent/volumes (list/delete with in-use 409 guard/prune)
  reusing volume_service.
- routers/agents.py: proxy routes /api/agents/{id}/volumes/* (audit-logged
  delete/prune).
- Frontend: volumesApi list/remove/prune take an optional agentId; new
  pages/Volumes.tsx (VolumesSection per host) + sidebar entry + /volumes route.
  The volume wizard (generate-yaml/host paths) stays local and unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
menzelj
2026-06-08 12:49:59 +00:00
co-authored by Claude Opus 4.8
parent 19cc92dc94
commit 8f6e354b3f
9 changed files with 317 additions and 10 deletions
+51
View File
@@ -645,6 +645,57 @@ async def agent_image_check(
return result
# --------------------------------------------------------------------------- #
# Volumes (proxied)
# --------------------------------------------------------------------------- #
@router.get("/{agent_id}/volumes")
async def agent_volumes(
agent_id: int,
session: Session = Depends(get_session),
_user: User = Depends(get_current_user),
) -> list[dict]:
agent = _get_or_404(session, agent_id)
return await _proxy(session, agent, "GET", "/agent/volumes") or []
@router.post("/{agent_id}/volumes/prune")
async def agent_volumes_prune(
agent_id: int,
request: Request,
session: Session = Depends(get_session),
user: User = Depends(require_admin),
) -> dict:
agent = _get_or_404(session, agent_id)
result = await _proxy(session, agent, "POST", "/agent/volumes/prune")
audit_service.record(
session, user=user.username, action="agent.volume.prune", target=agent.name,
detail=str(result.get("VolumesDeleted") or []), ip=_ip(request),
)
return result
@router.delete("/{agent_id}/volumes/{name}")
async def agent_volume_delete(
agent_id: int,
name: str,
request: Request,
force: bool = Query(False),
session: Session = Depends(get_session),
user: User = Depends(require_admin),
) -> dict:
agent = _get_or_404(session, agent_id)
result = await _proxy(
session, agent, "DELETE", f"/agent/volumes/{name}", params={"force": force}
)
audit_service.record(
session, user=user.username, action="agent.volume.delete",
target=f"{agent.name}/{name}", ip=_ip(request),
)
return result
# --------------------------------------------------------------------------- #
# File browser (proxied)
# --------------------------------------------------------------------------- #