openVMVNC opens a VNC console connection to the currently selected VM.
()
| 218 | |
| 219 | // openVMVNC opens a VNC console connection to the currently selected VM. |
| 220 | func (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 |
no test coverage detected