865993b200
Protocol: replace the loose Query/Kind/Matches/Limit search fields with a Search request object and a SearchResults response, and have the server answer search from Store.Search over the shared run projections (runFrom/runStamps).
CLI: add the read-only 'pipelines search QUERY [--type KIND] [--limit N] [--json]' command with usage/help, and document the typed targets, ranking and bounds in docs/cli.md.
TUI: the '/' popup keeps type-to-search, up/down, Enter and Esc, renders one ranked list with kind badges and a bracketed (non-colour) match snippet, and Enter opens the matched pipeline, run, step, artifact or field; footer text updated to match.
TUI: add a dedicated run artifacts view ('A') with open/copy of recorded files, and move artifacts out of the run-detail File changes section (artifactCaptureNotes).
Tests: add Store.OpenReadOnly for read-only inspection of a live database plus pipeline/server/TUI search tests and artifacts tests, including env-gated live checks.
115 lines
4.1 KiB
Go
115 lines
4.1 KiB
Go
package tui
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
"github.com/charmbracelet/x/ansi"
|
|
)
|
|
|
|
// Modal controls replace, rather than inherit, the obscured page's shortcuts.
|
|
func (m Model) activeFooter() string {
|
|
text := ""
|
|
switch {
|
|
case m.editorChecking:
|
|
text = "Refreshing published state · draft retained"
|
|
case m.decisionOpen:
|
|
text = "↑/↓ choose · Tab feedback · Enter decide · Esc cancel"
|
|
case m.artifactsOpen:
|
|
text = "j/k select · Enter open · y copy URL · Esc back"
|
|
case m.actionConfirm != nil || m.mutationCommand != nil:
|
|
text = "y confirm · n/Esc cancel · j/k read"
|
|
case m.draftDeletingPath != "":
|
|
text = "y delete · n/Esc keep · j/k read"
|
|
case m.statusOpen:
|
|
text = "j/k scroll · r refresh · Esc back"
|
|
case m.editorOpen:
|
|
text = "Type to filter · ↑/↓ choose · Enter open · Esc cancel"
|
|
case m.confirmOpen && m.templateConfirm:
|
|
text = "Enter create pipeline · edit name · Esc keep draft"
|
|
if m.pendingDraft != nil && m.pendingDraft.path == "" {
|
|
text = "Enter create pipeline · edit name · Esc back"
|
|
}
|
|
case m.confirmOpen && m.pendingDraft != nil && strings.TrimSpace(m.pendingDraft.name) == "":
|
|
text = "Enter save name · Esc keep draft"
|
|
case m.confirmOpen:
|
|
text = "s " + m.publicationAction() + " · e edit · Esc keep draft"
|
|
case m.versionsOpen:
|
|
text = "↑/↓ choose · Enter view version · Esc back"
|
|
case m.paletteOpen && m.searchOpen:
|
|
text = "Search pipelines, runs, steps, artifacts and text · ↑/↓ choose · Enter open · Esc cancel"
|
|
case m.paletteOpen:
|
|
text = "Type a command · ↑/↓ choose · Enter execute · Esc cancel"
|
|
case m.logOpen:
|
|
text = "j/k line · ←/→ pan · Esc back"
|
|
case m.runPicker:
|
|
text = "Type to filter · ↑/↓ choose · Enter select · Esc cancel"
|
|
case m.runForm != 0:
|
|
text = "Ctrl+S run · Enter newline · Esc cancel"
|
|
case m.templateOpen && len(m.templates) == 0:
|
|
text = ": commands · Esc back"
|
|
case m.templateOpen:
|
|
text = "s create pipeline · Tab graph · n/p template · j/k read · Esc back"
|
|
if m.templateGraphFocus {
|
|
text = "s create pipeline · Tab description · n/p template · hjkl pan · Esc back"
|
|
}
|
|
case m.runSearchOpen:
|
|
text = "Type to filter · Enter results · Esc clear"
|
|
}
|
|
if text == "" {
|
|
return ""
|
|
}
|
|
if m.width < 65 {
|
|
switch {
|
|
case m.editorChecking:
|
|
text = "Refreshing · draft retained"
|
|
case m.decisionOpen:
|
|
text = "Esc cancel · Enter decide · ↑↓ select"
|
|
case m.artifactsOpen:
|
|
text = "Esc back · Enter open · y copy"
|
|
case m.actionConfirm != nil || m.mutationCommand != nil:
|
|
text = "Esc cancel · y confirm · j/k read"
|
|
case m.draftDeletingPath != "":
|
|
text = "Esc keep · y delete · j/k read"
|
|
case m.statusOpen:
|
|
text = "Esc back · r refresh · j/k read"
|
|
case m.editorOpen || m.runPicker:
|
|
text = "Esc back · Enter open · ↑↓ select"
|
|
case m.confirmOpen && m.templateConfirm:
|
|
text = "Esc keep · Enter create pipeline"
|
|
if m.pendingDraft != nil && m.pendingDraft.path == "" {
|
|
text = "Esc back · Enter create pipeline"
|
|
}
|
|
case m.confirmOpen && m.pendingDraft != nil && strings.TrimSpace(m.pendingDraft.name) == "":
|
|
text = "Esc keep · Enter save name"
|
|
case m.confirmOpen:
|
|
text = "Esc keep · s " + m.publicationAction()
|
|
case m.versionsOpen:
|
|
text = "Esc back · Enter view · ↑↓ select"
|
|
case m.paletteOpen && m.searchOpen:
|
|
text = "Esc cancel · Enter open · ↑↓ select"
|
|
case m.paletteOpen:
|
|
text = "Esc back · Enter run · ↑↓ select"
|
|
case m.logOpen:
|
|
text = "Esc back · j/k read · ←→ pan"
|
|
case m.runForm != 0:
|
|
text = "Esc cancel · Ctrl+S run"
|
|
case m.templateOpen:
|
|
text = "Esc · s create · Tab graph · n/p"
|
|
if m.templateGraphFocus {
|
|
text = "Esc · Tab description · hjkl pan · n/p"
|
|
}
|
|
case m.runSearchOpen:
|
|
text = "Esc clear · Enter results"
|
|
}
|
|
}
|
|
return lipgloss.NewStyle().Foreground(themeMuted).Render(ansi.Truncate(text, max(1, m.width), "…"))
|
|
}
|
|
|
|
func (m Model) publicationAction() string {
|
|
if m.pendingDraft != nil && !m.pendingDraft.createOnly && m.pendingDraft.baseVersion > 0 {
|
|
return "update pipeline"
|
|
}
|
|
return "create pipeline"
|
|
}
|