Documentation
¶
Overview ¶
Package tree flattens a data.Snapshot into the rows of the TUI's left pane: projects, their coordinator, the "Ready to deliver" group, tasks by attention, review tasks under the task they review, and runs under their task. The selection is kept by a stable key, so a refresh never moves the cursor.
Index ¶
- Constants
- func RunGlyph(r *run.Run, in Info) string
- func RunLabel(r *run.Run) string
- type Info
- type Kind
- type Model
- func (m *Model) Clamp(h int)
- func (m *Model) Cursor() string
- func (m *Model) EnsureVisible(h int)
- func (m *Model) Expansion() map[string]bool
- func (m *Model) History() []string
- func (m *Model) Index() int
- func (m *Model) Move(delta int)
- func (m *Model) Parent(i int) int
- func (m *Model) Rebuild(s *data.Snapshot)
- func (m *Model) Render(w, h int, focused bool, in Info) []string
- func (m *Model) Select(key string) bool
- func (m *Model) SelectIndex(i int)
- func (m *Model) Selected() *Row
- func (m *Model) SetExpanded(key string, on bool) bool
- func (m *Model) SetExpansion(e map[string]bool)
- func (m *Model) VisibleOff(h int) int
- type Row
Constants ¶
const QuotaWarn = 50.0
QuotaWarn is the used percent from which a run row shows its account's quota.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Info ¶
type Info struct {
Now time.Time
Live map[string]tmux.Liveness // run id → pane liveness
Theme style.Theme
// contains filtered or unexported fields
}
Info is what rendering needs beyond the rows: liveness, open asks and quota, taken from one snapshot.
type Model ¶
type Model struct {
Rows []Row
Off int // first visible row
ShowClosed bool // closed tasks are listed (a reload is needed after a change)
// Filter keeps the rows whose id, title or profile contain it (case-insensitive) and
// their ancestors; every row is expanded meanwhile.
Filter string
Hover string // the key of the row under the pointer (hover is opt-in), else ""
// contains filtered or unexported fields
}
Model is the tree's state: rows, the selected key, the expansion and the scroll.
func (*Model) EnsureVisible ¶
EnsureVisible scrolls so the cursor is inside a window of h rows.
func (*Model) Expansion ¶
Expansion returns the explicit expansion choices (not the "+N earlier" rows, which need a load) for the UI state file.
func (*Model) History ¶
History lists the tasks whose "+N earlier" row is expanded: their full run history must be loaded (data.Request.History).
func (*Model) Rebuild ¶
Rebuild replaces the rows from s, keeping the selected key. When that row is gone the cursor stays at the same index.
func (*Model) Render ¶
Render returns the visible rows (from Off) for a pane of w x h; focused marks the cursor row strongly.
func (*Model) SelectIndex ¶
SelectIndex moves the cursor to row i (clamped).
func (*Model) SetExpanded ¶
SetExpanded expands or collapses key. It returns false when the row cannot expand or already is in that state.
func (*Model) SetExpansion ¶
SetExpansion replaces the explicit expansion choices (before the first Rebuild).
func (*Model) VisibleOff ¶
VisibleOff is the scroll offset clamped for a window of h rows.
type Row ¶
type Row struct {
Key string // p:<project> c:<project> g:deliver:<project> t:<task> r:<run> h:<task>
Kind Kind
Depth int
Project string
Proj *registry.ProjectRow // Project
Task *task.Task // Task
Run *run.Run // Run, Coord
// Count is the open tasks of a Project, the tasks of a Deliver group and the older
// runs behind an Earlier row; Ready is the ready tasks of a Project.
Count, Ready int
CanExpand bool
Expanded bool
}
Row is one line of the tree.
func (*Row) ToggleCells ¶
ToggleCells is the width of a row's indent and expansion arrow: a click inside toggles the row.