components

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 30 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.Primitive

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, targetProfile string) 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, initialGroup string) *App

NewApp creates a new application instance with all UI components.

func (*App) ClearAPICache added in v1.0.7

func (a *App) ClearAPICache()

ClearAPICache clears cached API responses.

func (*App) Client added in v1.0.7

func (a *App) Client() *api.Client

Client exposes the underlying API client for plugin use.

func (*App) CloseConnectionProfilesMenu

func (a *App) CloseConnectionProfilesMenu()

func (*App) CloseContextMenu

func (a *App) CloseContextMenu()

CloseContextMenu closes the context menu and restores the previous focus.

func (*App) Config added in v1.0.7

func (a *App) Config() *config.Config

Config returns the application's active configuration.

func (*App) Footer added in v1.0.7

func (a *App) Footer() FooterComponent

Footer returns the footer component instance.

func (*App) GetActiveBackupsForVM added in v1.0.15

func (a *App) GetActiveBackupsForVM(vmid int) []*taskpoller.TaskInfo

GetActiveBackupsForVM returns a list of active backups for a specific VM.

func (*App) GetVNCService

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

GetVNCService returns the VNC service instance.

func (*App) GroupManager added in v1.0.14

func (a *App) GroupManager() *api.GroupClientManager

GroupManager returns the group client manager if in group mode, nil otherwise.

func (*App) Header added in v1.0.7

func (a *App) Header() HeaderComponent

Header returns the header component instance.

func (*App) InitializePlugins added in v1.0.7

func (a *App) InitializePlugins(ctx context.Context, plugins []Plugin) error

InitializePlugins wires the provided plugins into the application lifecycle.

func (*App) IsGroupMode added in v1.0.14

func (a *App) IsGroupMode() bool

IsGroupMode returns whether the app is running in group cluster mode.

func (*App) IsPluginModal added in v1.0.9

func (a *App) IsPluginModal(pageName string) bool

IsPluginModal checks if the given page name is registered as a plugin modal. This is used by the global keyboard handler to determine if global keybindings should be suppressed when a plugin modal is active.

func (*App) ManualRefresh added in v1.0.7

func (a *App) ManualRefresh()

ManualRefresh triggers a manual refresh cycle.

func (*App) NodeList added in v1.0.7

func (a *App) NodeList() NodeListComponent

NodeList exposes the node list component.

func (*App) Pages added in v1.0.7

func (a *App) Pages() *tview.Pages

Pages exposes the root tview page stack.

func (*App) RegisterBackupCallback added in v1.0.15

func (a *App) RegisterBackupCallback(callback func()) func()

RegisterBackupCallback registers a callback for backup state changes. Returns a function to unregister the callback.

func (*App) Run

func (a *App) Run() error

Run starts the application.

func (*App) SetHotkeyOverride added in v1.0.14

func (a *App) SetHotkeyOverride(handler func(*tcell.EventKey) *tcell.EventKey)

SetHotkeyOverride installs a temporary handler that runs before global shortcuts. Return nil from the handler to swallow the event; otherwise return the event (optionally mutated) to allow further processing. Pass nil to clear.

func (*App) SetPluginCatalog added in v1.0.7

func (a *App) SetPluginCatalog(catalog []PluginInfo)

SetPluginCatalog stores metadata about available plugins for later UI use.

func (*App) ShowGlobalContextMenu

func (a *App) ShowGlobalContextMenu()

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

func (*App) ShowMessage added in v1.0.7

func (a *App) ShowMessage(message string)

ShowMessage displays a modal message, preserving focus when dismissed. This now uses a safe implementation that avoids QueueUpdateDraw deadlocks.

func (*App) ShowMessageSafe added in v1.0.7

func (a *App) ShowMessageSafe(message string)

ShowMessageSafe is now an alias to ShowMessage for backwards compatibility. Both use the same safe implementation that avoids QueueUpdateDraw deadlocks.

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.

func (*App) ShutdownPlugins added in v1.0.7

func (a *App) ShutdownPlugins(ctx context.Context) error

ShutdownPlugins gracefully tears down registered plugins.

func (*App) StartBackupMonitor added in v1.0.15

func (a *App) StartBackupMonitor(upid, nodeName string, vmid int)

StartBackupMonitor starts monitoring a backup task.

func (*App) TaskManager added in v1.0.18

func (a *App) TaskManager() *taskmanager.TaskManager

TaskManager returns the application task manager.

func (*App) VMList added in v1.0.7

func (a *App) VMList() VMListComponent

VMList exposes the VM list component.

type BackupForm added in v1.0.15

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

