ui

package
v0.0.0-...-3ec3326 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

LevelFilters defines the cycle order for log level filtering.

Functions

func LevelFilterLabel

func LevelFilterLabel(idx int) string

LevelFilterLabel returns the display label for a filter index.

func StatusBarView

func StatusBarView(width int, frozen bool, shellFocused bool, shellOpen bool, sidebarFocused bool, hideStopped bool, selectedCount int, totalLines int, cursorLine int, levelFilter int) string

StatusBarView renders the status bar.

func TitleBarView

func TitleBarView(width int, project string, visibleCount, totalCount int, notification string, copied bool, search SearchModel, frozen bool, wrapLines bool, showTimestamps bool, filterLevel int) string

TitleBarView renders the title bar.

Types

type ActionMenuModel

type ActionMenuModel struct {
	Open    bool
	Actions []ContainerAction
	Cursor  int
}

ActionMenuModel manages the container action menu overlay.

func (*ActionMenuModel) Close

func (m *ActionMenuModel) Close()

Close closes the action menu.

func (ActionMenuModel) InlineView

func (m ActionMenuModel) InlineView(width int, t theme.Theme) []string

InlineView renders the action menu as lines to embed within the sidebar.

func (*ActionMenuModel) OpenMenu

func (m *ActionMenuModel) OpenMenu(c *model.Container)

OpenMenu opens the action menu for a container.

func (ActionMenuModel) Update

func (m ActionMenuModel) Update(msg tea.KeyMsg, container *model.Container) (ActionMenuModel, tea.Cmd)

func (ActionMenuModel) View

func (m ActionMenuModel) View(width int) string

View renders the action menu as a bordered overlay box.

type ContainerAction

type ContainerAction struct {
	Key   string
	Label string
}

ContainerAction represents an available action for a container.

func GetContainerActions

func GetContainerActions(c *model.Container) []ContainerAction

GetContainerActions returns available actions for a container based on its status.

type CopiedMsg

type CopiedMsg struct {
	Text string
}

CopiedMsg indicates lines were copied.

type ExecSession

type ExecSession interface {
	Write(data []byte) (int, error)
	Reader() io.Reader
	Close() error
}

ExecSession is the interface the shell model uses to communicate with a Docker exec session. This keeps the ui package decoupled from the docker package.

type ExecuteActionMsg

type ExecuteActionMsg struct {
	Container *model.Container
	Action    string
}

ExecuteActionMsg is sent when a user selects an action from the menu.

type HelpModel

type HelpModel struct {
	Visible bool
}

HelpModel manages the help overlay.

func (*HelpModel) HandleKey

func (m *HelpModel) HandleKey(keyStr string) bool

HandleKey processes a key in help mode. Returns true if the key was consumed.

func (*HelpModel) Toggle

func (m *HelpModel) Toggle()

Toggle toggles help visibility.

func (HelpModel) View

func (m HelpModel) View(width, height int) string

View renders the help overlay.

type LogViewKeyMap

type LogViewKeyMap struct {
	Up       key.Binding
	Down     key.Binding
	Top      key.Binding
	Bottom   key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Select   key.Binding
	Copy     key.Binding
	ClearSel key.Binding
}

LogViewKeyMap holds log view key bindings.

type LogViewModel

type LogViewModel struct {
	Logs           []*model.LogEntry
	FilteredLogs   []*model.LogEntry
	Frozen         bool
	CursorLine     int
	SelectedLines  map[int]bool
	SelAnchor      int
	ShowTimestamps bool
	WrapLines      bool
	Width          int
	Height         int
	NameWidth      int // max container name width, set by app
}

LogViewModel manages the main log viewport.

func NewLogViewModel

func NewLogViewModel() LogViewModel

func (*LogViewModel) ClampCursor

func (m *LogViewModel) ClampCursor()

ClampCursor ensures cursor is within bounds after refilter.

func (*LogViewModel) ClickLine

func (m *LogViewModel) ClickLine(lineIdx int)

ClickLine auto-freezes and moves cursor to the given line index.

func (*LogViewModel) CopyLine

func (m *LogViewModel) CopyLine(lineIdx int) string

CopyLine returns the text of a single log line for clipboard copy.

func (*LogViewModel) CtrlClickLine

func (m *LogViewModel) CtrlClickLine(lineIdx int)

CtrlClickLine toggles the clicked line in the selection without clearing existing selections. Auto-freezes if needed.

func (*LogViewModel) Freeze

func (m *LogViewModel) Freeze()

Freeze toggles freeze state and adjusts cursor.

func (*LogViewModel) ScrollDown

func (m *LogViewModel) ScrollDown(n int)

ScrollDown scrolls the view down by n lines.

func (*LogViewModel) ScrollUp

func (m *LogViewModel) ScrollUp(n int)

ScrollUp scrolls the view up by n lines.

func (*LogViewModel) ShiftClickLine

func (m *LogViewModel) ShiftClickLine(lineIdx int)

ShiftClickLine selects a range from the current cursor (or anchor) to the clicked line index, auto-freezing if necessary.

func (LogViewModel) Update

func (m LogViewModel) Update(msg tea.KeyMsg, keys LogViewKeyMap) (LogViewModel, tea.Cmd)

func (LogViewModel) View

func (m LogViewModel) View() string

