components

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentSnapshotName = "current"
)

Variables

This section is empty.

Functions

func CreateAboutDialog

func CreateAboutDialog(versionInfo *version.BuildInfo, onClose func()) *tview.Modal

CreateAboutDialog creates an about dialog with version information and links.

func CreateConfirmDialog

func CreateConfirmDialog(title, message string, onConfirm, onCancel func()) *tview.Modal

CreateConfirmDialog creates a confirmation dialog.

func CreateErrorDialog

func CreateErrorDialog(title, message string, onClose func()) *tview.Modal

CreateErrorDialog creates an error dialog.

func CreateErrorDialogWithScrollableText

func CreateErrorDialogWithScrollableText(title, message string, onClose func()) *tview.Modal

CreateErrorDialogWithScrollableText creates an error dialog with scrollable text for long URLs.

func CreateFormDialog

func CreateFormDialog(title string, fields []FormField, onSubmit, onCancel func(map[string]string)) *tview.Form

CreateFormDialog creates a form dialog with custom fields.

func CreateInfoDialog

func CreateInfoDialog(title, message string, onClose func()) *tview.Modal

CreateInfoDialog creates an information dialog.

func CreateLoginForm

func CreateLoginForm() *tview.Form

CreateLoginForm creates a login form dialog.

func CreateSuccessDialogWithURL

func CreateSuccessDialogWithURL(title, message string, onClose func()) *tview.Modal

CreateSuccessDialogWithURL creates a success dialog with URL information for VNC connections.

func FormatFooterText

func FormatFooterText(keys config.KeyBindings) string

FormatFooterText builds the footer key binding text from config.

func NewConfigWizardPage

func NewConfigWizardPage(app *tview.Application, cfg *config.Config, configPath string, saveFn func(*config.Config) error, cancelFn func(), resultChan chan<- WizardResult) tview.Primitive

NewConfigWizardPage creates a new configuration wizard page.

func SaveConfigToFile

func SaveConfigToFile(cfg *config.Config, path string) error

SaveConfigToFile writes the config to the given path in YAML format.

Types

type App

type App struct {
	*tview.Application
	// contains filtered or unexported fields
}

App is the main application component.

func NewApp

func NewApp(ctx context.Context, client *api.Client, cfg *config.Config, configPath string) *App

NewApp creates a new application instance with all UI components.

func (*App) CloseConnectionProfilesMenu

func (a *App) CloseConnectionProfilesMenu()

CloseConnectionProfilesMenu closes the connection profiles menu and restores the previous focus.

func (*App) CloseContextMenu

func (a *App) CloseContextMenu()

CloseContextMenu closes the context menu and restores the previous focus.

func (*App) GetVNCService

func (a *App) GetVNCService() *vnc.Service

GetVNCService returns the VNC service instance.

func (*App) Run

func (a *App) Run() error

Run starts the application.

func (*App) ShowGlobalContextMenu

func (a *App) ShowGlobalContextMenu()

ShowGlobalContextMenu displays the global context menu for app-wide actions.

func (*App) ShowNodeContextMenu

func (a *App) ShowNodeContextMenu()

ShowNodeContextMenu displays the context menu for node actions.

func (*App) ShowVMContextMenu

func (a *App) ShowVMContextMenu()

ShowVMContextMenu displays the context menu for VM actions.

type ButtonAlignment

type ButtonAlignment int

ButtonAlignment defines how the button should be positioned within its container.

const (
	// AlignCenter centers the button horizontally (default)
	AlignCenter ButtonAlignment = iota
	// AlignLeft aligns the button to the left
	AlignLeft
	// AlignRight aligns the button to the right
	AlignRight
	// AlignCustom uses custom positioning (x, y coordinates)
	AlignCustom
)

type CleanConfig

