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
@@ -212,6 +212,8 @@ type monitorData struct {
|
||||
// firstRegion the same per region.
|
||||
first map[uuid.UUID]time.Time
|
||||
firstRegion map[uuid.UUID]map[string]time.Time
|
||||
// statuses are the organization's own incident statuses.
|
||||
statuses customStatuses
|
||||
}
|
||||
|
||||
// loadFirstData finds when monitors and their regions first reported. The
|
||||
@@ -333,6 +335,9 @@ func (s *Server) loadMonitorData(ctx context.Context, p *principal, rng web.Time
|
||||
if d.first, d.firstRegion, err = loadFirstData(ctx, q, p.Org.ID, now); err != nil {
|
||||
return err
|
||||
}
|
||||
if d.statuses, err = loadCustomStatuses(ctx, q); err != nil {
|
||||
return err
|
||||
}
|
||||
ids := make([]uuid.UUID, len(monitors))
|
||||
for i, m := range monitors {
|
||||
ids[i] = m.ID
|
||||
@@ -533,7 +538,7 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w
|
||||
}
|
||||
v.Incidents = append(v.Incidents, d.incidentRow(store.Incident{
|
||||
ID: i.ID, OrgID: i.OrgID, MonitorID: i.MonitorID, StartedAt: i.StartedAt, ResolvedAt: i.ResolvedAt, Cause: i.Cause,
|
||||
Title: i.Title, Status: i.Status,
|
||||
Title: i.Title, Status: i.Status, StatusID: i.StatusID,
|
||||
}, m.Name))
|
||||
}
|
||||
page.TitleID = "console.monitors.title"
|
||||
@@ -557,7 +562,7 @@ func (d monitorData) incidentRow(i store.Incident, monitor string) web.IncidentR
|
||||
row := web.IncidentRow{
|
||||
ID: i.ID.String(), MonitorID: i.MonitorID.String(), Monitor: monitor,
|
||||
Started: i.StartedAt.UTC().Format(timeLayout), Open: i.ResolvedAt == nil,
|
||||
Title: i.Title, Status: incidentStatus(i),
|
||||
Title: i.Title, Status: d.statuses.of(i),
|
||||
}
|
||||
end := time.Now()
|
||||
if i.ResolvedAt != nil {
|
||||
@@ -908,7 +913,7 @@ func (s *Server) incidentsView(c *gin.Context, p *principal, page web.Page, me w
|
||||
for i, r := range rows {
|
||||
v.Rows[i] = d.incidentRow(store.Incident{
|
||||
ID: r.ID, OrgID: r.OrgID, MonitorID: r.MonitorID, StartedAt: r.StartedAt, ResolvedAt: r.ResolvedAt, Cause: r.Cause,
|
||||
Title: r.Title, Status: r.Status,
|
||||
Title: r.Title, Status: r.Status, StatusID: r.StatusID,
|
||||
}, r.MonitorName)
|
||||
}
|
||||
if monitor != nil {
|
||||
|
||||
Reference in new issue
Block a user