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

+62
View File
@@ -274,6 +274,37 @@ func (q *Queries) MarkNotificationSent(ctx context.Context, id uuid.UUID) error
return err
}
const monitorIncidents = `-- name: MonitorIncidents :many
SELECT id, org_id, monitor_id, started_at, resolved_at, cause FROM incidents WHERE monitor_id = $1 ORDER BY started_at DESC LIMIT 20
`
func (q *Queries) MonitorIncidents(ctx context.Context, monitorID uuid.UUID) ([]Incident, error) {
rows, err := q.db.Query(ctx, monitorIncidents, monitorID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Incident{}
for rows.Next() {
var i Incident
if err := rows.Scan(
&i.ID,
&i.OrgID,
&i.MonitorID,
&i.StartedAt,
&i.ResolvedAt,
&i.Cause,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const notificationDetails = `-- name: NotificationDetails :many
SELECT n.id, n.org_id, n.event, n.attempts,
c.type AS channel_type, c.config AS channel_config, c.id AS channel_id,
@@ -374,6 +405,37 @@ func (q *Queries) OpenIncident(ctx context.Context, arg OpenIncidentParams) (Inc
return i, err
}
const openIncidents = `-- name: OpenIncidents :many
SELECT id, org_id, monitor_id, started_at, resolved_at, cause FROM incidents WHERE resolved_at IS NULL
`
func (q *Queries) OpenIncidents(ctx context.Context) ([]Incident, error) {
rows, err := q.db.Query(ctx, openIncidents)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Incident{}
for rows.Next() {
var i Incident
if err := rows.Scan(
&i.ID,
&i.OrgID,
&i.MonitorID,
&i.StartedAt,
&i.ResolvedAt,
&i.Cause,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const resolveIncident = `-- name: ResolveIncident :one
UPDATE incidents SET resolved_at = $1
WHERE monitor_id = $2 AND resolved_at IS NULL