feat: Volumes and Images pages #6

Merged
jfro merged 2 commits from feat/1-volumes-images into main 2026-11-29 00:39:32 +00:00
Owner

Closes #1, closes #2.

Replaces the Volumes and Images placeholders with real pages in the Containers style: a searchable list split into In Use / Unused, and a detail pane built from InfoSection/InfoRow.

Volumes

  • List: name, size, who uses it (or when it was created), total count and size in the header.
  • Details: name, status, size, created, driver, scope, mountpoint, Used By (each opens the container on the Containers page), compose project/volume, driver options, labels. Copy buttons on the usual rows.
  • Actions: New Volume (+), Delete (confirm; refused with a clear "in use by …" message, never forced), Delete Unused (anonymous only, or tick Include named volumes; the dialog says how many and how much), Copy Name / Copy Mountpoint, Open in File Manager when the mountpoint is readable by you (it usually isn't for the local driver, so it's hidden then).

Images

  • List: repo, tag, age and size; untagged images show as <none> with their short id.
  • Details: tags, id, digest, status, size, created, platform, entrypoint, command, working dir, user, exposed ports, environment, labels, Used By.
  • Actions: Delete (confirm, never forced; an image with several tags is untagged one tag at a time, which is what docker rmi does without -f), Delete Unused (dangling only, or tick Also delete unused tagged images), Copy Name / Copy ID.
  • Pull with progress is left out of this PR; happy to do it as a follow-up.

How it works

  • src/docker.rs: a resource watcher (started the first time the window refreshes) lists volumes and images, re-reads on Docker image/volume events, and every 10 s as a fallback. Actions are async fns that return a user-facing outcome.
  • Volume sizes: bollard 0.20's typed df() expects a VolumesDiskUsage key that current engines don't send (they answer Volumes, or VolumeUsage when verbose), so sizes come from a raw GET /system/df?type=volume over the engine's Unix socket (tokio net, no new crates). Remote (tcp://) engines just show no size. Re-read when volumes change or every 60 s, since it's slow on big hosts.
  • src/window/data.rs shapes both lists to JSON (including which containers use each); bridge.rs adds volumes_json, images_json, resources_error, image_inspect_json, the action invokables and a resourceActionFinished signal. Success shows a toast; a Docker error shows an alert with Docker's message.
  • QML: VolumesPage, ImagesPage, shared ResourceList / ResourceRow / ResourceDetail / ResourceIcon, a generic confirm/alert dialog and a New Volume dialog in Main.qml. The context-menu items moved from ContainerList into MenuEntry / MenuDivider / ContextMenu so all lists share them. Image tiles use the same color as their containers' avatars.

Also in here

  • fix: build with Qt 6.8: Qt 6.8's qmlcachegen (Debian 13) rejects p.public / p.private as reserved words, so main didn't build there. The port fields are now hostPort / containerPort. Separate commit.

Tried

Built with cargo build (no new warnings; cargo clippy only shows the 4 existing warnings), cargo test (adds 2 unit tests for the df parsing and byte formatting), and ran the app against a sandbox docker:dind daemon with example data (a shop compose project with postgres/redis/nginx, a few extra volumes and images): listed, searched, opened details, created a volume, deleted a volume and an image, pruned both, hit the in-use refusal, and forced a real Docker refusal (a container grabbed the volume while the confirm was open) to check the error alert.

Screenshots (example data)

Volumes — shop_pgdata selected, used by the compose project's db service:
Volumes page

Images — nginx selected, with its config, env and the container using it:
Images page

Delete Unused confirm with the option ticked:
Prune images confirm

A Docker refusal surfacing as an alert (a container started using the volume while the confirm was open):
Delete refused

Icons on my test desktop come from its own theme (not Breeze), so a couple of glyphs differ from what you'll see on Plasma.

