Validate providers and retain complete run debugging context
This commit is contained in:
+25
-15
@@ -5,7 +5,8 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
"git.a-wan.net/alan/pipelines/internal/statusview"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"net/url"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (m Model) openStatus() (tea.Model, tea.Cmd) {
|
||||
@@ -45,14 +46,7 @@ func (m Model) updateStatus(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
return m, nil
|
||||
}
|
||||
func (m Model) statusLines() []string {
|
||||
connection := "invalid URL"
|
||||
if u, err := url.Parse(m.url); err == nil {
|
||||
u.User = nil
|
||||
u.RawQuery = ""
|
||||
u.Fragment = ""
|
||||
connection = u.String()
|
||||
}
|
||||
lines := []string{"Client connection: " + connection}
|
||||
lines := []string{}
|
||||
if m.statusRequest != "" {
|
||||
lines = append(lines, m.loading("Checking server and ntfy…"))
|
||||
}
|
||||
@@ -69,10 +63,26 @@ func (m Model) statusLines() []string {
|
||||
return lines
|
||||
}
|
||||
func (m Model) statusView(height int) string {
|
||||
lines := m.statusLines()
|
||||
page := max(1, height-5)
|
||||
top := min(m.statusTop, max(0, len(lines)-page))
|
||||
rows := []string{"Status · Pipelines & ntfy", "↑/↓ scroll · PgUp/PgDn · r refresh · Esc close", ""}
|
||||
rows = append(rows, lines[top:min(len(lines), top+page)]...)
|
||||
return popup(m.width, height, 108, rows)
|
||||
server, ntfy := statusview.ServerLines(m.systemStatus), statusview.NtfyLines(m.systemStatus)
|
||||
if m.systemStatus == nil && m.statusError != "" {
|
||||
s := statusview.Offline(m.url)
|
||||
server, ntfy = statusview.ServerLines(s), statusview.NtfyLines(s)
|
||||
}
|
||||
if m.statusError != "" {
|
||||
server = append([]string{m.statusError}, server...)
|
||||
}
|
||||
if m.statusRequest != "" {
|
||||
server = append([]string{m.loading("Checking…")}, server...)
|
||||
}
|
||||
width := m.width
|
||||
if width >= 100 {
|
||||
w := (width - 2) / 2
|
||||
left := panel(w, max(4, height-2), []string{"Pipelines server"}, server, "", false)
|
||||
right := panel(width-w-2, max(4, height-2), []string{"ntfy · phone connection"}, ntfy, "", false)
|
||||
return fitBlock(append(strings.Split(lipgloss.JoinHorizontal(lipgloss.Top, left, " ", right), "\n"), "", "r refresh · Esc close"), width, height)
|
||||
}
|
||||
topHeight := max(4, (height-2)/2)
|
||||
left := panel(width, topHeight, []string{"Pipelines server"}, server, "", false)
|
||||
right := panel(width, max(4, height-topHeight-2), []string{"ntfy · phone connection"}, ntfy, "", false)
|
||||
return fitBlock(append(strings.Split(left+"\n"+right, "\n"), "r refresh · Esc close"), width, height)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user