Skip to content

feat(web): drag a VM onto a node to live-migrate, onto a pool to move it - #384

Merged
hanthor merged 7 commits into
mainfrom
feat/web-drag-migrate-pool
Oct 2, 2026
Merged

hanthor merged 7 commits into
mainfrom
feat/web-drag-migrate-pool

Conversation

@hanthor

@hanthor hanthor commented Sep 30, 2026

Copy link
Copy Markdown
Member

Summary

This PR implements issue #345: drag a VM onto a node to live-migrate, onto a pool to move it, unifying the drag implementation with context menu equivalents.

Changes

  • Unified Drag and Drop: Extracted and unified drag-and-drop primitives (makeDraggable, dropZone, dropTargetPool, dropTargetBackend, dropTargetNode) across Server View and Pool View.
  • Server View Drag-to-Migrate: Dragging a VM row onto a node row in Server View opens a migrate confirmation dialog with live/offline mode detection and target readiness checks, triggering POST /api/vms/{ns}/{name}/migrate upon confirmation.
  • Target Feedback & Validation: Drop targets highlight with .drop-target only when the drop is valid; invalid targets show reasons on hover and receive .drop-invalid.
  • Context Menu Redundancy: Every drag action is accessible via the right-click and keyboard-accessible context menu (Shift+F10 / ContextMenu key), including Migrate to node…, Move to pool…, Move to backend…, lifecycle controls, and console shortcuts.
  • Read-Only Mode: Respects body.read-only, disabling draggable handles and hiding mutating context menu actions.
  • Demo Mode Support: Added node selector patch parsing, VMI JSON state reporting, and migration placement cycling in pkg/demo.
  • Acceptance Smoke Check: Added named check drag-migrate and screenshot capture in scripts/ui-smoke.mjs.

Fixes #345

— hive: backend=agy model=gemini-3.7-flash-high effort=low


🐝 Hive Agent: contributor | SHA: df7e8cb

@hanthor-hive-agent

Copy link
Copy Markdown
Contributor

🛑 Fix loop escalated — human attention needed

This PR has stayed red on the same commit through 6 delivered fix re-dispatches with no new commit pushed (1 distinct red head seen). The hive has stopped dispatching further automated fixes for it.

Failing checks: e2e-kind

Also red on the base branch / other open PRs (shared breakage, not this PR): lint, ui-smoke

Raw failure evidence (from check-run annotations):

e2e-kind: Process completed with exit code 1.
lint: Error return value of `mResp.Body.Close` is not checked (errcheck)

Remove the needs-human label after addressing the root cause to return the PR to the automated fix lane.

hanthor and others added 7 commits October 2, 2026 00:35
Ctrl/Cmd+K opens a command palette that searches VMs, CTs, nodes, pools,
views and actions ("stop web-prod", "migrate db-prod", "create VM").
Items run from it are remembered in localStorage and rank first. The
palette is a native <dialog> with a combobox/listbox, so screen readers
follow the active result.

Single-key shortcuts, ignored while typing in a field or a console:
? shortcut overlay, / focus the new tree filter, c console, s start/stop,
g d datacenter. Read-only callers are offered no action that mutates,
and the Create CT button is now hidden from them like Create VM.

The ui-smoke "command-palette" check presses Ctrl+K, types a demo VM
name, presses Enter and asserts that VM is selected; it saves
command-palette.png and shortcuts.png, which the workflow uploads.

No build step and no new dependency (ADR-0004): palette.js is a native
ES module embedded with the rest of static/.

Hive-Run: #349
Hive-Plan: #349 web UI command palette
Hive-Spec: #349#acceptance-command-palette

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: James Reilly <jreilly1821@gmail.com>
After Escape the palette returns focus to an input, where ? is text and
not a shortcut, so the overlay check failed intermittently on CI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY
Signed-off-by: hanthor <hanthor@users.noreply.github.com>
Add right-click and keyboard (ContextMenu key, Shift+F10) context menus
to all tree rows (VMs, containers, nodes, namespaces, pools, hostpower)
and grid rows (VM table, CT table, template table).