Closes #1, closes #2. Replaces the Volumes and Images placeholders with real pages in the Containers style: a searchable list split into **In Use** / **Unused**, and a detail pane built from `InfoSection`/`InfoRow`. ### Volumes - List: name, size, who uses it (or when it was created), total count and size in the header. - Details: name, status, size, created, driver, scope, mountpoint, **Used By** (each opens the container on the Containers page), compose project/volume, driver options, labels. Copy buttons on the usual rows. - Actions: **New Volume** (+), **Delete** (confirm; refused with a clear "in use by …" message, never forced), **Delete Unused** (anonymous only, or tick *Include named volumes*; the dialog says how many and how much), Copy Name / Copy Mountpoint, Open in File Manager when the mountpoint is readable by you (it usually isn't for the local driver, so it's hidden then). ### Images - List: repo, tag, age and size; untagged images show as `<none>` with their short id. - Details: tags, id, digest, status, size, created, platform, entrypoint, command, working dir, user, exposed ports, environment, labels, **Used By**. - Actions: **Delete** (confirm, never forced; an image with several tags is untagged one tag at a time, which is what `docker rmi` does without `-f`), **Delete Unused** (dangling only, or tick *Also delete unused tagged images*), Copy Name / Copy ID. - **Pull with progress is left out** of this PR; happy to do it as a follow-up. ### How it works - `src/docker.rs`: a resource watcher (started the first time the window refreshes) lists volumes and images, re-reads on Docker `image`/`volume` events, and every 10 s as a fallback. Actions are `async fn`s that return a user-facing outcome. - Volume sizes: bollard 0.20's typed `df()` expects a `VolumesDiskUsage` key that current engines don't send (they answer `Volumes`, or `VolumeUsage` when verbose), so sizes come from a raw `GET /system/df?type=volume` over the engine's Unix socket (tokio `net`, no new crates). Remote (`tcp://`) engines just show no size. Re-read when volumes change or every 60 s, since it's slow on big hosts. - `src/window/data.rs` shapes both lists to JSON (including which containers use each); `bridge.rs` adds `volumes_json`, `images_json`, `resources_error`, `image_inspect_json`, the action invokables and a `resourceActionFinished` signal. Success shows a toast; a Docker error shows an alert with Docker's message. - QML: `VolumesPage`, `ImagesPage`, shared `ResourceList` / `ResourceRow` / `ResourceDetail` / `ResourceIcon`, a generic confirm/alert dialog and a New Volume dialog in `Main.qml`. The context-menu items moved from `ContainerList` into `MenuEntry` / `MenuDivider` / `ContextMenu` so all lists share them. Image tiles use the same color as their containers' avatars. ### Also in here - `fix: build with Qt 6.8`: Qt 6.8's `qmlcachegen` (Debian 13) rejects `p.public` / `p.private` as reserved words, so `main` didn't build there. The port fields are now `hostPort` / `containerPort`. Separate commit. ### Tried Built with `cargo build` (no new warnings; `cargo clippy` only shows the 4 existing warnings), `cargo test` (adds 2 unit tests for the df parsing and byte formatting), and ran the app against a sandbox `docker:dind` daemon with example data (a `shop` compose project with postgres/redis/nginx, a few extra volumes and images): listed, searched, opened details, created a volume, deleted a volume and an image, pruned both, hit the in-use refusal, and forced a real Docker refusal (a container grabbed the volume while the confirm was open) to check the error alert. ### Screenshots (example data) **Volumes** — `shop_pgdata` selected, used by the compose project's `db` service: ![Volumes page](https://git.knope.dev/attachments/b9ffebbd-0105-43b6-a05c-2eb2b5d3b242) **Images** — `nginx` selected, with its config, env and the container using it: ![Images page](https://git.knope.dev/attachments/717e896a-5014-4a12-9efb-5f05f4f24693) **Delete Unused** confirm with the option ticked: ![Prune images confirm](https://git.knope.dev/attachments/91825a14-e79e-4145-b5a8-c27ba82e225b) **A Docker refusal** surfacing as an alert (a container started using the volume while the confirm was open): ![Delete refused](https://git.knope.dev/attachments/9ce95908-af5c-461b-b893-b1f93a157f1a) Icons on my test desktop come from its own theme (not Breeze), so a couple of glyphs differ from what you'll see on Plasma.
Qt 6.8's qmlcachegen treats `public` and `private` as reserved words, so
`p.public` in Main.qml failed the build on Debian 13. Rename the port
fields to hostPort/containerPort.
Replace the Volumes and Images placeholders with real pages in the
Containers style: a searchable list split into In Use / Unused, and a
detail pane of InfoSections.

Volumes: size (from /system/df), created, which containers use it,
driver, mountpoint, compose project, driver options and labels. Create,
delete (refused with a clear message while a container uses it), prune
unused (anonymous only, or named too), copy name/mountpoint, and open
the mountpoint in the file manager when it's readable.

Images: tags, id, digest, size, created, platform, entrypoint/cmd,
exposed ports, env, labels and the containers using it. Delete without
force (an image with several tags is untagged tag by tag), prune
dangling or all unused, copy name/id. "Used by" rows open the container
on the Containers page.

Lists refresh on Docker image/volume events (and every 10s as a
fallback). Action results show as a toast; Docker errors as an alert.

Context menu items move into MenuEntry/MenuDivider/ContextMenu files so
all three lists share them.

Closes #1
Closes #2
jfro left a comment

Review from Nye: Approve (posted by Upper Wolfjaw, since Nye's token can't comment on this repo)

I built 08c5574 on Debian 13 (Qt 6.8.2) and ran krane --show against a docker:dind sandbox with a compose project, named and anonymous volumes, and a 3-tag image that includes a registry:port tag. I checked the Volumes and Images lists, sections and sizes, search (it matches tags other than the first), the detail panes, the in-use refusal alert, both prune dialogs (anonymous-only and include named), deleting a multi-tag image (all 3 tags gone), the Used By link back to Containers, and the Containers page with its port badge and localhost:8080 link. cargo test passes, and all QML compiles with qmlcachegen 6.8. F1 (Qt 6.8 build) is fixed by fcbe8a4.

Two notes that don't block it:

  1. remove_image untags one tag at a time, so if the last untag fails (say a container appeared after the list refreshed), the earlier tags are already gone. Only a race can cause it, since the UI refuses images in use.
  2. An image row shows only the first RepoTag, in Docker's order; a "+2" hint would help with multi-tag images.
**Review from Nye: Approve** (posted by Upper Wolfjaw, since Nye's token can't comment on this repo) I built 08c5574 on Debian 13 (Qt 6.8.2) and ran `krane --show` against a docker:dind sandbox with a compose project, named and anonymous volumes, and a 3-tag image that includes a registry:port tag. I checked the Volumes and Images lists, sections and sizes, search (it matches tags other than the first), the detail panes, the in-use refusal alert, both prune dialogs (anonymous-only and include named), deleting a multi-tag image (all 3 tags gone), the Used By link back to Containers, and the Containers page with its port badge and localhost:8080 link. `cargo test` passes, and all QML compiles with qmlcachegen 6.8. F1 (Qt 6.8 build) is fixed by fcbe8a4. Two notes that don't block it: 1. `remove_image` untags one tag at a time, so if the last untag fails (say a container appeared after the list refreshed), the earlier tags are already gone. Only a race can cause it, since the UI refuses images in use. 2. An image row shows only the first RepoTag, in Docker's order; a "+2" hint would help with multi-tag images.
jfro merged commit ee993dc31d into main 2026-11-29 00:39:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/krane!6
No description provided.