feat(console): set an incident's status right in the incident list
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 12m19s
ci / test (pull_request) Successful in 12m58s
ci / build (pull_request) Successful in 15m32s
ci / image (pull_request) Successful in 4m29s

Each row of the incident list offers "Set status" to those who may write
the monitor's incidents: a status (built-in or own, the next one
preselected), an optional message and whether it shows on status pages.
An update may now just change the status, without a message.

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:57:05 +01:00
1 parent 2409a919c3
commit 437b6e934f
9 files changed
+1966 -1693

No files matched your search

+17 -8
View File
@@ -45,13 +45,8 @@ func TestIncidentUpdates(t *testing.T) {
}
// Updates with a status, public or internal, and a title.
for _, bad := range []map[string]any{
{"status": "panicking", "message": "x"},
{"status": "investigating", "message": " "},
} {
st, body := owner.do("POST", base+"/updates", bad)
expect(t, "invalid update", st, body, http.StatusUnprocessableEntity, "invalid_input")
}
st, body := owner.do("POST", base+"/updates", map[string]any{"status": "panicking", "message": "x"})
expect(t, "invalid status", st, body, http.StatusUnprocessableEntity, "invalid_input")
if st, body := owner.do("POST", base+"/updates", map[string]any{"status": "investigating", "message": "We are **looking** into it."}); st != http.StatusCreated {
t.Fatalf("post update = %d %v", st, body)
}
@@ -95,12 +90,26 @@ func TestIncidentUpdates(t *testing.T) {
if st, _ := viewer.do("GET", base, nil); st != http.StatusOK {
t.Errorf("viewer reads incident = %d", st)
}
st, body := viewer.do("POST", base+"/updates", map[string]any{"status": "monitoring", "message": "x"})
st, body = viewer.do("POST", base+"/updates", map[string]any{"status": "monitoring", "message": "x"})
expect(t, "viewer posts update", st, body, http.StatusForbidden, "forbidden")
// The incident list sets the status right there, for writers only.
if _, _, html := owner.page("/incidents"); !strings.Contains(html, "Set status") || !strings.Contains(html, `data-api="/org/incidents/`+incident.String()+`/updates"`) {
t.Error("the incident list lacks the set-status button")
}
if _, _, html := viewer.page("/incidents"); strings.Contains(html, "Set status") {
t.Error("the viewer is offered setting the status")
}
if _, _, html := viewer.page("/incidents/" + incident.String()); strings.Contains(html, "Post update") {
t.Error("the viewer is offered the update form")
}
// A status change needs no message.
_, quick := owner.do("POST", base+"/updates", map[string]any{"status": "monitoring", "message": "", "public": true})
if quick["status"] != "monitoring" || status() != "monitoring" {
t.Errorf("status-only update = %v", quick)
}
owner.do("DELETE", base+"/updates/"+quick["id"].(string), nil)
// Deleting an update falls back to the previous status; the monitor
// recovering resolves the incident whatever was said.
if st, _ := owner.do("DELETE", base+"/updates/"+note["id"].(string), nil); st != http.StatusNoContent || status() != "investigating" {