feat: own incident statuses with a color; incidents before maintenance
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 9m38s
ci / test (pull_request) Successful in 14m21s
ci / build (pull_request) Successful in 16m36s
ci / image (pull_request) Successful in 3m37s

Organizations add statuses of their own, with a name and a color, next
to the built-in ones (Settings, incident statuses; API under
/org/incident-statuses, managed with org.manage). Updates pick them by
ID; the console and status pages show them in their color. Renaming or
recoloring carries into the history; a status in use cannot be deleted
(409 status_in_use). API responses give status "custom" with status_id,
status_name and status_color.

Status pages now list recent incidents before planned maintenance.

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-23 23:49:58 +01:00
1 parent 43a04e99b1
commit 2409a919c3
26 files changed
+1257 -238

No files matched your search

+10 -2
View File
@@ -63,6 +63,7 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
regions []store.Region
incidents []store.Incident
updates []store.PublicIncidentUpdatesRow
statuses customStatuses
planned map[uuid.UUID][]store.MaintenanceWindow
)
now := time.Now()
@@ -109,6 +110,9 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
if updates, err = q.PublicIncidentUpdates(ctx, incidentIDs); err != nil {
return err
}
if statuses, err = loadCustomStatuses(ctx, q); err != nil {
return err
}
if planned, err = maintenanceFor(ctx, q, ids); err != nil {
return err
}
@@ -201,12 +205,16 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
snap.Maintenance = pageMaintenance(planned, names, now)
updatesOf := map[uuid.UUID][]agentapi.PageIncidentUpdate{}
for _, u := range updates {
updatesOf[u.IncidentID] = append(updatesOf[u.IncidentID], agentapi.PageIncidentUpdate{Status: u.Status, Message: u.Message, At: u.CreatedAt})
st := statuses.info(&u.Status, u.StatusID)
updatesOf[u.IncidentID] = append(updatesOf[u.IncidentID], agentapi.PageIncidentUpdate{
Status: st.Key, StatusName: st.Name, StatusColor: st.Color, Message: u.Message, At: u.CreatedAt,
})
}
for _, i := range incidents {
st := statuses.of(i)
snap.Incidents = append(snap.Incidents, agentapi.PageIncident{
Component: names[i.MonitorID], StartedAt: i.StartedAt, ResolvedAt: i.ResolvedAt,
Title: i.Title, Status: incidentStatus(i), Updates: updatesOf[i.ID],
Title: i.Title, Status: st.Key, StatusName: st.Name, StatusColor: st.Color, Updates: updatesOf[i.ID],
})
}
return snap, nil