tui

package
v1.56.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TitleStyle       = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("63"))
	SubtitleStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("241"))
	BorderStyle      = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color("62"))
	SelectedStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("212")).Bold(true)
	NormalStyle      = lipgloss.NewStyle().Foreground(lipgloss.Color("250"))
	MetricLabelStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("243")).Width(20)
	MetricValueStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("39")).Bold(true)
	ChartBarStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("46"))
	ChartEmptyStyle  = lipgloss.NewStyle().Foreground(lipgloss.Color("238"))
)

Functions

This section is empty.

Types

type Client

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

Client is an HTTP client for fetching data from the hypervisor server

func NewClient

func NewClient(host string, port int) *Client

NewClient creates a new HTTP client for the hypervisor

func (*Client) GetDevice

func (c *Client) GetDevice(ctx context.Context, uuid string) (*api.DeviceInfo, error)

GetDevice fetches a specific device by UUID

func (*Client) GetDeviceAllocations

func (c *Client) GetDeviceAllocations(ctx context.Context, uuid string) ([]*api.WorkerAllocation, error)

GetDeviceAllocations fetches allocations for a specific device

func (*Client) GetGPUMetrics

func (c *Client) GetGPUMetrics(ctx context.Context) (map[string]*api.GPUUsageMetrics, error)

GetGPUMetrics fetches GPU metrics for all devices Note: This is a placeholder until a dedicated metrics endpoint is available

func (*Client) GetWorker

func (c *Client) GetWorker(ctx context.Context, workerID string) (*api.WorkerAllocation, map[string]map[string]map[string]*api.WorkerMetrics, error)

GetWorker fetches a specific worker by ID

func (*Client) GetWorkerMetrics

func (c *Client) GetWorkerMetrics(ctx context.Context) (map[string]map[string]map[string]*api.WorkerMetrics, error)

GetWorkerMetrics fetches worker metrics for all workers This is optimized to batch requests when possible

func (*Client) ListDevices

func (c *Client) ListDevices(ctx context.Context) ([]*api.DeviceInfo, error)

ListDevices fetches all devices from the hypervisor

func (*Client) ListWorkers

func (c *Client) ListWorkers(ctx context.Context) ([]*api.WorkerAllocation, error)

ListWorkers fetches all workers from the hypervisor

type DeviceMetricsHistory

type DeviceMetricsHistory struct {
	MemoryChart  *TimeSeriesChart
	ComputeChart *TimeSeriesChart
	TempChart    *TimeSeriesChart
	PowerChart   *TimeSeriesChart
}

DeviceMetricsHistory tracks historical metrics for a device

type Model

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

Model represents the TUI model

func NewModel

func NewModel(ctx context.Context, client *Client) *Model

NewModel creates a new TUI model

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

type ShmDialogModel

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

ShmDialogModel represents the shared memory detail dialog

func NewShmDialogModel

func NewShmDialogModel() *ShmDialogModel

NewShmDialogModel creates a new SHM dialog model

func (*ShmDialogModel) Hide

func (m *ShmDialogModel) Hide()

Hide hides the dialog

func (*ShmDialogModel) Init

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

Init initializes the dialog

func (*ShmDialogModel) IsVisible

func (m *ShmDialogModel) IsVisible() bool

IsVisible returns whether the dialog is visible

func (*ShmDialogModel) Show

func (m *ShmDialogModel) Show(workerInfo *api.WorkerInfo)

Show displays the dialog with SHM details for the given worker

func (*ShmDialogModel) Update

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

Update updates the dialog

func (*ShmDialogModel) View

func (m *ShmDialogModel) View() string

View renders the dialog

type TimeSeriesChart

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

TimeSeriesChart represents a time-series chart for metrics

func NewTimeSeriesChart

func NewTimeSeriesChart(width, height int, label string) *TimeSeriesChart

NewTimeSeriesChart creates a new time-series chart

func (*TimeSeriesChart) AddDataPoint

func (c *TimeSeriesChart) AddDataPoint(value float64)

AddDataPoint adds a new data point to the chart

func (*TimeSeriesChart) Render

func (c *TimeSeriesChart) Render() string

Render renders the time-series chart as a string

func (*TimeSeriesChart) SetDimensions

func (c *TimeSeriesChart) SetDimensions(width, height int)

SetDimensions sets the width and height of the chart

func (*TimeSeriesChart) SetMaxValue

func (c *TimeSeriesChart) SetMaxValue(max float64)

SetMaxValue sets the maximum value for the chart scale

type WorkerMetricsHistory

type WorkerMetricsHistory struct {
	MemoryChart  *TimeSeriesChart
	ComputeChart *TimeSeriesChart
}

WorkerMetricsHistory tracks historical metrics for a worker

Jump to

Keyboard shortcuts

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