BackupForm manages the create backup form.

func NewBackupForm added in v1.0.15

func NewBackupForm(app *App, vm *api.VM) *BackupForm

NewBackupForm creates a new backup form handler.

func (*BackupForm) SetTaskStartedCallback added in v1.0.15

func (bf *BackupForm) SetTaskStartedCallback(callback func(upid string))

SetTaskStartedCallback sets the callback for when a backup task starts.

func (*BackupForm) ShowCreateForm added in v1.0.15

func (bf *BackupForm) ShowCreateForm(onSuccess func())

ShowCreateForm displays the create backup form.

type BackupManager added in v1.0.15

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

BackupManager manages the backup interface for VMs and containers.

func NewBackupManager added in v1.0.15

func NewBackupManager(app *App, vm *api.VM) *BackupManager

NewBackupManager creates a new backup manager for the given VM.

type BackupOperations added in v1.0.15

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

BackupOperations handles backup CRUD operations.

func NewBackupOperations added in v1.0.15

func NewBackupOperations(app *App, vm *api.VM) *BackupOperations

NewBackupOperations creates a new backup operations handler.

func (*BackupOperations) CreateBackup added in v1.0.15

func (bo *BackupOperations) CreateBackup(options api.BackupOptions) (string, error)

CreateBackup creates a new backup with the given options.

func (*BackupOperations) DeleteBackup added in v1.0.15

func (bo *BackupOperations) DeleteBackup(volID string) error

DeleteBackup deletes the specified backup.

func (*BackupOperations) GetBackups added in v1.0.15

func (bo *BackupOperations) GetBackups() ([]api.Backup, error)

GetBackups retrieves all backups for the VM.

func (*BackupOperations) RestoreBackup added in v1.0.15

func (bo *BackupOperations) RestoreBackup(volID string) (string, error)

RestoreBackup restores the specified backup.

type BackupTable added in v1.0.15

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

BackupTable manages the backup list display and selection.

func NewBackupTable added in v1.0.15

func NewBackupTable(app *App, vm *api.VM) *BackupTable

NewBackupTable creates a new backup table.

func (*BackupTable) DisplayBackups added in v1.0.15

func (bt *BackupTable) DisplayBackups(backups []api.Backup)

DisplayBackups displays the backups in the table.

func (*BackupTable) GetSelectedBackup added in v1.0.15

func (bt *BackupTable) GetSelectedBackup() *api.Backup

GetSelectedBackup gets the currently selected backup.

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 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)
	SetApp(*App)
}

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) UpdateSelectedGuestsCount added in v1.0.19

func (f *Footer) UpdateSelectedGuestsCount(count int)

UpdateSelectedGuestsCount updates the selected guest counter in the footer status area.

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)
	UpdateSelectedGuestsCount(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 GuestAction added in v1.0.9

type GuestAction struct {
	ID          string
	Label       string
	Shortcut    rune
	Handler     GuestActionHandler
	IsAvailable func(node *api.Node, guest *api.VM) bool
}

GuestAction describes a menu action contributed by a plugin for guest targets (VMs and containers).

If Shortcut is zero, no keyboard shortcut is registered. When IsAvailable is nil the action is always shown for the selected guest.

type GuestActionHandler added in v1.0.9

type GuestActionHandler func(ctx context.Context, app *App, node *api.Node, guest *api.VM) error

GuestActionHandler executes a plugin-provided guest-level action.

Implementations receive the application instance along with the node and guest information, allowing access to both the host node and the specific VM/container.

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 NodeAction added in v1.0.7

type NodeAction struct {
	ID          string
	Label       string
	Shortcut    rune
	Handler     NodeActionHandler
	IsAvailable func(node *api.Node) bool
}

NodeAction describes a menu action contributed by a plugin for node targets.

If Shortcut is zero, no keyboard shortcut is registered. When IsAvailable is nil the action is always shown for the selected node.

type NodeActionHandler added in v1.0.7

type NodeActionHandler func(ctx context.Context, app *App, node *api.Node) error

NodeActionHandler executes a plugin-provided node-level action.

Implementations receive the application instance along with the currently selected node and can leverage the shared application context for long-running operations.

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 Plugin added in v1.0.7

type Plugin interface {
	ID() string
	Name() string
	Description() string
	Initialize(ctx context.Context, app *App, registrar PluginRegistrar) error
	Shutdown(ctx context.Context) error
	ModalPageNames() []string
}

Plugin defines the lifecycle hooks required to extend the UI through the plugin subsystem.

Initialize is called once during application startup. Shutdown is invoked as part of application teardown and should release any resources acquired by the plugin.

ModalPageNames returns a list of page names that this plugin adds to the application's page stack. These pages will be treated as modals by the global keyboard handler, preventing global keybindings from firing when they are active. Return an empty slice if the plugin doesn't add any modal pages.

type PluginInfo added in v1.0.7

type PluginInfo struct {
	ID          string
	Name        string
	Description string
}

PluginInfo describes user-facing metadata for a plugin.

type PluginRegistrar added in v1.0.7

type PluginRegistrar interface {
	RegisterNodeAction(action NodeAction)
	RegisterGuestAction(action GuestAction)
}

PluginRegistrar exposes registration hooks a plugin can use to contribute to the UI. It is provided to plugins during initialization.

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.Flex
	// 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 from history table.

func (*TasksList) Refresh added in v1.0.18

func (tl *TasksList) Refresh()

Refresh updates active tasks from TaskManager.

func (*TasksList) Select

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

Select wraps the table Select method to match the interface. Delegates to history table.

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
	Clear() *tview.Table
	Refresh()
}

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) GetNodeForVM added in v1.0.9

