Files
pipelines/internal/tui/status.go
T
alan fc7dbb0ac0 Remove ntfy: notifications go only through the app notification stream
Server: drop ntfy publishing (stage hooks, run outbox, chat attention, chat
tool notify, auto-switch and schedule notices), the chat push outbox (its
table is dropped at startup), ntfy status/endpoints and PIPELINES_NTFY_*.
The app_notifications stream, subscribe/clear and kinds are unchanged.
Notification settings keep run_finished/chat_needs_you/chat_reply_finished;
ntfy_enabled is accepted and ignored and its stored row is never read.

Stage type=ntfy is rejected: "ntfy stages were removed; notifications go to
the Pipelines apps — use the stage notify hook". The notify hook remains.

Installer: no ntfy build, accounts, config or supervisor child; manifest
gets top-level "mode" (legacy ntfy.mode still read). Reinstall retires an
old ntfy (safe PID-file stop, deletes binary, config, data dir, token, log,
with a note in logs/install.log); uninstall cleans leftovers.

App: ntfy settings section replaced by "Notification events"; texts updated.
Docs: docs/ntfy.md folded into docs/notifications.md; install, docker, cli,
author skill references updated; security review M1 marked resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:24:24 +00:00

94 lines
2.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package tui
import (
"fmt"
"git.a-wan.net/alan/pipelines/internal/protocol"
"git.a-wan.net/alan/pipelines/internal/statusview"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/x/ansi"
"strings"
)
func (m Model) openStatus() (tea.Model, tea.Cmd) {
m.statusOpen = true
m.statusTop = 0
m.systemStatus = nil
m.statusError = ""
return m.refreshStatus()
}
func (m Model) refreshStatus() (tea.Model, tea.Cmd) {
if m.conn == nil {
m.statusError = "Not connected to the Pipelines server."
return m, nil
}
m.nextID++
m.statusRequest = fmt.Sprintf("status-%d", m.nextID)
m.statusError = ""
return m, m.send(protocol.Message{Type: protocol.GetStatus, ID: m.statusRequest})
}
func (m Model) updateStatus(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "esc", "q":
m.statusOpen = false
return m, nil
case "r":
return m.refreshStatus()
case "j", "down":
m.statusTop++
case "k", "up":
m.statusTop--
case "pgdown":
m.statusTop += max(1, m.height-10)
case "pgup":
m.statusTop -= max(1, m.height-10)
}
m.statusTop = max(0, min(m.statusTop, max(0, len(m.statusContent())-max(1, m.height-4))))
return m, nil
}
func (m Model) statusLines() []string {
lines := []string{}
if m.statusRequest != "" {
lines = append(lines, m.loading("Checking server…"))
}
if m.statusError != "" {
lines = append(lines, m.statusError)
}
if m.systemStatus != nil {
lines = append(lines, " ")
lines = append(lines, statusview.Lines(m.systemStatus)...)
}
return lines
}
func (m Model) statusContent() []string {
server := statusview.ServerLines(m.systemStatus)
if m.systemStatus == nil && m.statusError != "" {
server = statusview.ServerLines(statusview.Offline(m.url))
}
if m.statusError != "" {
server = append([]string{m.statusError}, server...)
}
if m.statusRequest != "" {
server = append([]string{m.loading("Checking…")}, server...)
}
width := m.width
wrap := func(lines []string, w int) []string {
var rows []string
for _, line := range lines {
rows = append(rows, strings.Split(ansi.Wrap(line, max(1, w), ""), "\n")...)
}
return rows
}
server = wrap(server, width-4)
return strings.Split(panel(width, len(server)+4, []string{"Pipelines server"}, server, "", false), "\n")
}
func (m Model) statusView(height int) string {
lines := m.statusContent()
top := max(0, min(m.statusTop, max(0, len(lines)-height)))
visible := append([]string{}, lines[top:min(len(lines), top+height)]...)
if top+height < len(lines) && len(visible) > 0 {
visible[len(visible)-1] = bar("↓ More connection details", fmt.Sprintf("%d–%d / %d", top+1, top+height, len(lines)), m.width, false)
}
return fitBlock(visible, m.width, height)
}