type CleanConfig struct {
	Profiles       map[string]config.ProfileConfig `yaml:"profiles,omitempty"`
	DefaultProfile string                          `yaml:"default_profile,omitempty"`
	Debug          bool                            `yaml:"debug,omitempty"`
	CacheDir       string                          `yaml:"cache_dir,omitempty"`
	KeyBindings    config.KeyBindings              `yaml:"key_bindings,omitempty"`
	Theme          config.ThemeConfig              `yaml:"theme,omitempty"`
	// Legacy fields only included when no profiles are defined
	Addr        string `yaml:"addr,omitempty"`
	User        string `yaml:"user,omitempty"`
	Password    string `yaml:"password,omitempty"`
	TokenID     string `yaml:"token_id,omitempty"`
	TokenSecret string `yaml:"token_secret,omitempty"`
	Realm       string `yaml:"realm,omitempty"`
	ApiPath     string `yaml:"api_path,omitempty"`
	Insecure    bool   `yaml:"insecure,omitempty"`
	SSHUser     string `yaml:"ssh_user,omitempty"`
}

CleanConfig represents a clean config structure without legacy fields when profiles are used

type ClusterStatus

type ClusterStatus struct {
	*tview.Flex

	SummaryTable  *tview.Table
	ResourceTable *tview.Table
	// contains filtered or unexported fields
}

ClusterStatus encapsulates the cluster status panel.

func NewClusterStatus

func NewClusterStatus() *ClusterStatus

NewClusterStatus creates a new cluster status panel.

func (*ClusterStatus) SetApp

func (cs *ClusterStatus) SetApp(app *App)

SetApp sets the application reference.

func (*ClusterStatus) Update

func (cs *ClusterStatus) Update(cluster *api.Cluster)

Update populates both tables with current cluster data.

type ClusterStatusComponent

type ClusterStatusComponent interface {
	tview.Primitive
	Update(*api.Cluster)
}

type ContextMenu

type ContextMenu struct {
	// contains filtered or unexported fields
}

ContextMenu represents a popup menu with actions for a selected item.

func NewContextMenu

func NewContextMenu(title string, actions []string, onAction func(index int, action string)) *ContextMenu

NewContextMenu creates a new context menu component.

func NewContextMenuWithShortcuts

func NewContextMenuWithShortcuts(title string, actions []string, shortcuts []rune, onAction func(index int, action string)) *ContextMenu

NewContextMenuWithShortcuts creates a new context menu component with custom shortcuts.

func (*ContextMenu) SetApp

func (cm *ContextMenu) SetApp(app *App)

SetApp sets the parent app reference.

func (*ContextMenu) Show

func (cm *ContextMenu) Show() *tview.List

Show displays the context menu as a modal.

type EnhancedNetworkInterface

type EnhancedNetworkInterface struct {
	// From configuration
	Interface    string
	Model        string
	MACAddr      string
	Bridge       string
	VLAN         string
	Rate         string
	ConfiguredIP string
	Gateway      string
	Firewall     bool

	// From guest agent
	RuntimeName   string
	RuntimeIPs    []string
	IsUp          bool
	HasGuestAgent bool
	IsGuestOnly   bool // True if this interface is only visible via guest agent
}

EnhancedNetworkInterface represents enhanced network information with both config and runtime data.

type Footer struct {
	*tview.TextView
	// contains filtered or unexported fields
}

Footer encapsulates the application footer.

func NewFooter

func NewFooter() *Footer

NewFooter creates a new application footer with key bindings.

func (*Footer) IsLoading

func (f *Footer) IsLoading() bool

IsLoading returns true if the footer is currently showing a loading spinner.

func (*Footer) SetLoading

func (f *Footer) SetLoading(loading bool)

SetLoading sets the loading state and resets the spinner.

func (*Footer) TickSpinner

func (f *Footer) TickSpinner()

TickSpinner advances the loading spinner animation once.

func (*Footer) UpdateAutoRefreshCountdown

func (f *Footer) UpdateAutoRefreshCountdown(seconds int)

UpdateAutoRefreshCountdown updates the countdown for the next auto-refresh.

func (*Footer) UpdateAutoRefreshStatus

func (f *Footer) UpdateAutoRefreshStatus(active bool)

UpdateAutoRefreshStatus updates the auto-refresh status display.

func (*Footer) UpdateKeybindings

func (f *Footer) UpdateKeybindings(text string)

UpdateKeybindings updates the footer text with custom key bindings.

func (*Footer) UpdateVNCSessionCount

func (f *Footer) UpdateVNCSessionCount(count int)

