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

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:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-23 23:49:58 +01:00
1 parent 43a04e99b1
commit 2409a919c3
26 files changed
+1257 -238

No files matched your search

+57 -1
View File
@@ -288,7 +288,7 @@ type IncidentRow struct {
Cause []string
// Title and Status are what the organization said about it.
Title string
Status string
Status IncidentStatusInfo
}
// MonitorDetailView is the data of a monitor page.
@@ -1432,6 +1432,9 @@ templ IncidentDetailPage(p Page, me Me, v IncidentDetailView) {
for _, st := range IncidentStatuses {
<option value={ st } selected?={ st == v.NextStatus }>{ i18n.T(ctx, "incident.status."+st) }</option>
}
for _, st := range v.Custom {
<option value={ st.ID } selected?={ st.ID == v.NextStatus }>{ st.Name }</option>
}
</select>
</label>
<div class="mb-4">
@@ -1456,3 +1459,56 @@ templ IncidentDetailPage(p Page, me Me, v IncidentDetailView) {
</div>
}
}
// IncidentStatusesPage lists the organization's own incident statuses and,
// for those who manage the organization, edits them.
templ IncidentStatusesPage(p Page, me Me, statuses []CustomIncidentStatus, canManage bool) {
@consoleShell(p, me) {
@settingsHeading("incident_statuses.title", "incident_statuses.intro")
<section class="mb-12 max-w-2xl">
@sectionHeading("incident_statuses.builtin")
<ul class="flex flex-wrap gap-4 text-sm">
for _, st := range IncidentStatuses {
<li>@incidentStatusLabel(IncidentStatusInfo{Key: st}, true)</li>
}
</ul>
</section>
<section class="mb-12 max-w-2xl">
@sectionHeading("incident_statuses.own")
if len(statuses) == 0 {
<p class="text-sm text-muted">{ i18n.T(ctx, "incident_statuses.none") }</p>
}
<ul class="divide-y divide-rule border-y border-rule">
for _, st := range statuses {
<li class="py-3">
if canManage {
<form data-api={ "/org/incident-statuses/" + st.ID } data-method="put" data-next="/settings/incident-statuses" class="flex flex-wrap items-center gap-3">
<input type="color" name="color" value={ st.Color } class="h-8 w-10 cursor-pointer border border-rule bg-transparent" aria-label={ i18n.T(ctx, "incident_statuses.color") }/>
<input type="text" name="name" value={ st.Name } maxlength="40" required class="min-w-0 flex-1 border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"/>
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "common.save") }</button>
<button type="button" data-delete={ "/org/incident-statuses/" + st.ID } data-confirm={ i18n.T(ctx, "incident_statuses.delete_confirm") } class="text-sm text-muted hover:text-down">{ i18n.T(ctx, "incident.delete") }</button>
<p data-error class="hidden w-full text-xs text-down"></p>
</form>
} else {
@incidentStatusLabel(IncidentStatusInfo{Key: "custom", Name: st.Name, Color: st.Color}, true)
}
</li>
}
</ul>
if canManage {
<form data-api="/org/incident-statuses" data-next="/settings/incident-statuses" class="mt-6 flex flex-wrap items-end gap-3">
<label class="block">
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "incident_statuses.color") }</span>
<input type="color" name="color" value="#7c3aed" class="h-9 w-12 cursor-pointer border border-rule bg-transparent"/>
</label>
<label class="block min-w-0 flex-1">
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "sso.field.name") }</span>
<input type="text" name="name" maxlength="40" required placeholder={ i18n.T(ctx, "incident_statuses.placeholder") } class="w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"/>
</label>
<button type="submit" class="bg-ink px-3 py-2 text-sm text-paper">{ i18n.T(ctx, "incident_statuses.add") }</button>
<p data-error class="hidden w-full text-xs text-down"></p>
</form>
}
</section>
}
}