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:
co-authored by
Claude Opus 4.8
parent
19cc92dc94
commit
8f6e354b3f
+32
-1
@@ -44,6 +44,7 @@ from services import (
|
||||
image_service,
|
||||
network_service,
|
||||
update_service,
|
||||
volume_service,
|
||||
)
|
||||
|
||||
logger = logging.getLogger("stackpilot.agent")
|
||||
@@ -59,7 +60,7 @@ def _map_docker(exc: DockerError):
|
||||
raise HTTPException(status_code=code, detail=exc.detail or exc.error)
|
||||
raise exc # falls through to the global 502 DockerError handler
|
||||
|
||||
AGENT_VERSION = "0.16.0"
|
||||
AGENT_VERSION = "0.17.0"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
@@ -436,6 +437,36 @@ async def image_check() -> dict:
|
||||
return await update_service.check_all()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Volumes
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
@app.get("/agent/volumes", dependencies=[Depends(verify_token)])
|
||||
def list_volumes() -> list[dict]:
|
||||
return volume_service.list_volumes()
|
||||
|
||||
|
||||
@app.delete("/agent/volumes/{name}", dependencies=[Depends(verify_token)])
|
||||
def delete_volume(name: str, force: bool = Query(False)) -> dict:
|
||||
vols = {v["name"]: v for v in volume_service.list_volumes()}
|
||||
if name in vols and vols[name]["in_use"] and not force:
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail={
|
||||
"error": "volume_in_use",
|
||||
"detail": f"Volume '{name}' is used by: {', '.join(vols[name]['used_by'])}",
|
||||
},
|
||||
)
|
||||
volume_service.remove_volume(name, force=force)
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@app.post("/agent/volumes/prune", dependencies=[Depends(verify_token)])
|
||||
def prune_volumes() -> dict:
|
||||
return volume_service.prune_volumes()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# File browser (sandboxed by this agent's ALLOWED_BROWSE_ROOTS/HOST_ROOT_PREFIX)
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
Reference in New Issue
Block a user