func (vl *VMList) GetNodeForVM(vm *api.VM) *api.Node

GetNodeForVM returns the node object for a given VM by looking it up from the app's node list.

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
	GetNodeForVM(*api.VM) *api.Node
	SetVMSelectedFunc(func(*api.VM))
	SetVMChangedFunc(func(*api.VM))
	SetCurrentItem(int) *tview.List
	GetCurrentItem() int
}

type WideModal added in v1.0.14

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

WideModal is a slightly modified version of tview.Modal that allows controlling the minimum width and the fraction of screen width used for layout. This prevents long lines (e.g., URLs) from wrapping unexpectedly.

func NewWideModal added in v1.0.14

func NewWideModal(widthRatio float64, minWidth int) *WideModal

NewWideModal creates a modal that uses the provided widthRatio (0 < ratio <= 1) of the available screen width and enforces a minimum inner width.

func (*WideModal) AddButtons added in v1.0.14

func (m *WideModal) AddButtons(labels []string) *WideModal

AddButtons adds buttons to the window.

func (*WideModal) ClearButtons added in v1.0.14

func (m *WideModal) ClearButtons() *WideModal

ClearButtons removes all buttons from the window.

func (*WideModal) Draw added in v1.0.14

func (m *WideModal) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*WideModal) Focus added in v1.0.14

func (m *WideModal) Focus(delegate func(p tview.Primitive))

Focus is called when this primitive receives focus.

func (*WideModal) HasFocus added in v1.0.14

func (m *WideModal) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*WideModal) InputHandler added in v1.0.14

func (m *WideModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler forwards key events to the embedded form so buttons work.

func (*WideModal) MouseHandler added in v1.0.14

func (m *WideModal) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)

MouseHandler returns the mouse handler for this primitive.

func (*WideModal) SetBackgroundColor added in v1.0.14

func (m *WideModal) SetBackgroundColor(color tcell.Color) *WideModal

SetBackgroundColor sets the color of the modal frame background.

func (*WideModal) SetButtonActivatedStyle added in v1.0.14

func (m *WideModal) SetButtonActivatedStyle(style tcell.Style) *WideModal

SetButtonActivatedStyle sets the style of the buttons when they are focused.

func (*WideModal) SetButtonBackgroundColor added in v1.0.14

func (m *WideModal) SetButtonBackgroundColor(color tcell.Color) *WideModal

SetButtonBackgroundColor sets the background color of the buttons.

func (*WideModal) SetButtonStyle added in v1.0.14

func (m *WideModal) SetButtonStyle(style tcell.Style) *WideModal

SetButtonStyle sets the style of the buttons when they are not focused.

func (*WideModal) SetButtonTextColor added in v1.0.14

func (m *WideModal) SetButtonTextColor(color tcell.Color) *WideModal

SetButtonTextColor sets the color of the button texts.

func (*WideModal) SetDoneFunc added in v1.0.14

func (m *WideModal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *WideModal

SetDoneFunc sets a handler which is called when one of the buttons was pressed.

func (*WideModal) SetFocus added in v1.0.14

func (m *WideModal) SetFocus(index int) *WideModal

SetFocus shifts the focus to the button with the given index.

func (*WideModal) SetText added in v1.0.14

func (m *WideModal) SetText(text string) *WideModal

SetText sets the message text of the window.

func (*WideModal) SetTextColor added in v1.0.14

func (m *WideModal) SetTextColor(color tcell.Color) *WideModal

SetTextColor sets the color of the message text.

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