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
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:
1 parent
43a04e99b1
commit
2409a919c3
26 files changed
+1257
-238
No files matched your search
@@ -290,9 +290,9 @@ type incidentView struct {
|
||||
ResolvedAt *time.Time `json:"resolved_at"`
|
||||
Cause map[string]string `json:"cause"`
|
||||
Title string `json:"title"`
|
||||
// Status is resolved once the monitor recovered, otherwise the status
|
||||
// of the latest update, empty before the first.
|
||||
Status string `json:"status"`
|
||||
// The status is resolved once the monitor recovered, otherwise the
|
||||
// status of the latest update, empty before the first.
|
||||
statusFields
|
||||
}
|
||||
|
||||
// incidentPage reads a page of incidents, newest first, of one monitor
|
||||
@@ -333,16 +333,25 @@ func (s *Server) listIncidents(c *gin.Context) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
rows, info, err := s.incidentPage(c.Request.Context(), current(c), pg, monitor)
|
||||
ctx := c.Request.Context()
|
||||
rows, info, err := s.incidentPage(ctx, current(c), pg, monitor)
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
var statuses customStatuses
|
||||
if err := s.db.Tx(ctx, current(c).scope(), func(q *store.Queries) error {
|
||||
statuses, err = loadCustomStatuses(ctx, q)
|
||||
return err
|
||||
}); err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
out := make([]incidentView, len(rows))
|
||||
for i, r := range rows {
|
||||
out[i] = incidentView{
|
||||
ID: r.ID, MonitorID: r.MonitorID, MonitorName: r.MonitorName, StartedAt: r.StartedAt, ResolvedAt: r.ResolvedAt,
|
||||
Title: r.Title, Status: incidentStatus(store.Incident{ResolvedAt: r.ResolvedAt, Status: r.Status}),
|
||||
Title: r.Title, statusFields: toStatusFields(statuses.of(store.Incident{ResolvedAt: r.ResolvedAt, Status: r.Status, StatusID: r.StatusID}), r.StatusID),
|
||||
}
|
||||
_ = json.Unmarshal(r.Cause, &out[i].Cause)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user