UpdateVNCSessionCount updates the VNC session count display.

type FooterComponent

type FooterComponent interface {
	tview.Primitive
	UpdateKeybindings(string)
	UpdateVNCSessionCount(int)
	UpdateAutoRefreshStatus(bool)
	UpdateAutoRefreshCountdown(int)
	SetLoading(bool)
	IsLoading() bool
	TickSpinner()
}

type FormButton

type FormButton struct {
	*tview.Box
	// contains filtered or unexported fields
}

FormButton is a reusable FormItem that acts like a button and can be placed anywhere in a tview.Form.

func NewFormButton

func NewFormButton(label string, selected func()) *FormButton

NewFormButton creates a new FormButton with the given label and callback.

func (*FormButton) Blur

func (b *FormButton) Blur()

Blur removes focus from the button.

func (*FormButton) Draw

func (b *FormButton) Draw(screen tcell.Screen)

Draw renders the button by delegating to the embedded tview.Button.

func (*FormButton) Focus

func (b *FormButton) Focus(delegate func(p tview.Primitive))

Focus sets the button as focused.

func (*FormButton) GetFieldHeight

func (b *FormButton) GetFieldHeight() int

GetFieldHeight returns the height of the button (always 1).

func (*FormButton) GetFieldWidth

func (b *FormButton) GetFieldWidth() int

GetFieldWidth returns the width of the button (label length).

func (*FormButton) GetLabel

func (b *FormButton) GetLabel() string

GetLabel returns the button label.

func (*FormButton) HasFocus

func (b *FormButton) HasFocus() bool

HasFocus returns true if the button is focused.

func (*FormButton) InputHandler

func (b *FormButton) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler handles key events for the button by delegating to the embedded button.

func (*FormButton) IsDisabled

func (b *FormButton) IsDisabled() bool

IsDisabled returns true if the button is disabled.

func (*FormButton) SetAlignment

func (b *FormButton) SetAlignment(alignment ButtonAlignment) *FormButton

SetAlignment sets the button's alignment within its container.

func (*FormButton) SetCustomPosition

func (b *FormButton) SetCustomPosition(x, y int) *FormButton

SetCustomPosition sets custom positioning for the button (only used when alignment is AlignCustom).

func (*FormButton) SetDisabled

func (b *FormButton) SetDisabled(disabled bool) tview.FormItem

SetDisabled sets whether the button is disabled.

func (*FormButton) SetFieldWidth

func (b *FormButton) SetFieldWidth(width int) tview.FormItem

SetFieldWidth is a no-op for FormButton.

func (*FormButton) SetFinishedFunc

func (b *FormButton) SetFinishedFunc(handler func(key tcell.Key)) tview.FormItem

SetFinishedFunc sets the doneFunc for Tab/Backtab navigation.

func (*FormButton) SetFormAttributes

func (b *FormButton) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldTextColor, fieldBgColor tcell.Color) tview.FormItem

SetFormAttributes is a no-op for FormButton (to satisfy tview.FormItem interface).

func (*FormButton) SetLabel

func (b *FormButton) SetLabel(label string) tview.FormItem

SetLabel sets the button label.

func (*FormButton) SetSelectedFunc

func (b *FormButton) SetSelectedFunc(handler func()) *FormButton

SetSelectedFunc sets the callback for when the button is pressed.

type FormField

type FormField struct {
	Name         string
	Label        string
	DefaultValue string
	MaxLength    int
}

FormField represents a form field.

type Header struct {
	*tview.TextView
	// contains filtered or unexported fields
}

Header encapsulates the application header.

func NewHeader

func NewHeader() *Header

NewHeader creates a new application header.

func (*Header) GetCurrentProfile

func (h *Header) GetCurrentProfile() string

GetCurrentProfile returns the currently connected profile name.

func (*Header) IsLoading

func (h *Header) IsLoading() bool

IsLoading reports whether the header is currently showing a loading state.

func (*Header) SetApp

func (h *Header) SetApp(app *tview.Application)

SetApp sets the application reference for UI updates.

func (*Header) SetText

func (h *Header) SetText(text string)

SetText updates the header text directly.

func (*Header) SetTitle

func (h *Header) SetTitle(title string)

