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
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package web
|
|
|
|
// IncidentStatuses are the statuses an incident update gives, in their
|
|
// usual order.
|
|
var IncidentStatuses = []string{"investigating", "identified", "monitoring", "resolved"}
|
|
|
|
// IncidentStatusInfo is an incident's status as shown: a built-in key, or
|
|
// "custom" with the organization's name and color.
|
|
type IncidentStatusInfo struct {
|
|
Key string
|
|
Name string
|
|
Color string
|
|
}
|
|
|
|
// CustomIncidentStatus is a status an organization added.
|
|
type CustomIncidentStatus struct {
|
|
ID string
|
|
Name string
|
|
Color string
|
|
}
|
|
|
|
// 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, HTML, Author string
|
|
Status IncidentStatusInfo
|
|
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
|
|
// Custom are the organization's own statuses to choose from.
|
|
Custom []CustomIncidentStatus
|
|
}
|