Volumes page: on-demand volume sizes (0.18.0)

Docker's volume list has no size, so add a "Compute sizes" button that runs
`docker system df` (via client.df()) and shows per-volume size in a new Size
column. The df walk is expensive (seconds), so results are cached ~60s and
loaded on demand instead of on every poll.

- volume_service.volume_sizes(force) with a 60s TTL cache; GET /api/volumes/sizes
  + agent /agent/volumes/sizes + proxy /api/agents/{id}/volumes/sizes.
- Frontend: volumesApi.sizes(force, agentId); Volumes page gained a Size column
  and a Compute sizes button (per host) that triggers the lookup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
menzelj
2026-06-08 13:07:07 +00:00
co-authored by Claude Opus 4.8
parent 8f6e354b3f
commit 56450efd82
9 changed files with 96 additions and 5 deletions
+13
View File
@@ -660,6 +660,19 @@ async def agent_volumes(
return await _proxy(session, agent, "GET", "/agent/volumes") or []
@router.get("/{agent_id}/volumes/sizes")
async def agent_volume_sizes(
agent_id: int,
force: bool = Query(False),
session: Session = Depends(get_session),
_user: User = Depends(get_current_user),
) -> dict:
agent = _get_or_404(session, agent_id)
return await _proxy(
session, agent, "GET", "/agent/volumes/sizes", params={"force": force}
)
@router.post("/{agent_id}/volumes/prune")
async def agent_volumes_prune(
agent_id: int,
+9
View File
@@ -31,6 +31,15 @@ def orphaned(_user: User = Depends(get_current_user)) -> list[dict]:
return volume_service.orphaned_volumes()
@router.get("/api/volumes/sizes")
def volume_sizes(
force: bool = Query(False),
_user: User = Depends(get_current_user),
) -> dict:
"""Volume sizes in bytes ({name: size|null}). Expensive; cached ~60s."""
return volume_service.volume_sizes(force=force)
@router.delete("/api/volumes/{name}")
def delete_volume(
name: str,