func (*LogViewModel) VisibleStartIndex

func (m *LogViewModel) VisibleStartIndex() int

VisibleStartIndex returns the index of the first visible log line in the current viewport, matching the logic in View().

type OpenActionMenuMsg

type OpenActionMenuMsg struct{}

OpenActionMenuMsg requests opening the action menu.

type OpenShellMsg

type OpenShellMsg struct {
	Container *model.Container
}

OpenShellMsg requests opening a shell for a container.

type PickerModel

type PickerModel struct {
	Title    string
	Items    []string
	Cursor   int
	Selected string
	Quit     bool
}

PickerModel is a simple list picker for selecting a project.

func NewPickerModel

func NewPickerModel(title string, items []string) PickerModel

func (PickerModel) Init

func (m PickerModel) Init() tea.Cmd

func (PickerModel) Update

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

func (PickerModel) View

func (m PickerModel) View() string

type RefilterMsg

type RefilterMsg struct{}

RefilterMsg requests a log refilter after visibility change.

type SearchModel

type SearchModel struct {
	Query      string
	Regex      *regexp.Regexp
	IsRegex    bool
	Active     bool
	RegexError string
}

SearchModel manages search state.

func (*SearchModel) Activate

func (m *SearchModel) Activate()

Activate starts search mode.

func (SearchModel) Matches

func (m SearchModel) Matches(msg string) bool

Matches returns whether a message matches the current search.

func (SearchModel) Update

func (m SearchModel) Update(msg tea.KeyMsg) (SearchModel, tea.Cmd)

type ShellFocusLogs

type ShellFocusLogs struct{}

ShellFocusLogs is sent when the user presses Esc in the shell.

type ShellModel

type ShellModel struct {
	Container *model.Container
	Lines     []string
	Height    int
	Focused   bool
	// contains filtered or unexported fields
}

ShellModel manages the shell panel.

func NewShellModel

func NewShellModel() ShellModel

func (*ShellModel) Close

func (m *ShellModel) Close()

Close closes the shell panel.

func (*ShellModel) HandleOutput

func (m *ShellModel) HandleOutput(output string)

HandleOutput appends output from the exec session to the shell lines.

func (ShellModel) Handled

func (m ShellModel) Handled(msg tea.KeyMsg) bool

Handled returns true if the shell consumed the key. When false, the caller should process the key itself (e.g. tab to cycle focus, x to close shell).

func (ShellModel) IsOpen

func (m ShellModel) IsOpen() bool

IsOpen returns whether the shell is open.

func (*ShellModel) Open

func (m *ShellModel) Open(c *model.Container)

Open opens a shell for the given container.

func (*ShellModel) ReadExecOutput

func (m *ShellModel) ReadExecOutput() tea.Cmd

ReadExecOutput returns a tea.Cmd that reads from the exec session and sends ShellOutputMsg messages. It should be started once when the exec session is attached.

func (*ShellModel) SetExec

func (m *ShellModel) SetExec(s ExecSession)

SetExec attaches an exec session to the shell model.

func (ShellModel) Update

func (m ShellModel) Update(msg tea.KeyMsg) (ShellModel, tea.Cmd)

func (ShellModel) View

func (m ShellModel) View(width int) string

type ShellOutputMsg

type ShellOutputMsg struct {
	Output string
	Err    error
}

ShellOutputMsg carries output read from the exec session back into the Bubbletea update loop.

type SidebarKeyMap

type SidebarKeyMap struct {
	Up          key.Binding
	Down        key.Binding
	Toggle      key.Binding
	Action      key.Binding
	All         key.Binding
	Shell       key.Binding
	HideStopped key.Binding
}

SidebarKeyMap holds sidebar-specific key bindings.

type SidebarModel

type SidebarModel struct {
	Containers     []*model.Container
	Cursor         int
	Focused        bool
	Width          int
	Height         int
	ShellContainer *model.Container // currently open shell container
	HideStopped    bool             // hide stopped/exited containers
	ActionMenu     *ActionMenuModel // action menu to render inline (set by app)
}

SidebarModel manages the container list sidebar.

func (*SidebarModel) HandleClick

func (m *SidebarModel) HandleClick(contentY int)

HandleClick processes a left-click on the sidebar.

func (*SidebarModel) HandleRightClick

func (m *SidebarModel) HandleRightClick(contentY int) bool

HandleRightClick processes a right-click, returning whether an action menu should open.

func (SidebarModel) HiddenCount

func (m SidebarModel) HiddenCount() int

HiddenCount returns the number of hidden stopped containers.

func (SidebarModel) SelectedContainer

func (m SidebarModel) SelectedContainer() *model.Container

SelectedContainer returns the container at the current cursor position.

func (SidebarModel) Update

func (m SidebarModel) Update(msg tea.KeyMsg, keys SidebarKeyMap) (SidebarModel, tea.Cmd)

func (SidebarModel) View

func (m SidebarModel) View() string

func (SidebarModel) VisibleContainers

func (m SidebarModel) VisibleContainers() []*model.Container

VisibleContainers returns containers filtered by HideStopped.

func (SidebarModel) VisibleCount

func (m SidebarModel) VisibleCount() int

VisibleCount returns how many containers have logs visible.

Jump to

Keyboard shortcuts

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