SetTitle updates the header text.

func (*Header) ShowActiveProfile

func (h *Header) ShowActiveProfile(profileName string)

ShowActiveProfile displays the active profile in the header.

func (*Header) ShowError

func (h *Header) ShowError(message string)

ShowError displays an error message temporarily.

func (*Header) ShowLoading

func (h *Header) ShowLoading(message string)

ShowLoading displays an animated loading indicator.

func (*Header) ShowSuccess

func (h *Header) ShowSuccess(message string)

ShowSuccess displays a success message temporarily.

func (*Header) ShowWarning

func (h *Header) ShowWarning(message string)

ShowWarning displays a warning message temporarily.

func (*Header) StopLoading

func (h *Header) StopLoading()

StopLoading stops the loading animation.

type HeaderComponent

type HeaderComponent interface {
	tview.Primitive
	SetApp(*tview.Application)
	ShowLoading(string)
	StopLoading()
	IsLoading() bool
	ShowSuccess(string)
	ShowError(string)
	ShowWarning(string)
	SetTitle(string)
	ShowActiveProfile(string)
	GetCurrentProfile() string
}

type HelpModal

type HelpModal struct {
	*tview.Pages
	// contains filtered or unexported fields
}

HelpModal represents a modal dialog showing keybindings and usage information.

func NewHelpModal

func NewHelpModal(keys config.KeyBindings) *HelpModal

NewHelpModal creates a new help modal.

func (*HelpModal) Hide

func (hm *HelpModal) Hide()

Hide hides the help modal.

func (*HelpModal) SetApp

func (hm *HelpModal) SetApp(app *App)

SetApp sets the parent app reference.

func (*HelpModal) Show

func (hm *HelpModal) Show()

Show displays the help modal.

type NodeDetails

type NodeDetails struct {
	*tview.Table
	// contains filtered or unexported fields
}

NodeDetails encapsulates the node details panel.

func NewNodeDetails

func NewNodeDetails() *NodeDetails

NewNodeDetails creates a new node details panel.

func (*NodeDetails) Clear

func (nd *NodeDetails) Clear() *tview.Table

Clear wraps the table Clear method to satisfy the interface.

func (*NodeDetails) SetApp

func (nd *NodeDetails) SetApp(app *App)

SetApp sets the parent app reference for focus management.

func (*NodeDetails) Update

func (nd *NodeDetails) Update(node *api.Node, allNodes []*api.Node)

Update fills the node details table for the given node.

type NodeDetailsComponent

type NodeDetailsComponent interface {
	tview.Primitive
	SetApp(*App)
	Update(*api.Node, []*api.Node)
	Clear() *tview.Table
}

type NodeList

type NodeList struct {
	*tview.List
	// contains filtered or unexported fields
}

NodeList encapsulates the node list panel.

func NewNodeList

func NewNodeList() *NodeList

NewNodeList creates a new node list component.

func (*NodeList) GetNodes

func (nl *NodeList) GetNodes() []*api.Node

GetNodes returns the current nodes slice.

func (*NodeList) GetSelectedNode

func (nl *NodeList) GetSelectedNode() *api.Node

GetSelectedNode returns the currently selected node.

func (*NodeList) SetApp

func (nl *NodeList) SetApp(app *App)

SetApp sets the parent app reference for focus management.

func (*NodeList) SetCurrentItem

func (nl *NodeList) SetCurrentItem(index int) *tview.List

SetCurrentItem wraps the list method to match the interface.

func (*NodeList) SetNodeChangedFunc

func (nl *NodeList) SetNodeChangedFunc(handler func(*api.Node))

SetNodeChangedFunc sets the function to be called when selection changes.

func (*NodeList) SetNodeSelectedFunc

func (nl *NodeList) SetNodeSelectedFunc(handler func(*api.Node))

SetNodeSelectedFunc sets the function to be called when a node is selected.

func (*NodeList) SetNodes

func (nl *NodeList) SetNodes(nodes []*api.Node)

SetNodes updates the list with the provided nodes.

type NodeListComponent

