feat: improve VNC console with a version gate, in-use screen and confirmations (#1195)

* feat: improve vnc console

Signed-off-by: Andy Lee <andy.lee@suse.com>

* fix: keep VNC console retries from kicking the active session

Builds on "feat: improve vnc console" (#1147) by Andy Lee.

- Keep retrying with preserveSession after a failed reconnect attempt, so a
  displaced console waits for the other session to be released instead of
  failing immediately or taking the console back.
- Close the RFB socket when noVNC asks for credentials, so a failed console
  does not hold the VNC session.
- Restore Custom Shortcut Keys, which were removed in #1147.
- Add unit tests for the console reconnect behavior.

Related: harvester/harvester#10420
Signed-off-by: Alejandro Bonilla <abonilla@suse.com>

* fix: expose VNC quality and compression settings

- Add 0-9 sliders for the JPEG quality and compression level, which were
  already passed to noVNC but could not be changed.
- Mark the connection status as a polite live region so screen readers
  announce connection changes.

Related: harvester/harvester#10420
Signed-off-by: Alejandro Bonilla <abonilla@suse.com>

* fix: gate VNC session protection by version and rework the in-use screen

- Add the vncPreserveSession feature flag for Harvester v1.7.0, the first
  release whose KubeVirt (1.6.3) honours preserveSession. Without it the
  console connects as before, offers no Take Over and does not reconnect on
  its own after the session drops, so two open consoles no longer keep
  kicking each other out.
- Replace the error page with a short card that says when the console is in
  use, and confirm Take Over in a modal instead of window.confirm.
- Keep the overlay text readable on its dark background.
- Show "Connected (view only)", translate the Ctrl+Alt+Del label and remove
  unused translation keys.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* feat: show whether the VNC console has keyboard focus

noVNC hides the canvas focus outline, so nothing showed where typing would go.
Draw a ring around the console while it has focus, show a toolbar hint
("Typing goes to the virtual machine" / "Click the console to type"), focus
the console when it connects and return focus to it after sending keys from
the toolbar.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* feat: confirm Ctrl+Alt+Del and Soft Reboot in the VNC console

Both buttons can restart the virtual machine with one click: Soft Reboot
always, and Ctrl+Alt+Del on most Linux guests. Ask in a modal first, as the
VM list already does for Soft Reboot, and return focus to the console after.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* fix: return focus to the VNC console after its confirm modal closes

The modal gave focus back to the toolbar button that opened it, so typing
did not reach the console until it was clicked again.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* refactor: drop the VNC keyboard focus hint from the toolbar

The ring around the console already shows when it has keyboard focus.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
Signed-off-by: Alejandro Bonilla <abonilla@suse.com>
Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
Co-authored-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Alejandro Bonilla <abonilla@suse.com>
This commit is contained in:
marcelofukumoto
2026-10-21 18:30:27 +02:00
committed by GitHub
co-authored by Andy Lee Alejandro Bonilla
parent 5406c08f76
commit 2f72f25b6e
13 changed files with 1421 additions and 219 deletions
+45
View File
@@ -1021,6 +1021,51 @@ harvester:
tips: Press the record button to capture your keyboard inputs.
send: Send
preferredKeys: Preferred Custom Shortcut Keys
settings:
label: Settings
viewMode:
label: Display
scale: Scale the display to fit the window
none: Manual zoom
zoom: Zoom
viewOnly: View only
quality: JPEG quality
compression: Compression level
fullscreen:
enter: Full Screen
exit: Exit Full Screen
ctrlAltDel: Ctrl+Alt+Del
confirm:
ctrlAltDel:
title: Send Ctrl+Alt+Del?
message: Windows opens its sign-in or security screen. Most Linux systems restart the virtual machine.
button: Send
softReboot:
title: Soft reboot this virtual machine?
message: The guest operating system is asked to restart. Unsaved work inside the virtual machine is lost.
button: Soft Reboot
takeOver:
label: Take Over
title: Take over this console?
confirm: The other VNC session connected to this virtual machine will be disconnected.
failure:
inUse: This console is in use
unavailable: Unable to connect
dropped: Disconnected
error: Connection failed
failureDetail:
inUse: Another VNC session is connected to this virtual machine. Retry once it is released, or take over the console to disconnect the other session.
unavailable: The console is not available. Check that the virtual machine is running, then retry.
dropped: The console connection was closed. Another VNC session may have opened this console.
status:
connecting: Connecting
connected: Connected
connectedViewOnly: Connected (view only)
disconnected: Disconnected
failed: Connection failed
reconnecting: 'Reconnecting {retryTimes} of {maximumRetryTimes}'
credentialsRequired: This console requires credentials that the dashboard cannot provide.
inUse: Another VNC session may be using this console. Retrying until it is released.
terminationGracePeriodSeconds:
label: Termination Grace Period
affinity: