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
@@ -92,8 +92,8 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))
|
||||
@publicIncidents(s.Incidents)
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,8 +244,8 @@ templ PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pu
|
||||
<span>{ i18n.T(ctx, "page.today") }</span>
|
||||
</div>
|
||||
</section>
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), upcoming)
|
||||
@publicIncidents(s.IncidentsForComponent(comp.Name))
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), upcoming)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ templ publicIncidents(incidents []agentapi.PageIncident) {
|
||||
for _, inc := range incidents {
|
||||
<li class="py-3">
|
||||
<div class="flex flex-wrap items-baseline gap-x-4 gap-y-1">
|
||||
@incidentStatusLabel(inc.Status, inc.ResolvedAt == nil)
|
||||
@incidentStatusLabel(IncidentStatusInfo{Key: inc.Status, Name: inc.StatusName, Color: inc.StatusColor}, inc.ResolvedAt == nil)
|
||||
if inc.Title != "" {
|
||||
<span class="font-medium">{ inc.Title }</span>
|
||||
<span class="text-xs text-muted">{ inc.Component }</span>
|
||||
@@ -315,7 +315,7 @@ templ publicIncidents(incidents []agentapi.PageIncident) {
|
||||
for _, u := range inc.Updates {
|
||||
<li>
|
||||
<p class="text-xs">
|
||||
@incidentStatusLabel(u.Status, true)
|
||||
@incidentStatusLabel(IncidentStatusInfo{Key: u.Status, Name: u.StatusName, Color: u.StatusColor}, true)
|
||||
<span class="font-mono text-muted">{ " · " + u.At.UTC().Format("2006-01-02 15:04") + " UTC" }</span>
|
||||
</p>
|
||||
<div class="legal-text mt-1">
|
||||
@@ -333,11 +333,17 @@ templ publicIncidents(incidents []agentapi.PageIncident) {
|
||||
}
|
||||
|
||||
// incidentStatusLabel names an incident's status: what the organization
|
||||
// said, or ongoing or resolved when it said nothing.
|
||||
templ incidentStatusLabel(status string, open bool) {
|
||||
// said, in its own color for its own statuses, or ongoing or resolved when
|
||||
// it said nothing.
|
||||
templ incidentStatusLabel(st IncidentStatusInfo, open bool) {
|
||||
switch {
|
||||
case status != "":
|
||||
<span class={ "font-medium", incidentStatusClass(status) }>{ i18n.T(ctx, "incident.status."+status) }</span>
|
||||
case st.Key == "custom":
|
||||
<span class="inline-flex items-center gap-1.5 font-medium">
|
||||
<span class="inline-block size-2 rounded-full" style={ "background-color:" + st.Color }></span>
|
||||
{ st.Name }
|
||||
</span>
|
||||
case st.Key != "":
|
||||
<span class={ "font-medium", incidentStatusClass(st.Key) }>{ i18n.T(ctx, "incident.status."+st.Key) }</span>
|
||||
case open:
|
||||
<span class="font-medium text-down">{ i18n.T(ctx, "incidents.ongoing") }</span>
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user