Documentation
¶
Index ¶
- Constants
- func ComposeColumns(w int) []table.Column
- func ContainerColumns(w int) []table.Column
- func ContainerStatsColumns(w int) []table.Column
- func HostColumns(w int) []table.Column
- func ImageColumns(w int) []table.Column
- func NetworkColumns(w int) []table.Column
- func SortContainers(containers []docker.Container, stats map[string]docker.ContainerStats, ...) []docker.Container
- func Summary(total, shown int) string
- func VolumeColumns(w int) []table.Column
- type Colorizer
- type Model
- func (m *Model) InnerTable() *table.Model
- func (m *Model) RefreshStyles()
- func (m *Model) SelectComposeRow(id string)
- func (m Model) SelectedID() string
- func (m Model) SelectedRow() []string
- func (m *Model) SetColorizers(cs []Colorizer)
- func (m *Model) SetColumns(cols []table.Column)
- func (m *Model) SetCompose(projects []docker.ComposeProject, filter string)
- func (m *Model) SetContainers(containers []docker.Container, filter string, ...)
- func (m *Model) SetHosts(hostList []hosts.Host, filter string, summaries map[string]docker.HostSummary)
- func (m *Model) SetImages(images []docker.Image, filter string, selected map[string]bool)
- func (m *Model) SetNetworks(networks []docker.Network, filter string)
- func (m *Model) SetSize(width, height int)
- func (m *Model) SetSort(field SortField, desc bool)
- func (m *Model) SetVolumes(volumes []docker.Volume, filter string)
- func (m Model) Table() table.Model
- func (m *Model) Update(msg any)
- func (m Model) View() string
- type SortField
Constants ¶
const ComposeIDColumn = 2
ComposeIDColumn is the index of the column holding a deployment's identity (its full working_dir). Model.selectedID() reads it for the compose view — the PROJECT column is first but not unique, so it can't serve as the identity.
Variables ¶
This section is empty.
Functions ¶
func ComposeColumns ¶
func ContainerColumns ¶
func ContainerStatsColumns ¶
ContainerStatsColumns is the alternate container layout (toggled with 's') that mirrors `docker stats`: live CPU/MEM/MEM%/NET I/O/BLOCK I/O. ID stays last so Model.selectedID() keeps working.
func HostColumns ¶
HostColumns is the unified hosts/dashboard layout: saved-host identity plus the aggregate daemon summary (`docker info`). NAME stays first (identity for selectedID) and STATUS (col 2) is colorized after layout.
func ImageColumns ¶
func NetworkColumns ¶
func SortContainers ¶
func SortContainers(containers []docker.Container, stats map[string]docker.ContainerStats, field SortField, desc bool) []docker.Container
SortContainers returns containers reordered by field (stable; the input slice is not mutated). CPU/MEM figures come from stats — a container without a sample sorts as zero. SortNone returns the slice unchanged. Equal rows fall back to NAME ascending regardless of direction, so the order stays stable.
func VolumeColumns ¶
Types ¶
type Colorizer ¶
Colorizer maps a column's plain cell text to the style it should be drawn with. The bool reports whether to apply that style: returning false leaves the cell in the base style (so a colorizer can opt out per row, e.g. the alert marker only colors breaching rows).
func ComposeColorizers ¶
func ComposeColorizers() []Colorizer
ComposeColorizers colors the STATUS column of the compose layout.
func ContainerColorizers ¶
func ContainerColorizers() []Colorizer
ContainerColorizers colors the NAME (alert ⚠ marker), STATUS and HEALTH columns of the default container layout; the column order matches columns().
func ContainerStatsColorizers ¶
func ContainerStatsColorizers() []Colorizer
ContainerStatsColorizers colors the NAME column's alert ⚠ marker in the `docker stats`-style layout (7 columns); the other columns stay base.
func HostColorizers ¶
func HostColorizers() []Colorizer
HostColorizers colors the STATUS column of the hosts layout (col 2).
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) InnerTable ¶
func (*Model) RefreshStyles ¶
func (m *Model) RefreshStyles()
RefreshStyles re-applies the package styles to the underlying bubbles table. bubbles captures its Styles once at construction, so a runtime theme switch (styles.Apply) leaves the table's stored Selected/Header/Cell pointing at the previous palette. The selected-row highlight is detected and re-rendered by matching bubbles' Selected-style ANSI prefix (see selectedPrefix/View); once that prefix is stale the cursor row stops being recognised and its highlight vanishes in colorized views. Call this after every styles.Apply.
func (*Model) SelectComposeRow ¶
SelectComposeRow moves the cursor to the compose row whose identity column (working_dir) equals id; it's a no-op if no row matches. Used to restore the selection when returning from a drill-down to the deployment list.
func (Model) SelectedID ¶
SelectedID returns the last column of the selected row (the resource ID for containers/images/networks, whose last column is a real ID column).
func (Model) SelectedRow ¶
SelectedRow returns the cells of the currently selected row, or nil.
func (*Model) SetColorizers ¶
SetColorizers installs the per-column colorizers used to color cells after layout. Pass nil for views with no colored columns. The slice is indexed by column; a nil entry leaves that column in the base style.
func (*Model) SetColumns ¶
SetColumns updates column definitions (called on resize or resource switch). Rows are cleared ONLY when the column count changes to avoid index-out-of-range in renderRow while preserving existing rows on resize.
func (*Model) SetCompose ¶
func (m *Model) SetCompose(projects []docker.ComposeProject, filter string)
func (*Model) SetContainers ¶
func (*Model) SetHosts ¶
func (m *Model) SetHosts(hostList []hosts.Host, filter string, summaries map[string]docker.HostSummary)
SetHosts fills the unified hosts/dashboard view; summaries holds per-host daemon snapshots keyed by host URL (absent = probe pending).
func (*Model) SetSort ¶
SetSort selects the column the containers view is ordered by. SortNone keeps the daemon's order. Only the containers view honours it.
func (Model) View ¶
View post-processes bubbles output. bubbles truncates each cell with runewidth, which counts ANSI-escape bytes as visible width — so a pre-colored cell loses its text in a narrow column on truecolor terminals. We therefore keep colored content out of the row values and apply color here.
Two paths:
- colorized views (containers/compose/hosts): every data row is rebuilt from its plain text so colored columns can be styled after layout, with the selection background preserved under the cursor row.
- plain views: only the selected line needs fixing — its inner cell resets break the Selected background, so we strip and re-render it uniformly.