MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / openVMVNC

Method openVMVNC

internal/ui/components/shell.go:220–249  ·  view source on GitHub ↗

openVMVNC opens a VNC console connection to the currently selected VM.

()

Source from the content-addressed store, hash-verified

218
219// openVMVNC opens a VNC console connection to the currently selected VM.
220func (a *App) openVMVNC() {
221 vm := a.vmList.GetSelectedVM()
222 if vm == nil {
223 // Show error in modal dialog instead of header
224 errorModal := CreateErrorDialog("VNC Error", "No VM selected", func() {
225 a.pages.RemovePage("vnc_error")
226 })
227 a.pages.AddPage("vnc_error", errorModal, false, true)
228
229 return
230 }
231
232 // Use the shared VNC service instead of creating a new one
233 vncService := a.GetVNCService()
234
235 // Check if VNC is available for this VM
236 available, reason := vncService.GetVMVNCStatus(vm)
237 if !available {
238 // Show error in modal dialog instead of header
239 errorModal := CreateErrorDialog("VNC Not Available", reason, func() {
240 a.pages.RemovePage("vnc_error")
241 })
242 a.pages.AddPage("vnc_error", errorModal, false, true)
243
244 return
245 }
246
247 // Connect directly to VNC
248 a.connectToVMVNC(vm, vncService)
249}
250
251// openVMShell opens a shell session to the currently selected VM/container.
252

Callers 2

setupKeyboardHandlersMethod · 0.95
ShowVMContextMenuMethod · 0.95

Calls 5

GetVNCServiceMethod · 0.95
connectToVMVNCMethod · 0.95
CreateErrorDialogFunction · 0.85
GetVMVNCStatusMethod · 0.80
GetSelectedVMMethod · 0.65

Tested by

no test coverage detected