The context menu follows each object's capabilities (start, stop, reboot,
console, migrate, snapshot, clone, convert to template, tags, delete),
positions itself within the viewport boundaries, is navigable with
arrow keys / Home / End / Escape / Enter, and closes on Escape or an
outside click.

For nodes, the menu integrates with host-power plugins (power on/off) and
surfaces cordon/drain items. For VMs, keyboard and menu equivalents for
drag gestures (assign to pool, move to backend) are provided for
accessibility. In read-only mode (body.read-only), all mutating actions
are hidden/omitted.

A smoke check in scripts/ui-smoke.mjs exercises the context menu against
the demo fleet and verifies the state change.

Closes #343

Hive-Run: #343
Hive-Plan: web-ui-context-menus
Hive-Spec: web-ui#context-menus
Signed-off-by: James Reilly <jreilly1821@gmail.com>
A poll re-render replaced the rows under an open menu. The smoke check
read disabled="" as enabled and tried to click a disabled Stop item, and
its has-text("Start") also matched Restart.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY
Signed-off-by: hanthor <hanthor@users.noreply.github.com>
Attach the VM menu to grid rows via a new mountGrid decorateRow hook,
and read the row text in the smoke check because grid column order is
user-configurable (the grid-columns check reorders it).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY
Signed-off-by: hanthor <hanthor@users.noreply.github.com>
…ore bulk actions

Rebuilds #374 on top of the command palette (#369), inventory grid (#373)
and context menus (#385), which already cover the tree filter box, the
shared tree/grid selection set and the pool/backend menu equivalents.
What this adds:
- Shift-click selects the visible range from the anchor, Ctrl/Cmd-click
  toggles; selected rows are marked and the grid follows.
- The tree filter also matches tags and IP addresses.
- Arrow/Home/End move focus between visible tree rows.
- Bulk Snapshot, Tag and Delete next to Start/Stop/Restart.
- A bulk-select smoke check.

Fixes #344

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY
Signed-off-by: hanthor <hanthor@users.noreply.github.com>
Server View node rows become drop targets: dropping a VM opens the
migrate picker with that node preselected and a live/offline note, and
confirming runs the existing migrate endpoint. Drag and drop is unified
in pools.js (makeDraggable/dropZone) with validity checks, so invalid
drops (node not ready, already there, non-KubeVirt VM, pool it is
already in, backend that cannot receive it) are refused with the reason
as a tooltip and a red outline. Read-only mode disables dragging.

The demo cluster now honours a migrate target: it records the
nodeSelector patch, moves the VM on virtctl migrate, and answers
get vmi, so the drag-migrate smoke check round-trips.

Reworked from #384 on top of #385: menu entries come from #385, and the
export picker, pickNode selectors and console pop-out are kept.

Fixes #345

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY
Signed-off-by: hanthor <hanthor@users.noreply.github.com>
@hanthor

hanthor commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

Reworked on top of #385. The original commit had these problems:

Kept: the demo-cluster migrate support and its tests, the drag primitives in pools.js, node rows as drop targets in Server View, the migrate picker with the dropped node preselected and a live/offline note, and the drag-migrate smoke check. Dropped: a pkg/web demo test that started a background migration watcher, which outlived the test and broke shuffled runs.

🤖 Generated with Claude Code
https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY

@hanthor
hanthor merged commit 6c0fb1d into main Oct 2, 2026
10 checks passed
@hanthor-hive-agent

Copy link
Copy Markdown
Contributor

✅ Escalation cleared — back in the automated lane

CI is green on the current head — returning this PR to the automated lane.

The needs-human label has been removed; the fix loop owns this PR again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI: drag a VM onto a node to live-migrate, onto a pool to move it

1 participant