tui

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanelSystem = iota
	PanelWorkers
	PanelLogs
	PanelEntities
	PanelCount
)

Panel indices

Variables

This section is empty.

Functions

func Run

func Run(sources DataSources) error

Run starts the TUI application with full data sources (blocking)

func RunMinimal

func RunMinimal(sources MinimalDataSources) (*tea.Program, <-chan error)

RunMinimal starts the TUI with minimal data sources and returns the program for sending DataSourcesReadyMsg later. The returned channel signals when TUI exits.

Types

type AppModel

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

AppModel is the root TUI model

func NewApp

func NewApp(sources DataSources) *AppModel

NewApp creates a new TUI application with full data sources

func NewAppMinimal

func NewAppMinimal(sources MinimalDataSources) *AppModel

NewAppMinimal creates a TUI application with only log support (for early startup)

func (AppModel) Init

func (m AppModel) Init() tea.Cmd

Init initializes the model

func (AppModel) Update

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

Update handles messages

func (AppModel) View

func (m AppModel) View() string

View renders the UI

type DataSources

type DataSources struct {
	WorkerManager *workers.Manager
	JetStream     nats.JetStreamContext
	KeyValue      nats.KeyValue
	LogHook       *logger.TUIHook
}

DataSources holds all data source dependencies

type DataSourcesReadyMsg

type DataSourcesReadyMsg struct {
	WorkerManager interface{} // *workers.Manager - use interface to avoid import cycle
	JetStream     interface{} // nats.JetStreamContext
	KeyValue      interface{} // nats.KeyValue
}

DataSourcesReadyMsg signals that data sources are now available

type EntitiesUpdateMsg

type EntitiesUpdateMsg struct {
	Entities []datasource.EntitySummary
}

EntitiesUpdateMsg contains updated entity data

type ErrorMsg

type ErrorMsg struct {
	Error error
}

ErrorMsg represents an error that occurred during data fetching

type KeyMap

type KeyMap struct {
	// Navigation
	Up       key.Binding
	Down     key.Binding
	Left     key.Binding
	Right    key.Binding
	NextTab  key.Binding
	PrevTab  key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Home     key.Binding
	End      key.Binding

	// Actions
	Toggle  key.Binding
	Refresh key.Binding
	Help    key.Binding
	Quit    key.Binding
}

KeyMap defines all keybindings for the TUI

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns the full help for the help overlay

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns a short help string for the help bar

type LogEntryMsg

type LogEntryMsg struct {
	Time    time.Time
	Level   string
	Message string
	Fields  map[string]interface{}
}

LogEntryMsg contains a new log entry

type MetricsUpdateMsg

type MetricsUpdateMsg = datasource.MetricsSnapshot

MetricsUpdateMsg contains updated system metrics

type MinimalDataSources

type MinimalDataSources struct {
	LogHook *logger.TUIHook
}

MinimalDataSources holds only the log hook for early TUI startup

type QuitMsg

type QuitMsg struct{}

QuitMsg signals the app should quit

type RefreshMsg

type RefreshMsg struct{}

RefreshMsg signals a manual refresh request

type StreamsUpdateMsg

type StreamsUpdateMsg struct {
	Streams []datasource.StreamStat
}

StreamsUpdateMsg contains updated NATS stream stats

type TickMsg

type TickMsg time.Time

TickMsg is sent on each refresh tick

type WindowSizeMsg

type WindowSizeMsg struct {
	Width  int
	Height int
}

WindowSizeMsg is sent when the terminal window is resized

type WorkersUpdateMsg

type WorkersUpdateMsg struct {
	Workers []datasource.WorkerStatus
}

WorkersUpdateMsg contains updated worker statuses

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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