889d811858
The Artifacts view re-clamped its scroll offset to the selected row on every render, so the tail of the list - a trailing visit that recorded none (running or finished) and its capture summary - could never be brought on screen, and the image marker crowded out artifact names at narrow widths. - Decouple the scroll offset from the selection: add PgUp/PgDn (and ctrl+u/ ctrl+d) paging, and make G/end select the last artifact and scroll to the tail so a trailing visit stays reachable. - Share artifactContent/clampArtifactTop/revealArtifactSelection between selection and render so both agree on the same page. - Show the [img] marker only while the width still leaves room for a usable name, keeping columns aligned either way. - Advertise the scroll keys in the artifacts footer help. - Test the omitted-files capture wording, trailing-visit reachability via G/end and page scroll, and narrow-width no-overflow; render both the top and the scrolled tail in the env-gated live capture test. - Update the packaged operations reference for the A artifacts view.
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 · PgUp/PgDn scroll · 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 · PgUp/PgDn"
|
|
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"
|
|
}
|