feat(statuspages): page every group on its own and filter outages
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m3s
ci / test (pull_request) Successful in 12m33s
ci / build (pull_request) Successful in 18m44s
ci / image (pull_request) Successful in 5m29s

Paging all components of a status page at once left out whole groups on
every page, which confused visitors. Every group now shows its first 25
components and pages them on its own (?p.<group>=N), keeping the pages
of the other groups. Links jump back to the group.

Visitors can also show only the components with an outage or degraded
(?problems=1); groups without any are left out. The search stays.

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-28 14:35:24 +01:00
1 parent 9d01b62b98
commit 282ab27f81
7 files changed
+1057 -913

No files matched your search

+42 -31
View File
@@ -94,18 +94,21 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
<p class="text-lg font-medium">{ i18n.T(ctx, "page.status."+s.Status) }</p>
</section>
@pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now))
if cp := PageComponents(s.Sections, a.Page, a.PageSize, a.Query); len(s.Sections) > 0 {
if cp.Pages > 1 || cp.Query != "" {
@publicComponentSearch(cp, a)
if v := PublicComponents(s.Sections, a); len(s.Sections) > 0 {
if v.Filterable() {
@publicComponentFilter(v, a)
}
<section class="mb-12 border-t border-rule">
for _, sec := range cp.Sections {
@publicSection(sec, s, a)
for _, sec := range v.Sections {
@publicSection(sec, v, s, a)
}
if cp.Matches == 0 {
<p class="py-6 text-sm text-muted">{ i18n.T(ctx, "page.search_none") }</p>
if v.Filtered() && v.Matches == 0 {
if v.OnlyProblems && v.Query == "" {
<p class="py-6 text-sm text-muted">{ i18n.T(ctx, "page.filter_no_problems") }</p>
} else {
<p class="py-6 text-sm text-muted">{ i18n.T(ctx, "page.search_none") }</p>
}
}
@publicComponentPager(cp, a)
</section>
}
@publicIncidents(s.Incidents)
@@ -165,29 +168,33 @@ templ PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message s
}
}
// publicComponentSearch finds components on pages listing too many to scan.
templ publicComponentSearch(cp ComponentPage, a PublicAssets) {
<form method="get" action={ templ.SafeURL(BackHref(a.ComponentBase)) } role="search" class="mb-4 flex flex-wrap items-center gap-2 text-sm">
// publicComponentFilter searches the components of pages listing too many
// to scan, or narrows them to those with an outage.
templ publicComponentFilter(v ComponentView, a PublicAssets) {
<form method="get" action={ templ.SafeURL(BackHref(a.ComponentBase)) } role="search" class="mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm">
<label class="sr-only" for="component-search">{ i18n.T(ctx, "page.search") }</label>
<input id="component-search" type="search" name="q" value={ cp.Query } maxlength="100" placeholder={ i18n.T(ctx, "page.search") } class="min-w-0 flex-1 border border-rule bg-transparent px-2 py-1.5"/>
<input id="component-search" type="search" name="q" value={ v.Query } maxlength="100" placeholder={ i18n.T(ctx, "page.search") } class="min-w-0 flex-1 border border-rule bg-transparent px-2 py-1.5"/>
<label class="flex items-center gap-2">
<input type="checkbox" name="problems" value="1" checked?={ v.OnlyProblems }/>
<span>{ i18n.T(ctx, "page.filter_problems", "Count", v.Problems) }</span>
</label>
<button type="submit" class="border border-ink px-3 py-1.5 hover:bg-ink hover:text-paper">{ i18n.T(ctx, "page.search_submit") }</button>
if cp.Query != "" {
<a href={ templ.SafeURL(BackHref(a.ComponentBase)) } class="text-muted hover:text-ink">{ i18n.T(ctx, "page.search_clear") }</a>
if v.Filtered() {
<a href={ templ.SafeURL(v.ResetHref()) } class="text-muted hover:text-ink">{ i18n.T(ctx, "page.search_clear") }</a>
}
</form>
}
// publicComponentPager turns the pages of components.
templ publicComponentPager(cp ComponentPage, a PublicAssets) {
if cp.Pages > 1 {
<nav class="flex flex-wrap items-center gap-x-5 gap-y-2 py-4 text-sm" aria-label={ i18n.T(ctx, "pager.label") }>
if cp.Page > 0 {
<a href={ templ.SafeURL(ComponentPageHref(a.ComponentBase, 0, cp.Query)) } class="text-muted hover:text-ink">{ i18n.T(ctx, "pager.first") }</a>
<a href={ templ.SafeURL(ComponentPageHref(a.ComponentBase, cp.Page-1, cp.Query)) } rel="prev" class="text-muted hover:text-ink">← { i18n.T(ctx, "pager.previous") }</a>
// publicSectionPager turns the pages of a section's own components.
templ publicSectionPager(sec PublicSection, v ComponentView) {
if sec.Pages > 1 {
<nav class="flex flex-wrap items-center gap-x-5 gap-y-2 border-b border-rule py-2 text-sm" aria-label={ i18n.T(ctx, "pager.label") }>
if sec.Page > 0 {
<a href={ templ.SafeURL(v.PageHref(sec.Key, sec.Page-1)) } rel="prev" class="text-muted hover:text-ink">← { i18n.T(ctx, "pager.previous") }</a>
}
<span class="font-mono text-xs text-muted">{ i18n.T(ctx, "page.pages", "Page", cp.Page+1, "Pages", cp.Pages) }</span>
if cp.Page < cp.Pages-1 {
<a href={ templ.SafeURL(ComponentPageHref(a.ComponentBase, cp.Page+1, cp.Query)) } rel="next" class="ml-auto text-muted hover:text-ink">{ i18n.T(ctx, "pager.next") } →</a>
<span class="font-mono text-xs text-muted">{ i18n.T(ctx, "page.pages", "Page", sec.Page+1, "Pages", sec.Pages) }</span>
if sec.Page < sec.Pages-1 {
<a href={ templ.SafeURL(v.PageHref(sec.Key, sec.Page+1)) } rel="next" class="ml-auto text-muted hover:text-ink">{ i18n.T(ctx, "pager.next") } →</a>
}
</nav>
}
@@ -195,21 +202,25 @@ templ publicComponentPager(cp ComponentPage, a PublicAssets) {
// publicSection renders an unnamed root component list or a collapsible nested
// group matching the monitor dashboard hierarchy.
templ publicSection(sec agentapi.Section, s agentapi.PageSnapshot, a PublicAssets) {
templ publicSection(sec PublicSection, v ComponentView, s agentapi.PageSnapshot, a PublicAssets) {
if sec.Name == "" {
@publicComponentList(sec.Components, s, a)
<div id={ "g-" + sec.Key }>
@publicComponentList(sec.Components, s, a)
@publicSectionPager(sec, v)
</div>
} else {
<details open class="border-b border-rule">
<details open id={ "g-" + sec.Key } class="border-b border-rule">
<summary class="flex cursor-pointer items-center gap-2.5 py-3 text-sm font-medium select-none hover:bg-rule/30">
@statusDot(SectionStatus(sec))
@statusDot(PageStatus(sec.Status))
<span>{ sec.Name }</span>
<span class="font-mono text-xs font-normal text-muted">{ strconv.Itoa(SectionTotal(sec)) }</span>
<span class="ml-auto text-xs font-normal text-muted">{ i18n.T(ctx, "page.component."+string(secStatusName(sec))) }</span>
<span class="font-mono text-xs font-normal text-muted">{ strconv.Itoa(sec.Total) }</span>
<span class="ml-auto text-xs font-normal text-muted">{ i18n.T(ctx, "page.component."+sec.Status) }</span>
</summary>
<div class="ml-4 border-l border-rule pl-4">
@publicComponentList(sec.Components, s, a)
@publicSectionPager(sec, v)
for _, child := range sec.Children {
@publicSection(child, s, a)
@publicSection(child, v, s, a)
}
</div>
</details>