type NodeListComponent interface {
	tview.Primitive
	SetApp(*App)
	SetNodes([]*api.Node)
	GetSelectedNode() *api.Node
	GetNodes() []*api.Node
	SetNodeSelectedFunc(func(*api.Node))
	SetNodeChangedFunc(func(*api.Node))
	SetCurrentItem(int) *tview.List
	GetCurrentItem() int
}

type ScriptSelector

type ScriptSelector struct {
	*tview.Pages
	// contains filtered or unexported fields
}

ScriptSelector represents a page-based script selector for installing community scripts.

func NewScriptSelector

func NewScriptSelector(app *App, node *api.Node, vm *api.VM, user string) *ScriptSelector

NewScriptSelector creates a new script selector.

func (*ScriptSelector) Hide

func (s *ScriptSelector) Hide()

Hide hides the script selector.

func (*ScriptSelector) Show

func (s *ScriptSelector) Show()

Show displays the script selector.

type SnapshotForm

type SnapshotForm struct {
	// contains filtered or unexported fields
}

SnapshotForm manages the create snapshot form.

func NewSnapshotForm

func NewSnapshotForm(app *App, vm *api.VM) *SnapshotForm

NewSnapshotForm creates a new snapshot form handler.

func (*SnapshotForm) ShowCreateForm

func (sf *SnapshotForm) ShowCreateForm(onSuccess func())

ShowCreateForm displays the create snapshot form.

type SnapshotManager

type SnapshotManager struct {
	*tview.Flex
	// contains filtered or unexported fields
}

SnapshotManager manages the snapshot interface for VMs and containers.

func NewSnapshotManager

func NewSnapshotManager(app *App, vm *api.VM) *SnapshotManager

NewSnapshotManager creates a new snapshot manager for the given VM.

type SnapshotOperations

type SnapshotOperations struct {
	// contains filtered or unexported fields
}

SnapshotOperations handles snapshot CRUD operations.

func NewSnapshotOperations

func NewSnapshotOperations(app *App, vm *api.VM) *SnapshotOperations

NewSnapshotOperations creates a new snapshot operations handler.

func (*SnapshotOperations) CreateSnapshot

func (so *SnapshotOperations) CreateSnapshot(name string, description string, vmState bool) error

CreateSnapshot creates a new snapshot with the given options.

func (*SnapshotOperations) DeleteSnapshot

func (so *SnapshotOperations) DeleteSnapshot(snapshotName string) error

DeleteSnapshot deletes the specified snapshot.

func (*SnapshotOperations) GetSnapshots

func (so *SnapshotOperations) GetSnapshots() ([]api.Snapshot, error)

GetSnapshots retrieves all snapshots for the VM.

func (*SnapshotOperations) RollbackToSnapshot

func (so *SnapshotOperations) RollbackToSnapshot(snapshotName string) error

RollbackToSnapshot rolls back to the specified snapshot.

type SnapshotTable

type SnapshotTable struct {
	*tview.Table
	// contains filtered or unexported fields
}

SnapshotTable manages the snapshot list display and selection.

func NewSnapshotTable

func NewSnapshotTable(app *App, vm *api.VM) *SnapshotTable

NewSnapshotTable creates a new snapshot table.

func (*SnapshotTable) DisplaySnapshots

func (st *SnapshotTable) DisplaySnapshots(snapshots []api.Snapshot)

DisplaySnapshots displays the snapshots in the table.

func (*SnapshotTable) GetSelectedSnapshot

func (st *SnapshotTable) GetSelectedSnapshot() *api.Snapshot

GetSelectedSnapshot gets the currently selected snapshot.

func (*SnapshotTable) GetSnapshotCount

func (st *SnapshotTable) GetSnapshotCount() int

GetSnapshotCount returns the count of real snapshots (excluding "current").

type TasksList

type TasksList struct {
	*tview.Table
	// contains filtered or unexported fields
}

TasksList encapsulates the tasks list panel.

func NewTasksList

func NewTasksList() *TasksList

NewTasksList creates a new tasks list panel.

func (*TasksList) Clear

func (tl *TasksList) Clear() *tview.Table

Clear clears the tasks list.

func (*TasksList) GetSelectedTask

func (tl *TasksList) GetSelectedTask() *api.ClusterTask

GetSelectedTask returns the currently selected task.

