ui

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package ui implements dirt's Bubble Tea UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTheme added in v0.6.1

func ApplyTheme(name string)

ApplyTheme sets the global colour variables and rebuilds styles from the named theme. Unknown names fall back to "default".

func SetMigrationProgram added in v0.7.0

func SetMigrationProgram(p *tea.Program)

SetMigrationProgram is retained for backwards compat; prefer SetProgram.

func SetProgram added in v0.7.0

func SetProgram(p *tea.Program)

SetProgram records the tea.Program used by background job goroutines to send progress and completion messages.

Types

type Job added in v0.7.0

type Job struct {
	ID         string  // unique, e.g. "migrate-vm1-1702000000"
	Kind       string  // "migrate" / "snap-create" / "snap-delete"
	Target     string  // primary subject — VM name
	Detail     string  // "→ otherhost" / "@ snap-name"
	Phase      string  // "transferring memory" / "finalising"
	Progress   float64 // 0.0–1.0, or -1 for unbounded
	DataDone   uint64  // bytes transferred so far
	DataTotal  uint64  // total bytes (0 = unknown)
	StartedAt  time.Time
	FinishedAt time.Time // zero until done
	Err        error
	Cancel     func() // may be nil for non-cancellable jobs
}

Job is a long-running background operation surfaced in the status bar and the :jobs view. Kind / Target are user-facing labels; Cancel is called when the master aborts the job.

func (*Job) Elapsed added in v0.7.0

func (j *Job) Elapsed() time.Duration

Elapsed returns how long the job has been running, or its total duration if it has finished.

func (*Job) Running added in v0.7.0

func (j *Job) Running() bool

Running reports whether the job is still active.

type Model

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

Model is the root Bubble Tea model.

func New

func New(c *lv.Client) Model

New constructs a fresh Model bound to the given libvirt client.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

View is the root render — composes header, list, and status bar, or shows the detail / help / splash overlays as appropriate.

func (Model) WithConfig added in v0.6.0

func (m Model) WithConfig(cfg config.Config) Model

WithConfig applies user-level config.yaml preferences to the model: default sort column + direction and column visibility. Refresh interval is applied separately via WithRefreshInterval so the CLI --refresh flag can override the config without a second lookup.

func (Model) WithRefreshInterval added in v0.1.1

func (m Model) WithRefreshInterval(d time.Duration) Model

WithRefreshInterval returns a copy of the model with the snapshot tick rate set to d. Values below 200ms are clamped to 200ms to protect libvirt.

Jump to

Keyboard shortcuts

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