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
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:
1 parent
2409a919c3
commit
437b6e934f
9 files changed
+1966
-1693
No files matched your search
@@ -289,6 +289,10 @@ type IncidentRow struct {
|
||||
// Title and Status are what the organization said about it.
|
||||
Title string
|
||||
Status IncidentStatusInfo
|
||||
// CanWrite offers setting the status right in the list, NextStatus
|
||||
// preselected.
|
||||
CanWrite bool
|
||||
NextStatus string
|
||||
}
|
||||
|
||||
// MonitorDetailView is the data of a monitor page.
|
||||
@@ -425,7 +429,7 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
|
||||
if len(v.Incidents) > 0 {
|
||||
<section class="mb-10">
|
||||
@sectionHeading("incidents.title")
|
||||
@incidentList(v.Incidents, false)
|
||||
@incidentList(v.Incidents, false, nil)
|
||||
if v.MoreIncidents {
|
||||
<a href={ templ.SafeURL("/incidents?monitor=" + v.Row.ID) } class="mt-3 inline-block text-sm text-muted hover:text-ink">{ i18n.T(ctx, "incidents.all_of_monitor") } →</a>
|
||||
}
|
||||
@@ -494,7 +498,7 @@ templ ResultsPage(p Page, me Me, v ResultsView) {
|
||||
}
|
||||
}
|
||||
|
||||
templ incidentList(rows []IncidentRow, showMonitor bool) {
|
||||
templ incidentList(rows []IncidentRow, showMonitor bool, custom []CustomIncidentStatus) {
|
||||
<ul class="divide-y divide-rule border-y border-rule text-sm">
|
||||
for _, r := range rows {
|
||||
<li class="py-2.5">
|
||||
@@ -508,6 +512,9 @@ templ incidentList(rows []IncidentRow, showMonitor bool) {
|
||||
}
|
||||
<a href={ templ.SafeURL("/incidents/" + r.ID) } class="font-mono text-xs text-muted hover:text-ink">{ r.Started }</a>
|
||||
<span class="ml-auto font-mono text-xs">{ r.Duration }</span>
|
||||
if r.CanWrite {
|
||||
@quickStatus(r, custom)
|
||||
}
|
||||
</div>
|
||||
if len(r.Cause) > 0 {
|
||||
<p class="mt-1 font-mono text-xs text-muted">{ strings.Join(r.Cause, " · ") }</p>
|
||||
@@ -517,11 +524,38 @@ templ incidentList(rows []IncidentRow, showMonitor bool) {
|
||||
</ul>
|
||||
}
|
||||
|
||||
// quickStatus sets an incident's status right in the list, with an
|
||||
// optional message.
|
||||
templ quickStatus(r IncidentRow, custom []CustomIncidentStatus) {
|
||||
<details class="group w-full sm:w-auto">
|
||||
<summary class="cursor-pointer list-none border border-ink px-2 py-0.5 text-xs hover:bg-ink hover:text-paper">{ i18n.T(ctx, "incident.set_status") }</summary>
|
||||
<form data-api={ "/org/incidents/" + r.ID + "/updates" } data-next="/incidents" class="mt-3 grid gap-2 border border-rule p-3 sm:w-80">
|
||||
@formError()
|
||||
<select name="status" class="w-full border border-rule bg-transparent px-2 py-1.5 text-sm">
|
||||
for _, st := range IncidentStatuses {
|
||||
<option value={ st } selected?={ st == r.NextStatus }>{ i18n.T(ctx, "incident.status."+st) }</option>
|
||||
}
|
||||
for _, st := range custom {
|
||||
<option value={ st.ID } selected?={ st.ID == r.NextStatus }>{ st.Name }</option>
|
||||
}
|
||||
</select>
|
||||
<textarea name="message" rows="2" maxlength="5000" placeholder={ i18n.T(ctx, "incident.message_optional") } class="w-full border border-rule bg-transparent px-2 py-1.5 text-sm outline-none focus:border-ink"></textarea>
|
||||
<label class="flex items-center gap-2 text-xs">
|
||||
<input type="checkbox" name="public" checked class="accent-ink"/>
|
||||
{ i18n.T(ctx, "incident.public") }
|
||||
</label>
|
||||
<button type="submit" class="bg-ink px-3 py-1.5 text-sm text-paper">{ i18n.T(ctx, "incident.set_status") }</button>
|
||||
</form>
|
||||
</details>
|
||||
}
|
||||
|
||||
// IncidentsView is a page of incidents, of one monitor if Monitor is set.
|
||||
type IncidentsView struct {
|
||||
Rows []IncidentRow
|
||||
Pager Pager
|
||||
Monitor, MonitorID string
|
||||
// Custom are the organization's own statuses to set.
|
||||
Custom []CustomIncidentStatus
|
||||
}
|
||||
|
||||
templ IncidentsPage(p Page, me Me, v IncidentsView) {
|
||||
@@ -537,7 +571,7 @@ templ IncidentsPage(p Page, me Me, v IncidentsView) {
|
||||
if len(v.Rows) == 0 {
|
||||
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "incidents.none") }</p>
|
||||
} else {
|
||||
@incidentList(v.Rows, v.Monitor == "")
|
||||
@incidentList(v.Rows, v.Monitor == "", v.Custom)
|
||||
}
|
||||
@pager(v.Pager, "newer", "older")
|
||||
}
|
||||
|
||||
+1874
-1670
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user