Compact graph columns and branch spacing and simplify Home hints

This commit is contained in:
2026-10-10 02:00:39 +01:00
parent c05789d8a6
commit d73a021cd4
11 changed files with 146 additions and 37 deletions
+5
View File
@@ -95,6 +95,9 @@ pipelines
retry requires confirmation and restarts the pinned workflow, so earlier side retry requires confirmation and restarts the pinned workflow, so earlier side
effects may happen again. effects may happen again.
Home shows only **/** search and **:** commands as action hints; use the command
palette for creation, drafts, templates, history, status, logs, and quitting.
Quit with **:quit**; **q** does not exit. For a terminal-only run after publication: Quit with **:quit**; **q** does not exit. For a terminal-only run after publication:
```sh ```sh
@@ -221,6 +224,8 @@ Use **:status** for two panels: server addresses and ntfy phone connection detai
CLI: `pipelines status [--json]`. Candidate URLs are not CLI: `pipelines status [--json]`. Candidate URLs are not
verified reachable; publishing endpoints and credentials are not disclosed. verified reachable; publishing endpoints and credentials are not disclosed.
Retry is offered only after the failed run and its agent have fully stopped. Retry is offered only after the failed run and its agent have fully stopped.
Graphs use content-sized boxes/columns and tightly spaced branch lanes while
retaining every stage and labeled box-and-arrow route.
The run inspector shows the entire pinned graph above the details, dimming stages The run inspector shows the entire pinned graph above the details, dimming stages
and routes not executed. **g** focuses the graph; **hjkl** or arrows pan it. and routes not executed. **g** focuses the graph; **hjkl** or arrows pan it.
The path and elapsed duration update while running. **a** opens the active/latest The path and elapsed duration update while running. **a** opens the active/latest
+5
View File
@@ -210,6 +210,11 @@ pinned pipeline (lowercase `p` remains an alias only on the runs list).
The pipeline page also gives most height to its focused graph or stage-details The pipeline page also gives most height to its focused graph or stage-details
pane; Tab switches focus and resizes the two panes. Focused titles use the same pane; Tab switches focus and resizes the two panes. Focused titles use the same
background highlight as the run page. background highlight as the run page.
Graph boxes are sized to their contents rather than the longest label anywhere
in the graph. Fork columns share only their own required width, route tracks are
adjacent, and branch spacing follows stacked boxes rather than tall trunk/merge
nodes. All stages, outcome labels, ports, and terminal arrows remain visible in
the full pannable diagram.
Press `a` to select the active/latest retained OpenCode agent session and open its Press `a` to select the active/latest retained OpenCode agent session and open its
tool evidence. Session ID is available during execution; tool transcripts appear tool evidence. Session ID is available during execution; tool transcripts appear
+7 -6
View File
@@ -27,6 +27,9 @@ func (m Model) footerContent() string {
} else if len(m.lines) > 0 { } else if len(m.lines) > 0 {
style = lipgloss.NewStyle().Foreground(themeAccent).Bold(true) style = lipgloss.NewStyle().Foreground(themeAccent).Bold(true)
} }
if m.homePage() {
label = strings.ReplaceAll(label, " · :logs", "")
}
label = style.Render(ansi.Truncate(label, m.width, "")) label = style.Render(ansi.Truncate(label, m.width, ""))
available := m.width - lipgloss.Width(label) - 1 available := m.width - lipgloss.Width(label) - 1
left := "" left := ""
@@ -44,9 +47,7 @@ func (m Model) homeLines() []string {
panelWidth = (m.width - 2) / 2 panelWidth = (m.width - 2) / 2
} }
runs := []string{bar("Latest runs", fmt.Sprint(len(m.runs)), max(1, panelWidth-4), true), runs := []string{bar("Latest runs", fmt.Sprint(len(m.runs)), max(1, panelWidth-4), true),
"r all runs · :status server & ntfy", lipgloss.NewStyle().Foreground(themeMuted).Render("Pipeline · Version · Outcome · Duration")}
lipgloss.NewStyle().Foreground(themeMuted).Render("Pipeline · Version · Outcome · Duration"),
"Inspect with :runs; use :run in a pipeline."}
if len(m.runs) == 0 { if len(m.runs) == 0 {
runs = append(runs, "No runs yet.") runs = append(runs, "No runs yet.")
} }
@@ -58,13 +59,13 @@ func (m Model) homeLines() []string {
runs = append(runs, "") runs = append(runs, "")
} }
if len(m.runs) > 8 { if len(m.runs) > 8 {
runs = append(runs, "More runs: r or :runs (latest 50)") runs = append(runs, fmt.Sprintf("%d more runs in history", len(m.runs)-8))
} }
lines := []string{bar("Existing pipelines", fmt.Sprintf("%d", len(m.pipelines)), max(1, panelWidth-4), true), "r all runs · / search · n new", ""} lines := []string{bar("Existing pipelines", fmt.Sprintf("%d", len(m.pipelines)), max(1, panelWidth-4), true), ""}
if !m.loaded { if !m.loaded {
lines = append(lines, m.loading("Waiting for pipeline data…")) lines = append(lines, m.loading("Waiting for pipeline data…"))
} else if len(m.pipelines) == 0 { } else if len(m.pipelines) == 0 {
lines = append(lines, "No pipelines yet. Press b for templates, d for drafts, or n to create one.") lines = append(lines, "No pipelines yet. Create one using commands.")
} else { } else {
for _, p := range m.pipelines { for _, p := range m.pipelines {
lines = append(lines, lines = append(lines,
+41 -5
View File
@@ -28,8 +28,8 @@ func press(m Model, key string) Model {
func TestPaletteAndUnreadLogs(t *testing.T) { func TestPaletteAndUnreadLogs(t *testing.T) {
m := New(context.Background(), "ws://localhost/connect") m := New(context.Background(), "ws://localhost/connect")
m.height = 18 m.height = 18
if !strings.Contains(ansi.Strip(m.footerContent()), "LOGS 0 · :logs") { if !strings.Contains(ansi.Strip(m.footerContent()), "LOGS 0") {
t.Fatal("expected empty log count and command hint") t.Fatal("expected empty log count")
} }
for i := 0; i < 35; i++ { for i := 0; i < 35; i++ {
m.appendLine(fmt.Sprintf("line %02d", i)) m.appendLine(fmt.Sprintf("line %02d", i))
@@ -95,14 +95,14 @@ func TestPaletteAndUnreadLogs(t *testing.T) {
func TestLogBadgeRetainsReadLogs(t *testing.T) { func TestLogBadgeRetainsReadLogs(t *testing.T) {
m := New(context.Background(), "ws://localhost/connect") m := New(context.Background(), "ws://localhost/connect")
m.appendLine("connection lost") m.appendLine("connection lost")
if !strings.Contains(ansi.Strip(m.footerContent()), "● 1 NEW · LOGS 1 · :logs") { if !strings.Contains(ansi.Strip(m.footerContent()), "● 1 NEW · LOGS 1") {
t.Fatal("unread logs need an explicit badge") t.Fatal("unread logs need an explicit badge")
} }
m = press(m, ":") m = press(m, ":")
m = press(m, "logs") m = press(m, "logs")
m = press(m, "enter") m = press(m, "enter")
m = press(m, "esc") m = press(m, "esc")
if m.unread != 0 || !strings.Contains(ansi.Strip(m.footerContent()), "LOGS 1 · :logs") || strings.Contains(ansi.Strip(m.footerContent()), "NEW") { if m.unread != 0 || !strings.Contains(ansi.Strip(m.footerContent()), "LOGS 1") || strings.Contains(ansi.Strip(m.footerContent()), "NEW") {
t.Fatal("read logs must remain discoverable") t.Fatal("read logs must remain discoverable")
} }
for _, width := range []int{1, 12, 40, 80} { for _, width := range []int{1, 12, 40, 80} {
@@ -120,7 +120,7 @@ func TestHomeShowsEmptyLatestRunsBeforePipelines(t *testing.T) {
m.loaded = true m.loaded = true
m.pipelines = []protocol.PipelineSummary{{Name: "bug fix", Version: 3, Stages: 5}} m.pipelines = []protocol.PipelineSummary{{Name: "bug fix", Version: 3, Stages: 5}}
view := ansi.Strip(m.View()) view := ansi.Strip(m.View())
for _, text := range []string{"Latest runs", "Outcome", "No runs yet.", "Inspect with :runs", "Existing pipelines", "bug fix"} { for _, text := range []string{"Latest runs", "Outcome", "No runs yet.", "Existing pipelines", "bug fix"} {
if !strings.Contains(view, text) { if !strings.Contains(view, text) {
t.Fatalf("missing %q", text) t.Fatalf("missing %q", text)
} }
@@ -133,6 +133,42 @@ func TestHomeShowsEmptyLatestRunsBeforePipelines(t *testing.T) {
} }
} }
func TestHomeOnlyAdvertisesSearchAndCommands(t *testing.T) {
for _, populated := range []bool{false, true} {
m := New(context.Background(), "ws://localhost/connect")
m.width, m.height = 120, 40
m.loaded = true
if populated {
m.pipelines = []protocol.PipelineSummary{{Name: "demo", Version: 1, Stages: 3}}
m.usage = &protocol.UsageStats{}
}
view := ansi.Strip(m.View())
for _, hint := range []string{"/ search", ": commands"} {
if !strings.Contains(view, hint) {
t.Fatal("missing home hint", hint, view)
}
}
for _, hint := range []string{"r all runs", "n new", "d drafts", "b templates", "test ping", ":quit", ":status", ":logs", "Press b"} {
if strings.Contains(view, hint) {
t.Fatal("home advertises extra shortcut", hint, view)
}
}
if len(m.keys.ShortHelp()) != 2 {
t.Fatal("home help contains extra shortcuts")
}
available := m.pageCommands()
for _, command := range []string{":new", ":drafts", ":templates", ":runs", ":status", ":logs", ":quit"} {
if !strings.Contains(strings.Join(available, " "), command) {
t.Fatal("home action missing from commands", command)
}
}
m = press(m, ":")
if !m.paletteOpen {
t.Fatal("command palette inaccessible")
}
}
}
func TestDashboardAndModalDimensions(t *testing.T) { func TestDashboardAndModalDimensions(t *testing.T) {
for _, size := range []tea.WindowSizeMsg{{Width: 100, Height: 30}, {Width: 40, Height: 10}, {Width: 12, Height: 5}, {Width: 1, Height: 1}} { for _, size := range []tea.WindowSizeMsg{{Width: 100, Height: 30}, {Width: 40, Height: 10}, {Width: 12, Height: 5}, {Width: 1, Height: 1}} {
for _, mode := range []string{"home", "palette", "logs"} { for _, mode := range []string{"home", "palette", "logs"} {
+41
View File
@@ -0,0 +1,41 @@
package tui
import (
"fmt"
"strings"
"testing"
"git.a-wan.net/alan/pipelines/internal/pipeline"
"git.a-wan.net/alan/pipelines/internal/protocol"
"github.com/charmbracelet/x/ansi"
)
func TestCompactGraphDimensions(t *testing.T) {
linear, err := pipeline.Parse(pipeline.Template([]string{"plan", "implement_with_a_long_stage_name", "review", "publish"}, true))
if err != nil {
t.Fatal(err)
}
for name, graph := range map[string]protocol.Graph{"linear": linear, "nested": nestedForkGraph(t)} {
layout := layoutGraph(graph)
t.Logf("%s: %d columns × %d rows", name, layout.width, layout.height)
// Measured before compaction: linear 175×15; nested forks 147×48.
if name == "linear" && (layout.width > 100 || layout.height > 15) {
t.Fatal("linear graph grew", layout.width, layout.height)
}
if name == "nested" && (layout.width > 118 || layout.height > 41) {
t.Fatal("fork graph grew", layout.width, layout.height)
}
assertForkRouteClearance(t, layout)
view := ansi.Strip(strings.Join(renderGraph(graph), "\n"))
for _, stage := range graph.Stages {
if !strings.Contains(view, stage.Key) {
t.Fatal("compaction lost stage", stage.Key)
}
}
for _, edge := range layout.edges {
if !strings.Contains(view, fmt.Sprintf("%s [%d]", edge.label, edge.id)) {
t.Fatal("compaction lost outcome", edge)
}
}
}
}
+25 -11
View File
@@ -146,29 +146,43 @@ func layoutForkGraph(graph protocol.Graph, columns map[string]int, order []strin
} }
} }
gaps, xs := make([]int, maxColumn+2), make([]int, maxColumn+1) gaps, xs := make([]int, maxColumn+2), make([]int, maxColumn+1)
widths := make([]int, maxColumn+1)
for i := 0; i < len(graph.Stages); i++ {
node := r.nodes[i]
widths[columns[node.key]] = max(widths[columns[node.key]], node.width)
}
x := 0 x := 0
for column := 0; column <= maxColumn; column++ { for column := 0; column <= maxColumn; column++ {
gaps[column] = x gaps[column] = x
x += 2*(outCount[column]+inCount[column]) + 3 x += outCount[column] + inCount[column] + 3
xs[column] = x xs[column] = x
x += r.nodeWidth x += widths[column]
} }
gaps[maxColumn+1] = x gaps[maxColumn+1] = x
x += 2*outCount[maxColumn+1] + 3 x += outCount[maxColumn+1] + 3
r.width = x r.width = x
maxHeight := 0 maxHeight := 0
columnCounts := make([]int, maxColumn+1)
for _, stage := range graph.Stages {
columnCounts[columns[stage.Key]]++
}
for i := 0; i < len(graph.Stages); i++ { for i := 0; i < len(graph.Stages); i++ {
node := &r.nodes[i] node := &r.nodes[i]
node.height = incoming[node.key] + outgoing[node.key] + 4 node.height = incoming[node.key] + outgoing[node.key] + 4
if incoming[node.key] > 0 { if incoming[node.key] > 0 {
node.height++ node.height++
} }
maxHeight = max(maxHeight, node.height) // Only stacked branches set lane spacing; a tall trunk/merge must not
// inflate the spacing between every leaf in the graph.
if columnCounts[columns[node.key]] > 1 {
maxHeight = max(maxHeight, node.height)
}
} }
stride := maxHeight + 4 stride := maxHeight + 2
for i := 0; i < len(graph.Stages); i++ { for i := 0; i < len(graph.Stages); i++ {
node := &r.nodes[i] node := &r.nodes[i]
node.x = xs[columns[node.key]] node.x = xs[columns[node.key]]
node.width = widths[columns[node.key]]
node.y = arcs + ticks[node.key]*stride/2 node.y = arcs + ticks[node.key]*stride/2
} }
// Irregular cross-branch merges can otherwise share a lane with an unrelated // Irregular cross-branch merges can otherwise share a lane with an unrelated
@@ -182,10 +196,10 @@ func layoutForkGraph(graph protocol.Graph, columns map[string]int, order []strin
} }
} }
sort.SliceStable(ids, func(i, j int) bool { return r.nodes[ids[i]].y < r.nodes[ids[j]].y }) sort.SliceStable(ids, func(i, j int) bool { return r.nodes[ids[i]].y < r.nodes[ids[j]].y })
lastBottom := -4 lastBottom := -2
for _, id := range ids { for _, id := range ids {
node := &r.nodes[id] node := &r.nodes[id]
node.y = max(node.y, lastBottom+4) node.y = max(node.y, lastBottom+2)
lastBottom = node.y + node.height lastBottom = node.y + node.height
bottom = max(bottom, lastBottom) bottom = max(bottom, lastBottom)
} }
@@ -241,7 +255,7 @@ func layoutForkGraph(graph protocol.Graph, columns map[string]int, order []strin
edge := &r.edges[i] edge := &r.edges[i]
source := nodes[edge.source] source := nodes[edge.source]
gap := columns[edge.source] + 1 gap := columns[edge.source] + 1
edge.x = gaps[gap] + 1 + 2*usedOut[gap] edge.x = gaps[gap] + 1 + usedOut[gap]
usedOut[gap]++ usedOut[gap]++
if protocol.IsTerminal(edge.target) { if protocol.IsTerminal(edge.target) {
continue continue
@@ -253,7 +267,7 @@ func layoutForkGraph(graph protocol.Graph, columns map[string]int, order []strin
edge.path = append(edge.path, graphPoint{edge.x, edge.to}, graphPoint{target.x, edge.to}) edge.path = append(edge.path, graphPoint{edge.x, edge.to}, graphPoint{target.x, edge.to})
} else { } else {
gap := columns[edge.target] gap := columns[edge.target]
track := gaps[gap] + 1 + 2*(outCount[gap]+usedIn[gap]) track := gaps[gap] + 1 + outCount[gap] + usedIn[gap]
usedIn[gap]++ usedIn[gap]++
edge.path = append(edge.path, graphPoint{edge.x, arc}, graphPoint{track, arc}, graphPoint{track, edge.to}, graphPoint{target.x, edge.to}) edge.path = append(edge.path, graphPoint{edge.x, arc}, graphPoint{track, arc}, graphPoint{track, edge.to}, graphPoint{target.x, edge.to})
edge.lane = arc edge.lane = arc
@@ -318,7 +332,7 @@ func layoutForkGraph(graph protocol.Graph, columns map[string]int, order []strin
} }
lanes[lane] = append(lanes[lane], interval) lanes[lane] = append(lanes[lane], interval)
edge.lane = lane edge.lane = lane
row := bottom + 2 + lane row := bottom + 1 + lane
source := nodes[edge.source] source := nodes[edge.source]
edge.path = []graphPoint{{source.x + source.width - 1, edge.from}, {edge.x, edge.from}, {edge.x, row}, {destination, row}} edge.path = []graphPoint{{source.x + source.width - 1, edge.from}, {edge.x, edge.from}, {edge.x, row}, {destination, row}}
if edge.bottomExit { if edge.bottomExit {
@@ -327,7 +341,7 @@ func layoutForkGraph(graph protocol.Graph, columns map[string]int, order []strin
edge.path = []graphPoint{{center, exit}, {center, exit + 1}, {edge.x, exit + 1}, {edge.x, row}, {destination, row}} edge.path = []graphPoint{{center, exit}, {center, exit + 1}, {edge.x, exit + 1}, {edge.x, row}, {destination, row}}
} }
} }
endY := bottom + len(lanes) + 3 endY := bottom + len(lanes) + 2
for i := len(graph.Stages); i < len(r.nodes); i++ { for i := len(graph.Stages); i < len(r.nodes); i++ {
node := terminal[r.nodes[i].key] node := terminal[r.nodes[i].key]
node.y = endY node.y = endY
+13 -9
View File
@@ -18,12 +18,13 @@ func layoutGraph(graph protocol.Graph) graphLayout {
} }
func layoutSingleRowGraph(graph protocol.Graph) graphLayout { func layoutSingleRowGraph(graph protocol.Graph) graphLayout {
r := graphLayout{edges: graphEdges(graph), nodeWidth: 16, positions: map[string]int{}} r := graphLayout{edges: graphEdges(graph), positions: map[string]int{}}
count := len(graph.Stages) count := len(graph.Stages)
index, incoming, outgoing := map[string]int{}, map[string][]int{}, map[string][]int{} index, incoming, outgoing := map[string]int{}, map[string][]int{}, map[string][]int{}
widths := map[string]int{}
for i, s := range graph.Stages { for i, s := range graph.Stages {
index[s.Key] = i index[s.Key] = i
r.nodeWidth = max(r.nodeWidth, len(s.Key)+6) widths[s.Key] = max(14, len(s.Key)+4)
} }
gapCount := make([]int, count+1) gapCount := make([]int, count+1)
arcs := 0 arcs := 0
@@ -34,7 +35,10 @@ func layoutSingleRowGraph(graph protocol.Graph) graphLayout {
if !r.edges[i].bottomExit { if !r.edges[i].bottomExit {
gapCount[index[e.source]+1]++ gapCount[index[e.source]+1]++
} }
r.nodeWidth = max(r.nodeWidth, len(fmt.Sprintf("%s [%d]", e.label, e.id))+4) widths[e.source] = max(widths[e.source], len(fmt.Sprintf("%s [%d]", e.label, e.id))+4)
if !protocol.IsTerminal(e.target) {
widths[e.target] = max(widths[e.target], len(fmt.Sprintf("in [%d]", e.id))+4)
}
if !protocol.IsTerminal(e.target) && index[e.target] != index[e.source]+1 { if !protocol.IsTerminal(e.target) && index[e.target] != index[e.source]+1 {
arcs++ arcs++
gapCount[index[e.target]]++ gapCount[index[e.target]]++
@@ -44,18 +48,18 @@ func layoutSingleRowGraph(graph protocol.Graph) graphLayout {
x, mainY, height := 0, arcs, 4 x, mainY, height := 0, arcs, 4
for i, s := range graph.Stages { for i, s := range graph.Stages {
gapStarts[i] = x gapStarts[i] = x
x += gapCount[i]*2 + 3 x += gapCount[i] + 3
h := len(incoming[s.Key]) + len(outgoing[s.Key]) + 4 h := len(incoming[s.Key]) + len(outgoing[s.Key]) + 4
if len(incoming[s.Key]) > 0 { if len(incoming[s.Key]) > 0 {
h++ h++
} }
height = max(height, h) height = max(height, h)
r.nodes = append(r.nodes, graphNode{key: s.Key, x: x, y: mainY, width: r.nodeWidth, height: h}) r.nodes = append(r.nodes, graphNode{key: s.Key, x: x, y: mainY, width: widths[s.Key], height: h})
r.positions[s.Key] = mainY r.positions[s.Key] = mainY
x += r.nodeWidth x += widths[s.Key]
} }
gapStarts[count] = x gapStarts[count] = x
x += gapCount[count]*2 + 3 x += gapCount[count] + 3
r.width = x r.width = x
for i := range r.nodes { for i := range r.nodes {
r.nodes[i].height = height r.nodes[i].height = height
@@ -112,7 +116,7 @@ func layoutSingleRowGraph(graph protocol.Graph) graphLayout {
} }
} }
usedOut, usedIn := make([]int, count+1), make([]int, count+1) usedOut, usedIn := make([]int, count+1), make([]int, count+1)
sourceTrack := func(gap int) int { value := gapStarts[gap] + 1 + usedOut[gap]*2; usedOut[gap]++; return value } sourceTrack := func(gap int) int { value := gapStarts[gap] + 1 + usedOut[gap]; usedOut[gap]++; return value }
targetTrack := func(gap int) int { targetTrack := func(gap int) int {
outCount := 0 outCount := 0
if gap > 0 { if gap > 0 {
@@ -122,7 +126,7 @@ func layoutSingleRowGraph(graph protocol.Graph) graphLayout {
} }
} }
} }
value := gapStarts[gap] + 1 + (outCount+usedIn[gap])*2 value := gapStarts[gap] + 1 + outCount + usedIn[gap]
usedIn[gap]++ usedIn[gap]++
return value return value
} }
+3 -3
View File
@@ -13,7 +13,7 @@ import (
"github.com/charmbracelet/x/ansi" "github.com/charmbracelet/x/ansi"
) )
func TestHomeShortcutOpensAllRunsAndDisplaysHintInBothPanels(t *testing.T) { func TestHomeShortcutOpensAllRunsWithoutClutteringPanels(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel() defer cancel()
srv := httptest.NewServer(server.Handler(ctx)) srv := httptest.NewServer(server.Handler(ctx))
@@ -27,8 +27,8 @@ func TestHomeShortcutOpensAllRunsAndDisplaysHintInBothPanels(t *testing.T) {
m.height = 40 m.height = 40
m.runs = []protocol.RunSummary{{ID: 1, Status: "succeeded", Name: "passed"}, {ID: 2, Status: "failed", Name: "broken", FinishedAt: "2026-10-09T00:00:00Z"}, {ID: 3, Status: "running", Name: "active"}, {ID: 4, Status: "canceled", Name: "canceled"}, {ID: 5, Status: "failed", Name: "also broken", FinishedAt: "2026-10-09T00:00:00Z"}} m.runs = []protocol.RunSummary{{ID: 1, Status: "succeeded", Name: "passed"}, {ID: 2, Status: "failed", Name: "broken", FinishedAt: "2026-10-09T00:00:00Z"}, {ID: 3, Status: "running", Name: "active"}, {ID: 4, Status: "canceled", Name: "canceled"}, {ID: 5, Status: "failed", Name: "also broken", FinishedAt: "2026-10-09T00:00:00Z"}}
view := ansi.Strip(strings.Join(m.homeLines(), "\n")) view := ansi.Strip(strings.Join(m.homeLines(), "\n"))
if strings.Count(view, "r all runs") < 2 || strings.Contains(view, "r failed runs") { if strings.Contains(view, "r all runs") || strings.Contains(view, "r failed runs") {
t.Fatal("missing shortcut in both panels", view) t.Fatal("shortcut hints clutter home panels", view)
} }
updated, send := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'r'}}) updated, send := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'r'}})
m = updated.(Model) m = updated.(Model)
+4 -1
View File
@@ -85,7 +85,7 @@ func (k keyMap) ShortHelp() []key.Binding {
if k.detail { if k.detail {
return []key.Binding{k.commands, k.search, key.NewBinding(key.WithKeys("n", "p"), key.WithHelp("n/p", "next/prev stage")), key.NewBinding(key.WithKeys("tab"), key.WithHelp("Tab", "pane")), key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "runs")), key.NewBinding(key.WithKeys("j", "k"), key.WithHelp("j/k", "scroll")), key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "home"))} return []key.Binding{k.commands, k.search, key.NewBinding(key.WithKeys("n", "p"), key.WithHelp("n/p", "next/prev stage")), key.NewBinding(key.WithKeys("tab"), key.WithHelp("Tab", "pane")), key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "runs")), key.NewBinding(key.WithKeys("j", "k"), key.WithHelp("j/k", "scroll")), key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "home"))}
} }
return []key.Binding{k.commands, k.search, k.create, key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "all runs")), key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "drafts")), key.NewBinding(key.WithKeys("b"), key.WithHelp("b", "templates")), k.ping, k.quit} return []key.Binding{k.search, k.commands}
} }
func (k keyMap) FullHelp() [][]key.Binding { return [][]key.Binding{k.ShortHelp()} } func (k keyMap) FullHelp() [][]key.Binding { return [][]key.Binding{k.ShortHelp()} }
@@ -650,6 +650,9 @@ func (m Model) View() string {
connection := m.status connection := m.status
if m.conn != nil { if m.conn != nil {
connection = "Connected · :status" connection = "Connected · :status"
if m.homePage() {
connection = "Connected"
}
} }
if m.conn == nil { if m.conn == nil {
connection = m.loading(connection) connection = m.loading(connection)
+1 -1
View File
@@ -87,7 +87,7 @@ func TestLayoutResizes(t *testing.T) {
if !strings.HasPrefix(lines[0], "Pipelines ") || !strings.HasSuffix(lines[0], "127.0.0.1:8080") || lipgloss.Width(lines[0]) != size.Width { if !strings.HasPrefix(lines[0], "Pipelines ") || !strings.HasSuffix(lines[0], "127.0.0.1:8080") || lipgloss.Width(lines[0]) != size.Width {
t.Fatalf("invalid header: %q", lines[0]) t.Fatalf("invalid header: %q", lines[0])
} }
if !strings.HasPrefix(lines[len(lines)-1], ": commands") || !strings.Contains(lines[len(lines)-1], "● 20 NEW") || !strings.HasSuffix(lines[len(lines)-1], ":logs ") { if !strings.HasPrefix(lines[len(lines)-1], "/ search") || !strings.Contains(lines[len(lines)-1], ": commands") || !strings.Contains(lines[len(lines)-1], "● 20 NEW") {
t.Fatalf("invalid footer: %q", lines[len(lines)-1]) t.Fatalf("invalid footer: %q", lines[len(lines)-1])
} }
if strings.TrimSpace(lines[len(lines)-2]) != "" { if strings.TrimSpace(lines[len(lines)-2]) != "" {
+1 -1
View File
@@ -40,7 +40,7 @@ func usageChart(days []protocol.DailyUsage) string {
func (m Model) usageLines() []string { func (m Model) usageLines() []string {
lines := []string{"Usage · all history"} lines := []string{"Usage · all history"}
if m.usage == nil { if m.usage == nil {
return append(lines, m.loading("Waiting for usage statistics…"), ":status server & ntfy · r all runs") return append(lines, m.loading("Waiting for usage statistics…"))
} }
c := m.usage.RunCounts c := m.usage.RunCounts
lines = append(lines, fmt.Sprintf("%d pipelines · %d runs · %d active · %s · avg completed %s", len(m.pipelines), c.Total, c.Active, successLabel(c), averageLabel(c)), fmt.Sprintf("Outcomes: %d succeeded · %d failed · %d canceled · %d interrupted", c.Succeeded, c.Failed, c.Canceled, c.Interrupted)) lines = append(lines, fmt.Sprintf("%d pipelines · %d runs · %d active · %s · avg completed %s", len(m.pipelines), c.Total, c.Active, successLabel(c), averageLabel(c)), fmt.Sprintf("Outcomes: %d succeeded · %d failed · %d canceled · %d interrupted", c.Succeeded, c.Failed, c.Canceled, c.Interrupted))