Files
uptimesebi/internal/web/incidents.go
T
Sebastian UnterschützandClaude Opus 5.5 43a04e99b1
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m54s
ci / test (pull_request) Successful in 12m15s
ci / build (pull_request) Successful in 11m0s
ci / image (pull_request) Successful in 4m23s
feat: incident updates with a status, public or internal
Outages open and close with their monitor; now people can say what is
going on. An incident gets an optional title and updates, each with a
status (investigating, identified, monitoring, resolved) and a Markdown
message, shown on status pages or kept as an internal note. The incident
shows the latest update's status, resolved once its monitor recovered.

The console lists title and status and has a page per incident with its
timeline (outage, updates, recovery) and, for incidents.write in the
monitor's group, forms to post updates and set the title. Status pages
show title, status and public updates. API: GET/PATCH
/org/incidents/:id, POST and DELETE /org/incidents/:id/updates; the
incident list carries title and status; the organization export
includes the updates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-23 23:38:07 +01:00

38 lines
1016 B
Go

package web
// IncidentStatuses are the statuses an incident update gives, in their
// usual order.
var IncidentStatuses = []string{"investigating", "identified", "monitoring", "resolved"}
// incidentStatusClass colors an incident status: red while it is being
// worked on, amber while watched, green once resolved.
func incidentStatusClass(status string) string {
switch status {
case "resolved":
return "text-up"
case "monitoring":
return "text-degraded"
}
return "text-down"
}
// IncidentTimelineEntry is an update or one of the monitor's own events
// on an incident's timeline.
type IncidentTimelineEntry struct {
At string
// Kind is update, started or resolved.
Kind string
// Update fields.
ID, Status, HTML, Author string
Public bool
}
// IncidentDetailView is the page of one incident.
type IncidentDetailView struct {
Row IncidentRow
CanWrite bool
Timeline []IncidentTimelineEntry
// NextStatus preselects the status of the next update.
NextStatus string
}