Documentation
¶
Overview ¶
Package ui implements the Bubble Tea terminal UI for docker-tui.
Index ¶
- func CopyLogEntries(entries []LogEntry) error
- func CopyToClipboard(text string) error
- func RenderRow(totalWidth int, cells []Cell, rs RowStyle) string
- func ResolveLogTargetColor(colors map[string]string, target LogTarget) string
- func RowW(termW int) int
- func SetVersion(v string)
- func SortLogEntries(entries []LogEntry)
- func TableW(termW int) int
- type Cell
- type ColumnSpec
- type Command
- type Frame
- type ListColumn
- type ListRowKind
- type ListScreen
- type ListTableRow
- type LogEntry
- type LogModalFocus
- type LogModalState
- type LogTarget
- type LogViewerState
- func (s *LogViewerState) Append(entries ...LogEntry)
- func (s *LogViewerState) AppendSorted(entries ...LogEntry)
- func (s *LogViewerState) AppendSortedBatch(entries []LogEntry)
- func (s *LogViewerState) ClearSelection()
- func (s *LogViewerState) FilteredEntries() []LogEntry
- func (s *LogViewerState) FocusedEntry() (LogEntry, bool)
- func (s LogViewerState) IsContainerHidden(id string) bool
- func (s *LogViewerState) MoveFocus(delta int, height int)
- func (s *LogViewerState) ScrollBy(delta, height int)
- func (s *LogViewerState) ScrollEnd()
- func (s *LogViewerState) ScrollHome(height int)
- func (s *LogViewerState) ScrollPage(delta, height int)
- func (s *LogViewerState) SelectRangeToFocused()
- func (s *LogViewerState) SelectedEntries() []LogEntry
- func (s *LogViewerState) SetFilter(filter string)
- func (s *LogViewerState) SetUseRegex(useRegex bool)
- func (s *LogViewerState) ShowAllContainers()
- func (s *LogViewerState) ToggleContainer(id string)
- func (s *LogViewerState) ToggleSelectFocused()
- func (s *LogViewerState) VisibleEntries(height int) []LogEntry
- func (s *LogViewerState) VisibleWindow(height int) (int, int, int)
- type Model
- type Notification
- type RowStyle
- type ScreenState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyLogEntries ¶
func CopyToClipboard ¶
func ResolveLogTargetColor ¶
func SetVersion ¶
func SetVersion(v string)
SetVersion records the application version for display in the header.
func SortLogEntries ¶
func SortLogEntries(entries []LogEntry)
Types ¶
type Cell ¶
type Cell struct {
Text string
Width int // target display width; 0 = natural
FG lipgloss.Color
BG lipgloss.Color // per-cell background (e.g. container tag); overrides row BG
Bold bool
BarPercent float64 // when Bar is true, render a mini progress bar filling Width
Bar bool // render BarPercent as a bar (including 0%)
}
Cell is one column in a rendered row.
type ColumnSpec ¶ added in v0.2.0
type ColumnSpec struct {
Label string
Width int // fixed display cells; when > 0, Percent and Min are ignored
Percent int // share of the flexible width, 0-100
Min int // floor below which the column is dropped instead of shrunk
Priority int // higher drops first; 0 never drops
}
ColumnSpec declares one column's width policy. Views declare specs; the fitter turns them into concrete ListColumns for the available width.
type Frame ¶
type Frame struct {
TermW, TermH int
RowW int // highlight / row body width (termW - 5)
TableW int // column layout width (termW - 7)
BodyRows int // scrollable data rows
}
Frame holds measured terminal layout for a view.
type ListColumn ¶
ListColumn describes one table column header.
func FitColumns ¶ added in v0.2.0
func FitColumns(specs []ColumnSpec, availW int) []ListColumn
FitColumns lays specs out into availW display columns, accounting for the single-space gap the row renderer places between columns. Columns are dropped highest-Priority-first when the remainder cannot honour every Min.
Precondition: the combined width of every priority-0 (never-drop) column, plus their gaps, should not exceed availW. If it does — e.g. a fixed-width priority-0 column alongside a flexible priority-0 column, as happens in the events view, the notifications view, and the detail identity line — the returned total can exceed availW. This only occurs at terminal widths far narrower than any real terminal (observed threshold: termW < 16 for the events case), so it is documented here rather than defended against.
FitColumns always returns exactly one ListColumn per surviving spec (never nil when specs is non-empty), even at availW <= 0 — callers may see very small or zero Widths, but RenderRow's fitCells/clampRenderedWidth machinery handles that overflow safely.
type ListRowKind ¶
type ListRowKind int
ListRowKind selects marker and background styling for a list row.
const ( ListRowNormal ListRowKind = iota ListRowCursor ListRowSelected ListRowCursorSelected )
type ListScreen ¶ added in v0.2.0
type ListScreen struct {
Title string
Count int // total objects, before filtering
Selected int // multi-selection count; 0 hides the badge
Filter string // active filter text; "" hides the filter bar
Cols []ListColumn
Rows []ListTableRow
RowCount int // total rows when Rows is a scroll window; 0 → len(Rows)
RowOffset int // index of Rows[0] in the full list
Cursor int
State ScreenState
Message string // body text for Loading / Empty / NoMatch / Error
Extra []string // pre-rendered lines between the title and the table
Help string // pre-rendered help bar content
}
ListScreen describes a list view as data. Views build one of these; the renderer below is the only thing that turns it into text, so every view gets identical chrome in identical order.
type ListTableRow ¶
ListTableRow is one data row in a list-style screen.
type LogModalFocus ¶ added in v0.2.0
type LogModalFocus int
LogModalFocus is which pane receives j/k-style navigation in split layout.
type LogModalState ¶ added in v0.2.0
type LogModalState struct {
Entries []LogEntry
Targets map[string]LogTarget
ShowCentralTag bool
Cursor int
ListScroll int
BodyScroll int
Focus LogModalFocus
}
LogModalState holds a snapshot of log lines shown in the detail modal.
type LogTarget ¶
func SelectCentralLogTargets ¶
type LogViewerState ¶
type LogViewerState struct {
Entries []LogEntry
Targets map[string]LogTarget
Scroll int
Follow bool
Filter string
UseRegex bool
SelectedIndex int
LogCursor int
Focused int
Selection map[int64]bool
HiddenContainers map[string]bool
SelectAnchor int
ShowLegend bool
MaxEntries int
// contains filtered or unexported fields
}
func NewLogViewerState ¶
func NewLogViewerState(maxEntries int, targets []LogTarget) LogViewerState
func (*LogViewerState) Append ¶
func (s *LogViewerState) Append(entries ...LogEntry)
func (*LogViewerState) AppendSorted ¶
func (s *LogViewerState) AppendSorted(entries ...LogEntry)
func (*LogViewerState) AppendSortedBatch ¶ added in v0.2.0
func (s *LogViewerState) AppendSortedBatch(entries []LogEntry)
func (*LogViewerState) ClearSelection ¶
func (s *LogViewerState) ClearSelection()
func (*LogViewerState) FilteredEntries ¶
func (s *LogViewerState) FilteredEntries() []LogEntry
func (*LogViewerState) FocusedEntry ¶
func (s *LogViewerState) FocusedEntry() (LogEntry, bool)
func (LogViewerState) IsContainerHidden ¶
func (s LogViewerState) IsContainerHidden(id string) bool
func (*LogViewerState) MoveFocus ¶
func (s *LogViewerState) MoveFocus(delta int, height int)
func (*LogViewerState) ScrollBy ¶
func (s *LogViewerState) ScrollBy(delta, height int)
func (*LogViewerState) ScrollEnd ¶
func (s *LogViewerState) ScrollEnd()
func (*LogViewerState) ScrollHome ¶
func (s *LogViewerState) ScrollHome(height int)
func (*LogViewerState) ScrollPage ¶
func (s *LogViewerState) ScrollPage(delta, height int)
func (*LogViewerState) SelectRangeToFocused ¶
func (s *LogViewerState) SelectRangeToFocused()
func (*LogViewerState) SelectedEntries ¶
func (s *LogViewerState) SelectedEntries() []LogEntry
func (*LogViewerState) SetFilter ¶
func (s *LogViewerState) SetFilter(filter string)
func (*LogViewerState) SetUseRegex ¶
func (s *LogViewerState) SetUseRegex(useRegex bool)
func (*LogViewerState) ShowAllContainers ¶
func (s *LogViewerState) ShowAllContainers()
func (*LogViewerState) ToggleContainer ¶
func (s *LogViewerState) ToggleContainer(id string)
func (*LogViewerState) ToggleSelectFocused ¶
func (s *LogViewerState) ToggleSelectFocused()
func (*LogViewerState) VisibleEntries ¶
func (s *LogViewerState) VisibleEntries(height int) []LogEntry
func (*LogViewerState) VisibleWindow ¶
func (s *LogViewerState) VisibleWindow(height int) (int, int, int)
type RowStyle ¶
type RowStyle struct {
BG lipgloss.Color
Marker string
MarkerFG lipgloss.Color
Rail string // left accent glyph; " " when the row has no accent
RailFG lipgloss.Color
MinFG lipgloss.Color // floor colour for cells too close to BG to read
}
RowStyle controls marker, rail and row-level background.
type ScreenState ¶ added in v0.2.0
type ScreenState int
ScreenState selects which body a list screen renders.
const ( ScreenReady ScreenState = iota // rows are present ScreenLoading // data is being fetched ScreenEmpty // no objects exist ScreenNoMatch // objects exist but the filter matches none ScreenError // Message holds the error text )
Source Files
¶
- alerts.go
- cache.go
- cell.go
- clock.go
- columns.go
- command_palette.go
- commands.go
- components.go
- dashboard.go
- detail_input.go
- frame_memo.go
- glyphs.go
- graph.go
- helpers.go
- history.go
- input.go
- layout.go
- list_window.go
- log_batch.go
- log_modal.go
- log_streams.go
- log_viewer.go
- model.go
- screen.go
- state.go
- styles.go
- styles_render.go
- view_detail.go
- view_dialog.go
- view_events.go
- view_help.go
- view_images.go
- view_list.go
- view_log_modal.go
- view_logs.go
- view_networks.go
- view_notifications.go
- view_utils.go
- view_volumes.go
- views.go
- width_fast.go