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
@@ -106,8 +106,8 @@ WHERE i.id = $1;
|
||||
UPDATE incidents SET title = sqlc.arg(title) WHERE id = sqlc.arg(id);
|
||||
|
||||
-- name: AddIncidentUpdate :one
|
||||
INSERT INTO incident_updates (org_id, incident_id, status, message, public, author_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
INSERT INTO incident_updates (org_id, incident_id, status, status_id, message, public, author_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteIncidentUpdate :execrows
|
||||
@@ -115,8 +115,8 @@ DELETE FROM incident_updates WHERE id = sqlc.arg(id) AND incident_id = sqlc.arg(
|
||||
|
||||
-- name: RefreshIncidentStatus :exec
|
||||
-- The incident shows the status of its latest update.
|
||||
UPDATE incidents SET status = (
|
||||
SELECT u.status FROM incident_updates u WHERE u.incident_id = incidents.id
|
||||
UPDATE incidents SET (status, status_id) = (
|
||||
SELECT u.status, u.status_id FROM incident_updates u WHERE u.incident_id = incidents.id
|
||||
ORDER BY u.created_at DESC, u.id DESC LIMIT 1
|
||||
) WHERE incidents.id = $1;
|
||||
|
||||
@@ -129,6 +129,18 @@ ORDER BY u.created_at DESC, u.id DESC;
|
||||
|
||||
-- name: PublicIncidentUpdates :many
|
||||
-- The public updates of incidents shown on a status page, newest first.
|
||||
SELECT incident_id, status, message, created_at FROM incident_updates
|
||||
SELECT incident_id, status, status_id, message, created_at FROM incident_updates
|
||||
WHERE incident_id = ANY(sqlc.arg(ids)::uuid[]) AND public
|
||||
ORDER BY created_at DESC, id DESC;
|
||||
|
||||
-- name: ListIncidentStatuses :many
|
||||
SELECT * FROM incident_statuses ORDER BY name;
|
||||
|
||||
-- name: CreateIncidentStatus :one
|
||||
INSERT INTO incident_statuses (org_id, name, color) VALUES ($1, $2, $3) RETURNING *;
|
||||
|
||||
-- name: UpdateIncidentStatus :execrows
|
||||
UPDATE incident_statuses SET name = sqlc.arg(name), color = sqlc.arg(color) WHERE id = sqlc.arg(id);
|
||||
|
||||
-- name: DeleteIncidentStatus :execrows
|
||||
DELETE FROM incident_statuses WHERE id = $1;
|
||||
Reference in new issue
Block a user