Initial pipelines server, CLI, TUI, and Go installation
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
// Animation is driven by a local timer, never by extra server requests.
|
||||
func (m Model) progress(status string) string {
|
||||
marker := "○"
|
||||
color := themeMuted
|
||||
switch status {
|
||||
case "running":
|
||||
return m.runSpinner.View() + " running"
|
||||
case "completed", "succeeded", "done":
|
||||
marker = "✓"
|
||||
color = themeSuccess
|
||||
case "failed":
|
||||
marker = "✗"
|
||||
color = themeError
|
||||
case "interrupted":
|
||||
marker = "!"
|
||||
color = themeError
|
||||
case "canceled":
|
||||
marker = "−"
|
||||
}
|
||||
return lipgloss.NewStyle().Foreground(color).Render(marker + " " + status)
|
||||
}
|
||||
|
||||
func (m Model) stepProgressStatus(step protocol.RunStep) string {
|
||||
status := step.Status
|
||||
if status == "completed" {
|
||||
if step.Outcome == "error" || step.Target == protocol.FailureEnd {
|
||||
return "failed"
|
||||
}
|
||||
return "done"
|
||||
}
|
||||
// Never animate stale execution state in a terminal run.
|
||||
if status == "running" && m.runDetail != nil && m.runDetail.Status != "running" && m.runDetail.Status != "queued" {
|
||||
if m.runDetail.Status == "canceled" {
|
||||
return "canceled"
|
||||
}
|
||||
return "interrupted"
|
||||
}
|
||||
return status
|
||||
}
|
||||
Reference in New Issue
Block a user