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

Method SetVMSelectedFunc

internal/ui/components/vm_list.go:244–254  ·  view source on GitHub ↗

SetVMSelectedFunc sets the function to be called when a VM is selected.

(handler func(*api.VM))

Source from the content-addressed store, hash-verified

242
243// SetVMSelectedFunc sets the function to be called when a VM is selected.
244func (vl *VMList) SetVMSelectedFunc(handler func(*api.VM)) {
245 vl.onSelect = handler
246
247 vl.SetSelectedFunc(func(index int, mainText string, secondaryText string, shortcut rune) {
248 if index >= 0 && index < len(vl.vms) {
249 if vl.onSelect != nil {
250 vl.onSelect(vl.vms[index])
251 }
252 }
253 })
254}
255
256// SetVMChangedFunc sets the function to be called when selection changes.
257func (vl *VMList) SetVMChangedFunc(handler func(*api.VM)) {

Callers

nothing calls this directly

Calls 1

SetSelectedFuncMethod · 0.80

Tested by

no test coverage detected