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

Method connectToVMVNC

internal/ui/components/shell.go:144–172  ·  view source on GitHub ↗

connectToVMVNC performs the actual VM VNC connection using embedded noVNC client.

(vm *api.VM, vncService *vnc.Service)

Source from the content-addressed store, hash-verified

142
143// connectToVMVNC performs the actual VM VNC connection using embedded noVNC client.
144func (a *App) connectToVMVNC(vm *api.VM, vncService *vnc.Service) {
145 // Show loading message
146 a.header.ShowLoading(fmt.Sprintf("Starting embedded VNC console for %s...", vm.Name))
147
148 // Open embedded VNC connection in a goroutine to avoid blocking UI
149 go func() {
150 uiLogger := models.GetUILogger()
151 uiLogger.Debug("Starting VNC connection for VM %s with client addr: %s", vm.Name, a.config.GetAddr())
152
153 var vncURL string
154 var err error
155
156 client, clientErr := a.getClientForVM(vm)
157 if clientErr != nil {
158 err = clientErr
159 } else {
160 vncURL, err = vncService.ConnectToVMEmbeddedWithClient(client, vm)
161 }
162
163 a.QueueUpdateDraw(func() {
164 // Clear the loading message from header
165 a.header.StopLoading()
166 a.updateHeaderWithActiveProfile() // Restore header with active profile
167
168 // Unified outcome handling
169 a.handleVNCOutcome("vm", vm.Name, vncURL, err)
170 })
171 }()
172}
173
174// openNodeVNC opens a VNC shell connection to the currently selected node.
175func (a *App) openNodeVNC() {

Callers 1

openVMVNCMethod · 0.95

Calls 10

getClientForVMMethod · 0.95
handleVNCOutcomeMethod · 0.95
GetUILoggerFunction · 0.92
QueueUpdateDrawMethod · 0.80
ShowLoadingMethod · 0.65
DebugMethod · 0.65
GetAddrMethod · 0.65
StopLoadingMethod · 0.65

Tested by

no test coverage detected