Documentation
¶
Overview ¶
Package tui is the interactive terminal UI behind the CLI's "tui" command: a live, keyboard-driven view of apps, databases, deployments, nodes, domains, alerts and backups over the public HTTP API only.
Index ¶
- Constants
- func Run(ctx context.Context, api API, opts Options, in io.Reader, out io.Writer) error
- type API
- type AppRow
- type AttentionRow
- type BackupRow
- type Cell
- type DBRow
- type DeployRow
- type DomainRow
- type Fast
- type LiveAPI
- func (l LiveAPI) Deploy(ctx context.Context, app, image string) error
- func (l LiveAPI) Fast(parent context.Context) Fast
- func (l LiveAPI) Logs(ctx context.Context, kind LogKind, name string, onLine func(LogLine) error) error
- func (l LiveAPI) Restart(ctx context.Context, app string) error
- func (l LiveAPI) Rollback(ctx context.Context, app, deployID string) error
- func (l LiveAPI) Slow(parent context.Context) Slow
- func (l LiveAPI) Start(ctx context.Context, app string) error
- func (l LiveAPI) Stop(ctx context.Context, app string) error
- type LogKind
- type LogLine
- type MeshInfo
- type Model
- type NodeRow
- type Options
- type Row
- type ServerInfo
- type Slow
- type Tone
Constants ¶
const ( SecApps = "apps" SecDeploys = "deployments" SecAttention = "alerts" SecDatabases = "databases" SecNodes = "nodes" SecDomains = "domains" SecBackups = "backups" SecMesh = "mesh" SecServer = "server" )
Section names used as keys of Fast.Errs and Slow.Errs.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API interface {
Fast(ctx context.Context) Fast
Slow(ctx context.Context) Slow
Restart(ctx context.Context, app string) error
Start(ctx context.Context, app string) error
Stop(ctx context.Context, app string) error
Deploy(ctx context.Context, app, image string) error
Rollback(ctx context.Context, app, deployID string) error
Logs(ctx context.Context, kind LogKind, name string, onLine func(LogLine) error) error
}
API is everything the UI needs from the control plane, so tests can fake it.
type AppRow ¶
type AppRow struct {
Name string
Status string
Tone Tone
Image string
Strategy string
Node string
Replicas int
Domains []string
}
AppRow is one app in the apps view.
type AttentionRow ¶
AttentionRow is one item of the alerts/attention feed.
type BackupRow ¶
type BackupRow struct {
Resource string
Kind string
Status string
SizeBytes int64
StartedAt time.Time
}
BackupRow is one backup attempt in the backups view.
type DBRow ¶
type DBRow struct {
Name string
Engine string
Version string
Node string
Schedule string
Retain int
Public bool
Stopped bool
}
DBRow is one database in the databases view.
type DeployRow ¶
type DeployRow struct {
ID string
App string
Status string
Trigger string
Env string
Commit string
Branch string
StartedAt time.Time
DurationMS int64
IsLive bool
}
DeployRow is one deployment in the deployments view.
type Fast ¶
type Fast struct {
Apps []AppRow
Deploys []DeployRow
Attention []AttentionRow
Errs map[string]string
}
Fast is the data refreshed on every tick. A section present in Errs failed and its field is ignored, so stale data survives a blip.
type LiveAPI ¶
LiveAPI implements API over the HTTP client, one batched list call per section.
func (LiveAPI) Logs ¶
func (l LiveAPI) Logs(ctx context.Context, kind LogKind, name string, onLine func(LogLine) error) error
Logs tails an app or database log stream until ctx ends.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubble Tea model for the whole UI.
type NodeRow ¶
type NodeRow struct {
Name string
Address string
Status string
Schedulable bool
Local bool
LastSeen time.Time
}
NodeRow is one node in the nodes view.
type Options ¶
type Options struct {
Prog string
Profile string
Host string
ReadOnly bool
Color bool
Refresh time.Duration
SlowEvery int
LogBuffer int
Now func() time.Time
}
Options configures a Model. Zero values pick sane defaults.
type Row ¶
Row is one table row; Key identifies the resource and Ref names the app a drill-down should open (empty when there is none).
type ServerInfo ¶
ServerInfo is the header's control plane summary.