Skip to content

Toolbar: show disk work (clone, compact, grow) like profile work - #130

Merged
A21-devs merged 4 commits into
mainfrom
feat/vm-work-disk
Dec 2, 2026
Merged

A21-devs merged 4 commits into
mainfrom
feat/vm-work-disk

Conversation

@A21-devs

@A21-devs A21-devs commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Closes #128

withDiskWork in ipc.ts already refused Power on, Save state, profiles and Delete while a full clone, a compact or a grow ran, but the renderer never heard about it. During a compact started from Disk tools, Power on stayed enabled and clicking it gave "Kali is having its disk compacted. Wait for it to finish."

  • ProfileWork stays, and a new DiskWork (cloning | compacting | growing) sits next to it. VmWork is either.
  • vm:profileWork / profileWork() become vm:work / vmWork(). withDiskWork sends start and end on the same channel the profile code uses, and vmWork() returns both kinds.
  • The refusal message for disk work is unchanged ("is having its disk compacted" and so on), it now comes from a small lookup.
  • App.tsx already fed the selected VM's work into the status line, the toolbar and the Hardware lock (Toolbar: show a running profile save and disable what it would refuse #121), so those now cover disk work too: "Compacting disk", "Growing disk", "Cloning".
  • Mock API: clone, compact and grow report work like the backend, the mock compact takes 4 s so it can be seen, and the mock start now refuses a busy VM like startVm does (it didn't before, for profile saves either).

Testing

  • npm run typecheck, npm test (143 passed), npm run build
  • dev:web: started a compact on Kali, the status read "Compacting disk", Power on was disabled with "Compacting disk. Wait for it to finish." as its tooltip, and calling start through the API was refused. It all went back once the compact finished.
  • Not run against real QEMU: the backend change only adds the two send calls around the existing withDiskWork.

withDiskWork already refused Power on, Save state, profiles and Delete
while a full clone, a compact or a grow runs, but only the backend knew.
vm:profileWork becomes vm:work with cloning, compacting and growing next
to the profile kinds, sent from withDiskWork too, and vmWork() returns
both. The error text for a refused action stays the same.
The status, the toolbar and the Hardware lock already follow the work
reported for the selected VM, so a compact or grow started from Disk
tools now shows Compacting disk / Growing disk and disables Power on
instead of letting it fail with an error. The mock API reports clone,
compact and grow the same way, with a compact long enough to look at.
startVm in ipc.ts checks notBusy, the mock's start didn't, so in dev:web
a VM could be powered on in the middle of a compact.
@A21-devs A21-devs added enhancement New feature or request ui labels Dec 2, 2026

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff and tried it in dev:web. The rename is complete (no profileWork left in src or tests) and satisfies Record<VmWork, string> on workLabel means a new kind can't be added without a label.

One real thing, inline. Also looked at: a linked clone takes well under a second, so the status flashes "Cloning" briefly. The clone dialog is modal and already disables everything while it runs, so I'd leave it.

Comment thread src/main/ipc.ts
notBusy(name)
diskWork.set(name, what)
diskWork.set(name, work)
send('vm:work', { name, work })

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now sends vm:work before anything checked that name is a VM. All three callers only call byName(name) inside fn, so clone('nope', ...) broadcasts work for a VM that doesn't exist, then a null right after. The renderer survives it (it just adds and drops a key), but name comes straight from IPC and remove checks byName first for the same reason. Calling byName(name) at the top of withDiskWork would cover all three.

@A21-devs

A21-devs commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Fixed in bd83fa3: withDiskWork calls byName(name) first, so an unknown name throws "No VM called ..." before anything is sent, for clone, compact and grow alike. Reran typecheck, npm test (143 passed) and the build.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked bd83fa3 against the earlier finding: byName(name) now runs before notBusy and the first send, so a bad name throws before the renderer hears anything. The lookups inside the three handlers are still there and still needed, they want the config itself. Nothing else changed. Good to go.

The clone, compact and grow handlers only look the VM up inside the
work, so a bad name from IPC was sent to the renderer as work and
cleared right after.
@A21-devs
A21-devs merged commit 181a7ee into main Dec 2, 2026
1 check passed
@A21-devs
A21-devs deleted the feat/vm-work-disk branch December 2, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toolbar: show disk work (clone, compact, grow) like profile work

1 participant