Repository navigation
Toolbar: show disk work (clone, compact, grow) like profile work - #130
Conversation
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
left a comment
There was a problem hiding this comment.
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.
| notBusy(name) | ||
| diskWork.set(name, what) | ||
| diskWork.set(name, work) | ||
| send('vm:work', { name, work }) |
There was a problem hiding this comment.
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.
|
Fixed in bd83fa3: |
A21-devs
left a comment
There was a problem hiding this comment.
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.
Closes #128
withDiskWorkin 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."ProfileWorkstays, and a newDiskWork(cloning | compacting | growing) sits next to it.VmWorkis either.vm:profileWork/profileWork()becomevm:work/vmWork().withDiskWorksends start and end on the same channel the profile code uses, andvmWork()returns both kinds.startnow refuses a busy VM likestartVmdoes (it didn't before, for profile saves either).Testing
npm run typecheck,npm test(143 passed),npm run buildsendcalls around the existingwithDiskWork.