35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package tui
|
|
|
|
import (
|
|
"fmt"
|
|
"git.a-wan.net/alan/pipelines/internal/protocol"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
func (m Model) updateActionConfirm(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
|
switch msg.String() {
|
|
case "esc", "n":
|
|
m.actionConfirm = nil
|
|
return m, nil
|
|
case "y":
|
|
request := *m.actionConfirm
|
|
m.actionConfirm = nil
|
|
return m.sendRunRequest(request)
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (m Model) actionConfirmView(height int) string {
|
|
r := m.actionConfirm
|
|
lines := []string{"Start pipeline run?", fmt.Sprintf("Pipeline #%d · v%d", r.PipelineID, r.Version), "Directory: " + r.Workspace,
|
|
"This may edit files, execute commands and publish notifications."}
|
|
if r.Type == protocol.RetryRun {
|
|
lines = []string{fmt.Sprintf("Retry failed run #%d?", r.RunID), "Starts a NEW run from the entry stage with fresh OpenCode sessions.",
|
|
"Reuses the original input, directory, pinned version and edit scope.", "Previous side effects are not undone; commands/notifications may repeat."}
|
|
}
|
|
if r.Type == protocol.CancelRun {
|
|
lines = []string{fmt.Sprintf("Cancel run #%d?", r.RunID), "Stops execution and interrupts its active agent.", "Sessions/history are retained; previous side effects are not undone."}
|
|
}
|
|
return popup(m.width, height, 96, append(lines, "", "y confirm · n / Esc cancel"))
|
|
}
|