func (*TasksList) Select

func (tl *TasksList) Select(row, column int) *tview.Table

Select wraps the table Select method to match the interface.

func (*TasksList) SetApp

func (tl *TasksList) SetApp(app *App)

SetApp sets the application reference.

func (*TasksList) SetFilteredTasks

func (tl *TasksList) SetFilteredTasks(tasks []*api.ClusterTask)

SetFilteredTasks updates the tasks list with filtered data.

func (*TasksList) SetTasks

func (tl *TasksList) SetTasks(tasks []*api.ClusterTask)

SetTasks updates the tasks list with new data.

type TasksListComponent

type TasksListComponent interface {
	tview.Primitive
	SetApp(*App)
	SetTasks([]*api.ClusterTask)
	SetFilteredTasks([]*api.ClusterTask)
	GetSelectedTask() *api.ClusterTask
	Select(row, column int) *tview.Table
}

type VMConfigPage

type VMConfigPage struct {
	*tview.Form
	// contains filtered or unexported fields
}

VMConfigPage is a modal/page for editing VM or LXC configuration.

func NewVMConfigPage

func NewVMConfigPage(app *App, vm *api.VM, config *api.VMConfig, saveFn func(*api.VMConfig) error) *VMConfigPage

NewVMConfigPage creates a new config editor for the given VM.

type VMDetails

type VMDetails struct {
	*tview.Table
	// contains filtered or unexported fields
}

VMDetails encapsulates the VM details panel.

func NewVMDetails

func NewVMDetails() *VMDetails

NewVMDetails creates a new VM details panel.

func (*VMDetails) Clear

func (vd *VMDetails) Clear() *tview.Table

Clear wraps the table Clear method to satisfy the interface.

func (*VMDetails) SetApp

func (vd *VMDetails) SetApp(app *App)

SetApp sets the parent app reference for focus management.

func (*VMDetails) Update

func (vd *VMDetails) Update(vm *api.VM)

Update fills the VM details table for the given VM.

type VMDetailsComponent

type VMDetailsComponent interface {
	tview.Primitive
	SetApp(*App)
	Update(*api.VM)
	Clear() *tview.Table
}

type VMList

type VMList struct {
	*tview.List
	// contains filtered or unexported fields
}

VMList encapsulates the VM list panel.

func NewVMList

func NewVMList() *VMList

NewVMList creates a new VM list component.

func (*VMList) GetSelectedVM

func (vl *VMList) GetSelectedVM() *api.VM

GetSelectedVM returns the currently selected VM.

func (*VMList) GetVMs

func (vl *VMList) GetVMs() []*api.VM

GetVMs returns the internal sorted VMs slice.

func (*VMList) SetApp

func (vl *VMList) SetApp(app *App)

SetApp sets the parent app reference for focus management.

func (*VMList) SetCurrentItem

func (vl *VMList) SetCurrentItem(index int) *tview.List

SetCurrentItem wraps the list method to match the interface.

func (*VMList) SetVMChangedFunc

func (vl *VMList) SetVMChangedFunc(handler func(*api.VM))

SetVMChangedFunc sets the function to be called when selection changes.

func (*VMList) SetVMSelectedFunc

func (vl *VMList) SetVMSelectedFunc(handler func(*api.VM))

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

func (*VMList) SetVMs

func (vl *VMList) SetVMs(vms []*api.VM)

SetVMs updates the list with the provided VMs.

type VMListComponent

type VMListComponent interface {
	tview.Primitive
	SetApp(*App)
	SetVMs([]*api.VM)
	GetSelectedVM() *api.VM
	GetVMs() []*api.VM
	SetVMSelectedFunc(func(*api.VM))
	SetVMChangedFunc(func(*api.VM))
	SetCurrentItem(int) *tview.List
	GetCurrentItem() int
}

type WizardResult

type WizardResult struct {
	Saved         bool
	SopsEncrypted bool
	Canceled      bool
	ProfileName   string
}

WizardResult represents the result of a configuration wizard operation.

func LaunchConfigWizard

func LaunchConfigWizard(cfg *config.Config, configPath string, activeProfile string) WizardResult

LaunchConfigWizard launches the configuration wizard and returns the result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL