feat(web): console pages for monitors, incidents and notification channels

The dashboard lists monitors with status, latency and 24-hour uptime
bars rendered as SVG on the server; monitor pages add 90-day uptime,
latency and recent checks; an editor shows the settings of the selected
check type.

Closes #17
Closes #19

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 01:50:04 +01:00
1 parent 9a050ea712
commit b831478143
18 files changed
+4268 -323

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package web
import (
"testing"
"time"
)
func TestUptimeBars(t *testing.T) {
end := time.Date(2026, 1, 2, 10, 30, 0, 0, time.UTC)
hour := func(h int) time.Time { return time.Date(2026, 1, 2, h, 0, 0, 0, time.UTC) }
bars := UptimeBars([]Bucket{
{Start: hour(10), Total: 60, OK: 60},
{Start: hour(9), Total: 60, OK: 58},
{Start: hour(8), Total: 60, OK: 30},
}, end, time.Hour, 4, "15:04")
want := []Status{StatusUnknown, StatusDown, StatusDegraded, StatusUp}
for i, b := range bars {
if b.Status != want[i] {
t.Errorf("bar %d = %s (%s), want %s", i, b.Status, b.Title, want[i])
}
}
if bars[3].Title != "10:00 · 100%" {
t.Errorf("last bar title = %q", bars[3].Title)
}
}
func TestPercent(t *testing.T) {
for r, want := range map[float64]string{1: "100%", 0.99951: "99.95%", 0.9: "90.0%"} {
if got := Percent(r); got != want {
t.Errorf("Percent(%v) = %q, want %q", r, got, want)
}
}
}