perf(statuspages): page, search and compress public status pages
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Failing after 13m31s
ci / test (pull_request) Successful in 13m30s
ci / build (pull_request) Skipped
ci / image (pull_request) Skipped

A status page with 3128 components was 30 MB of uncompressed HTML: all
components at once, each with 90 bars carrying a tooltip.

- The status page server gzips text responses.
- Status pages list 50 components at a time (?page=N) and offer a search
  (?q=) over component and group names once they have more than one
  page. Group headings keep the status and count of the whole group.
  Single-file exports still list every component.
- Rows linking a detail page draw their bars as one path per status,
  without tooltips; the detail page keeps them.

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-27 00:10:27 +01:00
1 parent 52d2ce25c9
commit b051f6c430
12 files changed
+4059 -3094

No files matched your search

+15
View File
@@ -21,6 +21,7 @@ import (
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
@@ -331,9 +332,23 @@ func (s *Server) serve(c *gin.Context) {
}
s.localizeRequest(c)
c.Header("Cache-Control", "public, max-age=30")
assets.PageSize = componentsPerPage
if n, err := strconv.Atoi(c.Query("page")); err == nil && n > 1 {
assets.Page = n - 1
}
if q := c.Query("q"); len(q) <= maxComponentQuery {
assets.Query = q
}
web.Render(c, http.StatusOK, web.PublicStatusPage(e.Snap.WithMaintenance(s.now()), assets))
}
// componentsPerPage is how many components a status page lists at a time;
// organizations put thousands on one.
const componentsPerPage = 50
// maxComponentQuery bounds the search for components.
const maxComponentQuery = 100
// serveComponent renders one component's public detail page from the cached
// snapshot when the status page has enabled ShowDetails.
func (s *Server) serveComponent(c *gin.Context, e entry, compID string, assets web.PublicAssets) {