From 9b26b4150ed0d577c26b33432e55a814f6be8d26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?=
Date: Sun, 22 Nov 2026 20:07:30 +0100
Subject: [PATCH] feat(statuspage): add nested status page groups and optional
component details
---
internal/agentapi/pages.go | 168 +-
internal/api/apidocs.go | 12 +-
internal/api/audit.go | 82 +-
internal/api/console.go | 58 +-
internal/api/gdpr.go | 42 +-
internal/api/server.go | 5 +
internal/api/statuspage_groups.go | 402 +++++
internal/api/statuspages.go | 251 ++-
internal/api/statuspages_test.go | 214 +++
internal/i18n/locales/de.json | 17 +
internal/i18n/locales/en.json | 17 +
.../00041_status_page_groups_and_details.sql | 96 ++
.../migrations/status_page_groups_test.go | 90 +
internal/statuspage/statuspage.go | 62 +-
internal/statuspage/statuspage_test.go | 134 ++
internal/store/models.go | 37 +-
internal/store/querier.go | 8 +
internal/store/queries/status_pages.sql | 54 +-
internal/store/status_pages.sql.go | 274 ++-
internal/web/assets/app.js | 5 +-
internal/web/public.go | 100 +-
internal/web/public.templ | 346 +++-
internal/web/public_templ.go | 1523 +++++++++++++----
internal/web/statuspages.templ | 128 +-
internal/web/statuspages_templ.go | 1176 +++++++++++--
internal/web/testdata/forms.html | 25 +
26 files changed, 4566 insertions(+), 760 deletions(-)
create mode 100644 internal/api/statuspage_groups.go
create mode 100644 internal/migrations/sql/00041_status_page_groups_and_details.sql
create mode 100644 internal/migrations/status_page_groups_test.go
diff --git a/internal/agentapi/pages.go b/internal/agentapi/pages.go
index f611bd0..2cffaf3 100644
--- a/internal/agentapi/pages.go
+++ b/internal/agentapi/pages.go
@@ -5,6 +5,7 @@ import (
"errors"
"net/http"
"net/url"
+ "slices"
"time"
)
@@ -33,19 +34,53 @@ type Day struct {
Uptime float64 `json:"uptime"`
}
+// HourBucket is one hourly summary of a component's recent 24-hour history.
+// Uptime is -1 when no checks were recorded during that hour.
+type HourBucket struct {
+ Time time.Time `json:"time"`
+ Uptime float64 `json:"uptime"`
+ AvgLatencyMS int `json:"avg_latency_ms"`
+}
+
+// ComponentRegion is the public status of one monitoring region for a
+// component. Error details and checker IDs stay private.
+type ComponentRegion struct {
+ Name string `json:"name"`
+ Status string `json:"status"`
+ LatencyMS int `json:"latency_ms,omitempty"`
+}
+
+// ComponentDetails holds the public metrics shown on a component's detail page
+// when the status page opts in via ShowDetails.
+type ComponentDetails struct {
+ SLA24h float64 `json:"sla_24h"`
+ SLA7d float64 `json:"sla_7d"`
+ SLA30d float64 `json:"sla_30d"`
+ SLA90d float64 `json:"sla_90d"`
+ Hours []HourBucket `json:"hours,omitempty"`
+ Regions []ComponentRegion `json:"regions,omitempty"`
+}
+
// Component is one monitor as the public sees it. Targets, check details
// and error messages stay private.
type Component struct {
- Name string `json:"name"`
- Status string `json:"status"`
- Uptime float64 `json:"uptime"`
- Days []Day `json:"days"`
+ // ID identifies the component on detail URLs when ShowDetails is enabled.
+ ID string `json:"id,omitempty"`
+ Name string `json:"name"`
+ Status string `json:"status"`
+ Uptime float64 `json:"uptime"`
+ Days []Day `json:"days"`
+ Details *ComponentDetails `json:"details,omitempty"`
}
-// Section groups components under a heading; the first may be unnamed.
+// Section groups components and nested child sections under a heading; a
+// top-level section with an empty Name holds ungrouped components.
type Section struct {
Name string `json:"name"`
+ Status string `json:"status,omitempty"`
+ Total int `json:"total,omitempty"`
Components []Component `json:"components"`
+ Children []Section `json:"children,omitempty"`
}
// PageIncident is an incident of a listed component.
@@ -62,6 +97,7 @@ type PageSnapshot struct {
Description string `json:"description"`
Theme Theme `json:"theme"`
Status string `json:"status"`
+ ShowDetails bool `json:"show_details,omitempty"`
Sections []Section `json:"sections"`
Incidents []PageIncident `json:"incidents"`
GeneratedAt time.Time `json:"generated_at"`
@@ -87,9 +123,9 @@ type PageMaintenance struct {
Components []string `json:"components"`
}
-// Summarize derives a page state from component states. Unknown components
-// do not make a page look broken, and a single failed component is a partial
-// problem: only when all fail is it an outage.
+// Summarize derives a page or group state from component states. Unknown
+// components do not make a page look broken, and a single failed component is
+// a partial problem: only when all fail is it an outage.
func Summarize(states []string) string {
rank := map[string]int{PageOperational: 0, PageUnknown: 0, PageDegraded: 1, PageOutage: 2}
worst, allUnknown, allDown := PageOperational, true, len(states) > 0
@@ -109,8 +145,22 @@ func Summarize(states []string) string {
return worst
}
+func summarizeWithMaintenance(states []string, hasMaintenance bool) string {
+ if len(states) == 0 {
+ if hasMaintenance {
+ return PageUnderMaintenance
+ }
+ return PageUnknown
+ }
+ status := Summarize(states)
+ if hasMaintenance && (status == PageOperational || status == PageUnknown) {
+ return PageUnderMaintenance
+ }
+ return status
+}
+
// WithMaintenance returns s as of now: components under maintenance in
-// progress show as such and the page state leaves them out.
+// progress show as such and the page and group states reflect it.
func (s PageSnapshot) WithMaintenance(now time.Time) PageSnapshot {
affected := map[string]bool{}
for _, m := range s.Maintenance {
@@ -123,27 +173,105 @@ func (s PageSnapshot) WithMaintenance(now time.Time) PageSnapshot {
if len(affected) == 0 {
return s
}
- sections := make([]Section, len(s.Sections))
- var states []string
- for i, sec := range s.Sections {
- sections[i] = Section{Name: sec.Name, Components: make([]Component, len(sec.Components))}
- for j, c := range sec.Components {
+ var allStates []string
+ var anyMaint bool
+ var apply func(src Section) (Section, []string, bool)
+ apply = func(src Section) (Section, []string, bool) {
+ dst := Section{
+ Name: src.Name,
+ Total: src.Total,
+ Components: make([]Component, len(src.Components)),
+ }
+ var subStates []string
+ subMaint := false
+ for i, c := range src.Components {
if affected[c.Name] {
c.Status = PageUnderMaintenance
+ subMaint = true
} else {
- states = append(states, c.Status)
+ subStates = append(subStates, c.Status)
}
- sections[i].Components[j] = c
+ dst.Components[i] = c
}
+ if len(src.Children) > 0 {
+ dst.Children = make([]Section, len(src.Children))
+ for i, child := range src.Children {
+ var childStates []string
+ var childMaint bool
+ dst.Children[i], childStates, childMaint = apply(child)
+ subStates = append(subStates, childStates...)
+ subMaint = subMaint || childMaint
+ }
+ }
+ if dst.Name != "" {
+ dst.Status = summarizeWithMaintenance(subStates, subMaint)
+ }
+ return dst, subStates, subMaint
+ }
+
+ sections := make([]Section, len(s.Sections))
+ for i, sec := range s.Sections {
+ var states []string
+ var maint bool
+ sections[i], states, maint = apply(sec)
+ allStates = append(allStates, states...)
+ anyMaint = anyMaint || maint
}
s.Sections = sections
- s.Status = Summarize(states)
- if len(states) == 0 || s.Status == PageOperational {
- s.Status = PageUnderMaintenance
- }
+ s.Status = summarizeWithMaintenance(allStates, anyMaint)
return s
}
+// ComponentByID finds a component anywhere in s.Sections by its ID.
+func (s PageSnapshot) ComponentByID(id string) (Component, bool) {
+ if id == "" {
+ return Component{}, false
+ }
+ var find func(secs []Section) (Component, bool)
+ find = func(secs []Section) (Component, bool) {
+ for _, sec := range secs {
+ for _, c := range sec.Components {
+ if c.ID == id {
+ return c, true
+ }
+ }
+ if c, ok := find(sec.Children); ok {
+ return c, true
+ }
+ }
+ return Component{}, false
+ }
+ return find(s.Sections)
+}
+
+// IncidentsForComponent returns incidents belonging to componentName.
+func (s PageSnapshot) IncidentsForComponent(componentName string) []PageIncident {
+ var out []PageIncident
+ for _, inc := range s.Incidents {
+ if inc.Component == componentName {
+ out = append(out, inc)
+ }
+ }
+ return out
+}
+
+// MaintenanceForComponent splits planned maintenance affecting componentName
+// into ongoing and upcoming occurrences at now.
+func (s PageSnapshot) MaintenanceForComponent(componentName string, now time.Time) (ongoing, upcoming []PageMaintenance) {
+ for _, m := range s.Maintenance {
+ if !slices.Contains(m.Components, componentName) {
+ continue
+ }
+ switch {
+ case !now.Before(m.Start) && now.Before(m.End):
+ ongoing = append(ongoing, m)
+ case now.Before(m.Start):
+ upcoming = append(upcoming, m)
+ }
+ }
+ return ongoing, upcoming
+}
+
// Ongoing returns occurrences in progress at now.
func (s PageSnapshot) Ongoing(now time.Time) []PageMaintenance {
var out []PageMaintenance
diff --git a/internal/api/apidocs.go b/internal/api/apidocs.go
index 207d7d6..4a1aaed 100644
--- a/internal/api/apidocs.go
+++ b/internal/api/apidocs.go
@@ -114,8 +114,18 @@ var endpoints = []endpoint{
req: statusPageRequest{}, resp: statusPageView{}},
{method: "DELETE", path: "/api/v1/org/statuspages/:id", tag: "Status pages", summary: "Delete a status page", perm: "statuspages.write",
status: http.StatusNoContent},
+ {method: "GET", path: "/api/v1/org/statuspages/:id/groups", tag: "Status pages", summary: "List status page groups", perm: "statuspages.read",
+ resp: obj{"groups": []pageGroupView{}}},
+ {method: "POST", path: "/api/v1/org/statuspages/:id/groups", tag: "Status pages", summary: "Create a status page group", perm: "statuspages.write",
+ req: pageGroupRequest{}, status: http.StatusCreated, resp: pageGroupView{}},
+ {method: "PUT", path: "/api/v1/org/statuspages/:id/groups/:group_id", tag: "Status pages", summary: "Rename, move or reorder a status page group", perm: "statuspages.write",
+ req: pageGroupRequest{}, resp: pageGroupView{}},
+ {method: "DELETE", path: "/api/v1/org/statuspages/:id/groups/:group_id", tag: "Status pages", summary: "Delete a status page group", perm: "statuspages.write",
+ description: "Child groups and monitors move up to the deleted group's parent.", status: http.StatusNoContent},
+ {method: "POST", path: "/api/v1/org/statuspages/:id/groups/import", tag: "Status pages", summary: "Import monitor groups into a status page", perm: "statuspages.write",
+ description: "Copies the organization's monitor group tree for the page's monitors and maps them into the imported groups.", resp: obj{"groups": []pageGroupView{}}},
{method: "PUT", path: "/api/v1/org/statuspages/:id/monitors", tag: "Status pages", summary: "Set the monitors shown", perm: "statuspages.write",
- req: pageMonitorsRequest{}, status: http.StatusNoContent},
+ description: "Assigns monitors to optional nested groups via `group_id`. Legacy `section` names are mapped to top-level groups.", req: pageMonitorsRequest{}, status: http.StatusNoContent},
{method: "PUT", path: "/api/v1/org/statuspages/:id/domain", tag: "Status pages", summary: "Set a custom domain", perm: "statuspages.write",
description: "Verify it with a TXT record before it is served.", req: domainRequest{}, resp: statusPageView{}},
{method: "POST", path: "/api/v1/org/statuspages/:id/domain/verify", tag: "Status pages", summary: "Verify the custom domain", perm: "statuspages.write",
diff --git a/internal/api/audit.go b/internal/api/audit.go
index 430730e..774123a 100644
--- a/internal/api/audit.go
+++ b/internal/api/audit.go
@@ -45,45 +45,49 @@ var auditActions = map[string]string{
"POST /api/v1/invitations/:token/accept": "member.join",
"POST /api/v1/invitations/:token/signup": "member.join",
- "PUT /api/v1/org/policy": "org.policy_update",
- "POST /api/v1/org/monitors": "monitor.create",
- "PUT /api/v1/org/monitors/:id": "monitor.update",
- "DELETE /api/v1/org/monitors/:id": "monitor.delete",
- "POST /api/v1/org/alertmanager/receivers": "alertmanager.receiver_create",
- "DELETE /api/v1/org/alertmanager/receivers/:id": "alertmanager.receiver_delete",
- "POST /api/v1/org/maintenance": "maintenance.create",
- "PUT /api/v1/org/maintenance/:id": "maintenance.update",
- "DELETE /api/v1/org/maintenance/:id": "maintenance.delete",
- "POST /api/v1/org/groups": "group.create",
- "PUT /api/v1/org/groups/:id": "group.update",
- "DELETE /api/v1/org/groups/:id": "group.delete",
- "POST /api/v1/org/regions": "region.create",
- "DELETE /api/v1/org/regions/:id": "region.delete",
- "POST /api/v1/org/agents": "agent.create",
- "DELETE /api/v1/org/agents/:id": "agent.delete",
- "POST /api/v1/org/statuspages": "statuspage.create",
- "PUT /api/v1/org/statuspages/:id": "statuspage.update",
- "DELETE /api/v1/org/statuspages/:id": "statuspage.delete",
- "PUT /api/v1/org/statuspages/:id/monitors": "statuspage.monitors_update",
- "PUT /api/v1/org/statuspages/:id/domain": "statuspage.domain_update",
- "POST /api/v1/org/statuspages/:id/domain/verify": "statuspage.domain_verify",
- "POST /api/v1/org/channels": "channel.create",
- "PUT /api/v1/org/channels/:id": "channel.update",
- "DELETE /api/v1/org/channels/:id": "channel.delete",
- "POST /api/v1/org/channels/:id/test": "channel.test",
- "POST /api/v1/org/sso": "sso.create",
- "PUT /api/v1/org/sso/:id": "sso.update",
- "DELETE /api/v1/org/sso/:id": "sso.delete",
- "DELETE /api/v1/org/members/:user": "member.remove",
- "POST /api/v1/org/members/:user/roles": "member.role_assign",
- "DELETE /api/v1/org/assignments/:id": "member.role_unassign",
- "POST /api/v1/org/invitations": "invitation.create",
- "DELETE /api/v1/org/invitations/:id": "invitation.delete",
- "POST /api/v1/org/roles": "role.create",
- "PUT /api/v1/org/roles/:id": "role.update",
- "DELETE /api/v1/org/roles/:id": "role.delete",
- "POST /api/v1/org/tokens": "token.create",
- "DELETE /api/v1/org/tokens/:id": "token.delete",
+ "PUT /api/v1/org/policy": "org.policy_update",
+ "POST /api/v1/org/monitors": "monitor.create",
+ "PUT /api/v1/org/monitors/:id": "monitor.update",
+ "DELETE /api/v1/org/monitors/:id": "monitor.delete",
+ "POST /api/v1/org/alertmanager/receivers": "alertmanager.receiver_create",
+ "DELETE /api/v1/org/alertmanager/receivers/:id": "alertmanager.receiver_delete",
+ "POST /api/v1/org/maintenance": "maintenance.create",
+ "PUT /api/v1/org/maintenance/:id": "maintenance.update",
+ "DELETE /api/v1/org/maintenance/:id": "maintenance.delete",
+ "POST /api/v1/org/groups": "group.create",
+ "PUT /api/v1/org/groups/:id": "group.update",
+ "DELETE /api/v1/org/groups/:id": "group.delete",
+ "POST /api/v1/org/regions": "region.create",
+ "DELETE /api/v1/org/regions/:id": "region.delete",
+ "POST /api/v1/org/agents": "agent.create",
+ "DELETE /api/v1/org/agents/:id": "agent.delete",
+ "POST /api/v1/org/statuspages": "statuspage.create",
+ "PUT /api/v1/org/statuspages/:id": "statuspage.update",
+ "DELETE /api/v1/org/statuspages/:id": "statuspage.delete",
+ "POST /api/v1/org/statuspages/:id/groups": "statuspage.group_create",
+ "PUT /api/v1/org/statuspages/:id/groups/:group_id": "statuspage.group_update",
+ "DELETE /api/v1/org/statuspages/:id/groups/:group_id": "statuspage.group_delete",
+ "POST /api/v1/org/statuspages/:id/groups/import": "statuspage.groups_import",
+ "PUT /api/v1/org/statuspages/:id/monitors": "statuspage.monitors_update",
+ "PUT /api/v1/org/statuspages/:id/domain": "statuspage.domain_update",
+ "POST /api/v1/org/statuspages/:id/domain/verify": "statuspage.domain_verify",
+ "POST /api/v1/org/channels": "channel.create",
+ "PUT /api/v1/org/channels/:id": "channel.update",
+ "DELETE /api/v1/org/channels/:id": "channel.delete",
+ "POST /api/v1/org/channels/:id/test": "channel.test",
+ "POST /api/v1/org/sso": "sso.create",
+ "PUT /api/v1/org/sso/:id": "sso.update",
+ "DELETE /api/v1/org/sso/:id": "sso.delete",
+ "DELETE /api/v1/org/members/:user": "member.remove",
+ "POST /api/v1/org/members/:user/roles": "member.role_assign",
+ "DELETE /api/v1/org/assignments/:id": "member.role_unassign",
+ "POST /api/v1/org/invitations": "invitation.create",
+ "DELETE /api/v1/org/invitations/:id": "invitation.delete",
+ "POST /api/v1/org/roles": "role.create",
+ "PUT /api/v1/org/roles/:id": "role.update",
+ "DELETE /api/v1/org/roles/:id": "role.delete",
+ "POST /api/v1/org/tokens": "token.create",
+ "DELETE /api/v1/org/tokens/:id": "token.delete",
"PUT /api/v1/admin/legal/:kind": "platform.legal_update",
"PUT /api/v1/org/legal/:kind": "org.legal_update",
diff --git a/internal/api/console.go b/internal/api/console.go
index 2870e29..00d4a89 100644
--- a/internal/api/console.go
+++ b/internal/api/console.go
@@ -832,9 +832,11 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
}
ctx := c.Request.Context()
var (
- row store.StatusPage
- listed []store.StatusPageMonitorsRow
- monitors []store.Monitor
+ row store.StatusPage
+ listed []store.StatusPageMonitorsRow
+ pageGroups []store.StatusPageGroup
+ orgGroups []store.MonitorGroup
+ monitors []store.Monitor
)
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err error
@@ -844,6 +846,12 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
if listed, err = q.StatusPageMonitors(ctx, id); err != nil {
return err
}
+ if pageGroups, err = q.ListStatusPageGroups(ctx, id); err != nil {
+ return err
+ }
+ if orgGroups, err = q.ListGroups(ctx); err != nil {
+ return err
+ }
monitors, err = q.ListMonitors(ctx)
return err
})
@@ -856,21 +864,59 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
v := viewStatusPage(row)
e := web.PageEditor{
ID: row.ID.String(), Title: row.Title, Slug: row.Slug, Description: row.Description,
- Published: row.Published, Accent: v.Theme.Accent, LogoURL: v.Theme.LogoURL, CSS: v.Theme.CSS,
+ Published: row.Published, ShowDetails: row.ShowComponentDetails,
+ Accent: v.Theme.Accent, LogoURL: v.Theme.LogoURL, CSS: v.Theme.CSS,
URL: s.pageURL(row), Domain: deref(row.CustomDomain), DomainVerified: v.DomainVerified,
+ HasOrgGroups: len(orgGroups) > 0,
}
if v.DomainRecord != nil {
e.RecordName, e.RecordValue = v.DomainRecord.Name, v.DomainRecord.Value
}
+ newPageGroupTree(pageGroups).walk(func(g store.StatusPageGroup, depth int) {
+ var parentID string
+ if g.ParentID != nil {
+ parentID = g.ParentID.String()
+ }
+ e.Groups = append(e.Groups, web.PageGroupRow{
+ ID: g.ID.String(), Name: g.Name, ParentID: parentID, Position: int(g.Position), Depth: depth,
+ Label: strings.Repeat("— ", depth) + g.Name,
+ })
+ })
+ orgTree := newGroupTree(orgGroups)
+ groupPath := func(gid *uuid.UUID) string {
+ if gid == nil {
+ return ""
+ }
+ var parts []string
+ for cur := gid; cur != nil && len(parts) < 10; {
+ g, ok := orgTree.byID[*cur]
+ if !ok {
+ break
+ }
+ parts = append(parts, g.Name)
+ cur = g.ParentID
+ }
+ slices.Reverse(parts)
+ return strings.Join(parts, " / ")
+ }
// Listed monitors keep their order; the rest follow alphabetically.
seen := map[uuid.UUID]bool{}
for _, l := range listed {
seen[l.MonitorID] = true
- e.Monitors = append(e.Monitors, web.PageMonitorOption{ID: l.MonitorID.String(), Name: l.MonitorName, Included: true, Section: l.Section, Label: l.Label})
+ var groupID string
+ if l.GroupID != nil {
+ groupID = l.GroupID.String()
+ }
+ e.Monitors = append(e.Monitors, web.PageMonitorOption{
+ ID: l.MonitorID.String(), Name: l.MonitorName, MonitorGroupPath: groupPath(l.MonitorGroupID),
+ Included: true, GroupID: groupID, Label: l.Label,
+ })
}
for _, m := range monitors {
if !seen[m.ID] {
- e.Monitors = append(e.Monitors, web.PageMonitorOption{ID: m.ID.String(), Name: m.Name})
+ e.Monitors = append(e.Monitors, web.PageMonitorOption{
+ ID: m.ID.String(), Name: m.Name, MonitorGroupPath: groupPath(m.GroupID),
+ })
}
}
return web.StatusPageEditor(page, me, e), nil
diff --git a/internal/api/gdpr.go b/internal/api/gdpr.go
index 145899c..eb1aca4 100644
--- a/internal/api/gdpr.go
+++ b/internal/api/gdpr.go
@@ -279,19 +279,22 @@ type exportChannel struct {
}
type exportStatusPage struct {
- ID uuid.UUID `json:"id"`
- Slug string `json:"slug"`
- Title string `json:"title"`
- Description string `json:"description"`
- Published bool `json:"published"`
- CustomDomain *string `json:"custom_domain"`
- Monitors []exportPageMember `json:"monitors"`
+ ID uuid.UUID `json:"id"`
+ Slug string `json:"slug"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Published bool `json:"published"`
+ ShowComponentDetails bool `json:"show_component_details"`
+ CustomDomain *string `json:"custom_domain"`
+ Groups []pageGroupView `json:"groups"`
+ Monitors []exportPageMember `json:"monitors"`
}
type exportPageMember struct {
- MonitorID uuid.UUID `json:"monitor_id"`
- Section string `json:"section"`
- Label string `json:"label"`
+ MonitorID uuid.UUID `json:"monitor_id"`
+ GroupID *uuid.UUID `json:"group_id"`
+ Section string `json:"section"`
+ Label string `json:"label"`
}
type exportSSO struct {
@@ -449,17 +452,30 @@ func (s *Server) buildOrgExport(ctx context.Context, p *principal) (orgExport, e
}
x.StatusPages = []exportStatusPage{}
for _, pg := range pages {
+ pgGroups, err := q.ListStatusPageGroups(ctx, pg.ID)
+ if err != nil {
+ return err
+ }
+ exportedGroups := []pageGroupView{}
+ newPageGroupTree(pgGroups).walk(func(g store.StatusPageGroup, _ int) {
+ exportedGroups = append(exportedGroups, pageGroupView{
+ ID: g.ID, Name: g.Name, ParentID: g.ParentID, Position: g.Position,
+ })
+ })
pm, err := q.StatusPageMonitors(ctx, pg.ID)
if err != nil {
return err
}
members := []exportPageMember{}
for _, m := range pm {
- members = append(members, exportPageMember{MonitorID: m.MonitorID, Section: m.Section, Label: m.Label})
+ members = append(members, exportPageMember{
+ MonitorID: m.MonitorID, GroupID: m.GroupID, Section: m.Section, Label: m.Label,
+ })
}
x.StatusPages = append(x.StatusPages, exportStatusPage{
- ID: pg.ID, Slug: pg.Slug, Title: pg.Title, Description: pg.Description, Published: pg.Published,
- CustomDomain: pg.CustomDomain, Monitors: members,
+ ID: pg.ID, Slug: pg.Slug, Title: pg.Title, Description: pg.Description,
+ Published: pg.Published, ShowComponentDetails: pg.ShowComponentDetails,
+ CustomDomain: pg.CustomDomain, Groups: exportedGroups, Monitors: members,
})
}
diff --git a/internal/api/server.go b/internal/api/server.go
index 568b2fb..421a9ce 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -182,6 +182,11 @@ func (s *Server) Mount(r gin.IRouter) {
page := org.Group("/statuspages/:id")
page.PUT("", canPage(authz.StatusPagesWrite), s.updateStatusPage)
page.DELETE("", canPage(authz.StatusPagesWrite), s.deleteStatusPage)
+ page.GET("/groups", canPage(authz.StatusPagesRead), s.listStatusPageGroups)
+ page.POST("/groups", canPage(authz.StatusPagesWrite), s.createStatusPageGroup)
+ page.PUT("/groups/:group_id", canPage(authz.StatusPagesWrite), s.updateStatusPageGroup)
+ page.DELETE("/groups/:group_id", canPage(authz.StatusPagesWrite), s.deleteStatusPageGroup)
+ page.POST("/groups/import", canPage(authz.StatusPagesWrite), s.importStatusPageGroups)
page.PUT("/monitors", canPage(authz.StatusPagesWrite), s.setPageMonitors)
page.PUT("/domain", canPage(authz.StatusPagesWrite), s.setPageDomain)
page.POST("/domain/verify", canPage(authz.StatusPagesWrite), s.verifyPageDomain)
diff --git a/internal/api/statuspage_groups.go b/internal/api/statuspage_groups.go
new file mode 100644
index 0000000..694fc29
--- /dev/null
+++ b/internal/api/statuspage_groups.go
@@ -0,0 +1,402 @@
+package api
+
+import (
+ "context"
+ "errors"
+ "net/http"
+ "strings"
+
+ "github.com/gin-gonic/gin"
+ "github.com/google/uuid"
+ "github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgconn"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/store"
+)
+
+// pageGroupTree organizes one status page's nested groups in display order.
+type pageGroupTree struct {
+ byID map[uuid.UUID]store.StatusPageGroup
+ children map[uuid.UUID][]uuid.UUID
+ roots []uuid.UUID
+}
+
+func newPageGroupTree(groups []store.StatusPageGroup) pageGroupTree {
+ t := pageGroupTree{
+ byID: make(map[uuid.UUID]store.StatusPageGroup, len(groups)),
+ children: map[uuid.UUID][]uuid.UUID{},
+ }
+ for _, g := range groups {
+ t.byID[g.ID] = g
+ }
+ for _, g := range groups {
+ if g.ParentID != nil {
+ if _, ok := t.byID[*g.ParentID]; ok {
+ t.children[*g.ParentID] = append(t.children[*g.ParentID], g.ID)
+ continue
+ }
+ }
+ t.roots = append(t.roots, g.ID)
+ }
+ return t
+}
+
+func (t pageGroupTree) walk(fn func(g store.StatusPageGroup, depth int)) {
+ var visit func(ids []uuid.UUID, depth int)
+ visit = func(ids []uuid.UUID, depth int) {
+ for _, id := range ids {
+ fn(t.byID[id], depth)
+ visit(t.children[id], depth+1)
+ }
+ }
+ visit(t.roots, 0)
+}
+
+type pageGroupView struct {
+ ID uuid.UUID `json:"id"`
+ Name string `json:"name"`
+ ParentID *uuid.UUID `json:"parent_id"`
+ Position int32 `json:"position"`
+}
+
+type pageGroupRequest struct {
+ Name string `json:"name" binding:"required,max=100"`
+ ParentID *uuid.UUID `json:"parent_id"`
+ Position int32 `json:"position"`
+}
+
+func pageGroupError(c *gin.Context, err error) bool {
+ var pgErr *pgconn.PgError
+ if !errors.As(err, &pgErr) {
+ return false
+ }
+ switch {
+ case pgErr.ConstraintName == "status_page_groups_cycle", pgErr.ConstraintName == "status_page_groups_check":
+ fail(c, http.StatusUnprocessableEntity, "group_cycle")
+ case pgErr.ConstraintName == "status_page_groups_depth":
+ fail(c, http.StatusUnprocessableEntity, "group_too_deep")
+ case pgErr.Code == "23503":
+ fail(c, http.StatusUnprocessableEntity, "invalid_group")
+ default:
+ return false
+ }
+ return true
+}
+
+func (s *Server) listStatusPageGroups(c *gin.Context) {
+ pageID := uuid.MustParse(c.Param("id"))
+ p := current(c)
+ ctx := c.Request.Context()
+ var groups []store.StatusPageGroup
+ err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
+ if _, err := q.GetStatusPage(ctx, pageID); err != nil {
+ return err
+ }
+ var err error
+ groups, err = q.ListStatusPageGroups(ctx, pageID)
+ return err
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ out := make([]pageGroupView, 0, len(groups))
+ newPageGroupTree(groups).walk(func(g store.StatusPageGroup, _ int) {
+ out = append(out, pageGroupView{ID: g.ID, Name: g.Name, ParentID: g.ParentID, Position: g.Position})
+ })
+ c.JSON(http.StatusOK, gin.H{"groups": out})
+}
+
+func (s *Server) createStatusPageGroup(c *gin.Context) {
+ var req pageGroupRequest
+ if !bind(c, &req) {
+ return
+ }
+ req.Name = strings.TrimSpace(req.Name)
+ if req.Name == "" {
+ fail(c, http.StatusUnprocessableEntity, "invalid_input")
+ return
+ }
+ pageID := uuid.MustParse(c.Param("id"))
+ p := current(c)
+ ctx := c.Request.Context()
+ var g store.StatusPageGroup
+ err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
+ if _, err := q.GetStatusPage(ctx, pageID); err != nil {
+ return err
+ }
+ var err error
+ g, err = q.CreateStatusPageGroup(ctx, store.CreateStatusPageGroupParams{
+ PageID: pageID,
+ OrgID: p.Org.ID,
+ ParentID: req.ParentID,
+ Name: req.Name,
+ Position: req.Position,
+ })
+ return err
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ if pageGroupError(c, err) {
+ return
+ }
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ c.JSON(http.StatusCreated, pageGroupView{ID: g.ID, Name: g.Name, ParentID: g.ParentID, Position: g.Position})
+}
+
+func (s *Server) updateStatusPageGroup(c *gin.Context) {
+ groupID, err := uuid.Parse(c.Param("group_id"))
+ if err != nil {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ var req pageGroupRequest
+ if !bind(c, &req) {
+ return
+ }
+ req.Name = strings.TrimSpace(req.Name)
+ if req.Name == "" {
+ fail(c, http.StatusUnprocessableEntity, "invalid_input")
+ return
+ }
+ pageID := uuid.MustParse(c.Param("id"))
+ p := current(c)
+ ctx := c.Request.Context()
+ var g store.StatusPageGroup
+ err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
+ var err error
+ g, err = q.UpdateStatusPageGroup(ctx, store.UpdateStatusPageGroupParams{
+ ID: groupID,
+ PageID: pageID,
+ Name: req.Name,
+ ParentID: req.ParentID,
+ Position: req.Position,
+ })
+ return err
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ if pageGroupError(c, err) {
+ return
+ }
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ c.JSON(http.StatusOK, pageGroupView{ID: g.ID, Name: g.Name, ParentID: g.ParentID, Position: g.Position})
+}
+
+// deleteStatusPageGroup moves child groups and monitors up to the deleted
+// group's parent before removing the group.
+func (s *Server) deleteStatusPageGroup(c *gin.Context) {
+ groupID, err := uuid.Parse(c.Param("group_id"))
+ if err != nil {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ pageID := uuid.MustParse(c.Param("id"))
+ p := current(c)
+ ctx := c.Request.Context()
+ err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
+ groups, err := q.ListStatusPageGroups(ctx, pageID)
+ if err != nil {
+ return err
+ }
+ target, ok := newPageGroupTree(groups).byID[groupID]
+ if !ok {
+ return pgx.ErrNoRows
+ }
+ if err := q.ReparentStatusPageGroupChildren(ctx, store.ReparentStatusPageGroupChildrenParams{
+ PageID: pageID, ParentID: &groupID, ParentID_2: target.ParentID,
+ }); err != nil {
+ return err
+ }
+ if err := q.ReparentStatusPageGroupMonitors(ctx, store.ReparentStatusPageGroupMonitorsParams{
+ PageID: pageID, GroupID: &groupID, GroupID_2: target.ParentID,
+ }); err != nil {
+ return err
+ }
+ n, err := q.DeleteStatusPageGroup(ctx, store.DeleteStatusPageGroupParams{ID: groupID, PageID: pageID})
+ if err != nil {
+ return err
+ }
+ if n == 0 {
+ return pgx.ErrNoRows
+ }
+ return nil
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ c.Status(http.StatusNoContent)
+}
+
+// importStatusPageGroups copies the organization's monitor group hierarchy
+// onto the status page and maps the page's monitors into those groups. When
+// the page already lists monitors, only groups containing those monitors (and
+// their ancestors) are imported; otherwise the full monitor group tree is
+// copied as a starting layout.
+func (s *Server) importStatusPageGroups(c *gin.Context) {
+ pageID := uuid.MustParse(c.Param("id"))
+ p := current(c)
+ ctx := c.Request.Context()
+ var created []store.StatusPageGroup
+ err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
+ if _, err := q.GetStatusPage(ctx, pageID); err != nil {
+ return err
+ }
+ orgGroups, err := q.ListGroups(ctx)
+ if err != nil {
+ return err
+ }
+ listed, err := q.StatusPageMonitors(ctx, pageID)
+ if err != nil {
+ return err
+ }
+ tree := newGroupTree(orgGroups)
+ needed := map[uuid.UUID]bool{}
+ if len(listed) == 0 {
+ for id := range tree.byID {
+ needed[id] = true
+ }
+ } else {
+ for _, m := range listed {
+ for cur := m.MonitorGroupID; cur != nil; {
+ g, ok := tree.byID[*cur]
+ if !ok || needed[g.ID] {
+ break
+ }
+ needed[g.ID] = true
+ cur = g.ParentID
+ }
+ }
+ }
+ if err := q.ClearStatusPageGroups(ctx, pageID); err != nil {
+ return err
+ }
+ mapped := map[uuid.UUID]store.StatusPageGroup{}
+ var createErr error
+ posByParent := map[uuid.UUID]int32{}
+ tree.walk(func(g store.MonitorGroup, _ int) {
+ if createErr != nil || !needed[g.ID] {
+ return
+ }
+ var parentKey uuid.UUID
+ var parentID *uuid.UUID
+ if g.ParentID != nil {
+ if parent, ok := mapped[*g.ParentID]; ok {
+ pid := parent.ID
+ parentID = &pid
+ parentKey = pid
+ }
+ }
+ pos := posByParent[parentKey]
+ posByParent[parentKey] = pos + 1
+ row, err := q.CreateStatusPageGroup(ctx, store.CreateStatusPageGroupParams{
+ PageID: pageID,
+ OrgID: p.Org.ID,
+ ParentID: parentID,
+ Name: g.Name,
+ Position: pos,
+ })
+ if err != nil {
+ createErr = err
+ return
+ }
+ mapped[g.ID] = row
+ created = append(created, row)
+ })
+ if createErr != nil {
+ return createErr
+ }
+ for _, m := range listed {
+ var gid *uuid.UUID
+ section := ""
+ if m.MonitorGroupID != nil {
+ if g, ok := mapped[*m.MonitorGroupID]; ok {
+ id := g.ID
+ gid = &id
+ section = g.Name
+ }
+ }
+ if err := q.SetStatusPageMonitorGroup(ctx, store.SetStatusPageMonitorGroupParams{
+ PageID: pageID, MonitorID: m.MonitorID, GroupID: gid, Section: section,
+ }); err != nil {
+ return err
+ }
+ }
+ return nil
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ fail(c, http.StatusNotFound, "not_found")
+ return
+ }
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ out := make([]pageGroupView, 0, len(created))
+ for _, g := range created {
+ out = append(out, pageGroupView{ID: g.ID, Name: g.Name, ParentID: g.ParentID, Position: g.Position})
+ }
+ c.JSON(http.StatusOK, gin.H{"groups": out})
+}
+
+// resolvePageMonitorGroup returns the status page group ID and section label
+// for a component entry, creating a top-level group when a legacy caller passes
+// only section.
+func resolvePageMonitorGroup(
+ ctx context.Context,
+ q *store.Queries,
+ pageID, orgID uuid.UUID,
+ m pageMonitor,
+ groupsByID map[uuid.UUID]store.StatusPageGroup,
+ topByName map[string]store.StatusPageGroup,
+ nextPos *int32,
+) (*uuid.UUID, string, error) {
+ if m.GroupID != nil {
+ if g, ok := groupsByID[*m.GroupID]; ok {
+ return m.GroupID, g.Name, nil
+ }
+ // Let the database foreign key reject unknown or foreign group IDs.
+ return m.GroupID, strings.TrimSpace(m.Section), nil
+ }
+ sec := strings.TrimSpace(m.Section)
+ if sec == "" {
+ return nil, "", nil
+ }
+ if g, ok := topByName[sec]; ok {
+ id := g.ID
+ return &id, g.Name, nil
+ }
+ g, err := q.CreateStatusPageGroup(ctx, store.CreateStatusPageGroupParams{
+ PageID: pageID,
+ OrgID: orgID,
+ Name: sec,
+ Position: *nextPos,
+ })
+ if err != nil {
+ return nil, "", err
+ }
+ *nextPos++
+ groupsByID[g.ID] = g
+ topByName[sec] = g
+ id := g.ID
+ return &id, g.Name, nil
+}
diff --git a/internal/api/statuspages.go b/internal/api/statuspages.go
index 5fc607e..2a8b14c 100644
--- a/internal/api/statuspages.go
+++ b/internal/api/statuspages.go
@@ -6,6 +6,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
+ "math"
"net"
"net/http"
"net/url"
@@ -17,6 +18,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgconn"
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
"git.zb-server.de/ZB-Server/uptimesebi/internal/authz"
@@ -42,17 +44,25 @@ var (
// buildSnapshot computes what the public sees of page.
func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agentapi.PageSnapshot, error) {
snap := agentapi.PageSnapshot{
- Slug: page.Slug, Title: page.Title, Description: page.Description,
- Sections: []agentapi.Section{}, Incidents: []agentapi.PageIncident{}, GeneratedAt: time.Now(),
+ Slug: page.Slug,
+ Title: page.Title,
+ Description: page.Description,
+ ShowDetails: page.ShowComponentDetails,
+ Sections: []agentapi.Section{},
+ Incidents: []agentapi.PageIncident{},
+ GeneratedAt: time.Now(),
}
_ = json.Unmarshal(page.Theme, &snap.Theme)
var (
- listed []store.StatusPageMonitorsRow
- latest []store.LatestResultsRow
- open []store.Incident
- daily []store.DailyBucketsForMonitorsRow
- incidents []store.Incident
- planned map[uuid.UUID][]store.MaintenanceWindow
+ listed []store.StatusPageMonitorsRow
+ pageGroups []store.StatusPageGroup
+ latest []store.LatestResultsRow
+ open []store.Incident
+ daily []store.DailyBucketsForMonitorsRow
+ hourly []store.HourlyBucketsRow
+ regions []store.Region
+ incidents []store.Incident
+ planned map[uuid.UUID][]store.MaintenanceWindow
)
now := time.Now()
err := s.db.Tx(ctx, tenant.Org(page.OrgID, uuid.Nil), func(q *store.Queries) error {
@@ -60,6 +70,9 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
if listed, err = q.StatusPageMonitors(ctx, page.ID); err != nil {
return err
}
+ if pageGroups, err = q.ListStatusPageGroups(ctx, page.ID); err != nil {
+ return err
+ }
ids := make([]uuid.UUID, len(listed))
for i, m := range listed {
ids[i] = m.MonitorID
@@ -75,6 +88,16 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
}); err != nil {
return err
}
+ if page.ShowComponentDetails {
+ if hourly, err = q.HourlyBuckets(ctx, store.HourlyBucketsParams{
+ OrgID: page.OrgID, Bucket: now.UTC().Add(-24 * time.Hour),
+ }); err != nil {
+ return err
+ }
+ if regions, err = q.ListVisibleRegions(ctx); err != nil {
+ return err
+ }
+ }
if incidents, err = q.IncidentsForMonitors(ctx, store.IncidentsForMonitorsParams{Ids: ids, Since: ptr(now.Add(-incidentLookback))}); err != nil {
return err
}
@@ -90,11 +113,13 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
}
failing := map[uuid.UUID]int{}
reported := map[uuid.UUID]int{}
+ latestByMonitor := map[uuid.UUID][]store.LatestResultsRow{}
for _, l := range latest {
reported[l.MonitorID]++
if !l.Ok {
failing[l.MonitorID]++
}
+ latestByMonitor[l.MonitorID] = append(latestByMonitor[l.MonitorID], l)
}
down := map[uuid.UUID]bool{}
for _, i := range open {
@@ -104,15 +129,34 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
for _, d := range daily {
days[d.MonitorID] = append(days[d.MonitorID], web.Bucket{Start: d.Bucket, Total: d.Total, OK: d.OkCount})
}
+ hourlyByMonitor := map[uuid.UUID][]web.Bucket{}
+ for _, h := range hourly {
+ hourlyByMonitor[h.MonitorID] = append(hourlyByMonitor[h.MonitorID], web.Bucket{
+ Start: h.Bucket, Total: h.Total, OK: h.OkCount, Latency: h.AvgLatencyMs,
+ })
+ }
+ regionNames := make(map[string]string, len(regions))
+ for _, r := range regions {
+ regionNames[r.ID.String()] = r.Name
+ }
+
names := map[uuid.UUID]string{}
var states []string
+ var ungrouped []agentapi.Component
+ byGroup := map[uuid.UUID][]agentapi.Component{}
for _, m := range listed {
name := m.Label
if name == "" {
name = m.MonitorName
}
names[m.MonitorID] = name
- comp := agentapi.Component{Name: name, Uptime: web.Uptime(days[m.MonitorID]), Days: dayHistory(days[m.MonitorID], now)}
+ uptime90 := web.Uptime(days[m.MonitorID])
+ comp := agentapi.Component{
+ ID: m.MonitorID.String(),
+ Name: name,
+ Uptime: uptime90,
+ Days: dayHistory(days[m.MonitorID], now),
+ }
switch {
case down[m.MonitorID]:
comp.Status = agentapi.PageOutage
@@ -123,13 +167,27 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
default:
comp.Status = agentapi.PageOperational
}
+ if page.ShowComponentDetails {
+ comp.Details = buildComponentDetails(
+ days[m.MonitorID],
+ hourlyByMonitor[m.MonitorID],
+ latestByMonitor[m.MonitorID],
+ regionNames,
+ uptime90,
+ now,
+ )
+ }
states = append(states, comp.Status)
- if n := len(snap.Sections); n == 0 || snap.Sections[n-1].Name != m.Section {
- snap.Sections = append(snap.Sections, agentapi.Section{Name: m.Section})
+ if m.GroupID != nil {
+ byGroup[*m.GroupID] = append(byGroup[*m.GroupID], comp)
+ } else {
+ ungrouped = append(ungrouped, comp)
}
- last := &snap.Sections[len(snap.Sections)-1]
- last.Components = append(last.Components, comp)
}
+ if len(ungrouped) > 0 {
+ snap.Sections = append(snap.Sections, agentapi.Section{Name: "", Components: ungrouped})
+ }
+ snap.Sections = append(snap.Sections, buildPageSections(newPageGroupTree(pageGroups), byGroup)...)
snap.Status = agentapi.Summarize(states)
snap.Maintenance = pageMaintenance(planned, names, now)
for _, i := range incidents {
@@ -138,6 +196,102 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen
return snap, nil
}
+// buildPageSections turns a status page's group tree and grouped components
+// into recursive public sections, omitting subtrees with no components.
+func buildPageSections(tree pageGroupTree, byGroup map[uuid.UUID][]agentapi.Component) []agentapi.Section {
+ var build func(id uuid.UUID) (agentapi.Section, []string)
+ build = func(id uuid.UUID) (agentapi.Section, []string) {
+ g := tree.byID[id]
+ sec := agentapi.Section{Name: g.Name, Components: byGroup[id]}
+ var states []string
+ for _, c := range sec.Components {
+ states = append(states, c.Status)
+ }
+ sec.Total = len(sec.Components)
+ for _, childID := range tree.children[id] {
+ childSec, childStates := build(childID)
+ if childSec.Total == 0 {
+ continue
+ }
+ sec.Children = append(sec.Children, childSec)
+ sec.Total += childSec.Total
+ states = append(states, childStates...)
+ }
+ if sec.Total > 0 {
+ sec.Status = agentapi.Summarize(states)
+ }
+ return sec, states
+ }
+ var out []agentapi.Section
+ for _, rootID := range tree.roots {
+ sec, _ := build(rootID)
+ if sec.Total > 0 {
+ out = append(out, sec)
+ }
+ }
+ return out
+}
+
+func buildComponentDetails(
+ daily []web.Bucket,
+ hourly []web.Bucket,
+ latest []store.LatestResultsRow,
+ regionNames map[string]string,
+ uptime90 float64,
+ now time.Time,
+) *agentapi.ComponentDetails {
+ since7d := now.UTC().AddDate(0, 0, -7)
+ since30d := now.UTC().AddDate(0, 0, -30)
+ var d7, d30 []web.Bucket
+ for _, b := range daily {
+ if !b.Start.Before(since30d) {
+ d30 = append(d30, b)
+ }
+ if !b.Start.Before(since7d) {
+ d7 = append(d7, b)
+ }
+ }
+ byHour := make(map[int64]web.Bucket, len(hourly))
+ for _, b := range hourly {
+ byHour[web.AlignBucket(b.Start.UTC(), time.Hour).Unix()] = b
+ }
+ endHour := web.AlignBucket(now.UTC(), time.Hour)
+ hours := make([]agentapi.HourBucket, 24)
+ for i := range hours {
+ ts := endHour.Add(-time.Duration(23-i) * time.Hour)
+ hours[i] = agentapi.HourBucket{Time: ts, Uptime: -1}
+ if b, ok := byHour[ts.Unix()]; ok && b.Total > 0 {
+ hours[i].Uptime = float64(b.OK) / float64(b.Total)
+ hours[i].AvgLatencyMS = int(math.Round(float64(b.Latency)))
+ }
+ }
+ regs := make([]agentapi.ComponentRegion, 0, len(latest))
+ for _, l := range latest {
+ name := regionNames[l.Region]
+ if name == "" {
+ name = l.Region
+ }
+ status := agentapi.PageOperational
+ if !l.Ok {
+ status = agentapi.PageOutage
+ }
+ var latency int
+ if l.LatencyMs != nil && *l.LatencyMs > 0 {
+ latency = int(*l.LatencyMs)
+ }
+ regs = append(regs, agentapi.ComponentRegion{Name: name, Status: status, LatencyMS: latency})
+ }
+ slices.SortFunc(regs, func(a, b agentapi.ComponentRegion) int { return strings.Compare(a.Name, b.Name) })
+ return &agentapi.ComponentDetails{
+ SLA24h: web.Uptime(hourly),
+ SLA7d: web.Uptime(d7),
+ SLA30d: web.Uptime(d30),
+ SLA90d: uptime90,
+ Hours: hours,
+ Regions: regs,
+ }
+}
+
func dayHistory(buckets []web.Bucket, now time.Time) []agentapi.Day {
byDay := map[string]web.Bucket{}
for _, b := range buckets {
@@ -192,11 +346,12 @@ func (s *Server) agentPage(c *gin.Context) {
}
type statusPageRequest struct {
- Slug string `json:"slug" binding:"required,max=63"`
- Title string `json:"title" binding:"required,max=200"`
- Description string `json:"description" binding:"max=10000"`
- Published bool `json:"published"`
- Theme agentapi.Theme `json:"theme"`
+ Slug string `json:"slug" binding:"required,max=63"`
+ Title string `json:"title" binding:"required,max=200"`
+ Description string `json:"description" binding:"max=10000"`
+ Published bool `json:"published"`
+ ShowComponentDetails bool `json:"show_component_details"`
+ Theme agentapi.Theme `json:"theme"`
}
func (r *statusPageRequest) normalize() string {
@@ -226,14 +381,15 @@ func (r *statusPageRequest) normalize() string {
}
type statusPageView struct {
- ID uuid.UUID `json:"id"`
- Slug string `json:"slug"`
- Title string `json:"title"`
- Description string `json:"description"`
- Published bool `json:"published"`
- Theme agentapi.Theme `json:"theme"`
- CustomDomain *string `json:"custom_domain"`
- DomainVerified bool `json:"domain_verified"`
+ ID uuid.UUID `json:"id"`
+ Slug string `json:"slug"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Published bool `json:"published"`
+ ShowComponentDetails bool `json:"show_component_details"`
+ Theme agentapi.Theme `json:"theme"`
+ CustomDomain *string `json:"custom_domain"`
+ DomainVerified bool `json:"domain_verified"`
// DomainRecord is the TXT record that proves control of CustomDomain.
DomainRecord *dnsRecord `json:"domain_record,omitempty"`
}
@@ -246,7 +402,8 @@ type dnsRecord struct {
func viewStatusPage(p store.StatusPage) statusPageView {
v := statusPageView{
- ID: p.ID, Slug: p.Slug, Title: p.Title, Description: p.Description, Published: p.Published,
+ ID: p.ID, Slug: p.Slug, Title: p.Title, Description: p.Description,
+ Published: p.Published, ShowComponentDetails: p.ShowComponentDetails,
CustomDomain: p.CustomDomain, DomainVerified: p.DomainVerifiedAt != nil,
}
_ = json.Unmarshal(p.Theme, &v.Theme)
@@ -313,7 +470,8 @@ func (s *Server) createStatusPage(c *gin.Context) {
var err error
row, err = q.CreateStatusPage(ctx, store.CreateStatusPageParams{
OrgID: p.Org.ID, Slug: req.Slug, Title: req.Title, Description: req.Description,
- Published: req.Published, DomainToken: newDomainToken(), Theme: theme,
+ Published: req.Published, ShowComponentDetails: req.ShowComponentDetails,
+ DomainToken: newDomainToken(), Theme: theme,
})
return err
})
@@ -351,7 +509,8 @@ func (s *Server) updateStatusPage(c *gin.Context) {
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err error
row, err = q.UpdateStatusPage(ctx, store.UpdateStatusPageParams{
- ID: id, Slug: req.Slug, Title: req.Title, Description: req.Description, Published: req.Published, Theme: theme,
+ ID: id, Slug: req.Slug, Title: req.Title, Description: req.Description,
+ Published: req.Published, ShowComponentDetails: req.ShowComponentDetails, Theme: theme,
})
return err
})
@@ -389,9 +548,10 @@ func (s *Server) deleteStatusPage(c *gin.Context) {
}
type pageMonitor struct {
- MonitorID uuid.UUID `json:"monitor_id" binding:"required"`
- Section string `json:"section" binding:"max=100"`
- Label string `json:"label" binding:"max=200"`
+ MonitorID uuid.UUID `json:"monitor_id" binding:"required"`
+ GroupID *uuid.UUID `json:"group_id"`
+ Section string `json:"section" binding:"max=100"`
+ Label string `json:"label" binding:"max=200"`
}
type pageMonitorsRequest struct {
@@ -412,13 +572,33 @@ func (s *Server) setPageMonitors(c *gin.Context) {
if _, err := q.GetStatusPage(ctx, id); err != nil {
return err
}
+ existingGroups, err := q.ListStatusPageGroups(ctx, id)
+ if err != nil {
+ return err
+ }
+ groupsByID := make(map[uuid.UUID]store.StatusPageGroup, len(existingGroups))
+ topByName := map[string]store.StatusPageGroup{}
+ var nextPos int32
+ for _, g := range existingGroups {
+ groupsByID[g.ID] = g
+ if g.ParentID == nil {
+ topByName[g.Name] = g
+ if g.Position >= nextPos {
+ nextPos = g.Position + 1
+ }
+ }
+ }
if err := q.ClearStatusPageMonitors(ctx, id); err != nil {
return err
}
for i, m := range req.Monitors {
- err := q.AddStatusPageMonitor(ctx, store.AddStatusPageMonitorParams{
+ groupID, section, err := resolvePageMonitorGroup(ctx, q, id, p.Org.ID, m, groupsByID, topByName, &nextPos)
+ if err != nil {
+ return err
+ }
+ err = q.AddStatusPageMonitor(ctx, store.AddStatusPageMonitorParams{
PageID: id, MonitorID: m.MonitorID, OrgID: p.Org.ID,
- Section: strings.TrimSpace(m.Section), Label: strings.TrimSpace(m.Label), Position: int32(i),
+ Section: section, GroupID: groupID, Label: strings.TrimSpace(m.Label), Position: int32(i),
})
if err != nil {
return err
@@ -426,9 +606,12 @@ func (s *Server) setPageMonitors(c *gin.Context) {
}
return nil
})
+ var pgErr *pgconn.PgError
switch {
case errors.Is(err, pgx.ErrNoRows):
fail(c, http.StatusNotFound, "not_found")
+ case errors.As(err, &pgErr) && pgErr.Code == "23503" && strings.Contains(pgErr.ConstraintName, "group_id"):
+ fail(c, http.StatusUnprocessableEntity, "invalid_group")
case isForeignKeyViolation(err), isUniqueViolation(err, "status_page_monitors_pkey"):
// Unknown monitors, monitors of other orgs and duplicates.
fail(c, http.StatusUnprocessableEntity, "invalid_monitor")
diff --git a/internal/api/statuspages_test.go b/internal/api/statuspages_test.go
index 733a909..e5f9ee7 100644
--- a/internal/api/statuspages_test.go
+++ b/internal/api/statuspages_test.go
@@ -213,3 +213,217 @@ func verifyDomain(t *testing.T, owner *browser, pageID string, record map[string
st, body := owner.do("POST", "/api/v1/org/statuspages/"+pageID+"/domain/verify", nil)
expect(t, "verify domain", st, body, http.StatusNoContent, "")
}
+
+func TestStatusPageGroupsAndDetails(t *testing.T) {
+ e := newEnv(t)
+ ctx, cancel := context.WithCancel(context.Background())
+ t.Cleanup(cancel)
+ go e.api.RunScheduler(ctx)
+
+ up := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}))
+ defer up.Close()
+ down := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ w.WriteHeader(http.StatusInternalServerError)
+ }))
+ defer down.Close()
+ tok, region := e.platformChecker(t, uniq("eu-"))
+ e.startChecker(t, tok)
+
+ owner := e.browser(t)
+ owner.signup("o@"+uniq("spg")+".test", uniq("spg-"))
+
+ // Create monitor groups to test importing the hierarchy later.
+ st, mgRoot := owner.do("POST", "/api/v1/org/groups", map[string]any{"name": "Core"})
+ if st != http.StatusCreated {
+ t.Fatalf("create monitor root group = %d %v, want 201", st, mgRoot)
+ }
+ st, mgChild := owner.do("POST", "/api/v1/org/groups", map[string]any{
+ "name": "Edge",
+ "parent_id": mgRoot["id"],
+ })
+ if st != http.StatusCreated {
+ t.Fatalf("create monitor child group = %d %v, want 201", st, mgChild)
+ }
+
+ newMonitor := func(name, target string, groupID any) string {
+ t.Helper()
+ st, body := owner.do("POST", "/api/v1/org/monitors", map[string]any{
+ "name": name,
+ "type": "http",
+ "target": target,
+ "interval_seconds": 60,
+ "confirmations": 1,
+ "regions": []string{region},
+ "group_id": groupID,
+ })
+ if st != http.StatusCreated {
+ t.Fatalf("create monitor %q = %d %v, want 201", name, st, body)
+ }
+ return body["id"].(string)
+ }
+ webID := newMonitor("web", up.URL, mgChild["id"])
+ apiID := newMonitor("api", down.URL, mgRoot["id"])
+
+ slug := uniq("nested-")
+ st, pageBody := owner.do("POST", "/api/v1/org/statuspages", map[string]any{
+ "slug": slug,
+ "title": "Nested Status",
+ "published": true,
+ "show_component_details": false,
+ })
+ if st != http.StatusCreated {
+ t.Fatalf("create status page = %d %v, want 201", st, pageBody)
+ }
+ pageID := pageBody["id"].(string)
+
+ // Nested status page groups CRUD + cycle & depth validation.
+ st, gParent := owner.do("POST", "/api/v1/org/statuspages/"+pageID+"/groups", map[string]any{
+ "name": "Platform",
+ "position": 0,
+ })
+ if st != http.StatusCreated {
+ t.Fatalf("create page parent group = %d %v, want 201", st, gParent)
+ }
+ parentID := gParent["id"].(string)
+
+ st, gChild := owner.do("POST", "/api/v1/org/statuspages/"+pageID+"/groups", map[string]any{
+ "name": "Public Services",
+ "parent_id": parentID,
+ "position": 0,
+ })
+ if st != http.StatusCreated {
+ t.Fatalf("create page child group = %d %v, want 201", st, gChild)
+ }
+ childID := gChild["id"].(string)
+
+ // Cycle rejection.
+ st, body := owner.do("PUT", "/api/v1/org/statuspages/"+pageID+"/groups/"+parentID, map[string]any{
+ "name": "Platform",
+ "parent_id": childID,
+ })
+ expect(t, "group cycle", st, body, http.StatusUnprocessableEntity, "group_cycle")
+
+ // Assign monitors into nested groups.
+ st, body = owner.do("PUT", "/api/v1/org/statuspages/"+pageID+"/monitors", map[string]any{
+ "monitors": []map[string]any{
+ {"monitor_id": webID, "group_id": childID, "label": "Website"},
+ {"monitor_id": apiID, "group_id": parentID, "label": "API"},
+ },
+ })
+ expect(t, "assign grouped monitors", st, body, http.StatusNoContent, "")
+
+ waitFor(t, 10*time.Second, "incident for failing monitor", func() bool {
+ _, b := owner.do("GET", "/api/v1/org/incidents", nil)
+ return len(b["incidents"].([]any)) == 1
+ })
+
+ platform := e.statuspageClient(t, nil)
+ snap, err := platform.Page(context.Background(), "", slug)
+ if err != nil {
+ t.Fatalf("Page() error = %v", err)
+ }
+ if snap.ShowDetails {
+ t.Fatalf("snap.ShowDetails = true, want false")
+ }
+ if len(snap.Sections) != 1 || snap.Sections[0].Name != "Platform" ||
+ snap.Sections[0].Total != 2 || snap.Sections[0].Status != agentapi.PageDegraded ||
+ len(snap.Sections[0].Children) != 1 || snap.Sections[0].Children[0].Name != "Public Services" ||
+ snap.Sections[0].Children[0].Status != agentapi.PageOperational {
+ t.Fatalf("nested sections = %+v, want Platform(degraded,2) -> Public Services(operational,1)", snap.Sections)
+ }
+ if snap.Sections[0].Components[0].Details != nil {
+ t.Errorf("component Details populated when show_component_details=false")
+ }
+
+ // Enable show_component_details and verify snapshot details & privacy.
+ st, body = owner.do("PUT", "/api/v1/org/statuspages/"+pageID, map[string]any{
+ "slug": slug,
+ "title": "Nested Status",
+ "published": true,
+ "show_component_details": true,
+ })
+ if st != http.StatusOK || body["show_component_details"] != true {
+ t.Fatalf("enable show_component_details = %d %v, want 200 with true", st, body)
+ }
+ snap, err = platform.Page(context.Background(), "", slug)
+ if err != nil {
+ t.Fatalf("Page(with details) error = %v", err)
+ }
+ if !snap.ShowDetails {
+ t.Fatalf("snap.ShowDetails = false, want true")
+ }
+ comp, ok := snap.ComponentByID(apiID)
+ if !ok || comp.Details == nil {
+ t.Fatalf("ComponentByID(%s) = (%+v, %t), want component with Details", apiID, comp, ok)
+ }
+ if len(comp.Details.Hours) != 24 || len(comp.Details.Regions) != 1 {
+ t.Errorf("component details hours/regions = %d/%d, want 24/1", len(comp.Details.Hours), len(comp.Details.Regions))
+ }
+ raw, _ := json.Marshal(snap)
+ for _, secret := range []string{up.URL, down.URL, "unexpected status", "HTTP 500"} {
+ if strings.Contains(string(raw), secret) {
+ t.Errorf("snapshot with details leaks %q", secret)
+ }
+ }
+
+ // Verify live status page server renders component detail page.
+ cat, _ := i18n.Load()
+ spSrv, err := statuspage.New(platform, cat, slog.New(slog.DiscardHandler), statuspage.Options{Hosts: []string{"status.test"}})
+ if err != nil {
+ t.Fatalf("statuspage.New() error = %v", err)
+ }
+ gin.SetMode(gin.TestMode)
+ router := gin.New()
+ spSrv.Mount(router)
+ req := httptest.NewRequest(http.MethodGet, "/"+slug+"/components/"+apiID, nil)
+ req.Host = "status.test"
+ rec := httptest.NewRecorder()
+ router.ServeHTTP(rec, req)
+ if rec.Code != http.StatusOK || !strings.Contains(rec.Body.String(), "API") || !strings.Contains(rec.Body.String(), "Last 24 hours") {
+ t.Errorf("GET detail page = %d, want 200 with component details", rec.Code)
+ }
+
+ // Static export has no broken /components/ links and embeds inline details.
+ resp, err := owner.hc.Get(owner.base + "/api/v1/org/statuspages/" + pageID + "/export")
+ if err != nil {
+ t.Fatalf("export request error = %v", err)
+ }
+ exported, _ := io.ReadAll(resp.Body)
+ _ = resp.Body.Close()
+ if resp.StatusCode != http.StatusOK || strings.Contains(string(exported), "/components/") || !strings.Contains(string(exported), "Show details") {
+ t.Errorf("export status = %d, want inline details without /components/ links", resp.StatusCode)
+ }
+
+ // Delete child group: monitor moves up to parent group.
+ st, body = owner.do("DELETE", "/api/v1/org/statuspages/"+pageID+"/groups/"+childID, nil)
+ expect(t, "delete child group", st, body, http.StatusNoContent, "")
+ snap, err = platform.Page(context.Background(), "", slug)
+ if err != nil {
+ t.Fatalf("Page(after delete) error = %v", err)
+ }
+ if len(snap.Sections) != 1 || len(snap.Sections[0].Components) != 2 || len(snap.Sections[0].Children) != 0 {
+ t.Errorf("after deleting child group, sections = %+v, want 2 monitors under Platform", snap.Sections)
+ }
+
+ // Import monitor groups copies Core -> Edge and re-assigns monitors.
+ st, imported := owner.do("POST", "/api/v1/org/statuspages/"+pageID+"/groups/import", nil)
+ if st != http.StatusOK || len(imported["groups"].([]any)) != 2 {
+ t.Fatalf("import groups = %d %v, want 200 with 2 groups", st, imported)
+ }
+ snap, err = platform.Page(context.Background(), "", slug)
+ if err != nil {
+ t.Fatalf("Page(after import) error = %v", err)
+ }
+ if len(snap.Sections) != 1 || snap.Sections[0].Name != "Core" ||
+ len(snap.Sections[0].Children) != 1 || snap.Sections[0].Children[0].Name != "Edge" {
+ t.Errorf("imported sections = %+v, want Core -> Edge", snap.Sections)
+ }
+
+ // Console editor shows new controls.
+ st, _, html := owner.page("/statuspages/" + pageID)
+ for _, want := range []string{`name="show_component_details"`, `/groups/import`, `data-field="group_id"`} {
+ if st != http.StatusOK || !strings.Contains(html, want) {
+ t.Errorf("editor HTML = %d, missing %q", st, want)
+ }
+ }
+}
diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json
index d720082..6f97aea 100644
--- a/internal/i18n/locales/de.json
+++ b/internal/i18n/locales/de.json
@@ -111,6 +111,10 @@
"audit.action.statuspage.delete": "Statusseite gelöscht",
"audit.action.statuspage.domain_update": "Eigene Domain geändert",
"audit.action.statuspage.domain_verify": "Eigene Domain verifiziert",
+ "audit.action.statuspage.group_create": "Statusseiten-Gruppe erstellt",
+ "audit.action.statuspage.group_delete": "Statusseiten-Gruppe gelöscht",
+ "audit.action.statuspage.group_update": "Statusseiten-Gruppe geändert",
+ "audit.action.statuspage.groups_import": "Statusseiten-Gruppen aus Monitor-Gruppen übernommen",
"audit.action.statuspage.monitors_update": "Monitore der Statusseite geändert",
"audit.action.statuspage.update": "Statusseite geändert",
"audit.action.token.create": "API-Token erstellt",
@@ -979,6 +983,9 @@
"one": "vor {{.Count}} Tag",
"other": "vor {{.Count}} Tagen"
},
+ "page.details_expand": "Details anzeigen",
+ "page.details_last_24h": "Letzte 24 Stunden",
+ "page.details_latency_summary": "Ø {{.Avg}} · Max {{.Max}}",
"page.incidents": "Letzte Vorfälle",
"page.maintenance_ongoing": "Laufende Wartung",
"page.maintenance_upcoming": "Geplante Wartung",
@@ -1005,14 +1012,24 @@
"pages.domain_verified": "Domain geprüft.",
"pages.draft": "Entwurf",
"pages.export": "Als HTML exportieren",
+ "pages.group": "Gruppe",
+ "pages.group_position": "Reihenfolge",
+ "pages.groups": "Gruppen",
+ "pages.groups_import": "Aus Monitor-Gruppen übernehmen",
+ "pages.groups_import_confirm": "Die Gruppen dieser Statusseite durch die Monitor-Gruppenstruktur der Organisation ersetzen?",
+ "pages.groups_imported": "Gruppen aus den Monitor-Gruppen übernommen.",
+ "pages.groups_intro": "Ordne Komponenten in einklappbare, verschachtelte Gruppen – genau wie auf der Monitore-Seite.",
"pages.intro": "Öffentliche Seiten mit dem Zustand ausgewählter Monitore. Jede Seite kann eine eigene Domain nutzen oder als einzelne HTML-Datei exportiert werden.",
"pages.label": "Öffentlicher Name",
"pages.logo": "Logo-URL (https)",
+ "pages.no_group": "Ohne Gruppe",
"pages.open": "Öffnen",
"pages.page_title": "Titel",
"pages.published": "Veröffentlicht",
"pages.section": "Abschnitt",
"pages.settings": "Einstellungen",
+ "pages.show_details": "Monitor-Details beim Anklicken anzeigen",
+ "pages.show_details_hint": "Erlaubt Besuchern eine Detailansicht mit 24h-Verlauf, Latenz, SLA und Regionen-Status. Ziele, Fehlermeldungen und Zugangsdaten bleiben immer privat.",
"pages.slug": "Kurzname (URL)",
"pages.theme": "Theme",
"pages.title": "Statuspages",
diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json
index 72cefb1..08c27c5 100644
--- a/internal/i18n/locales/en.json
+++ b/internal/i18n/locales/en.json
@@ -111,6 +111,10 @@
"audit.action.statuspage.delete": "Status page deleted",
"audit.action.statuspage.domain_update": "Custom domain changed",
"audit.action.statuspage.domain_verify": "Custom domain verified",
+ "audit.action.statuspage.group_create": "Status page group created",
+ "audit.action.statuspage.group_delete": "Status page group deleted",
+ "audit.action.statuspage.group_update": "Status page group changed",
+ "audit.action.statuspage.groups_import": "Status page groups imported from monitor groups",
"audit.action.statuspage.monitors_update": "Status page monitors changed",
"audit.action.statuspage.update": "Status page changed",
"audit.action.token.create": "API token created",
@@ -979,6 +983,9 @@
"one": "{{.Count}} day ago",
"other": "{{.Count}} days ago"
},
+ "page.details_expand": "Show details",
+ "page.details_last_24h": "Last 24 hours",
+ "page.details_latency_summary": "avg {{.Avg}} · max {{.Max}}",
"page.incidents": "Recent incidents",
"page.maintenance_ongoing": "Maintenance in progress",
"page.maintenance_upcoming": "Planned maintenance",
@@ -1005,14 +1012,24 @@
"pages.domain_verified": "Domain verified.",
"pages.draft": "draft",
"pages.export": "Export as HTML",
+ "pages.group": "Group",
+ "pages.group_position": "Order",
+ "pages.groups": "Groups",
+ "pages.groups_import": "Import from monitor groups",
+ "pages.groups_import_confirm": "Replace this status page's groups with the organization's monitor group tree?",
+ "pages.groups_imported": "Groups imported from monitor groups.",
+ "pages.groups_intro": "Organize components into collapsible nested groups, just like on the monitors page.",
"pages.intro": "Public pages showing the state of selected monitors. Each page can use its own domain or be exported as a single HTML file.",
"pages.label": "Public name",
"pages.logo": "Logo URL (https)",
+ "pages.no_group": "No group",
"pages.open": "Open",
"pages.page_title": "Title",
"pages.published": "Published",
"pages.section": "Section",
"pages.settings": "Settings",
+ "pages.show_details": "Show component details on click",
+ "pages.show_details_hint": "Lets visitors open a detail view with 24h history, latency, SLA and region status. Targets, errors and credentials always stay private.",
"pages.slug": "Short name (URL)",
"pages.theme": "Theme",
"pages.title": "Status pages",
diff --git a/internal/migrations/sql/00041_status_page_groups_and_details.sql b/internal/migrations/sql/00041_status_page_groups_and_details.sql
new file mode 100644
index 0000000..e85a5de
--- /dev/null
+++ b/internal/migrations/sql/00041_status_page_groups_and_details.sql
@@ -0,0 +1,96 @@
+-- +goose Up
+ALTER TABLE status_pages
+ ADD COLUMN show_component_details boolean NOT NULL DEFAULT false;
+
+CREATE TABLE status_page_groups (
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
+ page_id uuid NOT NULL,
+ org_id uuid NOT NULL,
+ parent_id uuid,
+ name text NOT NULL CHECK (length(name) BETWEEN 1 AND 100),
+ position integer NOT NULL DEFAULT 0,
+ created_at timestamptz NOT NULL DEFAULT now(),
+ updated_at timestamptz NOT NULL DEFAULT now(),
+ UNIQUE (id, page_id, org_id),
+ CHECK (parent_id IS DISTINCT FROM id),
+ FOREIGN KEY (page_id, org_id) REFERENCES status_pages (id, org_id) ON DELETE CASCADE,
+ FOREIGN KEY (parent_id, page_id, org_id) REFERENCES status_page_groups (id, page_id, org_id) ON DELETE SET NULL (parent_id)
+);
+
+CREATE INDEX status_page_groups_page_idx ON status_page_groups (page_id, position, name);
+CREATE INDEX status_page_groups_parent_idx ON status_page_groups (parent_id);
+
+-- +goose StatementBegin
+-- Rejects cycles and nesting deeper than eight levels within a status page.
+CREATE FUNCTION status_page_groups_tree_check() RETURNS trigger
+LANGUAGE plpgsql AS $$
+DECLARE
+ depth integer;
+BEGIN
+ IF NEW.parent_id IS NULL THEN
+ RETURN NEW;
+ END IF;
+ WITH RECURSIVE up AS (
+ SELECT id, parent_id, 1 AS depth FROM status_page_groups WHERE id = NEW.parent_id
+ UNION ALL
+ SELECT g.id, g.parent_id, up.depth + 1 FROM status_page_groups g JOIN up ON g.id = up.parent_id
+ WHERE up.depth < 20
+ )
+ SELECT max(up.depth) INTO depth FROM up;
+ IF EXISTS (
+ WITH RECURSIVE up AS (
+ SELECT id, parent_id FROM status_page_groups WHERE id = NEW.parent_id
+ UNION
+ SELECT g.id, g.parent_id FROM status_page_groups g JOIN up ON g.id = up.parent_id
+ )
+ SELECT 1 FROM up WHERE id = NEW.id
+ ) THEN
+ RAISE EXCEPTION 'status page group cycle' USING ERRCODE = 'check_violation', CONSTRAINT = 'status_page_groups_cycle';
+ END IF;
+ IF depth >= 8 THEN
+ RAISE EXCEPTION 'status page groups nested too deeply' USING ERRCODE = 'check_violation', CONSTRAINT = 'status_page_groups_depth';
+ END IF;
+ RETURN NEW;
+END
+$$;
+-- +goose StatementEnd
+
+CREATE TRIGGER status_page_groups_tree BEFORE INSERT OR UPDATE OF parent_id ON status_page_groups
+ FOR EACH ROW EXECUTE FUNCTION status_page_groups_tree_check();
+
+ALTER TABLE status_page_groups ENABLE ROW LEVEL SECURITY;
+ALTER TABLE status_page_groups FORCE ROW LEVEL SECURITY;
+CREATE POLICY status_page_groups_tenant ON status_page_groups FOR ALL
+ USING (app_scope_system() OR org_id = app_org_id())
+ WITH CHECK (app_scope_system() OR org_id = app_org_id());
+
+ALTER TABLE status_page_monitors ADD COLUMN group_id uuid;
+ALTER TABLE status_page_monitors
+ ADD FOREIGN KEY (group_id, page_id, org_id) REFERENCES status_page_groups (id, page_id, org_id) ON DELETE SET NULL (group_id);
+CREATE INDEX status_page_monitors_group_idx ON status_page_monitors (group_id);
+
+WITH existing_sections AS (
+ SELECT page_id, org_id, section, min(position) AS first_pos
+ FROM status_page_monitors
+ WHERE section <> ''
+ GROUP BY page_id, org_id, section
+)
+INSERT INTO status_page_groups (page_id, org_id, name, position)
+SELECT page_id, org_id, section,
+ (row_number() OVER (PARTITION BY page_id ORDER BY first_pos, section) - 1)::integer
+FROM existing_sections;
+
+UPDATE status_page_monitors spm
+SET group_id = g.id
+FROM status_page_groups g
+WHERE g.page_id = spm.page_id
+ AND g.org_id = spm.org_id
+ AND g.parent_id IS NULL
+ AND g.name = spm.section
+ AND spm.section <> '';
+
+-- +goose Down
+ALTER TABLE status_page_monitors DROP COLUMN group_id;
+DROP TABLE status_page_groups;
+DROP FUNCTION status_page_groups_tree_check();
+ALTER TABLE status_pages DROP COLUMN show_component_details;
diff --git a/internal/migrations/status_page_groups_test.go b/internal/migrations/status_page_groups_test.go
new file mode 100644
index 0000000..fd5586d
--- /dev/null
+++ b/internal/migrations/status_page_groups_test.go
@@ -0,0 +1,90 @@
+package migrations
+
+import (
+ "context"
+ "os"
+ "strings"
+ "testing"
+
+ "github.com/google/uuid"
+ "github.com/jackc/pgx/v5"
+)
+
+func TestStatusPageGroupsBackfill(t *testing.T) {
+ dsn := os.Getenv("UPTIME_TEST_DATABASE_URL")
+ if dsn == "" {
+ t.Skip("UPTIME_TEST_DATABASE_URL not set")
+ }
+ ctx := context.Background()
+ if _, err := Up(ctx, dsn); err != nil {
+ t.Fatalf("Up() error = %v", err)
+ }
+ conn, err := pgx.Connect(ctx, dsn)
+ if err != nil {
+ t.Fatalf("pgx.Connect() error = %v", err)
+ }
+ defer func() { _ = conn.Close(ctx) }()
+ tx, err := conn.Begin(ctx)
+ if err != nil {
+ t.Fatalf("conn.Begin() error = %v", err)
+ }
+ defer func() { _ = tx.Rollback(ctx) }()
+ if _, err := tx.Exec(ctx, "SET LOCAL app.scope = 'system'"); err != nil {
+ t.Fatalf("SET LOCAL app.scope error = %v", err)
+ }
+ raw, err := files.ReadFile("sql/00041_status_page_groups_and_details.sql")
+ if err != nil {
+ t.Fatalf("ReadFile(00041) error = %v", err)
+ }
+ up, down, ok := strings.Cut(string(raw), "-- +goose Down")
+ if !ok {
+ t.Fatal("00041_status_page_groups_and_details.sql missing -- +goose Down")
+ }
+ if _, err := tx.Exec(ctx, down); err != nil {
+ t.Fatalf("down migration error = %v", err)
+ }
+
+ orgID := uuid.New()
+ pageID := uuid.New()
+ m1, m2, m3 := uuid.New(), uuid.New(), uuid.New()
+ if _, err := tx.Exec(ctx, `INSERT INTO orgs (id, slug, name) VALUES ($1, $2, 'Migration Org')`, orgID, "sp-mig-"+orgID.String()); err != nil {
+ t.Fatalf("insert org error = %v", err)
+ }
+ if _, err := tx.Exec(ctx, `INSERT INTO status_pages (id, org_id, slug, title, domain_token) VALUES ($1, $2, $3, 'Status', 'tok')`, pageID, orgID, "sp-"+pageID.String()[:12]); err != nil {
+ t.Fatalf("insert status_page error = %v", err)
+ }
+ for i, id := range []uuid.UUID{m1, m2, m3} {
+ if _, err := tx.Exec(ctx, `INSERT INTO monitors (id, org_id, name, type, target, interval_seconds, timeout_ms) VALUES ($1, $2, $3, 'tcp', 'example.test:443', 60, 1000)`, id, orgID, "M"+string(rune('1'+i))); err != nil {
+ t.Fatalf("insert monitor %d error = %v", i, err)
+ }
+ }
+ rows := []struct {
+ id uuid.UUID
+ section string
+ pos int
+ }{
+ {id: m1, section: "Frontend", pos: 0},
+ {id: m2, section: "Backend", pos: 1},
+ {id: m3, section: "", pos: 2},
+ }
+ for _, r := range rows {
+ if _, err := tx.Exec(ctx, `INSERT INTO status_page_monitors (page_id, monitor_id, org_id, section, position) VALUES ($1, $2, $3, $4, $5)`, pageID, r.id, orgID, r.section, r.pos); err != nil {
+ t.Fatalf("insert status_page_monitors(%s) error = %v", r.section, err)
+ }
+ }
+
+ if _, err := tx.Exec(ctx, up); err != nil {
+ t.Fatalf("up migration error = %v", err)
+ }
+ var groups, linked, ungrouped int
+ err = tx.QueryRow(ctx, `SELECT
+ (SELECT count(*) FROM status_page_groups WHERE page_id = $1),
+ (SELECT count(*) FROM status_page_monitors WHERE page_id = $1 AND group_id IS NOT NULL),
+ (SELECT count(*) FROM status_page_monitors WHERE page_id = $1 AND group_id IS NULL)`, pageID).Scan(&groups, &linked, &ungrouped)
+ if err != nil {
+ t.Fatalf("verify counts error = %v", err)
+ }
+ if groups != 2 || linked != 2 || ungrouped != 1 {
+ t.Fatalf("backfilled groups/linked/ungrouped = %d/%d/%d, want 2/2/1", groups, linked, ungrouped)
+ }
+}
diff --git a/internal/statuspage/statuspage.go b/internal/statuspage/statuspage.go
index 2eca8f4..f4d582f 100644
--- a/internal/statuspage/statuspage.go
+++ b/internal/statuspage/statuspage.go
@@ -192,29 +192,40 @@ func (s *Server) serve(c *gin.Context) {
return
}
host := hostOnly(c.Request.Host)
- parts := strings.Split(strings.Trim(c.Request.URL.Path, "/"), "/")
- var key, slug, base, legal string
+ trimmed := strings.Trim(c.Request.URL.Path, "/")
+ parts := strings.Split(trimmed, "/")
+ var key, slug, base, legal, compID string
custom := s.IsCustomDomain(host)
switch {
case custom:
key, base = "host:"+host, "/"
- if len(parts) > 1 {
+ switch {
+ case trimmed == "":
+ case len(parts) == 1:
+ legal = parts[0]
+ case len(parts) == 2 && parts[0] == "components" && parts[1] != "":
+ compID = parts[1]
+ default:
c.Status(http.StatusNotFound)
return
}
default:
slug = parts[0]
- if len(parts) == 2 {
- legal = parts[1]
- }
- if slug == "" || len(parts) > 2 {
+ if slug == "" {
c.Status(http.StatusNotFound)
return
}
key, host, base = "slug:"+slug, "", "/"+slug+"/"
- }
- if custom {
- legal = parts[0]
+ switch {
+ case len(parts) == 1:
+ case len(parts) == 2:
+ legal = parts[1]
+ case len(parts) == 3 && parts[1] == "components" && parts[2] != "":
+ compID = parts[2]
+ default:
+ c.Status(http.StatusNotFound)
+ return
+ }
}
e, ok := s.lookup(c.Request.Context(), key, host, slug)
if !ok {
@@ -229,9 +240,38 @@ func (s *Server) serve(c *gin.Context) {
if s.now().Sub(e.Fetched) > staleNoticeAfter {
staleSince = e.Fetched
}
+ assets := web.PublicAssets{
+ CSSHref: "/static/dist/app.css",
+ StaleSince: staleSince,
+ LegalBase: base,
+ ComponentBase: base,
+ Now: s.now(),
+ }
+ if compID != "" {
+ s.serveComponent(c, e, compID, assets)
+ return
+ }
s.localizeRequest(c)
c.Header("Cache-Control", "public, max-age=30")
- web.Render(c, http.StatusOK, web.PublicStatusPage(e.Snap.WithMaintenance(s.now()), web.PublicAssets{CSSHref: "/static/dist/app.css", StaleSince: staleSince, LegalBase: base, Now: s.now()}))
+ web.Render(c, http.StatusOK, web.PublicStatusPage(e.Snap.WithMaintenance(s.now()), assets))
+}
+
+// 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) {
+ snap := e.Snap.WithMaintenance(assets.Now)
+ if !snap.ShowDetails {
+ c.Status(http.StatusNotFound)
+ return
+ }
+ comp, ok := snap.ComponentByID(compID)
+ if !ok {
+ c.Status(http.StatusNotFound)
+ return
+ }
+ s.localizeRequest(c)
+ c.Header("Cache-Control", "public, max-age=30")
+ web.Render(c, http.StatusOK, web.PublicComponentPage(snap, comp, assets))
}
// serveLegal shows a legal document of the page from the cached snapshot,
diff --git a/internal/statuspage/statuspage_test.go b/internal/statuspage/statuspage_test.go
index 7994389..1781796 100644
--- a/internal/statuspage/statuspage_test.go
+++ b/internal/statuspage/statuspage_test.go
@@ -299,3 +299,137 @@ func TestMaintenanceStartsWhileAPIIsDown(t *testing.T) {
t.Error("ended maintenance is still shown")
}
}
+
+func TestNestedGroupsAndComponentDetails(t *testing.T) {
+ now := time.Date(2026, 11, 22, 12, 0, 0, 0, time.UTC)
+ hours := make([]agentapi.HourBucket, 24)
+ for i := range hours {
+ hours[i] = agentapi.HourBucket{
+ Time: now.Add(-time.Duration(23-i) * time.Hour),
+ Uptime: 1,
+ AvgLatencyMS: 35 + i,
+ }
+ }
+ snap := agentapi.PageSnapshot{
+ Slug: "acme",
+ Title: "Acme status",
+ Status: agentapi.PageDegraded,
+ ShowDetails: true,
+ GeneratedAt: now,
+ Sections: []agentapi.Section{
+ {
+ Name: "Platform",
+ Status: agentapi.PageDegraded,
+ Total: 2,
+ Children: []agentapi.Section{
+ {
+ Name: "API",
+ Status: agentapi.PageOutage,
+ Total: 1,
+ Components: []agentapi.Component{
+ {
+ ID: "comp-api",
+ Name: "Public API",
+ Status: agentapi.PageOutage,
+ Uptime: 0.995,
+ Days: []agentapi.Day{{Date: "2026-11-22", Uptime: 0.995}},
+ Details: &agentapi.ComponentDetails{
+ SLA24h: 0.99,
+ SLA7d: 0.995,
+ SLA30d: 0.998,
+ SLA90d: 0.995,
+ Hours: hours,
+ Regions: []agentapi.ComponentRegion{
+ {Name: "Frankfurt", Status: agentapi.PageOperational, LatencyMS: 42},
+ },
+ },
+ },
+ },
+ },
+ },
+ Components: []agentapi.Component{
+ {
+ ID: "comp-web",
+ Name: "Website",
+ Status: agentapi.PageOperational,
+ Uptime: 1,
+ Days: []agentapi.Day{{Date: "2026-11-22", Uptime: 1}},
+ },
+ },
+ },
+ },
+ Incidents: []agentapi.PageIncident{
+ {Component: "Public API", StartedAt: now.Add(-10 * time.Minute)},
+ },
+ }
+
+ src := &fakeSource{pages: map[string]agentapi.PageSnapshot{
+ "|acme": snap,
+ "status.acme.test|": snap,
+ }}
+ h := newHarness(t, src, t.TempDir(), &now)
+
+ t.Run("main page renders nested groups and clickable links", func(t *testing.T) {
+ code, body := h.get("status.example.test", "/acme")
+ if code != http.StatusOK {
+ t.Fatalf("GET /acme = %d, want 200", code)
+ }
+ for _, want := range []string{" {
const obj = {};
for (const f of row.querySelectorAll("[data-field]")) {
- if (f.dataset.field !== "include") obj[f.dataset.field] = f.value;
+ if (f.dataset.field !== "include") {
+ obj[f.dataset.field] = f.dataset.nullable !== undefined ? (f.value || null) : f.value;
+ }
}
return obj;
});
@@ -165,6 +167,7 @@
}
const post = ev.target.closest("[data-post]");
if (post) {
+ if (post.dataset.confirm && !confirm(post.dataset.confirm)) return;
post.disabled = true;
try {
await api.post(post.dataset.post);
diff --git a/internal/web/public.go b/internal/web/public.go
index b425727..68b9b8b 100644
--- a/internal/web/public.go
+++ b/internal/web/public.go
@@ -1,7 +1,10 @@
package web
import (
+ "fmt"
"io/fs"
+ "strconv"
+ "strings"
"time"
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
@@ -19,6 +22,9 @@ type PublicAssets struct {
// "/acme/" or "/" on a custom domain. Empty leaves them out, as in a
// single-file export, which can only link elsewhere.
LegalBase string
+ // ComponentBase prefixes links to component detail pages, e.g. "/acme/"
+ // or "/". Empty in static single-file exports where subpages do not exist.
+ ComponentBase string
// Now is the moment the page shows, deciding which maintenance is in
// progress.
Now time.Time
@@ -39,7 +45,7 @@ func StylesheetText() (string, error) {
return string(b), err
}
-// DayBars turns a component's history into bars.
+// DayBars turns a component's 90-day history into bars.
func DayBars(days []agentapi.Day) []Bar {
out := make([]Bar, len(days))
for i, d := range days {
@@ -52,6 +58,54 @@ func DayBars(days []agentapi.Day) []Bar {
return out
}
+// HourBars turns a component's 24-hour history into bars.
+func HourBars(hours []agentapi.HourBucket) []Bar {
+ out := make([]Bar, len(hours))
+ for i, h := range hours {
+ label := h.Time.UTC().Format("15:04") + " UTC"
+ if h.Uptime < 0 {
+ out[i] = Bar{Status: StatusUnknown, Title: label + " · –"}
+ continue
+ }
+ title := label + " · " + Percent(h.Uptime)
+ if h.AvgLatencyMS > 0 {
+ title += fmt.Sprintf(" · %d ms", h.AvgLatencyMS)
+ }
+ out[i] = Bar{Status: ratioStatus(h.Uptime), Title: title}
+ }
+ return out
+}
+
+// HourLatency builds the SVG polyline for a component's 24-hour latency.
+func HourLatency(hours []agentapi.HourBucket, width, height int) LatencyLine {
+ if len(hours) < 2 {
+ return LatencyLine{Width: width, Height: height}
+ }
+ buckets := make([]Bucket, 0, len(hours))
+ for _, h := range hours {
+ if h.Uptime < 0 || h.AvgLatencyMS <= 0 {
+ continue
+ }
+ buckets = append(buckets, Bucket{Start: h.Time, Total: 1, OK: 1, Latency: float32(h.AvgLatencyMS)})
+ }
+ return Latency(buckets, hours[0].Time, hours[len(hours)-1].Time, width, height)
+}
+
+// AvgLatencyText formats the mean latency across hourly buckets with data.
+func AvgLatencyText(hours []agentapi.HourBucket) string {
+ var sum, count int
+ for _, h := range hours {
+ if h.Uptime >= 0 && h.AvgLatencyMS > 0 {
+ sum += h.AvgLatencyMS
+ count++
+ }
+ }
+ if count == 0 {
+ return "–"
+ }
+ return strconv.Itoa(sum/count) + " ms"
+}
+
// PageStatus maps a page state to the chart statuses used for colors.
func PageStatus(s string) Status {
switch s {
@@ -67,7 +121,49 @@ func PageStatus(s string) Status {
return StatusUnknown
}
-// UptimeText formats a component's 90-day uptime.
+// SectionStatus returns a section's aggregated status, falling back to
+// summarizing its direct components for legacy cached snapshots.
+func SectionStatus(sec agentapi.Section) Status {
+ if sec.Status != "" {
+ return PageStatus(sec.Status)
+ }
+ states := make([]string, len(sec.Components))
+ for i, c := range sec.Components {
+ states[i] = c.Status
+ }
+ return PageStatus(agentapi.Summarize(states))
+}
+
+// SectionTotal returns the total component count in sec and its descendants.
+func SectionTotal(sec agentapi.Section) int {
+ if sec.Total > 0 {
+ return sec.Total
+ }
+ total := len(sec.Components)
+ for _, child := range sec.Children {
+ total += SectionTotal(child)
+ }
+ return total
+}
+
+// ComponentHref returns the detail link for comp when clickable details are
+// enabled on a live status page server, or "" otherwise.
+func ComponentHref(base string, comp agentapi.Component, showDetails bool) string {
+ if !showDetails || base == "" || comp.ID == "" {
+ return ""
+ }
+ return base + "components/" + comp.ID
+}
+
+// BackHref turns a page base prefix ("/acme/" or "/") into the page's root URL.
+func BackHref(base string) string {
+ if base == "" || base == "/" {
+ return "/"
+ }
+ return strings.TrimSuffix(base, "/")
+}
+
+// UptimeText formats a component's uptime ratio, or "–" without data.
func UptimeText(r float64) string {
if r < 0 {
return "–"
diff --git a/internal/web/public.templ b/internal/web/public.templ
index e78cd2f..0c4a942 100644
--- a/internal/web/public.templ
+++ b/internal/web/public.templ
@@ -1,6 +1,7 @@
package web
import (
+ "strconv"
"strings"
"time"
@@ -8,14 +9,14 @@ import (
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
-templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
+templ publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) {
- { s.Title }
+ { docTitle }
if a.InlineCSS == "" {
@faviconLinks()
}
@@ -33,84 +34,7 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
-
- if !a.StaleSince.IsZero() {
-
- { i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC") }
-
- }
-
- { i18n.T(ctx, "page.status."+s.Status) }
-
- @pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now))
- for _, sec := range s.Sections {
-
- if sec.Name != "" {
- { sec.Name }
- }
-
- for _, comp := range sec.Components {
- -
-
- @statusDot(PageStatus(comp.Status))
- { comp.Name }
- { i18n.T(ctx, "page.component."+comp.Status) }
-
- @bars(DayBars(comp.Days), 22)
-
- { i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)) }
- { UptimeText(comp.Uptime) }
- { i18n.T(ctx, "page.today") }
-
-
- }
-
-
- }
- @pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))
-
- { i18n.T(ctx, "page.incidents") }
- if len(s.Incidents) == 0 {
- { i18n.T(ctx, "page.no_incidents") }
- } else {
-
- for _, inc := range s.Incidents {
- -
- if inc.ResolvedAt == nil {
- { i18n.T(ctx, "incidents.ongoing") }
- } else {
- { i18n.T(ctx, "incidents.resolved") }
- }
- { inc.Component }
-
- { inc.StartedAt.UTC().Format("2006-01-02 15:04") }
- if inc.ResolvedAt != nil {
- – { inc.ResolvedAt.UTC().Format("15:04") }
- }
- UTC
-
-
- }
-
- }
-
+ { children... }
+ @bars(HourBars(comp.Details.Hours), 24)
+ {{ lat := HourLatency(comp.Details.Hours, 600, 96) }}
+ if lat.Points != "" {
+
+ { i18n.T(ctx, "monitors.latency") }
+ { i18n.T(ctx, "page.details_latency_summary", "Avg", AvgLatencyText(comp.Details.Hours), "Max", strconv.Itoa(lat.MaxMS)+" ms") }
+
+
+ }
+
+
+ { i18n.T(ctx, "monitors.sla_table") }
+ @publicSLAGrid(comp.Details)
+
+ if len(comp.Details.Regions) > 0 {
+
+ { i18n.T(ctx, "monitors.regions") }
+ @publicRegionsList(comp.Details.Regions)
+
+ }
+ }
+
+
+
{ i18n.T(ctx, "monitors.last_90d") }
+ { UptimeText(comp.Uptime) }
+
+ @bars(DayBars(comp.Days), 24)
+
+ { i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)) }
+ { UptimeText(comp.Uptime) }
+ { i18n.T(ctx, "page.today") }
+
+
+ @pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), upcoming)
+ @publicIncidents(s.IncidentsForComponent(comp.Name))
+ }
+}
+
+templ publicSLAGrid(d *agentapi.ComponentDetails) {
+
+ for _, item := range []struct {
+ label string
+ value float64
+ }{
+ {"24h", d.SLA24h},
+ {"7d", d.SLA7d},
+ {"30d", d.SLA30d},
+ {"90d", d.SLA90d},
+ } {
+
+
- { item.label }
+ - { UptimeText(item.value) }
+
+ }
+
+}
+
+templ publicRegionsList(regions []agentapi.ComponentRegion) {
+
+ for _, r := range regions {
+ -
+ @statusDot(PageStatus(r.Status))
+ { r.Name }
+
+ { i18n.T(ctx, "page.component."+r.Status) }
+ if r.LatencyMS > 0 {
+ { " · " + strconv.Itoa(r.LatencyMS) + " ms" }
+ }
+
+
+ }
+
+}
+
+templ publicIncidents(incidents []agentapi.PageIncident) {
+
+ { i18n.T(ctx, "page.incidents") }
+ if len(incidents) == 0 {
+ { i18n.T(ctx, "page.no_incidents") }
+ } else {
+
+ for _, inc := range incidents {
+ -
+ if inc.ResolvedAt == nil {
+ { i18n.T(ctx, "incidents.ongoing") }
+ } else {
+ { i18n.T(ctx, "incidents.resolved") }
+ }
+ { inc.Component }
+
+ { inc.StartedAt.UTC().Format("2006-01-02 15:04") }
+ if inc.ResolvedAt != nil {
+ – { inc.ResolvedAt.UTC().Format("15:04") }
+ }
+ UTC
+
+
+ }
+
+ }
+
+}
+
templ pageMaintenance(heading string, items []agentapi.PageMaintenance) {
if len(items) > 0 {
diff --git a/internal/web/public_templ.go b/internal/web/public_templ.go
index 1de8921..3577e16 100644
--- a/internal/web/public_templ.go
+++ b/internal/web/public_templ.go
@@ -10,6 +10,7 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
+ "strconv"
"strings"
"time"
@@ -17,7 +18,7 @@ import (
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
-func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
+func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -33,6 +34,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, l := range PageLegalLinks(s, a.LegalBase) {
+ templ_7745c5c3_Err = legalLink(l).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+ templ_7745c5c3_Err = brandMark("h-3.5 w-3.5").Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " UptimeSebi")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func publicStaleNotice(a PublicAssets) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
if !a.StaleSince.IsZero() {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var8 string
- templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC"))
+ var templ_7745c5c3_Var7 string
+ templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 49, Col: 95}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 58, Col: 92}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
+ return nil
+ })
+}
+
+func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Var9 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if s.Theme.LogoURL != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var12 string
+ templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 69, Col: 88}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if s.Description != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ.Raw(Markdown(s.Description)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicStaleNotice(a).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ {
+ templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
+ templ_7745c5c3_Buffer := templ.GetBuffer()
+ var templ_7745c5c3_ElementScripts []templ.ComponentScript
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var15 string
+ templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.status."+s.Status))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 85, Col: 72}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if len(s.Sections) > 0 {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, sec := range s.Sections {
+ templ_7745c5c3_Err = publicSection(sec, s, a).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicIncidents(s.Incidents).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+ templ_7745c5c3_Err = publicShell(s, a, s.Title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+// publicSection renders an unnamed root component list or a collapsible nested
+// group matching the monitor dashboard hierarchy.
+func publicSection(sec agentapi.Section, s agentapi.PageSnapshot, a PublicAssets) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ if sec.Name == "" {
+ templ_7745c5c3_Err = publicComponentList(sec.Components, s, a).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = statusDot(SectionStatus(sec)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var17 string
+ templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(sec.Name)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 109, Col: 20}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var18 string
+ templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(SectionTotal(sec)))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 110, Col: 92}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var19 string
+ templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+string(secStatusName(sec))))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 111, Col: 116}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicComponentList(sec.Components, s, a).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, child := range sec.Children {
+ templ_7745c5c3_Err = publicSection(child, s, a).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ return nil
+ })
+}
+
+func secStatusName(sec agentapi.Section) string {
+ if sec.Status != "" {
+ return sec.Status
+ }
+ states := make([]string, len(sec.Components))
+ for i, c := range sec.Components {
+ states[i] = c.Status
+ }
+ return agentapi.Summarize(states)
+}
+
+func publicComponentList(comps []agentapi.Component, s agentapi.PageSnapshot, a PublicAssets) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ if len(comps) > 0 {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, comp := range comps {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "- ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if href := ComponentHref(a.ComponentBase, comp, s.ShowDetails); href != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicComponentBody(comp, true).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ templ_7745c5c3_Err = publicComponentBody(comp, false).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if s.ShowDetails && comp.Details != nil {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var22 string
+ templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.details_expand"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 147, Col: 102}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicSLAGrid(comp.Details).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if len(comp.Details.Regions) > 0 {
+ templ_7745c5c3_Err = publicRegionsList(comp.Details.Regions).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ return nil
+ })
+}
+
+func publicComponentBody(comp agentapi.Component, clickable bool) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = statusDot(PageStatus(comp.Status)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
{
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
templ_7745c5c3_Buffer := templ.GetBuffer()
var templ_7745c5c3_ElementScripts []templ.ComponentScript
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, ">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var11 string
- templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.status."+s.Status))
+ var templ_7745c5c3_Var26 string
+ templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 60, Col: 74}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 166, Col: 87}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now)).Render(ctx, templ_7745c5c3_Buffer)
+ var templ_7745c5c3_Var27 string
+ templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 168, Col: 53}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- for _, sec := range s.Sections {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- if sec.Name != "" {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var12 string
- templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(sec.Name)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 66, Col: 90}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- for _, comp := range sec.Components {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = statusDot(PageStatus(comp.Status)).Render(ctx, templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var13 string
- templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 73, Col: 27}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var14 string
- templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status))
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 74, Col: 95}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = bars(DayBars(comp.Days), 22).Render(ctx, templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var15 string
- templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)))
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 78, Col: 71}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var16 string
- templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 79, Col: 41}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, " ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var17 string
- templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today"))
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 80, Col: 43}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if clickable {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "→")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now)).Render(ctx, templ_7745c5c3_Buffer)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "")
+ templ_7745c5c3_Err = bars(DayBars(comp.Days), 22).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var18 string
- templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.incidents"))
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 89, Col: 109}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "")
+ var templ_7745c5c3_Var28 string
+ templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 176, Col: 63}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- if len(s.Incidents) == 0 {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var29 string
+ templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 177, Col: 33}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var30 string
+ templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 178, Col: 35}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a PublicAssets) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Var32 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "\" class=\"text-muted hover:text-ink\">← ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var34 string
+ templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 185, Col: 103}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = statusDot(PageStatus(comp.Status)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var35 string
+ templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 190, Col: 21}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicStaleNotice(a).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ {
+ templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
+ templ_7745c5c3_Buffer := templ.GetBuffer()
+ var templ_7745c5c3_ElementScripts []templ.ComponentScript
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var38 string
+ templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 202, Col: 80}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ ongoing, upcoming := s.MaintenanceForComponent(comp.Name, a.Now)
+ templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), ongoing).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if comp.Details != nil {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var39 string
+ templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.details_last_24h"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 209, Col: 111}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var40 string
+ templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Details.SLA24h))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 210, Col: 70}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = bars(HourBars(comp.Details.Hours), 24).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ lat := HourLatency(comp.Details.Hours, 600, 96)
+ if lat.Points != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var41 string
+ templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.latency"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 216, Col: 45}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var42 string
+ templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.details_latency_summary", "Avg", AvgLatencyText(comp.Details.Hours), "Max", strconv.Itoa(lat.MaxMS)+" ms"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 217, Col: 138}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var45 string
+ templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.sla_table"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 225, Col: 112}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicSLAGrid(comp.Details).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if len(comp.Details.Regions) > 0 {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var46 string
+ templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.regions"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 230, Col: 111}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicRegionsList(comp.Details.Regions).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var47 string
+ templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.last_90d"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 237, Col: 106}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var48 string
+ templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 238, Col: 61}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = bars(DayBars(comp.Days), 24).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var49 string
+ templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 242, Col: 65}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var50 string
+ templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 243, Col: 35}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var51 string
+ templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 244, Col: 37}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), upcoming).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = publicIncidents(s.IncidentsForComponent(comp.Name)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+ templ_7745c5c3_Err = publicShell(s, a, comp.Name+" · "+s.Title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var32), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func publicSLAGrid(d *agentapi.ComponentDetails) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, item := range []struct {
+ label string
+ value float64
+ }{
+ {"24h", d.SLA24h},
+ {"7d", d.SLA7d},
+ {"30d", d.SLA30d},
+ {"90d", d.SLA90d},
+ } {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "- ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var53 string
+ templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(item.label)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 264, Col: 57}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "
- ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var54 string
+ templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(item.value))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 265, Col: 58}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func publicRegionsList(regions []agentapi.ComponentRegion) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, r := range regions {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "- ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = statusDot(PageStatus(r.Status)).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var56 string
+ templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 276, Col: 18}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var57 string
+ templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+r.Status))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 278, Col: 46}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, " ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if r.LatencyMS > 0 {
+ var templ_7745c5c3_Var58 string
+ templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + strconv.Itoa(r.LatencyMS) + " ms")
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 280, Col: 50}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var60 string
+ templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.incidents"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 290, Col: 106}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if len(incidents) == 0 {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var61 string
+ templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.no_incidents"))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 292, Col: 67}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- for _, inc := range s.Incidents {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "- ")
+ for _, inc := range incidents {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "
- ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inc.ResolvedAt == nil {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var20 string
- templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing"))
+ var templ_7745c5c3_Var62 string
+ templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 97, Col: 80}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 298, Col: 77}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var21 string
- templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved"))
+ var templ_7745c5c3_Var63 string
+ templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 99, Col: 67}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 300, Col: 64}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var22 string
- templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Component)
+ var templ_7745c5c3_Var64 string
+ templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Component)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 101, Col: 30}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 302, Col: 27}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var23 string
- templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(inc.StartedAt.UTC().Format("2006-01-02 15:04"))
+ var templ_7745c5c3_Var65 string
+ templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(inc.StartedAt.UTC().Format("2006-01-02 15:04"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 103, Col: 58}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 304, Col: 55}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inc.ResolvedAt != nil {
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "– ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "– ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var24 string
- templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(inc.ResolvedAt.UTC().Format("15:04"))
+ var templ_7745c5c3_Var66 string
+ templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(inc.ResolvedAt.UTC().Format("15:04"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 105, Col: 53}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 306, Col: 50}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, " ")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "UTC
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "UTC")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "