tui

package
v0.0.0-...-eefbc77 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinTerminalWidth = 80
	LargeWidth       = 120
)
View Source
const RefreshInterval = 2 * time.Second

Variables

View Source
var ErrTUIManagerAlreadyRunning = errors.New("TUI manager is already running")

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	Quit       key.Binding
	Help       key.Binding
	Dashboard  key.Binding
	Worker     key.Binding
	NextTab    key.Binding
	PrevTab    key.Binding
	ScrollUp   key.Binding
	ScrollDown key.Binding
	PageUp     key.Binding
	PageDown   key.Binding
}

KeyMap defines key bindings for the TUI.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns default key bindings.

type Manager

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

Manager manages the TUI interface for multiple workers.

func NewManager

func NewManager(ctx context.Context, logDir string, logger *zap.Logger) *Manager

NewManager creates a new TUI manager.

func (*Manager) AddWorker

func (m *Manager) AddWorker(id int, workerType, name, logPath string) *components.ProgressBar

AddWorker adds a new worker to track.

func (*Manager) GetWorker

func (m *Manager) GetWorker(id int) *WorkerInfo

GetWorker gets a worker by ID.

func (*Manager) IsRunning

func (m *Manager) IsRunning() bool

IsRunning returns whether the TUI is currently running.

func (*Manager) RemoveWorker

func (m *Manager) RemoveWorker(id int)

RemoveWorker removes a worker from tracking.

func (*Manager) Start

func (m *Manager) Start() error

Start starts the TUI interface.

func (*Manager) Stop

func (m *Manager) Stop()

Stop stops the TUI interface.

func (*Manager) UpdateWorkerStatus

func (m *Manager) UpdateWorkerStatus(id int, status string, healthy bool)

UpdateWorkerStatus updates a worker's status.

type Model

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

Model represents the main TUI model.

func NewModel

func NewModel(ctx context.Context, logDir string) *Model

NewModel creates a new TUI model.

func (*Model) AddWorker

func (m *Model) AddWorker(id int, workerType, name, logPath string, bar *components.ProgressBar)

AddWorker adds a new worker to track.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model.

func (*Model) Update

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

Update handles messages.

func (*Model) UpdateWorkerStatus

func (m *Model) UpdateWorkerStatus(id int, status string, healthy bool)

UpdateWorkerStatus updates a worker's status.

func (*Model) View

func (m *Model) View() string

View renders the current view.

type TickMsg

type TickMsg struct{}

TickMsg is sent every refresh interval.

type ViewType

type ViewType int

ViewType represents different TUI views.

const (
	DashboardView ViewType = iota
	WorkerView
	HelpView
)

type WorkerInfo

type WorkerInfo struct {
	ID          int
	Name        string
	Type        string
	LogPath     string
	Bar         *components.ProgressBar
	Status      string
	Healthy     bool
	LastUpdated time.Time
}

WorkerInfo contains information about a worker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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