From 98fb5d3a8224935e120ec792bc89725fc6747c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 21:40:25 +0100 Subject: [PATCH 1/2] fix(datapolicy): read running TimescaleDB jobs A running job reports -infinity as its next start, which failed the storage overview and, intermittently, its test. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/datapolicy/stats.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/datapolicy/stats.go b/internal/datapolicy/stats.go index 4559e92..4715495 100644 --- a/internal/datapolicy/stats.go +++ b/internal/datapolicy/stats.go @@ -88,7 +88,9 @@ func Collect(ctx context.Context, pool *pgxpool.Pool) (Stats, error) { rows, err = pool.Query(ctx, ` SELECT j.job_id, j.proc_name, coalesce(j.hypertable_name, ''), coalesce(st.last_run_status, ''), - st.last_run_started_at, st.next_start, coalesce(st.total_failures, 0) + -- A running job reports -infinity as its next start. + nullif(nullif(st.last_run_started_at, '-infinity'), 'infinity'), + nullif(nullif(st.next_start, '-infinity'), 'infinity'), coalesce(st.total_failures, 0) FROM timescaledb_information.jobs j LEFT JOIN timescaledb_information.job_stats st USING (job_id) WHERE j.proc_name LIKE 'policy_%' AND j.proc_name <> 'policy_telemetry' From d7c5cd711e837ceb95fbfa0b6f631307cf3775ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 21:40:25 +0100 Subject: [PATCH 2/2] feat: page long and truncated lists Lists that were cut off by a fixed LIMIT, or could grow without bound, are paged by keyset: the cursor holds the sort key and an ID, so pages neither skip nor repeat items as others are added. The audit logs had a timestamp-only cursor that could skip entries with equal times. The API returns at most 100 items per list (limit takes up to 500) with next_cursor and prev_cursor, passed back as after and before. The console shows Newer/Older (or Previous/Next) links and To the start, without JavaScript. Paged: incidents (optionally of one monitor), a monitor's results and evidence, a checker's results, the audit logs, members, maintenance windows, firing Alertmanager alerts, the monitors API and the admin lists of status pages and organizations, which move to their own admin pages. A monitor's page shows its latest incidents and results and links to all of them. The dashboard caps every group at 50 of its own monitors with a link to a paged view of the group, and gains a search by name or target. Lists filtered by permission after reading may show fewer items on a page. Closes #116 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/api/alertmanager.go | 38 +- internal/api/apidocs.go | 39 +- internal/api/audit.go | 70 +- internal/api/channels.go | 41 +- internal/api/checkers.go | 67 +- internal/api/console.go | 276 +- internal/api/evidence.go | 70 +- internal/api/limits.go | 27 +- internal/api/limits_test.go | 2 +- internal/api/maintenance.go | 27 +- internal/api/members.go | 19 +- internal/api/moderation.go | 26 +- internal/api/moderation_test.go | 2 +- internal/api/monitors.go | 13 +- internal/api/openapi.go | 5 +- internal/api/pages.go | 42 +- internal/api/paging.go | 218 ++ internal/api/paging_internal_test.go | 75 + internal/api/paging_test.go | 184 + internal/api/server.go | 1 + internal/i18n/i18n_test.go | 1 + internal/i18n/locales/de.json | 23 +- internal/i18n/locales/en.json | 23 +- internal/store/alertmanager.sql.go | 69 + internal/store/audit.sql.go | 32 +- internal/store/check_results.sql.go | 159 +- internal/store/evidence.sql.go | 67 +- internal/store/incidents.sql.go | 63 +- internal/store/limits.sql.go | 33 +- internal/store/maintenance.sql.go | 61 + internal/store/memberships.sql.go | 64 + internal/store/moderation.sql.go | 30 +- internal/store/monitors.sql.go | 61 + internal/store/querier.go | 37 +- internal/store/queries/alertmanager.sql | 14 + internal/store/queries/audit.sql | 12 +- internal/store/queries/check_results.sql | 36 +- internal/store/queries/evidence.sql | 16 +- internal/store/queries/incidents.sql | 15 +- internal/store/queries/limits.sql | 14 +- internal/store/queries/maintenance.sql | 12 + internal/store/queries/memberships.sql | 13 + internal/store/queries/moderation.sql | 11 +- internal/store/queries/monitors.sql | 12 + internal/store/results_test.go | 3 +- internal/web/admin_orgs.templ | 20 +- internal/web/admin_orgs_templ.go | 237 +- internal/web/alertmanager.templ | 2 + internal/web/alertmanager_templ.go | 41 +- internal/web/audit.templ | 6 +- internal/web/audit_templ.go | 136 +- internal/web/checkers.templ | 2 + internal/web/checkers_templ.go | 59 +- internal/web/maintenance.templ | 2 + internal/web/maintenance_templ.go | 81 +- internal/web/monitors.templ | 182 +- internal/web/monitors_templ.go | 4175 ++++++++++++---------- internal/web/org.templ | 2 + internal/web/org_templ.go | 161 +- internal/web/pager.templ | 30 + internal/web/pager_templ.go | 165 + internal/web/regions.templ | 58 +- internal/web/regions_templ.go | 986 ++--- 63 files changed, 5427 insertions(+), 3041 deletions(-) create mode 100644 internal/api/paging.go create mode 100644 internal/api/paging_internal_test.go create mode 100644 internal/api/paging_test.go create mode 100644 internal/web/pager.templ create mode 100644 internal/web/pager_templ.go diff --git a/internal/api/alertmanager.go b/internal/api/alertmanager.go index 4d8839a..13defe7 100644 --- a/internal/api/alertmanager.go +++ b/internal/api/alertmanager.go @@ -327,22 +327,34 @@ type alertMonitorRef struct { // firingAlertViews lists the organization's firing alerts and which // monitors they hold down, so alerts no monitor follows stand out. -func (s *Server) firingAlertViews(ctx context.Context, p *principal) ([]alertView, error) { +// firingAlertViews reads a page of firing alerts, newest first, with the +// monitors they match. +func (s *Server) firingAlertViews(ctx context.Context, p *principal, pg pageReq) ([]alertView, pageInfo, error) { now := time.Now() var ( - alerts []firingAlert + rows []store.FiringAlertsPageRow monitors []store.AlertmanagerMonitorsRow ) err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { var err error - if alerts, err = loadFiringAlerts(ctx, q, p.Org.ID, now.Add(-time.Duration(check.DefaultStaleHours)*time.Hour)); err != nil { + if rows, err = q.FiringAlertsPage(ctx, store.FiringAlertsPageParams{ + OrgID: p.Org.ID, Since: now.Add(-time.Duration(check.DefaultStaleHours) * time.Hour), + AfterT: pg.afterT(), AfterS: pg.afterS(), BeforeT: pg.beforeT(), BeforeS: pg.beforeS(), MaxRows: pg.fetch(), + }); err != nil { return err } monitors, err = q.AlertmanagerMonitors(ctx, &p.Org.ID) return err }) if err != nil { - return nil, err + return nil, pageInfo{}, err + } + rows, info := paginate(pg, rows, func(r store.FiringAlertsPageRow) cursor { return cursor{T: r.StartsAt, S: r.Fingerprint} }) + alerts := make([]firingAlert, len(rows)) + for i, r := range rows { + alerts[i] = firingAlert{Fingerprint: r.Fingerprint, StartsAt: r.StartsAt, UpdatedAt: r.UpdatedAt, GeneratorURL: r.GeneratorUrl} + _ = json.Unmarshal(r.Labels, &alerts[i].Labels) + _ = json.Unmarshal(r.Annotations, &alerts[i].Annotations) } out := make([]alertView, len(alerts)) for i, a := range alerts { @@ -355,16 +367,20 @@ func (s *Server) firingAlertViews(ctx context.Context, p *principal) ([]alertVie } } } - return out, nil + return out, info, nil } func (s *Server) listFiringAlerts(c *gin.Context) { - out, err := s.firingAlertViews(c.Request.Context(), current(c)) + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + out, info, err := s.firingAlertViews(c.Request.Context(), current(c), pg) if err != nil { internalError(c, err) return } - c.JSON(http.StatusOK, gin.H{"alerts": out}) + c.JSON(http.StatusOK, gin.H{"alerts": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) } // suggestedMatchers proposes matchers for a monitor following a: its @@ -384,11 +400,15 @@ func suggestedMatchers(a firingAlert) []check.Matcher { func (s *Server) alertmanagerPage(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { ctx := c.Request.Context() - alerts, err := s.firingAlertViews(ctx, p) + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + alerts, info, err := s.firingAlertViews(ctx, p, pg) if err != nil { return nil, err } - v := web.AlertmanagerView{CanManage: p.Grants.Can(authz.OrgManage)} + v := web.AlertmanagerView{CanManage: p.Grants.Can(authz.OrgManage), Pager: pager(c, info)} for _, a := range alerts { row := web.AlertRow{ Name: a.Labels["alertname"], Summary: a.Annotations["summary"], diff --git a/internal/api/apidocs.go b/internal/api/apidocs.go index c9e5ffa..1f337f1 100644 --- a/internal/api/apidocs.go +++ b/internal/api/apidocs.go @@ -12,6 +12,12 @@ import ( // sessionStarted is the answer of requests that sign in. var sessionStarted = obj{"status": "", "csrf_token": ""} +// paged adds the cursors of a paged list to its response. +func paged(o obj) obj { + o["next_cursor"], o["prev_cursor"] = "", "" + return o +} + // endpoints documents every route under /api/v1, in the order the docs // show them. var endpoints = []endpoint{ @@ -39,7 +45,7 @@ var endpoints = []endpoint{ {method: "POST", path: "/api/v1/me/totp/recovery-codes", tag: "Account", summary: "Replace the recovery codes", sessionOnly: true, req: reauthRequest{}, resp: obj{"recovery_codes": []string{}}}, {method: "GET", path: "/api/v1/me/audit", tag: "Account", summary: "Sign-ins and security changes of the account", - resp: obj{"events": []auditEventView{}}}, + description: "Paged, newest first.", resp: paged(obj{"events": []auditEventView{}})}, {method: "GET", path: "/api/v1/me/export", tag: "Account", summary: "Export all personal data (GDPR Art. 15, 20)", description: "`?format=pdf` returns a PDF instead of JSON.", resp: accountExport{}}, {method: "POST", path: "/api/v1/me/delete", tag: "Account", summary: "Delete the account (GDPR Art. 17)", sessionOnly: true, @@ -54,8 +60,8 @@ var endpoints = []endpoint{ // Monitors {method: "GET", path: "/api/v1/org/monitors", tag: "Monitors", summary: "List monitors with their latest results", - description: "Only monitors the caller may read; header values and heartbeat tokens only for those who may change the monitor.", - perm: "monitors.read", resp: obj{"monitors": []monitorView{}}}, + description: "Paged by name. Only monitors the caller may read, so a page may hold fewer; header values and heartbeat tokens only for those who may change the monitor.", + perm: "monitors.read", resp: paged(obj{"monitors": []monitorView{}})}, {method: "POST", path: "/api/v1/org/monitors", tag: "Monitors", summary: "Create a monitor", description: "`type` is one of http, json, prometheus, tcp, tls, dns, icmp, postgres, mysql, mssql, mongodb, redis, mqtt, kafka, rabbitmq, grpc, smtp, radius, snmp, steam, minecraft, docker, heartbeat or alertmanager (GET /api/v1/org/check-types lists those offered); `config` depends on it (see HTTPConfig, JSONConfig, PrometheusConfig, DNSConfig, TLSConfig, DBConfig, BrokerConfig, GRPCConfig, SMTPConfig, RADIUSConfig, SNMPConfig, GameConfig, DockerConfig, HeartbeatConfig, AlertmanagerConfig). Passwords, RADIUS secrets and SNMP communities are stored encrypted and never returned: `secrets_set` names those set, and an update that leaves one empty keeps it. Heartbeat and alertmanager monitors take neither target nor regions; heartbeats return their `ping_url`. Omit `alert_group_ids` to assign the default alert group; an empty array disables notifications.", perm: "monitors.write", req: monitorRequest{}, status: http.StatusCreated, resp: monitorView{}}, @@ -65,12 +71,14 @@ var endpoints = []endpoint{ {method: "DELETE", path: "/api/v1/org/monitors/:id", tag: "Monitors", summary: "Delete a monitor and its history", perm: "monitors.write", status: http.StatusNoContent}, {method: "GET", path: "/api/v1/org/monitors/:id/evidence", tag: "Monitors", summary: "What checkers saw: captured responses", - perm: "monitors.write", resp: obj{"evidence": []evidenceSummary{}}}, + description: "Paged, newest first.", perm: "monitors.write", resp: paged(obj{"evidence": []evidenceSummary{}})}, + {method: "GET", path: "/api/v1/org/monitors/:id/results", tag: "Monitors", summary: "A monitor's check results", + description: "Paged, newest first, back to the end of raw result retention.", resp: paged(obj{"results": []resultView{}})}, {method: "GET", path: "/api/v1/org/monitors/:id/evidence/:evidence", tag: "Monitors", summary: "One captured response", description: "Redirect chain with headers, timing, certificate and the first 32 KiB of the body.", perm: "monitors.write", resp: obj{"id": uuid.UUID{}, "region": "", "checker_id": uuid.UUID{}, "time": time.Time{}, "ok": false, "status_code": new(int32), "error": new(string), "evidence": check.Evidence{}}}, {method: "GET", path: "/api/v1/org/checkers/:id", tag: "Monitors", summary: "What a checker instance is doing", - description: "Platform checkers serve every organization; other organizations' work appears only as a count.", + description: "Platform checkers serve every organization; other organizations' work appears only as a count. `recent` is paged, newest first; a page may hold fewer results than `limit` when some belong to monitors you cannot read.", resp: checkerActivity{}}, {method: "GET", path: "/api/v1/org/limits", tag: "Organization", summary: "Limits in effect for the organization and its usage", description: "0 means unlimited. Creating beyond a limit gives 422 monitor_limit, status_page_limit, region_limit or platform_region_limit.", @@ -88,7 +96,7 @@ var endpoints = []endpoint{ {method: "DELETE", path: "/api/v1/org/groups/:id", tag: "Monitors", summary: "Delete a group; its content moves up", perm: "monitors.write", status: http.StatusNoContent}, {method: "GET", path: "/api/v1/org/maintenance", tag: "Monitors", summary: "List maintenance windows", perm: "monitors.read", - resp: obj{"maintenance": []maintenanceView{}}}, + description: "Paged, latest start first. Only windows the caller may read, so a page may hold fewer.", resp: paged(obj{"maintenance": []maintenanceView{}})}, {method: "POST", path: "/api/v1/org/maintenance", tag: "Monitors", summary: "Plan maintenance", description: "During maintenance, failures open no incidents and send no notifications.", perm: "monitors.write", req: maintenanceRequest{}, status: http.StatusCreated, resp: maintenanceView{}}, @@ -97,8 +105,8 @@ var endpoints = []endpoint{ {method: "DELETE", path: "/api/v1/org/maintenance/:id", tag: "Monitors", summary: "Delete maintenance", perm: "monitors.write", status: http.StatusNoContent}, {method: "GET", path: "/api/v1/org/alertmanager/alerts", tag: "Monitors", summary: "Alerts Alertmanager reports as firing", - description: "With the alertmanager monitors each alert holds down; alerts no monitor follows have none.", - perm: "monitors.read", resp: obj{"alerts": []alertView{}}}, + description: "Paged, newest first. With the alertmanager monitors each alert holds down; alerts no monitor follows have none.", + perm: "monitors.read", resp: paged(obj{"alerts": []alertView{}})}, {method: "GET", path: "/api/v1/org/alertmanager/receivers", tag: "Monitors", summary: "List Alertmanager receivers", perm: "org.manage", resp: obj{"receivers": []receiverView{}}}, {method: "POST", path: "/api/v1/org/alertmanager/receivers", tag: "Monitors", summary: "Create a receiver URL for Alertmanager's webhook", @@ -107,7 +115,7 @@ var endpoints = []endpoint{ {method: "DELETE", path: "/api/v1/org/alertmanager/receivers/:id", tag: "Monitors", summary: "Delete a receiver", perm: "org.manage", sessionOnly: true, status: http.StatusNoContent}, {method: "GET", path: "/api/v1/org/incidents", tag: "Monitors", summary: "List incidents", perm: "incidents.read", - resp: obj{"incidents": []incidentView{}}}, + description: "Paged, newest first. `monitor_id` limits them to one monitor.", resp: paged(obj{"incidents": []incidentView{}})}, // Status pages {method: "GET", path: "/api/v1/org/statuspages", tag: "Status pages", summary: "List status pages", resp: obj{"pages": []statusPageView{}}}, @@ -164,7 +172,7 @@ var endpoints = []endpoint{ {method: "PUT", path: "/api/v1/org/policy", tag: "Organization", summary: "Set sign-in and token policies", perm: "org.manage", sessionOnly: true, req: policyRequest{}, resp: obj{"require_totp": false, "require_sso": false, "api_token_max_days": new(int32)}}, {method: "GET", path: "/api/v1/org/members", tag: "Organization", summary: "List members and their roles", perm: "members.read", - resp: obj{"members": []memberView{}}}, + description: "Paged by email.", resp: paged(obj{"members": []memberView{}})}, {method: "DELETE", path: "/api/v1/org/members/:user", tag: "Organization", summary: "Remove a member", perm: "members.manage", sessionOnly: true, status: http.StatusNoContent}, {method: "POST", path: "/api/v1/org/members/:user/roles", tag: "Organization", summary: "Assign a role, optionally limited to a group or status page", @@ -219,8 +227,7 @@ var endpoints = []endpoint{ description: "Markdown or a link; a link wins. Both empty removes the document.", perm: "org.manage", req: legalRequest{}, status: http.StatusNoContent}, {method: "GET", path: "/api/v1/org/audit", tag: "Organization", summary: "The organization's audit log", perm: "audit.read", - description: "Newest first; pass `next_before` of the answer as `?before=` for older entries.", - resp: obj{"events": []auditEventView{}}}, + description: "Paged, newest first.", resp: paged(obj{"events": []auditEventView{}})}, {method: "GET", path: "/api/v1/org/export", tag: "Organization", summary: "Export the organization's data", perm: "org.manage", sessionOnly: true, description: "`?format=pdf` returns a PDF instead of JSON.", resp: orgExport{}}, {method: "POST", path: "/api/v1/org/delete", tag: "Organization", summary: "Delete the organization with all its data", sessionOnly: true, @@ -229,7 +236,7 @@ var endpoints = []endpoint{ // Platform {method: "GET", path: "/api/v1/admin/audit", tag: "Platform", summary: "Platform audit log", perm: "platform admin", - resp: obj{"events": []auditEventView{}}}, + description: "Paged, newest first.", resp: paged(obj{"events": []auditEventView{}})}, {method: "GET", path: "/api/v1/admin/legal", tag: "Platform", summary: "Platform legal notice and privacy policy", perm: "platform admin", resp: obj{"documents": []legalView{}}}, {method: "PUT", path: "/api/v1/admin/legal/:kind", tag: "Platform", summary: "Set a platform legal document", perm: "platform admin", @@ -249,14 +256,14 @@ var endpoints = []endpoint{ description: "0 means unlimited. Defaults apply at once to every organization and account without an override of its own. Lowering a limit below current usage keeps everything; only new monitors, status pages, regions or organizations are refused.", perm: "platform admin", req: limitsRequest{}, status: http.StatusNoContent}, {method: "GET", path: "/api/v1/admin/orgs", tag: "Platform", summary: "Organizations with usage, limits and owner", - description: "Newest first, at most 500. `q` searches name, slug and owner email.", perm: "platform admin", resp: obj{"orgs": []adminOrg{}}}, + description: "Paged, newest first. `q` searches name, slug and owner email.", perm: "platform admin", resp: paged(obj{"orgs": []adminOrg{}})}, {method: "PUT", path: "/api/v1/admin/orgs/:id/limits", tag: "Platform", summary: "Override an organization's limits", description: "null follows the platform default, 0 means unlimited.", perm: "platform admin", req: orgLimitsView{}, status: http.StatusNoContent}, {method: "PUT", path: "/api/v1/admin/users/:id/limits", tag: "Platform", summary: "Override how many organizations an account may own", description: "null follows the platform default, 0 means unlimited.", perm: "platform admin", req: userLimitsRequest{}, status: http.StatusNoContent}, {method: "GET", path: "/api/v1/admin/status-pages", tag: "Platform", summary: "Public and suspended status pages with organization and owner", - description: "Newest first, at most 500. `q` searches title, slug, domain, organization and owner email.", - perm: "platform admin", resp: obj{"status_pages": []moderatedPage{}}}, + description: "Paged, newest first. `q` searches title, slug, domain, organization and owner email.", + perm: "platform admin", resp: paged(obj{"status_pages": []moderatedPage{}})}, {method: "PUT", path: "/api/v1/admin/status-pages/:id/suspension", tag: "Platform", summary: "Suspend or reinstate a status page", description: "A suspended page is not served; status page servers drop it when they next ask for it.", perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent}, diff --git a/internal/api/audit.go b/internal/api/audit.go index 7ee5f26..9ed5c3c 100644 --- a/internal/api/audit.go +++ b/internal/api/audit.go @@ -6,7 +6,6 @@ import ( "encoding/json" "net/http" "net/netip" - "net/url" "strings" "time" @@ -282,23 +281,17 @@ func (s *Server) writeAudit(c *gin.Context, e store.InsertAuditEventParams, deta } } -const auditPageSize = 100 - -// auditQuery reads one page of entries; before pages back in time. -func (s *Server) auditQuery(ctx context.Context, scope tenant.Scope, p store.ListAuditEventsParams, before string) ([]store.ListAuditEventsRow, error) { - if t, err := time.Parse(time.RFC3339Nano, before); err == nil { - p.Before = &t - } - if p.MaxRows == 0 { - p.MaxRows = auditPageSize - } +// auditQuery reads a page of entries, newest first. +func (s *Server) auditQuery(ctx context.Context, scope tenant.Scope, p store.ListAuditEventsParams, pg pageReq) ([]store.ListAuditEventsRow, pageInfo, error) { + p.AfterT, p.AfterID, p.BeforeT, p.BeforeID, p.MaxRows = pg.afterT(), pg.afterID(), pg.beforeT(), pg.beforeID(), pg.fetch() var rows []store.ListAuditEventsRow err := s.db.Tx(ctx, scope, func(q *store.Queries) error { var err error rows, err = q.ListAuditEvents(ctx, p) return err }) - return rows, err + rows, info := paginate(pg, rows, func(r store.ListAuditEventsRow) cursor { return cursor{T: r.Time, ID: r.ID} }) + return rows, info, err } type auditEventView struct { @@ -316,7 +309,7 @@ type auditEventView struct { RequestID string `json:"request_id,omitempty"` } -func auditJSON(c *gin.Context, rows []store.ListAuditEventsRow, err error) { +func auditJSON(c *gin.Context, rows []store.ListAuditEventsRow, info pageInfo, err error) { if err != nil { internalError(c, err) return @@ -329,28 +322,30 @@ func auditJSON(c *gin.Context, rows []store.ListAuditEventsRow, err error) { IP: r.Ip, UserAgent: r.UserAgent, RequestID: r.RequestID, } } - resp := gin.H{"events": out} - if len(rows) == auditPageSize { - resp["next_before"] = rows[len(rows)-1].Time.Format(time.RFC3339Nano) - } - c.JSON(http.StatusOK, resp) + c.JSON(http.StatusOK, gin.H{"events": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) } func (s *Server) listOrgAudit(c *gin.Context) { - p := current(c) - rows, err := s.auditQuery(c.Request.Context(), p.scope(), store.ListAuditEventsParams{Kind: "org", OrgID: &p.Org.ID}, c.Query("before")) - auditJSON(c, rows, err) + if pg, ok := parsePage(c, apiPageSize); ok { + p := current(c) + rows, info, err := s.auditQuery(c.Request.Context(), p.scope(), store.ListAuditEventsParams{Kind: "org", OrgID: &p.Org.ID}, pg) + auditJSON(c, rows, info, err) + } } func (s *Server) listMyAudit(c *gin.Context) { - sess := auth.Current(c) - rows, err := s.auditQuery(c.Request.Context(), tenant.User(sess.UserID), store.ListAuditEventsParams{Kind: "user", Actor: &sess.UserID}, c.Query("before")) - auditJSON(c, rows, err) + if pg, ok := parsePage(c, apiPageSize); ok { + sess := auth.Current(c) + rows, info, err := s.auditQuery(c.Request.Context(), tenant.User(sess.UserID), store.ListAuditEventsParams{Kind: "user", Actor: &sess.UserID}, pg) + auditJSON(c, rows, info, err) + } } func (s *Server) listPlatformAudit(c *gin.Context) { - rows, err := s.auditQuery(c.Request.Context(), tenant.System(), store.ListAuditEventsParams{Kind: "platform"}, c.Query("before")) - auditJSON(c, rows, err) + if pg, ok := parsePage(c, apiPageSize); ok { + rows, info, err := s.auditQuery(c.Request.Context(), tenant.System(), store.ListAuditEventsParams{Kind: "platform"}, pg) + auditJSON(c, rows, info, err) + } } // auditEntries prepares rows for the console. Unknown actions, say from a @@ -391,11 +386,15 @@ func auditEntries(c *gin.Context, rows []store.ListAuditEventsRow) []web.AuditEn } func (s *Server) auditView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { - rows, err := s.auditQuery(c.Request.Context(), p.scope(), store.ListAuditEventsParams{Kind: "org", OrgID: &p.Org.ID}, c.Query("before")) + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + rows, info, err := s.auditQuery(c.Request.Context(), p.scope(), store.ListAuditEventsParams{Kind: "org", OrgID: &p.Org.ID}, pg) if err != nil { return nil, err } - return web.AuditPage(page, me, "audit.title", "audit.intro", auditEntries(c, rows), nextAuditPage(c, rows)), nil + return web.AuditPage(page, me, "audit.title", "audit.intro", auditEntries(c, rows), pager(c, info)), nil } func (s *Server) adminAuditPage(c *gin.Context) { @@ -403,17 +402,14 @@ func (s *Server) adminAuditPage(c *gin.Context) { if !ok { return } - rows, err := s.auditQuery(c.Request.Context(), tenant.System(), store.ListAuditEventsParams{Kind: "platform"}, c.Query("before")) + pg, ok := parsePage(c, consolePageSize) + if !ok { + return + } + rows, info, err := s.auditQuery(c.Request.Context(), tenant.System(), store.ListAuditEventsParams{Kind: "platform"}, pg) if err != nil { internalError(c, err) return } - web.Render(c, http.StatusOK, web.AuditPage(s.pageFor(c, "audit.platform_title"), me, "audit.platform_title", "audit.platform_intro", auditEntries(c, rows), nextAuditPage(c, rows))) -} - -func nextAuditPage(c *gin.Context, rows []store.ListAuditEventsRow) string { - if len(rows) < auditPageSize { - return "" - } - return c.Request.URL.Path + "?before=" + url.QueryEscape(rows[len(rows)-1].Time.Format(time.RFC3339Nano)) + web.Render(c, http.StatusOK, web.AuditPage(s.pageFor(c, "audit.platform_title"), me, "audit.platform_title", "audit.platform_intro", auditEntries(c, rows), pager(c, info))) } diff --git a/internal/api/channels.go b/internal/api/channels.go index 8f60bbc..511c811 100644 --- a/internal/api/channels.go +++ b/internal/api/channels.go @@ -1,6 +1,7 @@ package api import ( + "context" "crypto/rand" "encoding/base64" "encoding/hex" @@ -290,15 +291,45 @@ type incidentView struct { Cause map[string]string `json:"cause"` } -func (s *Server) listIncidents(c *gin.Context) { - p := current(c) - ctx := c.Request.Context() +// incidentPage reads a page of incidents, newest first, of one monitor +// if monitor is set. +func (s *Server) incidentPage(ctx context.Context, p *principal, pg pageReq, monitor *uuid.UUID) ([]store.ListIncidentsRow, pageInfo, error) { var rows []store.ListIncidentsRow err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { var err error - rows, err = q.ListIncidents(ctx) + rows, err = q.ListIncidents(ctx, store.ListIncidentsParams{ + MonitorID: monitor, AfterT: pg.afterT(), AfterID: pg.afterID(), BeforeT: pg.beforeT(), BeforeID: pg.beforeID(), MaxRows: pg.fetch(), + }) return err }) + rows, info := paginate(pg, rows, func(r store.ListIncidentsRow) cursor { return cursor{T: r.StartedAt, ID: r.ID} }) + return rows, info, err +} + +// monitorFilter reads the optional monitor query parameter. +func monitorFilter(c *gin.Context, name string) (*uuid.UUID, bool) { + raw := c.Query(name) + if raw == "" { + return nil, true + } + id, err := uuid.Parse(raw) + if err != nil { + fail(c, http.StatusUnprocessableEntity, "invalid_input") + return nil, false + } + return &id, true +} + +func (s *Server) listIncidents(c *gin.Context) { + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + monitor, ok := monitorFilter(c, "monitor_id") + if !ok { + return + } + rows, info, err := s.incidentPage(c.Request.Context(), current(c), pg, monitor) if err != nil { internalError(c, err) return @@ -308,5 +339,5 @@ func (s *Server) listIncidents(c *gin.Context) { out[i] = incidentView{ID: r.ID, MonitorID: r.MonitorID, MonitorName: r.MonitorName, StartedAt: r.StartedAt, ResolvedAt: r.ResolvedAt} _ = json.Unmarshal(r.Cause, &out[i].Cause) } - c.JSON(http.StatusOK, gin.H{"incidents": out}) + c.JSON(http.StatusOK, gin.H{"incidents": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) } diff --git a/internal/api/checkers.go b/internal/api/checkers.go index f147ba4..49a9a54 100644 --- a/internal/api/checkers.go +++ b/internal/api/checkers.go @@ -104,20 +104,23 @@ func (s *Server) runningOn(ctx context.Context, instance uuid.UUID, now time.Tim // Platform checkers work for every organization: only the viewer's own // monitors are named, the rest is counted. type checkerActivity struct { - ID uuid.UUID `json:"id"` - Agent string `json:"agent"` - Region string `json:"region"` - Platform bool `json:"platform"` - Release string `json:"release"` - StartedAt time.Time `json:"started_at"` - LastSeenAt time.Time `json:"last_seen_at"` - Live bool `json:"live"` - Queued int64 `json:"queued"` - Running []runningView `json:"running"` - OtherOrgs int `json:"running_for_others"` - LastHour checkerHourStats `json:"last_hour"` - Recent []recentByCheck `json:"recent"` - Siblings []uuid.UUID `json:"other_instances"` + ID uuid.UUID `json:"id"` + Agent string `json:"agent"` + Region string `json:"region"` + Platform bool `json:"platform"` + Release string `json:"release"` + StartedAt time.Time `json:"started_at"` + LastSeenAt time.Time `json:"last_seen_at"` + Live bool `json:"live"` + Queued int64 `json:"queued"` + Running []runningView `json:"running"` + OtherOrgs int `json:"running_for_others"` + LastHour checkerHourStats `json:"last_hour"` + Recent []recentByCheck `json:"recent"` + // NextCursor and PrevCursor page through Recent, newest first. + NextCursor string `json:"next_cursor,omitempty"` + PrevCursor string `json:"prev_cursor,omitempty"` + Siblings []uuid.UUID `json:"other_instances"` regionID string monitorName map[uuid.UUID]string } @@ -148,7 +151,7 @@ var errNoChecker = errors.New("api: checker not found") // loadCheckerActivity gathers the activity of a checker instance visible to // p: platform instances and those of p's organization. -func (s *Server) loadCheckerActivity(ctx context.Context, p *principal, instance uuid.UUID) (checkerActivity, error) { +func (s *Server) loadCheckerActivity(ctx context.Context, p *principal, instance uuid.UUID, pg pageReq) (checkerActivity, error) { now := time.Now() a := checkerActivity{ID: instance, Running: []runningView{}, Recent: []recentByCheck{}, Siblings: []uuid.UUID{}, monitorName: map[uuid.UUID]string{}} t, err := s.loadGroupTree(ctx, p.scope()) @@ -194,7 +197,15 @@ func (s *Server) loadCheckerActivity(ctx context.Context, p *principal, instance return err } a.LastHour = checkerHourStats{Checks: stats.Total, Failed: stats.Failed, AvgLatencyMS: stats.AvgLatencyMs} - recent, err := q.ResultsByChecker(ctx, store.ResultsByCheckerParams{OrgID: p.Org.ID, CheckerID: instance}) + recent, err := q.ResultsByChecker(ctx, store.ResultsByCheckerParams{ + OrgID: p.Org.ID, CheckerID: instance, AfterT: pg.afterT(), AfterS: pg.afterS(), BeforeT: pg.beforeT(), BeforeS: pg.beforeS(), MaxRows: pg.fetch(), + }) + // Pages are cut before filtering, so cursors follow every result + // and a page may show fewer than it read. + recent, info := paginate(pg, recent, func(r store.ResultsByCheckerRow) cursor { + return cursor{T: r.Time, S: r.MonitorID.String() + "|" + r.Region} + }) + a.NextCursor, a.PrevCursor = info.Next, info.Prev for _, r := range recent { if readable[r.MonitorID] { a.Recent = append(a.Recent, recentByCheck{ @@ -237,7 +248,11 @@ func (s *Server) getChecker(c *gin.Context) { fail(c, http.StatusNotFound, "not_found") return } - a, err := s.loadCheckerActivity(c.Request.Context(), current(c), id) + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + a, err := s.loadCheckerActivity(c.Request.Context(), current(c), id, pg) if errors.Is(err, errNoChecker) { fail(c, http.StatusNotFound, "not_found") return @@ -254,7 +269,11 @@ func (s *Server) checkerPage(c *gin.Context, p *principal, page web.Page, me web if err != nil { return notFoundPage(c) } - a, err := s.loadCheckerActivity(c.Request.Context(), p, id) + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + a, err := s.loadCheckerActivity(c.Request.Context(), p, id, pg) if errors.Is(err, errNoChecker) { return notFoundPage(c) } @@ -274,9 +293,15 @@ func (s *Server) checkerPage(c *gin.Context, p *principal, page web.Page, me web MonitorURL: "/monitors/" + r.MonitorID.String(), Monitor: r.Monitor, For: now.Sub(r.Since).Round(time.Second).String(), }) } + // Live while showing the latest results; paged back, with dates. + timeLayout := "15:04:05" + if pg.at() != nil { + timeLayout = "01-02 15:04:05" + } + v.Pager = pager(c, pageInfo{Next: a.NextCursor, Prev: a.PrevCursor}) for _, r := range a.Recent { row := web.CheckerResult{ - Time: r.Time.Local().Format("15:04:05"), MonitorURL: "/monitors/" + r.MonitorID.String(), Monitor: r.Monitor, + Time: r.Time.Local().Format(timeLayout), MonitorURL: "/monitors/" + r.MonitorID.String(), Monitor: r.Monitor, OK: r.OK, Latency: "–", Detail: deref(r.Error), } if r.LatencyMS != nil { @@ -290,7 +315,9 @@ func (s *Server) checkerPage(c *gin.Context, p *principal, page web.Page, me web for _, sb := range a.Siblings { v.Siblings = append(v.Siblings, web.CheckerLink{URL: "/checkers/" + sb.String(), Label: shortID(sb)}) } - page.RefreshSeconds = 5 + if pg.at() == nil { + page.RefreshSeconds = 5 + } return web.CheckerPage(page, me, v), nil } diff --git a/internal/api/console.go b/internal/api/console.go index 24f948b..df98214 100644 --- a/internal/api/console.go +++ b/internal/api/console.go @@ -1,11 +1,13 @@ package api import ( + "cmp" "context" "encoding/json" "errors" "fmt" "net/http" + "net/url" "slices" "strconv" "strings" @@ -39,6 +41,7 @@ func (s *Server) registerConsole(r gin.IRouter) { r.GET("/groups", s.orgPage("groups.title", "", s.groupsView)) r.GET("/settings", s.settingsIndex) r.GET("/incidents", s.orgPage("incidents.title", authz.IncidentsRead, s.incidentsView)) + r.GET("/monitors/:id/results", s.orgPage("monitors.results_title", "", s.resultsView)) r.GET("/maintenance", s.orgPage("maintenance.title", "", s.maintenancePage)) r.GET("/settings/alertmanager", s.orgPage("alertmanager.title", authz.MonitorsRead, s.alertmanagerPage)) r.GET("/settings/channels", s.orgPage("channels.title", authz.NotificationsRead, s.channelsView)) @@ -69,6 +72,9 @@ func (s *Server) dashboard(c *gin.Context) { } v.Root = buildGroupNodes(data.tree, data.rows) v.Empty = len(data.rows) == 0 && len(v.Root.Children) == 0 + if !s.dashboardPage(c, &v, data) { + return + } v.CanWrite = writableAnywhere(p, data.tree) v.Range = data.rng.Key var earliest time.Time @@ -85,6 +91,105 @@ func (s *Server) dashboard(c *gin.Context) { web.Render(c, http.StatusOK, web.Dashboard(s.pageFor(c, "console.monitors.title"), me, v)) } +// groupMonitorsShown is how many of its own monitors a group shows on the +// dashboard before linking to all of them. +const groupMonitorsShown = 50 + +// ungrouped names the pseudo-group of monitors outside any group. +const ungrouped = "none" + +func monitorKey(m web.MonitorRow) cursor { + id, _ := uuid.Parse(m.ID) + return cursor{S: strings.ToLower(m.Name), ID: id} +} + +func sortMonitors(ms []web.MonitorRow) { + slices.SortFunc(ms, func(a, b web.MonitorRow) int { + ka, kb := monitorKey(a), monitorKey(b) + if c := strings.Compare(ka.S, kb.S); c != 0 { + return c + } + return strings.Compare(a.ID, b.ID) + }) +} + +// dashboardPage narrows the dashboard to a search or one group, pages it +// and caps every group's own monitors. It reports false after answering +// with an error. +func (s *Server) dashboardPage(c *gin.Context, v *web.DashboardView, data monitorData) bool { + pg, ok := parsePage(c, consolePageSize) + if !ok { + return false + } + link := func(group string) string { + q := url.Values{"group": {group}} + if r := c.Query("range"); r != "" { + q.Set("range", r) + } + return "/?" + q.Encode() + } + var capNode func(n *web.GroupNode) + capNode = func(n *web.GroupNode) { + sortMonitors(n.Monitors) + if len(n.Monitors) > groupMonitorsShown { + n.More = len(n.Monitors) - groupMonitorsShown + n.Monitors = n.Monitors[:groupMonitorsShown] + n.MoreURL = link(cmp.Or(n.ID, ungrouped)) + } + for i := range n.Children { + capNode(&n.Children[i]) + } + } + var info pageInfo + switch group := c.Query("group"); { + case strings.TrimSpace(c.Query("q")) != "": + v.Search = strings.TrimSpace(c.Query("q")) + needle := strings.ToLower(v.Search) + var hits []web.MonitorRow + for _, m := range data.rows { + if strings.Contains(strings.ToLower(m.Name), needle) || strings.Contains(strings.ToLower(m.Target), needle) { + hits = append(hits, m) + } + } + sortMonitors(hits) + v.Results, info = pageSlice(hits, pg, monitorKey) + case group != "": + var focus web.GroupNode + found := false + if group == ungrouped { + focus, found = web.GroupNode{Monitors: v.Root.Monitors}, true + v.Focus = i18n.T(c.Request.Context(), "monitors.ungrouped") + } else { + var find func(ns []web.GroupNode) + find = func(ns []web.GroupNode) { + for _, n := range ns { + if n.ID == group { + focus, found = n, true + return + } + find(n.Children) + } + } + find(v.Root.Children) + v.Focus = focus.Name + } + if !found { + c.Redirect(http.StatusSeeOther, "/") + return false + } + sortMonitors(focus.Monitors) + focus.Monitors, info = pageSlice(focus.Monitors, pg, monitorKey) + for i := range focus.Children { + capNode(&focus.Children[i]) + } + v.Root = focus + default: + capNode(&v.Root) + } + v.Pager = pager(c, info) + return true +} + type monitorData struct { // heartbeatLabel names the pseudo-region of heartbeat results. heartbeatLabel string @@ -366,8 +471,8 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w } var ( daily []store.DailyBucketsRow - recent []store.RecentResultsRow - incidents []store.Incident + recent []store.ListResultsRow + incidents []store.ListIncidentsRow ) now := time.Now() err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { @@ -375,10 +480,10 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w if daily, err = q.DailyBuckets(ctx, store.DailyBucketsParams{OrgID: p.Org.ID, MonitorID: id, Bucket: now.AddDate(0, 0, -90)}); err != nil { return err } - if recent, err = q.RecentResults(ctx, store.RecentResultsParams{OrgID: p.Org.ID, MonitorID: id, Time: now.Add(-24 * time.Hour)}); err != nil { + if recent, err = q.ListResults(ctx, store.ListResultsParams{OrgID: p.Org.ID, MonitorID: id, MaxRows: monitorResultsShown + 1}); err != nil { return err } - incidents, err = q.MonitorIncidents(ctx, id) + incidents, err = q.ListIncidents(ctx, store.ListIncidentsParams{MonitorID: &id, MaxRows: monitorIncidentsShown + 1}) return err }) if err != nil { @@ -403,42 +508,27 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w if u := web.Uptime(buckets); u >= 0 { v.Uptime90 = web.Percent(u) } - var evidenceOf map[string]string if v.CanWrite { - if v.Evidence, evidenceOf, err = s.evidenceRows(ctx, p, d, m); err != nil { + if v.Evidence, err = s.evidenceRows(ctx, p, d, m); err != nil { return nil, err } } - shown := recent[:min(len(recent), 50)] - var checkerIDs []uuid.UUID - for _, r := range shown { - if r.CheckerID != uuid.Nil && !slices.Contains(checkerIDs, r.CheckerID) { - checkerIDs = append(checkerIDs, r.CheckerID) - } + more := len(recent) > monitorResultsShown + if more { + recent = recent[:monitorResultsShown] + v.MoreResults = true } - checkers, err := s.checkerLinks(ctx, p, checkerIDs) - if err != nil { + if v.Recent, err = s.resultRows(ctx, p, d, m, recent, v.CanWrite); err != nil { return nil, err } - for _, r := range shown { - row := web.ResultRow{Time: r.Time.Format("01-02 15:04:05"), Region: d.regionNameString(r.Region), OK: r.Ok, Latency: "–", Detail: deref(r.Error)} - row.Checker = checkers[r.CheckerID] - if row.Checker.Label == "" && r.CheckerID != uuid.Nil { - // Instances seen before names were recorded, or of a deleted - // agent. - row.Checker.Label = shortID(r.CheckerID) + for n, i := range incidents { + if n == monitorIncidentsShown { + v.MoreIncidents = true + break } - row.EvidenceURL = evidenceOf[evidenceKey(r.Region, r.Time)] - if r.LatencyMs != nil { - row.Latency = fmt.Sprintf("%d ms", *r.LatencyMs) - } - if r.StatusCode != nil && row.Detail == "" { - row.Detail = fmt.Sprint(*r.StatusCode) - } - v.Recent = append(v.Recent, row) - } - for _, i := range incidents { - v.Incidents = append(v.Incidents, d.incidentRow(i, m.Name)) + v.Incidents = append(v.Incidents, d.incidentRow(store.Incident{ + ID: i.ID, OrgID: i.OrgID, MonitorID: i.MonitorID, StartedAt: i.StartedAt, ResolvedAt: i.ResolvedAt, Cause: i.Cause, + }, m.Name)) } page.TitleID = "console.monitors.title" return web.MonitorDetail(page, me, v), nil @@ -689,14 +779,117 @@ func fillForm(f *web.MonitorForm, m store.Monitor) { } } -func (s *Server) incidentsView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { - ctx := c.Request.Context() - var rows []store.ListIncidentsRow +// monitorIncidentsShown is how many incidents a monitor's page lists +// before linking to all of them. +const monitorIncidentsShown = 10 + +// monitorResultsShown is how many results a monitor's page lists before +// linking to all of them. +const monitorResultsShown = 50 + +// resultPage reads a page of m's results, newest first. +func (s *Server) resultPage(ctx context.Context, p *principal, m store.Monitor, pg pageReq) ([]store.ListResultsRow, pageInfo, error) { + var rows []store.ListResultsRow err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { var err error - rows, err = q.ListIncidents(ctx) + rows, err = q.ListResults(ctx, store.ListResultsParams{ + OrgID: p.Org.ID, MonitorID: m.ID, AfterT: pg.afterT(), AfterS: pg.afterS(), BeforeT: pg.beforeT(), BeforeS: pg.beforeS(), MaxRows: pg.fetch(), + }) return err }) + rows, info := paginate(pg, rows, func(r store.ListResultsRow) cursor { return cursor{T: r.Time, S: r.Position} }) + return rows, info, err +} + +func (s *Server) resultsView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { + id, err := uuid.Parse(c.Param("id")) + if err != nil { + return notFoundPage(c) + } + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + ctx := c.Request.Context() + d, err := s.loadMonitorData(ctx, p, web.RangeByKey("")) + if err != nil { + return nil, err + } + m, ok := d.byID[id] + if !ok { + return notFoundPage(c) + } + rows, info, err := s.resultPage(ctx, p, m, pg) + if err != nil { + return nil, err + } + v := web.ResultsView{MonitorID: m.ID.String(), Monitor: m.Name, Pager: pager(c, info)} + if v.Rows, err = s.resultRows(ctx, p, d, m, rows, canInGroup(p, authz.MonitorsWrite, d.tree, m.GroupID)); err != nil { + return nil, err + } + return web.ResultsPage(page, me, v), nil +} + +// resultRows renders check results of m, linking evidence if withEvidence. +func (s *Server) resultRows(ctx context.Context, p *principal, d monitorData, m store.Monitor, rows []store.ListResultsRow, withEvidence bool) ([]web.ResultRow, error) { + if len(rows) == 0 { + return nil, nil + } + var checkerIDs []uuid.UUID + for _, r := range rows { + if r.CheckerID != uuid.Nil && !slices.Contains(checkerIDs, r.CheckerID) { + checkerIDs = append(checkerIDs, r.CheckerID) + } + } + checkers, err := s.checkerLinks(ctx, p, checkerIDs) + if err != nil { + return nil, err + } + evidence := map[string]string{} + if withEvidence { + err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { + found, err := q.EvidenceBetween(ctx, store.EvidenceBetweenParams{MonitorID: m.ID, Since: rows[len(rows)-1].Time, Until: rows[0].Time}) + for _, e := range found { + evidence[evidenceKey(e.Region, e.Time)] = "/monitors/" + m.ID.String() + "/evidence/" + e.ID.String() + } + return err + }) + if err != nil { + return nil, err + } + } + out := make([]web.ResultRow, 0, len(rows)) + for _, r := range rows { + row := web.ResultRow{Time: r.Time.Format("01-02 15:04:05"), Region: d.regionNameString(r.Region), OK: r.Ok, Latency: "–", Detail: deref(r.Error)} + row.Checker = checkers[r.CheckerID] + if row.Checker.Label == "" && r.CheckerID != uuid.Nil { + // Instances seen before names were recorded, or of a deleted + // agent. + row.Checker.Label = shortID(r.CheckerID) + } + row.EvidenceURL = evidence[evidenceKey(r.Region, r.Time)] + if r.LatencyMs != nil { + row.Latency = fmt.Sprintf("%d ms", *r.LatencyMs) + } + if r.StatusCode != nil && row.Detail == "" { + row.Detail = fmt.Sprint(*r.StatusCode) + } + out = append(out, row) + } + return out, nil +} + +func (s *Server) incidentsView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { + ctx := c.Request.Context() + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + monitor, ok := monitorFilter(c, "monitor") + if !ok { + return nil, errAborted + } + rows, info, err := s.incidentPage(ctx, p, pg, monitor) if err != nil { return nil, err } @@ -704,13 +897,18 @@ func (s *Server) incidentsView(c *gin.Context, p *principal, page web.Page, me w if err != nil { return nil, err } - out := make([]web.IncidentRow, len(rows)) + v := web.IncidentsView{Rows: make([]web.IncidentRow, len(rows)), Pager: pager(c, info)} for i, r := range rows { - out[i] = d.incidentRow(store.Incident{ + v.Rows[i] = d.incidentRow(store.Incident{ ID: r.ID, OrgID: r.OrgID, MonitorID: r.MonitorID, StartedAt: r.StartedAt, ResolvedAt: r.ResolvedAt, Cause: r.Cause, }, r.MonitorName) } - return web.IncidentsPage(page, me, out), nil + if monitor != nil { + if m, ok := d.byID[*monitor]; ok { + v.Monitor, v.MonitorID = m.Name, monitor.String() + } + } + return web.IncidentsPage(page, me, v), nil } func (s *Server) channelsView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { diff --git a/internal/api/evidence.go b/internal/api/evidence.go index 4388bc2..6b082ec 100644 --- a/internal/api/evidence.go +++ b/internal/api/evidence.go @@ -131,22 +131,29 @@ func (s *Server) listEvidence(c *gin.Context) { if !ok { return } + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } ctx := c.Request.Context() var rows []store.ListEvidenceRow err := s.db.Tx(ctx, current(c).scope(), func(q *store.Queries) error { var err error - rows, err = q.ListEvidence(ctx, m.ID) + rows, err = q.ListEvidence(ctx, store.ListEvidenceParams{ + MonitorID: m.ID, AfterT: pg.afterT(), AfterID: pg.afterID(), BeforeT: pg.beforeT(), BeforeID: pg.beforeID(), MaxRows: pg.fetch(), + }) return err }) if err != nil { internalError(c, err) return } + rows, info := paginate(pg, rows, func(r store.ListEvidenceRow) cursor { return cursor{T: r.Time, ID: r.ID} }) out := make([]evidenceSummary, len(rows)) for i, r := range rows { out[i] = evidenceSummary{ID: r.ID, Region: r.Region, Time: r.Time, OK: r.Ok, StatusCode: r.StatusCode, Error: r.Error} } - c.JSON(http.StatusOK, gin.H{"evidence": out}) + c.JSON(http.StatusOK, gin.H{"evidence": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) } func (s *Server) loadEvidence(c *gin.Context, m store.Monitor) (store.CheckEvidence, check.Evidence, bool) { @@ -295,32 +302,65 @@ func prettyBody(contentType, body string) string { return buf.String() } -// evidenceRows lists stored evidence of m for its page. -func (s *Server) evidenceRows(ctx context.Context, p *principal, d monitorData, m store.Monitor) ([]web.EvidenceRow, map[string]string, error) { +// evidenceShown is how much of a monitor's evidence its page lists. +const evidenceShown = 20 + +// evidenceRows lists the latest stored evidence of m for its page. +func (s *Server) evidenceRows(ctx context.Context, p *principal, d monitorData, m store.Monitor) ([]web.EvidenceRow, error) { var rows []store.ListEvidenceRow err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { var err error - rows, err = q.ListEvidence(ctx, m.ID) + rows, err = q.ListEvidence(ctx, store.ListEvidenceParams{MonitorID: m.ID, MaxRows: evidenceShown}) return err }) - byResult := map[string]string{} - out := make([]web.EvidenceRow, 0, min(len(rows), 20)) - for i, r := range rows { - url := "/monitors/" + m.ID.String() + "/evidence/" + r.ID.String() - byResult[evidenceKey(r.Region, r.Time)] = url - if i >= 20 { - continue - } + out := make([]web.EvidenceRow, 0, len(rows)) + for _, r := range rows { detail := deref(r.Error) if detail == "" && r.StatusCode != nil { detail = strconv.Itoa(int(*r.StatusCode)) } - out = append(out, web.EvidenceRow{URL: url, Time: r.Time.Local().Format("01-02 15:04:05"), Region: d.regionNameString(r.Region), OK: r.Ok, Detail: detail}) + out = append(out, web.EvidenceRow{ + URL: "/monitors/" + m.ID.String() + "/evidence/" + r.ID.String(), Time: r.Time.Local().Format("01-02 15:04:05"), + Region: d.regionNameString(r.Region), OK: r.Ok, Detail: detail, + }) } - return out, byResult, err + return out, err } // evidenceKey matches evidence with the check result it belongs to. func evidenceKey(region string, t time.Time) string { return region + "@" + strconv.FormatInt(t.UnixMicro(), 10) } + +// resultView is one check result. +type resultView struct { + Time time.Time `json:"time"` + Region string `json:"region"` + CheckerID uuid.UUID `json:"checker_id"` + OK bool `json:"ok"` + LatencyMS *int32 `json:"latency_ms"` + StatusCode *int32 `json:"status_code,omitempty"` + Error *string `json:"error,omitempty"` +} + +// listResults pages through a monitor's check results, newest first. +func (s *Server) listResults(c *gin.Context) { + m, _, ok := s.evidenceMonitor(c) + if !ok { + return + } + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + rows, info, err := s.resultPage(c.Request.Context(), current(c), m, pg) + if err != nil { + internalError(c, err) + return + } + out := make([]resultView, len(rows)) + for i, r := range rows { + out[i] = resultView{r.Time, r.Region, r.CheckerID, r.Ok, r.LatencyMs, r.StatusCode, r.Error} + } + c.JSON(http.StatusOK, gin.H{"results": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) +} diff --git a/internal/api/limits.go b/internal/api/limits.go index 0e3a36a..ddd0767 100644 --- a/internal/api/limits.go +++ b/internal/api/limits.go @@ -325,15 +325,17 @@ type adminOwner struct { Orgs int `json:"orgs"` } -func (s *Server) adminOrgs(ctx context.Context, search string) ([]adminOrg, error) { +func (s *Server) adminOrgs(ctx context.Context, search string, pg pageReq) ([]adminOrg, pageInfo, error) { var rows []store.AdminListOrgsRow err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { var err error rows, err = q.AdminListOrgs(ctx, store.AdminListOrgsParams{ - Search: truncate(strings.TrimSpace(search), 200), MaxRows: moderationRows, + Search: truncate(strings.TrimSpace(search), 200), MaxRows: pg.fetch(), + AfterT: pg.afterT(), AfterID: pg.afterID(), BeforeT: pg.beforeT(), BeforeID: pg.beforeID(), }) return err }) + rows, info := paginate(pg, rows, func(r store.AdminListOrgsRow) cursor { return cursor{T: r.CreatedAt, ID: r.ID} }) defaults := s.platformLimits(ctx) out := make([]adminOrg, len(rows)) for i, r := range rows { @@ -355,16 +357,20 @@ func (s *Server) adminOrgs(ctx context.Context, search string) ([]adminOrg, erro } } } - return out, err + return out, info, err } func (s *Server) adminListOrgs(c *gin.Context) { - orgs, err := s.adminOrgs(c.Request.Context(), c.Query("q")) + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + orgs, info, err := s.adminOrgs(c.Request.Context(), c.Query("q"), pg) if err != nil { internalError(c, err) return } - c.JSON(http.StatusOK, gin.H{"orgs": orgs}) + c.JSON(http.StatusOK, gin.H{"orgs": orgs, "next_cursor": info.Next, "prev_cursor": info.Prev}) } func webLimits(l Limits) web.LimitsView { return web.LimitsView(l) } @@ -376,12 +382,13 @@ func optInt(v *int32) string { return strconv.Itoa(int(*v)) } -func (s *Server) orgsView(c *gin.Context) (web.OrgsView, error) { +func (s *Server) orgsView(c *gin.Context, pg pageReq) (web.OrgsView, error) { ctx := c.Request.Context() - // The admin page searches organizations with oq; q is the status page - // search. - orgs, err := s.adminOrgs(ctx, c.Query("oq")) - v := web.OrgsView{Search: strings.TrimSpace(c.Query("oq")), Limited: len(orgs) == moderationRows, Defaults: webLimits(s.platformLimits(ctx))} + orgs, info, err := s.adminOrgs(ctx, c.Query("q"), pg) + v := web.OrgsView{ + Search: strings.TrimSpace(c.Query("q")), Pager: pager(c, info), Next: c.Request.URL.RequestURI(), + Defaults: webLimits(s.platformLimits(ctx)), + } state := func(at *time.Time, reason string) string { switch { case at == nil: diff --git a/internal/api/limits_test.go b/internal/api/limits_test.go index 6f4af7a..40ef931 100644 --- a/internal/api/limits_test.go +++ b/internal/api/limits_test.go @@ -148,7 +148,7 @@ func TestLimits(t *testing.T) { if st, _ := owner.do("GET", "/api/v1/admin/orgs", nil); st != http.StatusForbidden { t.Errorf("non-admin org list = %d", st) } - if _, _, html := admin.page("/admin?oq=" + orgSlug); !strings.Contains(html, `id="orgs"`) || !strings.Contains(html, orgSlug) { + if _, _, html := admin.page("/admin/orgs?q=" + orgSlug); !strings.Contains(html, `id="orgs"`) || !strings.Contains(html, orgSlug) { t.Error("the admin page lacks the organization list") } if _, _, html := owner.page("/settings/org"); !strings.Contains(html, "3 / 10") { diff --git a/internal/api/maintenance.go b/internal/api/maintenance.go index e5a8b9f..bff6d2e 100644 --- a/internal/api/maintenance.go +++ b/internal/api/maintenance.go @@ -266,19 +266,24 @@ func (ms maintenanceScope) can(p *principal, perm authz.Permission, monitors, gr return n == len(monitors)+len(groups) } -func (s *Server) listMaintenanceViews(ctx context.Context, p *principal, ms maintenanceScope) ([]maintenanceView, error) { +// listMaintenanceViews reads a page of maintenance windows, latest start +// first, keeping those p may read: a page may hold fewer. +func (s *Server) listMaintenanceViews(ctx context.Context, p *principal, ms maintenanceScope, pg pageReq) ([]maintenanceView, pageInfo, error) { var ( windows []store.MaintenanceWindow targets []store.MaintenanceTarget ) err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { var err error - if windows, err = q.ListMaintenance(ctx); err != nil { + if windows, err = q.ListMaintenancePage(ctx, store.ListMaintenancePageParams{ + AfterT: pg.afterT(), AfterID: pg.afterID(), BeforeT: pg.beforeT(), BeforeID: pg.beforeID(), MaxRows: pg.fetch(), + }); err != nil { return err } targets, err = q.ListMaintenanceTargets(ctx) return err }) + windows, info := paginate(pg, windows, func(w store.MaintenanceWindow) cursor { return cursor{T: w.StartsAt, ID: w.ID} }) out := []maintenanceView{} now := time.Now() for _, w := range windows { @@ -287,7 +292,7 @@ func (s *Server) listMaintenanceViews(ctx context.Context, p *principal, ms main out = append(out, v) } } - return out, err + return out, info, err } func (s *Server) listMaintenance(c *gin.Context) { @@ -298,12 +303,16 @@ func (s *Server) listMaintenance(c *gin.Context) { internalError(c, err) return } - out, err := s.listMaintenanceViews(ctx, p, ms) + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + out, info, err := s.listMaintenanceViews(ctx, p, ms, pg) if err != nil { internalError(c, err) return } - c.JSON(http.StatusOK, gin.H{"maintenance": out}) + c.JSON(http.StatusOK, gin.H{"maintenance": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) } func (s *Server) saveMaintenance(c *gin.Context, id *uuid.UUID) { @@ -519,11 +528,15 @@ func (s *Server) maintenancePage(c *gin.Context, p *principal, page web.Page, me if err != nil { return nil, err } - windows, err := s.listMaintenanceViews(ctx, p, ms) + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + windows, info, err := s.listMaintenanceViews(ctx, p, ms, pg) if err != nil { return nil, err } - v := web.MaintenanceView{Form: web.MaintenanceForm{Duration: 60, Recurrence: "none", Every: 1}} + v := web.MaintenanceView{Form: web.MaintenanceForm{Duration: 60, Recurrence: "none", Every: 1}, Pager: pager(c, info)} ms.tree.walk(func(g store.MonitorGroup, depth int) { if canInGroup(p, authz.MonitorsWrite, ms.tree, &g.ID) { v.Groups = append(v.Groups, web.TargetOption{ID: g.ID.String(), Name: g.Name, Depth: depth}) diff --git a/internal/api/members.go b/internal/api/members.go index acb6985..256322b 100644 --- a/internal/api/members.go +++ b/internal/api/members.go @@ -32,15 +32,20 @@ type memberView struct { Assignments []assignmentView `json:"assignments"` } -func (s *Server) loadMembers(c *gin.Context) ([]memberView, error) { +// loadMembers reads a page of members by email. +func (s *Server) loadMembers(c *gin.Context, pg pageReq) ([]memberView, pageInfo, error) { p := current(c) ctx := c.Request.Context() var out []memberView + var info pageInfo err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { - members, err := q.ListOrgMembers(ctx, p.Org.ID) + members, err := q.ListOrgMembersPage(ctx, store.ListOrgMembersPageParams{ + OrgID: p.Org.ID, AfterS: pg.afterS(), AfterID: pg.afterID(), BeforeS: pg.beforeS(), BeforeID: pg.beforeID(), MaxRows: pg.fetch(), + }) if err != nil { return err } + members, info = paginate(pg, members, func(m store.ListOrgMembersPageRow) cursor { return cursor{S: m.Email, ID: m.ID} }) assigns, err := q.ListAssignments(ctx, p.Org.ID) if err != nil { return err @@ -64,16 +69,20 @@ func (s *Server) loadMembers(c *gin.Context) ([]memberView, error) { } return nil }) - return out, err + return out, info, err } func (s *Server) listMembers(c *gin.Context) { - members, err := s.loadMembers(c) + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + members, info, err := s.loadMembers(c, pg) if err != nil { internalError(c, err) return } - c.JSON(http.StatusOK, gin.H{"members": members}) + c.JSON(http.StatusOK, gin.H{"members": members, "next_cursor": info.Next, "prev_cursor": info.Prev}) } // removeMember requires the actor to hold every permission the member holds diff --git a/internal/api/moderation.go b/internal/api/moderation.go index a452ab1..6d6d5b3 100644 --- a/internal/api/moderation.go +++ b/internal/api/moderation.go @@ -1,6 +1,7 @@ package api import ( + "context" "errors" "net/http" "strings" @@ -51,18 +52,17 @@ type moderatedUser struct { Admin bool `json:"admin,omitempty"` } -const moderationRows = 500 - -func (s *Server) moderatedPages(c *gin.Context) ([]moderatedPage, error) { - ctx := c.Request.Context() +func (s *Server) moderatedPages(ctx context.Context, search string, pg pageReq) ([]moderatedPage, pageInfo, error) { var rows []store.AdminListStatusPagesRow err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { var err error rows, err = q.AdminListStatusPages(ctx, store.AdminListStatusPagesParams{ - Search: truncate(strings.TrimSpace(c.Query("q")), 200), MaxRows: moderationRows, + Search: truncate(strings.TrimSpace(search), 200), MaxRows: pg.fetch(), + AfterT: pg.afterT(), AfterID: pg.afterID(), BeforeT: pg.beforeT(), BeforeID: pg.beforeID(), }) return err }) + rows, info := paginate(pg, rows, func(r store.AdminListStatusPagesRow) cursor { return cursor{T: r.CreatedAt, ID: r.ID} }) out := make([]moderatedPage, len(rows)) for i, r := range rows { p := &out[i] @@ -75,16 +75,20 @@ func (s *Server) moderatedPages(c *gin.Context) ([]moderatedPage, error) { p.Owner = &moderatedUser{r.OwnerID, r.OwnerEmail, r.OwnerDisabledAt, r.OwnerDisabledReason, r.OwnerIsAdmin} } } - return out, err + return out, info, err } func (s *Server) adminListStatusPages(c *gin.Context) { - pages, err := s.moderatedPages(c) + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } + pages, info, err := s.moderatedPages(c.Request.Context(), c.Query("q"), pg) if err != nil { internalError(c, err) return } - c.JSON(http.StatusOK, gin.H{"status_pages": pages}) + c.JSON(http.StatusOK, gin.H{"status_pages": pages, "next_cursor": info.Next, "prev_cursor": info.Prev}) } type suspensionRequest struct { @@ -273,9 +277,9 @@ func (s *Server) adminDeleteUser(c *gin.Context) { c.Status(http.StatusNoContent) } -func (s *Server) moderationView(c *gin.Context) (web.ModerationView, error) { - pages, err := s.moderatedPages(c) - v := web.ModerationView{Search: strings.TrimSpace(c.Query("q")), Limited: len(pages) == moderationRows} +func (s *Server) moderationView(c *gin.Context, pg pageReq) (web.ModerationView, error) { + pages, info, err := s.moderatedPages(c.Request.Context(), c.Query("q"), pg) + v := web.ModerationView{Search: strings.TrimSpace(c.Query("q")), Pager: pager(c, info), Next: c.Request.URL.RequestURI()} state := func(at *time.Time, reason string) string { switch { case at == nil: diff --git a/internal/api/moderation_test.go b/internal/api/moderation_test.go index 685d915..1dcf0d5 100644 --- a/internal/api/moderation_test.go +++ b/internal/api/moderation_test.go @@ -189,7 +189,7 @@ func TestModeration(t *testing.T) { } // The admin page shows the list. - if _, _, html := admin.page("/admin"); !strings.Contains(html, `id="moderation"`) { + if _, _, html := admin.page("/admin/status-pages"); !strings.Contains(html, `id="moderation"`) { t.Error("the admin page lacks the status page list") } } diff --git a/internal/api/monitors.go b/internal/api/monitors.go index fdd9e0d..707bbee 100644 --- a/internal/api/monitors.go +++ b/internal/api/monitors.go @@ -190,8 +190,13 @@ func (s *Server) validateMonitor(c *gin.Context, req *monitorRequest, t groupTre // listMonitors returns the monitors the principal may read, org-wide or // through a group assignment. func (s *Server) listMonitors(c *gin.Context) { + pg, ok := parsePage(c, apiPageSize) + if !ok { + return + } p := current(c) ctx := c.Request.Context() + var info pageInfo t, err := s.loadGroupTree(ctx, p.scope()) if err != nil { internalError(c, err) @@ -199,10 +204,14 @@ func (s *Server) listMonitors(c *gin.Context) { } out := []monitorView{} err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { - monitors, err := q.ListMonitors(ctx) + monitors, err := q.ListMonitorsPage(ctx, store.ListMonitorsPageParams{ + AfterS: pg.afterS(), AfterID: pg.afterID(), BeforeS: pg.beforeS(), BeforeID: pg.beforeID(), MaxRows: pg.fetch(), + }) if err != nil { return err } + // Paged before filtering by permission: a page may hold fewer. + monitors, info = paginate(pg, monitors, func(m store.Monitor) cursor { return cursor{S: m.Name, ID: m.ID} }) assignments, err := q.AllMonitorAlertGroups(ctx) if err != nil { return err @@ -253,7 +262,7 @@ func (s *Server) listMonitors(c *gin.Context) { internalError(c, err) return } - c.JSON(http.StatusOK, gin.H{"monitors": out}) + c.JSON(http.StatusOK, gin.H{"monitors": out, "next_cursor": info.Next, "prev_cursor": info.Prev}) } func (s *Server) createMonitor(c *gin.Context) { diff --git a/internal/api/openapi.go b/internal/api/openapi.go index a0ef069..783a1bf 100644 --- a/internal/api/openapi.go +++ b/internal/api/openapi.go @@ -306,7 +306,10 @@ func buildOpenAPI(publicURL string) map[string]any { "description": "Manage monitors, status pages, alerting and members of an organization.\n\n" + "Authenticate with an API token as `Authorization: Bearer ust_…` (create one under Settings → API tokens; " + "it never exceeds its owner's permissions), or use the browser session, which additionally needs the " + - "`" + auth.CSRFHeader + "` header on changes. Errors share one format with a stable `error` code.", + "`" + auth.CSRFHeader + "` header on changes. Errors share one format with a stable `error` code.\n\n" + + "Lists marked as paged return at most 100 items (`limit` takes up to 500) with `next_cursor` and " + + "`prev_cursor`; pass one as `after` or `before` to get the next or previous page. A missing cursor " + + "means the list ends there. Cursors are opaque and stay valid while items are added.", "license": map[string]any{"name": "AGPL-3.0-only", "identifier": "AGPL-3.0-only"}, }, "servers": []any{map[string]any{"url": strings.TrimSuffix(publicURL, "/")}}, diff --git a/internal/api/pages.go b/internal/api/pages.go index ff0adc0..d8ca332 100644 --- a/internal/api/pages.go +++ b/internal/api/pages.go @@ -39,6 +39,8 @@ func (s *Server) registerPages(r gin.IRouter) { r.GET("/settings/audit", s.orgPage("audit.title", authz.AuditRead, s.auditView)) r.GET("/admin", s.adminPage) r.GET("/admin/audit", s.adminAuditPage) + r.GET("/admin/status-pages", s.adminStatusPagesPage) + r.GET("/admin/orgs", s.adminOrgsPage) r.GET("/admin/legal", s.adminLegalPage) r.GET("/settings/legal", s.orgPage("legal.org_title", authz.OrgManage, s.orgLegalView)) r.GET("/legal/:kind", s.legalPage) @@ -218,7 +220,7 @@ func (s *Server) securityPage(c *gin.Context) { return } } - rows, err := s.auditQuery(ctx, tenant.User(sess.UserID), store.ListAuditEventsParams{Kind: "user", Actor: &sess.UserID, MaxRows: 20}, "") + rows, _, err := s.auditQuery(ctx, tenant.User(sess.UserID), store.ListAuditEventsParams{Kind: "user", Actor: &sess.UserID}, pageReq{limit: 20}) if err != nil { internalError(c, err) return @@ -302,7 +304,11 @@ func (s *Server) orgSettingsView(c *gin.Context, p *principal, page web.Page, me func (s *Server) membersView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { c.Set(ctxPrincipal, p) - members, err := s.loadMembers(c) + pg, ok := parsePage(c, consolePageSize) + if !ok { + return nil, errAborted + } + members, info, err := s.loadMembers(c, pg) if err != nil { return nil, err } @@ -322,7 +328,7 @@ func (s *Server) membersView(c *gin.Context, p *principal, page web.Page, me web if err != nil { return nil, err } - v := web.MembersView{CanManage: p.Grants.Can(authz.MembersManage)} + v := web.MembersView{CanManage: p.Grants.Can(authz.MembersManage), Pager: pager(c, info)} scopeNames, scopes, err := s.scopeOptions(ctx, p) if err != nil { return nil, err @@ -511,17 +517,41 @@ func (s *Server) adminPage(c *gin.Context) { for _, t := range check.Types { types = append(types, web.CheckTypeOption{Type: string(t), Enabled: !off[string(t)]}) } - mod, err := s.moderationView(c) + web.Render(c, http.StatusOK, web.AdminPage(s.pageFor(c, "admin.title"), me, v, storageView(c, stats), types, s.platformPrivate(ctx), webLimits(s.platformLimits(ctx)))) +} + +func (s *Server) adminStatusPagesPage(c *gin.Context) { + me, ok := s.adminMe(c) + if !ok { + return + } + pg, ok := parsePage(c, consolePageSize) + if !ok { + return + } + v, err := s.moderationView(c, pg) if err != nil { internalError(c, err) return } - orgs, err := s.orgsView(c) + web.Render(c, http.StatusOK, web.AdminStatusPagesPage(s.pageFor(c, "moderation.title"), me, v)) +} + +func (s *Server) adminOrgsPage(c *gin.Context) { + me, ok := s.adminMe(c) + if !ok { + return + } + pg, ok := parsePage(c, consolePageSize) + if !ok { + return + } + v, err := s.orgsView(c, pg) if err != nil { internalError(c, err) return } - web.Render(c, http.StatusOK, web.AdminPage(s.pageFor(c, "admin.title"), me, v, storageView(c, stats), types, s.platformPrivate(ctx), mod, orgs)) + web.Render(c, http.StatusOK, web.AdminOrgsPage(s.pageFor(c, "orgs.title"), me, v)) } func (s *Server) buildRegionsView(ctx context.Context, regions []store.Region, agents []store.ListAgentsRow, apiBase, next string, manageable func(store.Region) bool) (web.RegionsView, error) { diff --git a/internal/api/paging.go b/internal/api/paging.go new file mode 100644 index 0000000..b08802b --- /dev/null +++ b/internal/api/paging.go @@ -0,0 +1,218 @@ +package api + +import ( + "encoding/base64" + "encoding/json" + "net/http" + "slices" + "strconv" + "strings" + "time" + + "github.com/gin-gonic/gin" + "github.com/google/uuid" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/web" +) + +// Lists are paged by keyset: a cursor holds the sort key of an item and +// its ID, so pages neither skip nor repeat items when others are added. +// after pages forward in the list's order, before backward. + +const ( + apiPageSize = 100 + maxPageSize = 500 + consolePageSize = 50 +) + +// cursor is the position of an item: a time or string sort key and a +// tie-breaking ID. +type cursor struct { + T time.Time `json:"t,omitzero"` + S string `json:"s,omitempty"` + ID uuid.UUID `json:"i,omitzero"` +} + +func (c cursor) encode() string { + b, _ := json.Marshal(c) + return base64.RawURLEncoding.EncodeToString(b) +} + +func decodeCursor(s string) (*cursor, bool) { + if s == "" { + return nil, true + } + b, err := base64.RawURLEncoding.DecodeString(s) + var c cursor + if err != nil || json.Unmarshal(b, &c) != nil { + return nil, false + } + return &c, true +} + +// pageReq is a requested page. +type pageReq struct { + after, before *cursor + limit int +} + +// backward reports whether the page is read against the list's order. +func (p pageReq) backward() bool { return p.before != nil } + +// fetch is how many rows to read: one more tells whether more follow. +func (p pageReq) fetch() int32 { return int32(p.limit + 1) } + +// at is the cursor to read from, in reading direction. +func (p pageReq) at() *cursor { + if p.before != nil { + return p.before + } + return p.after +} + +// Keys of the cursor for queries; nil when not paging from a position. +func (p pageReq) afterT() *time.Time { return timeOf(p.after) } +func (p pageReq) beforeT() *time.Time { return timeOf(p.before) } +func (p pageReq) afterS() *string { return strOf(p.after) } +func (p pageReq) beforeS() *string { return strOf(p.before) } +func (p pageReq) afterID() *uuid.UUID { return idOf(p.after) } +func (p pageReq) beforeID() *uuid.UUID { return idOf(p.before) } + +func timeOf(c *cursor) *time.Time { + if c == nil { + return nil + } + return &c.T +} + +func strOf(c *cursor) *string { + if c == nil { + return nil + } + return &c.S +} + +func idOf(c *cursor) *uuid.UUID { + if c == nil { + return nil + } + return &c.ID +} + +// parsePage reads after, before and limit, answering 422 when invalid. +func parsePage(c *gin.Context, def int) (pageReq, bool) { + p := pageReq{limit: def} + if l := c.Query("limit"); l != "" { + n, err := strconv.Atoi(l) + if err != nil || n < 1 || n > maxPageSize { + fail(c, http.StatusUnprocessableEntity, "invalid_limit", "Max", maxPageSize) + return p, false + } + p.limit = n + } + var okA, okB bool + p.after, okA = decodeCursor(c.Query("after")) + p.before, okB = decodeCursor(c.Query("before")) + if !okA || !okB || p.after != nil && p.before != nil { + fail(c, http.StatusUnprocessableEntity, "invalid_cursor") + return p, false + } + return p, true +} + +// pageInfo holds the cursors of the neighbouring pages, empty at either +// end of the list. +type pageInfo struct { + Next string `json:"next_cursor,omitempty"` + Prev string `json:"prev_cursor,omitempty"` +} + +// paginate trims rows read for p to one page in the list's order and +// works out the neighbouring pages. +func paginate[T any](p pageReq, rows []T, key func(T) cursor) ([]T, pageInfo) { + var info pageInfo + more := len(rows) > p.limit + if more { + rows = rows[:p.limit] + } + if p.backward() { + slices.Reverse(rows) + } + if len(rows) == 0 { + return rows, info + } + first, last := key(rows[0]).encode(), key(rows[len(rows)-1]).encode() + switch { + case p.backward(): + info.Next = last + if more { + info.Prev = first + } + default: + if more { + info.Next = last + } + if p.after != nil { + info.Prev = first + } + } + return rows, info +} + +// pager builds the console's page links from info, keeping the request's +// other query parameters. +func pager(c *gin.Context, info pageInfo) web.Pager { + link := func(key, cur string) string { + q := c.Request.URL.Query() + q.Del("after") + q.Del("before") + if key != "" { + q.Set(key, cur) + } + if len(q) == 0 { + return c.Request.URL.Path + } + return c.Request.URL.Path + "?" + q.Encode() + } + var pg web.Pager + if info.Next != "" { + pg.Next = link("after", info.Next) + } + if info.Prev != "" { + pg.Prev = link("before", info.Prev) + pg.First = link("", "") + } + return pg +} + +// pageSlice pages through items held in memory the way the queries page +// through tables. items must be sorted ascending by key. +func pageSlice[T any](items []T, pg pageReq, key func(T) cursor) ([]T, pageInfo) { + cmp := func(a, b cursor) int { + if c := strings.Compare(a.S, b.S); c != 0 { + return c + } + if c := a.T.Compare(b.T); c != 0 { + return c + } + return strings.Compare(a.ID.String(), b.ID.String()) + } + var read []T + if pg.backward() { + for i := len(items) - 1; i >= 0 && len(read) < int(pg.fetch()); i-- { + if cmp(key(items[i]), *pg.before) < 0 { + read = append(read, items[i]) + } + } + } else { + for _, it := range items { + if len(read) == int(pg.fetch()) { + break + } + if pg.after == nil || cmp(key(it), *pg.after) > 0 { + read = append(read, it) + } + } + } + return paginate(pg, read, key) +} diff --git a/internal/api/paging_internal_test.go b/internal/api/paging_internal_test.go new file mode 100644 index 0000000..2ea3e8c --- /dev/null +++ b/internal/api/paging_internal_test.go @@ -0,0 +1,75 @@ +package api + +import ( + "slices" + "testing" + + "github.com/google/uuid" +) + +func TestPaginate(t *testing.T) { + // A list of 0..9 shown in order, read the way the queries do: from a + // cursor in reading direction, one row more than the page. + all := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} + key := func(i int) cursor { return cursor{S: string(rune('a' + i)), ID: uuid.Nil} } + read := func(p pageReq) []int { + var out []int + if p.backward() { + for i := len(all) - 1; i >= 0; i-- { + if key(all[i]).S < p.before.S { + out = append(out, all[i]) + } + } + } else { + for _, v := range all { + if p.after == nil || key(v).S > p.after.S { + out = append(out, v) + } + } + } + return out[:min(len(out), int(p.fetch()))] + } + page := func(p pageReq) ([]int, pageInfo) { return paginate(p, read(p), key) } + + first, info := page(pageReq{limit: 4}) + if !slices.Equal(first, []int{0, 1, 2, 3}) || info.Prev != "" || info.Next == "" { + t.Fatalf("first = %v %+v", first, info) + } + next, _ := decodeCursor(info.Next) + second, info := page(pageReq{limit: 4, after: next}) + if !slices.Equal(second, []int{4, 5, 6, 7}) || info.Prev == "" || info.Next == "" { + t.Fatalf("second = %v %+v", second, info) + } + n3, _ := decodeCursor(info.Next) + last, lastInfo := page(pageReq{limit: 4, after: n3}) + if !slices.Equal(last, []int{8, 9}) || lastInfo.Next != "" || lastInfo.Prev == "" { + t.Fatalf("last = %v %+v", last, lastInfo) + } + // Back from the last page and from the second to the first. + prev, _ := decodeCursor(lastInfo.Prev) + back, backInfo := page(pageReq{limit: 4, before: prev}) + if !slices.Equal(back, []int{4, 5, 6, 7}) || backInfo.Prev == "" || backInfo.Next == "" { + t.Fatalf("back = %v %+v", back, backInfo) + } + p2, _ := decodeCursor(backInfo.Prev) + start, startInfo := page(pageReq{limit: 4, before: p2}) + if !slices.Equal(start, []int{0, 1, 2, 3}) || startInfo.Prev != "" || startInfo.Next == "" { + t.Fatalf("start = %v %+v", start, startInfo) + } + if _, ok := decodeCursor("not a cursor!"); ok { + t.Error("garbage cursor accepted") + } +} + +func TestPageSlice(t *testing.T) { + items := []string{"a", "b", "c", "d", "e"} + key := func(s string) cursor { return cursor{S: s} } + first, info := pageSlice(items, pageReq{limit: 2}, key) + next, _ := decodeCursor(info.Next) + second, info2 := pageSlice(items, pageReq{limit: 2, after: next}, key) + prev, _ := decodeCursor(info2.Prev) + back, _ := pageSlice(items, pageReq{limit: 2, before: prev}, key) + if !slices.Equal(first, []string{"a", "b"}) || !slices.Equal(second, []string{"c", "d"}) || !slices.Equal(back, first) { + t.Errorf("first %v, second %v, back %v", first, second, back) + } +} diff --git a/internal/api/paging_test.go b/internal/api/paging_test.go new file mode 100644 index 0000000..3d33ee0 --- /dev/null +++ b/internal/api/paging_test.go @@ -0,0 +1,184 @@ +package api_test + +import ( + "context" + "net/http" + "net/url" + "regexp" + "slices" + "strconv" + "strings" + "testing" + "time" + + "github.com/jackc/pgx/v5" +) + +// pages follows next_cursor through a list and back through prev_cursor, +// returning the IDs in order both ways. +func pages(t *testing.T, b *browser, path, key string) (forward, backward []string) { + t.Helper() + sep := "?" + if strings.Contains(path, "?") { + sep = "&" + } + ids := func(body map[string]any) []string { + var out []string + for _, it := range body[key].([]any) { + out = append(out, it.(map[string]any)["id"].(string)) + } + return out + } + var last map[string]any + cursor := "" + for range 20 { + q := path + sep + "limit=2" + if cursor != "" { + q += "&after=" + url.QueryEscape(cursor) + } + st, body := b.do("GET", q, nil) + if st != http.StatusOK { + t.Fatalf("GET %s = %d %v", q, st, body) + } + forward = append(forward, ids(body)...) + last = body + if cursor, _ = body["next_cursor"].(string); cursor == "" { + break + } + } + // Back from the last page to the first. + page := ids(last) + backward = append(page, backward...) + prev, _ := last["prev_cursor"].(string) + for prev != "" { + st, body := b.do("GET", path+sep+"limit=2&before="+url.QueryEscape(prev), nil) + if st != http.StatusOK { + t.Fatalf("before = %d %v", st, body) + } + backward = append(ids(body), backward...) + prev, _ = body["prev_cursor"].(string) + } + return forward, backward +} + +func TestPaging(t *testing.T) { + e := newEnv(t) + owner := e.browser(t) + owner.signup("o@"+uniq("pg")+".test", uniq("pg-")) + var monitors []string + for _, name := range []string{"e", "a", "d", "b", "c"} { + _, m := owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": name, "type": "heartbeat", "interval_seconds": 3600}) + monitors = append(monitors, m["id"].(string)) + } + + // Monitors page by name. + fwd, back := pages(t, owner, "/api/v1/org/monitors", "monitors") + if len(fwd) != 5 || !slices.Equal(fwd, back) { + t.Errorf("monitors forward %v, backward %v", fwd, back) + } + _, first := owner.do("GET", "/api/v1/org/monitors?limit=1", nil) + if first["monitors"].([]any)[0].(map[string]any)["name"] != "a" { + t.Errorf("monitors are not by name: %v", first["monitors"]) + } + + // Incidents with the same start time: none skipped or repeated. + started := time.Now().Add(-time.Hour).Truncate(time.Second) + if err := e.asSystem(t, func(tx pgx.Tx) error { + for _, m := range monitors { + if _, err := tx.Exec(context.Background(), `INSERT INTO incidents (org_id, monitor_id, started_at, resolved_at, cause) + SELECT org_id, id, $2::timestamptz, $2::timestamptz + interval '1 minute', '{}' FROM monitors WHERE id = $1`, m, started); err != nil { + return err + } + } + return nil + }); err != nil { + t.Fatal(err) + } + fwd, back = pages(t, owner, "/api/v1/org/incidents", "incidents") + if len(fwd) != 5 || !slices.Equal(fwd, back) { + t.Errorf("incidents forward %v, backward %v", fwd, back) + } + seen := map[string]bool{} + for _, id := range fwd { + if seen[id] { + t.Errorf("incident %s repeated", id) + } + seen[id] = true + } + fwd, _ = pages(t, owner, "/api/v1/org/incidents?monitor_id="+monitors[0], "incidents") + if len(fwd) != 1 { + t.Errorf("incidents of one monitor = %v", fwd) + } + + // Invalid requests. + st, body := owner.do("GET", "/api/v1/org/incidents?after=nonsense!", nil) + expect(t, "bad cursor", st, body, http.StatusUnprocessableEntity, "invalid_cursor") + st, body = owner.do("GET", "/api/v1/org/incidents?limit=501", nil) + expect(t, "limit too large", st, body, http.StatusUnprocessableEntity, "invalid_limit") + + // The console pages with links. + _, _, html := owner.page("/incidents?limit=2") + if !strings.Contains(html, `rel="next"`) || strings.Contains(html, `rel="prev"`) { + t.Error("the first console page lacks a next link or has a previous one") + } + if _, _, html := owner.page(nextLink(t, html)); !strings.Contains(html, `rel="prev"`) || !strings.Contains(html, "To the start") { + t.Error("a later console page lacks the way back") + } +} + +var nextHref = regexp.MustCompile(`href="([^"]+)" rel="next"`) + +// nextLink returns the console's link to the next page. +func nextLink(t *testing.T, html string) string { + t.Helper() + m := nextHref.FindStringSubmatch(html) + if m == nil { + t.Fatal("no next link") + } + return strings.ReplaceAll(m[1], "&", "&") +} + +// shown counts the monitors a dashboard page links to. +func shown(html string) int { + return strings.Count(html, `href="/monitors/`) - strings.Count(html, `href="/monitors/new"`) +} + +func TestDashboardPaging(t *testing.T) { + e := newEnv(t) + owner := e.browser(t) + owner.signup("o@"+uniq("dash")+".test", uniq("dash-")) + _, g := owner.do("POST", "/api/v1/org/groups", map[string]any{"name": "Fleet"}) + group := g["id"].(string) + for i := range 55 { + st, body := owner.do("POST", "/api/v1/org/monitors", map[string]any{ + "name": "node-" + strconv.Itoa(100+i), "type": "heartbeat", "interval_seconds": 3600, "group_id": group, + }) + if st != http.StatusCreated { + t.Fatalf("create = %d %v", st, body) + } + } + owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "loner", "type": "heartbeat", "interval_seconds": 3600}) + + _, _, html := owner.page("/") + if n := shown(html); n != 51 { + t.Errorf("dashboard shows %d monitors, want 50 of the group and the ungrouped one", n) + } + if !strings.Contains(html, "Show all 55") || !strings.Contains(html, "/?group="+group) { + t.Error("the group lacks its show-all link") + } + + _, _, html = owner.page("/?group=" + group) + if n := shown(html); n != 50 || !strings.Contains(html, `rel="next"`) || !strings.Contains(html, "Fleet") { + t.Errorf("focused group shows %d monitors or lacks paging", n) + } + if _, _, page2 := owner.page(nextLink(t, html)); shown(page2) != 5 || !strings.Contains(page2, "node-154") { + t.Error("the second page of the group is wrong") + } + + if _, _, html := owner.page("/?q=node-107"); shown(html) != 1 || !strings.Contains(html, "node-107") { + t.Error("search does not find the one monitor") + } + if _, _, html := owner.page("/?group=none"); !strings.Contains(html, "loner") || strings.Contains(html, "node-100") { + t.Error("the ungrouped view is wrong") + } +} diff --git a/internal/api/server.go b/internal/api/server.go index ca23460..97e9700 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -140,6 +140,7 @@ func (s *Server) Mount(r gin.IRouter) { org.PUT("/monitors/:id", s.updateMonitor) org.DELETE("/monitors/:id", s.deleteMonitor) org.GET("/monitors/:id/evidence", s.listEvidence) + org.GET("/monitors/:id/results", s.listResults) org.GET("/checkers/:id", s.getChecker) org.GET("/monitors/:id/evidence/:evidence", s.getEvidence) org.GET("/alertmanager/receivers", can(authz.OrgManage), s.listReceivers) diff --git a/internal/i18n/i18n_test.go b/internal/i18n/i18n_test.go index 96a84f9..c8936c9 100644 --- a/internal/i18n/i18n_test.go +++ b/internal/i18n/i18n_test.go @@ -171,6 +171,7 @@ func TestDynamicFamilies(t *testing.T) { "moderation.delete_": {"page", "org", "owner"}, "moderation.delete_confirm_": {"page", "org", "owner"}, "limits.own_": {"true", "false"}, + "pager.": {"newer", "older", "previous", "next", "later", "earlier"}, "weekday.": {"0", "1", "2", "3", "4", "5", "6"}, "md.": {"heading", "bold", "italic", "strike", "link", "ul", "ol", "quote", "code", "codeblock", "table", "hr"}, "maintenance.recurrence_": {"none", "daily", "weekly", "monthly"}, diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index 26599b1..edff6e5 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -131,7 +131,6 @@ "audit.deleted_user": "Gelöschter Benutzer", "audit.empty": "Noch keine Einträge.", "audit.intro": "Änderungen in dieser Organisation: wer wann was getan hat und von welcher Adresse. Einträge lassen sich nicht bearbeiten.", - "audit.older": "Ältere Einträge", "audit.platform_intro": "Änderungen an Plattform-Regionen und -Agents sowie Anmeldeversuche für unbekannte Konten.", "audit.platform_title": "Plattform-Audit-Log", "audit.title": "Audit-Log", @@ -495,6 +494,7 @@ "error.invalid_code": "Code ungültig.", "error.invalid_config": "Die Check-Einstellungen sind ungültig.", "error.invalid_credentials": "E-Mail oder Passwort falsch.", + "error.invalid_cursor": "Dieser Seitenlink ist ungültig; beginne bei der ersten Seite.", "error.invalid_domain": "Eine der Domains ist ungültig.", "error.invalid_email": "Bitte eine gültige E-Mail-Adresse eingeben.", "error.invalid_expect_status": "Erwartete Statuscodes müssen Codes wie 200 oder Klassen wie 2xx sein.", @@ -505,6 +505,7 @@ "error.invalid_interval": "Das Intervall muss mindestens {{.Min}} Sekunden und höchstens einen Tag betragen.", "error.invalid_json_body": "Der Request-Body ist kein gültiges JSON.", "error.invalid_legal_url": "Der Link muss eine http- oder https-URL sein.", + "error.invalid_limit": "limit muss zwischen 1 und {{.Max}} liegen.", "error.invalid_maintenance_duration": "Die Dauer muss zwischen 1 Minute und 30 Tagen liegen.", "error.invalid_maintenance_time": "Prüfe Beginn, Wochentage und letzten Tag.", "error.invalid_matchers": "Lege 1 bis 20 Label-Matcher mit gültigen Label-Namen und regulären Ausdrücken an.", @@ -731,7 +732,10 @@ "groups.none": "– oberste Ebene –", "groups.parent": "In Gruppe", "groups.title": "Monitor-Gruppen", + "incidents.all": "Alle Vorfälle", + "incidents.all_of_monitor": "Alle Vorfälle dieses Monitors", "incidents.none": "Bisher keine Incidents.", + "incidents.of_monitor": "Vorfälle von", "incidents.ongoing": "laufend", "incidents.resolved": "behoben", "incidents.title": "Incidents", @@ -847,7 +851,6 @@ "moderation.delete_owner": "Account löschen", "moderation.delete_page": "Statusseite löschen", "moderation.intro": "Alle veröffentlichten Statusseiten und alle gesperrten Seiten, Organisationen und Accounts, jeweils mit Organisation und Inhaber. Sperren lässt sich rückgängig machen und zeigt der Organisation den Grund; Löschen ist endgültig.", - "moderation.limited": "Nur die neuesten 500 werden angezeigt; die Suche grenzt ein.", "moderation.none": "Keine Statusseite gefunden.", "moderation.org": "Organisation", "moderation.owner": "Inhaber", @@ -864,6 +867,8 @@ "moderation.target_page": "Statusseite", "moderation.title": "Öffentliche Statusseiten", "monitors.alertmanager_hint": "Ausgefallen, solange ein Alert feuert, der alle Matcher erfüllt. Alerts kommen über einen Empfänger:", + "monitors.all": "Alle Monitore", + "monitors.all_results": "Alle Ergebnisse", "monitors.assertion_op": "Operator", "monitors.assertion_path": "Pfad", "monitors.assertion_value": "Wert", @@ -935,6 +940,8 @@ "monitors.minecraft_hint": "Ziel ist host:port (Java meist 25565, Bedrock 19132). Pingt den Server wie die Serverliste im Spiel.", "monitors.minecraft_java": "Java Edition", "monitors.new": "Neuer Monitor", + "monitors.no_match": "Kein Monitor gefunden.", + "monitors.no_results": "Noch keine Ergebnisse.", "monitors.op_absent": "fehlt", "monitors.op_contains": "enthält", "monitors.op_eq": "gleich", @@ -963,7 +970,10 @@ "monitors.recent": "Letzte Checks", "monitors.regions": "Regionen", "monitors.regions_hint": "Geprüft von einem zufälligen Checker jeder gewählten Region. Deine eigenen Regionen stehen oben.", + "monitors.results_title": "Prüfergebnisse", + "monitors.search": "Nach Name oder Ziel suchen", "monitors.secret_unchanged": "unverändert", + "monitors.show_all": "Alle {{.Count}} anzeigen", "monitors.sla": "SLA", "monitors.sla_table": "SLA nach Zeitraum", "monitors.smtp_hint": "Ziel ist host:port (25, 587 oder 465). Wartet auf die Begrüßung und sendet EHLO; mit Verschlüsselung muss STARTTLS gelingen.", @@ -1015,6 +1025,7 @@ "monitors.type_steam": "Steam-Spieleserver", "monitors.type_tcp": "TCP-Port", "monitors.type_tls": "TLS-Zertifikat", + "monitors.ungrouped": "Ohne Gruppe", "monitors.uptime_chart": "Uptime pro Zeitraum", "monitors.verify_tls": "TLS-Zertifikat prüfen", "notify.duration": "Ausgefallen für {{.Duration}}", @@ -1063,6 +1074,14 @@ "page.status.unknown": "Status derzeit nicht verfügbar", "page.today": "Heute", "page.updated": "Aktualisiert {{.Time}}", + "pager.earlier": "Frühere", + "pager.first": "Zum Anfang", + "pager.label": "Seiten", + "pager.later": "Spätere", + "pager.newer": "Neuere", + "pager.next": "Weiter", + "pager.older": "Ältere", + "pager.previous": "Zurück", "pages.accent": "Akzentfarbe (#rrggbb)", "pages.components": "Monitore auf dieser Seite", "pages.create": "Statuspage anlegen", diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json index 36e4a7a..d426b83 100644 --- a/internal/i18n/locales/en.json +++ b/internal/i18n/locales/en.json @@ -131,7 +131,6 @@ "audit.deleted_user": "Deleted user", "audit.empty": "No entries yet.", "audit.intro": "Changes in this organization: who did what and when, from which address. Entries cannot be edited.", - "audit.older": "Older entries", "audit.platform_intro": "Changes to platform regions and agents, and sign-in attempts for unknown accounts.", "audit.platform_title": "Platform audit log", "audit.title": "Audit log", @@ -495,6 +494,7 @@ "error.invalid_code": "Invalid code.", "error.invalid_config": "The check settings are not valid.", "error.invalid_credentials": "Wrong email or password.", + "error.invalid_cursor": "This page link is invalid; start from the first page.", "error.invalid_domain": "One of the domains is not valid.", "error.invalid_email": "Please enter a valid email address.", "error.invalid_expect_status": "Expected status codes must be codes like 200 or classes like 2xx.", @@ -505,6 +505,7 @@ "error.invalid_interval": "The interval must be at least {{.Min}} seconds and at most one day.", "error.invalid_json_body": "The request body is not valid JSON.", "error.invalid_legal_url": "The link must be an http or https URL.", + "error.invalid_limit": "limit must be between 1 and {{.Max}}.", "error.invalid_maintenance_duration": "The duration must be between 1 minute and 30 days.", "error.invalid_maintenance_time": "Check start, weekdays and last day.", "error.invalid_matchers": "Add 1 to 20 label matchers with valid label names and regular expressions.", @@ -731,7 +732,10 @@ "groups.none": "– top level –", "groups.parent": "Inside group", "groups.title": "Monitor groups", + "incidents.all": "All incidents", + "incidents.all_of_monitor": "All incidents of this monitor", "incidents.none": "No incidents so far.", + "incidents.of_monitor": "Incidents of", "incidents.ongoing": "ongoing", "incidents.resolved": "resolved", "incidents.title": "Incidents", @@ -847,7 +851,6 @@ "moderation.delete_owner": "Delete account", "moderation.delete_page": "Delete status page", "moderation.intro": "Every published status page, and every page, organization or account that is suspended, with the organization and its owner behind it. Suspending can be undone and shows the reason to the organization; deleting cannot be undone.", - "moderation.limited": "Only the newest 500 are shown; search to narrow down.", "moderation.none": "No status page matches.", "moderation.org": "Organization", "moderation.owner": "Owner", @@ -864,6 +867,8 @@ "moderation.target_page": "Status page", "moderation.title": "Public status pages", "monitors.alertmanager_hint": "Down while an alert matching all matchers fires. Alerts arrive through a receiver:", + "monitors.all": "All monitors", + "monitors.all_results": "All results", "monitors.assertion_op": "Operator", "monitors.assertion_path": "Path", "monitors.assertion_value": "Value", @@ -935,6 +940,8 @@ "monitors.minecraft_hint": "Target is host:port (Java usually 25565, Bedrock 19132). Pings the server like the in-game server list.", "monitors.minecraft_java": "Java Edition", "monitors.new": "New monitor", + "monitors.no_match": "No monitor matches.", + "monitors.no_results": "No results yet.", "monitors.op_absent": "is absent", "monitors.op_contains": "contains", "monitors.op_eq": "equals", @@ -963,7 +970,10 @@ "monitors.recent": "Recent checks", "monitors.regions": "Regions", "monitors.regions_hint": "Checked from a random checker in each selected region. Your own regions are listed first.", + "monitors.results_title": "Check results", + "monitors.search": "Search by name or target", "monitors.secret_unchanged": "unchanged", + "monitors.show_all": "Show all {{.Count}}", "monitors.sla": "SLA", "monitors.sla_table": "SLA by period", "monitors.smtp_hint": "Target is host:port (25, 587 or 465). Waits for the greeting and says EHLO; with encryption, STARTTLS must succeed.", @@ -1015,6 +1025,7 @@ "monitors.type_steam": "Steam game server", "monitors.type_tcp": "TCP port", "monitors.type_tls": "TLS certificate", + "monitors.ungrouped": "Without group", "monitors.uptime_chart": "Uptime per period", "monitors.verify_tls": "Verify TLS certificate", "notify.duration": "Down for {{.Duration}}", @@ -1063,6 +1074,14 @@ "page.status.unknown": "Status currently unavailable", "page.today": "Today", "page.updated": "Updated {{.Time}}", + "pager.earlier": "Earlier", + "pager.first": "To the start", + "pager.label": "Pages", + "pager.later": "Later", + "pager.newer": "Newer", + "pager.next": "Next", + "pager.older": "Older", + "pager.previous": "Previous", "pages.accent": "Accent color (#rrggbb)", "pages.components": "Monitors on this page", "pages.create": "Create status page", diff --git a/internal/store/alertmanager.sql.go b/internal/store/alertmanager.sql.go index bc1107b..65b840c 100644 --- a/internal/store/alertmanager.sql.go +++ b/internal/store/alertmanager.sql.go @@ -185,6 +185,75 @@ func (q *Queries) FiringAlerts(ctx context.Context, arg FiringAlertsParams) ([]F return items, nil } +const firingAlertsPage = `-- name: FiringAlertsPage :many +SELECT fingerprint, labels, annotations, starts_at, generator_url, updated_at +FROM alertmanager_alerts +WHERE org_id = $1 AND status = 'firing' AND updated_at > $2 + AND ($3::timestamptz IS NULL OR (starts_at, fingerprint) < ($3, $4::text)) + AND ($5::timestamptz IS NULL OR (starts_at, fingerprint) > ($5, $6::text)) +ORDER BY + CASE WHEN $5::timestamptz IS NULL THEN starts_at END DESC, + CASE WHEN $5::timestamptz IS NULL THEN fingerprint END DESC, + starts_at, fingerprint +LIMIT $7 +` + +type FiringAlertsPageParams struct { + OrgID uuid.UUID + Since time.Time + AfterT *time.Time + AfterS *string + BeforeT *time.Time + BeforeS *string + MaxRows int32 +} + +type FiringAlertsPageRow struct { + Fingerprint string + Labels []byte + Annotations []byte + StartsAt time.Time + GeneratorUrl string + UpdatedAt time.Time +} + +// FiringAlerts newest first, a page from a keyset cursor (see paging.go) +// whose string key is the fingerprint. +func (q *Queries) FiringAlertsPage(ctx context.Context, arg FiringAlertsPageParams) ([]FiringAlertsPageRow, error) { + rows, err := q.db.Query(ctx, firingAlertsPage, + arg.OrgID, + arg.Since, + arg.AfterT, + arg.AfterS, + arg.BeforeT, + arg.BeforeS, + arg.MaxRows, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []FiringAlertsPageRow{} + for rows.Next() { + var i FiringAlertsPageRow + if err := rows.Scan( + &i.Fingerprint, + &i.Labels, + &i.Annotations, + &i.StartsAt, + &i.GeneratorUrl, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const latestResultForMonitor = `-- name: LatestResultForMonitor :one SELECT ok, coalesce(error, '')::text AS error FROM check_results WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '2 days' diff --git a/internal/store/audit.sql.go b/internal/store/audit.sql.go index 717d464..a981ec2 100644 --- a/internal/store/audit.sql.go +++ b/internal/store/audit.sql.go @@ -59,17 +59,24 @@ LEFT JOIN users u ON u.id = e.actor_user_id WHERE e.kind = $1 AND ($2::uuid IS NULL OR e.org_id = $2) AND ($3::uuid IS NULL OR e.actor_user_id = $3) - AND ($4::timestamptz IS NULL OR e.time < $4) -ORDER BY e.time DESC -LIMIT $5 + AND ($4::timestamptz IS NULL OR (e.time, e.id) < ($4, $5::uuid)) + AND ($6::timestamptz IS NULL OR (e.time, e.id) > ($6, $7::uuid)) +ORDER BY + CASE WHEN $6::timestamptz IS NULL THEN e.time END DESC, + CASE WHEN $6::timestamptz IS NULL THEN e.id END DESC, + e.time, e.id +LIMIT $8 ` type ListAuditEventsParams struct { - Kind string - OrgID *uuid.UUID - Actor *uuid.UUID - Before *time.Time - MaxRows int32 + Kind string + OrgID *uuid.UUID + Actor *uuid.UUID + AfterT *time.Time + AfterID *uuid.UUID + BeforeT *time.Time + BeforeID *uuid.UUID + MaxRows int32 } type ListAuditEventsRow struct { @@ -90,14 +97,17 @@ type ListAuditEventsRow struct { ActorName string } -// Newest first, paged by time. kind narrows to one kind; the row policy -// already limits what the scope can see. +// Newest first, a page from a keyset cursor (see paging.go). kind narrows +// to one kind; the row policy already limits what the scope can see. func (q *Queries) ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error) { rows, err := q.db.Query(ctx, listAuditEvents, arg.Kind, arg.OrgID, arg.Actor, - arg.Before, + arg.AfterT, + arg.AfterID, + arg.BeforeT, + arg.BeforeID, arg.MaxRows, ) if err != nil { diff --git a/internal/store/check_results.sql.go b/internal/store/check_results.sql.go index d9d13b6..a05761f 100644 --- a/internal/store/check_results.sql.go +++ b/internal/store/check_results.sql.go @@ -343,6 +343,82 @@ func (q *Queries) LatestResultsForMonitor(ctx context.Context, arg LatestResults return items, nil } +const listResults = `-- name: ListResults :many +SELECT time, region, ok, latency_ms, status_code, error, checker_id, + (region || '|' || checker_id::text)::text AS position +FROM check_results +WHERE org_id = $1 AND monitor_id = $2 + AND ($3::timestamptz IS NULL + OR time <= $3 AND (time, region || '|' || checker_id::text) < ($3, $4::text)) + AND ($5::timestamptz IS NULL + OR time >= $5 AND (time, region || '|' || checker_id::text) > ($5, $6::text)) +ORDER BY + CASE WHEN $5::timestamptz IS NULL THEN time END DESC, + CASE WHEN $5::timestamptz IS NULL THEN region || '|' || checker_id::text END DESC, + time, region || '|' || checker_id::text +LIMIT $7 +` + +type ListResultsParams struct { + OrgID uuid.UUID + MonitorID uuid.UUID + AfterT *time.Time + AfterS *string + BeforeT *time.Time + BeforeS *string + MaxRows int32 +} + +type ListResultsRow struct { + Time time.Time + Region string + Ok bool + LatencyMs *int32 + StatusCode *int32 + Error *string + CheckerID uuid.UUID + Position string +} + +// A monitor's results newest first, a page from a keyset cursor (see +// paging.go) whose string key is region and checker. +func (q *Queries) ListResults(ctx context.Context, arg ListResultsParams) ([]ListResultsRow, error) { + rows, err := q.db.Query(ctx, listResults, + arg.OrgID, + arg.MonitorID, + arg.AfterT, + arg.AfterS, + arg.BeforeT, + arg.BeforeS, + arg.MaxRows, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []ListResultsRow{} + for rows.Next() { + var i ListResultsRow + if err := rows.Scan( + &i.Time, + &i.Region, + &i.Ok, + &i.LatencyMs, + &i.StatusCode, + &i.Error, + &i.CheckerID, + &i.Position, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const rangeBuckets = `-- name: RangeBuckets :many SELECT monitor_id, time_bucket($2::text::interval, time)::timestamptz AS bucket, count(*)::bigint AS total, count(*) FILTER (WHERE ok)::bigint AS ok_count, @@ -517,58 +593,6 @@ func (q *Queries) RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourly return items, nil } -const recentResults = `-- name: RecentResults :many -SELECT time, region, ok, latency_ms, status_code, error, checker_id -FROM check_results -WHERE org_id = $1 AND monitor_id = $2 AND time > $3 -ORDER BY time DESC -LIMIT 500 -` - -type RecentResultsParams struct { - OrgID uuid.UUID - MonitorID uuid.UUID - Time time.Time -} - -type RecentResultsRow struct { - Time time.Time - Region string - Ok bool - LatencyMs *int32 - StatusCode *int32 - Error *string - CheckerID uuid.UUID -} - -func (q *Queries) RecentResults(ctx context.Context, arg RecentResultsParams) ([]RecentResultsRow, error) { - rows, err := q.db.Query(ctx, recentResults, arg.OrgID, arg.MonitorID, arg.Time) - if err != nil { - return nil, err - } - defer rows.Close() - items := []RecentResultsRow{} - for rows.Next() { - var i RecentResultsRow - if err := rows.Scan( - &i.Time, - &i.Region, - &i.Ok, - &i.LatencyMs, - &i.StatusCode, - &i.Error, - &i.CheckerID, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - const regionBuckets = `-- name: RegionBuckets :many SELECT region, time_bucket($2::text::interval, time)::timestamptz AS bucket, count(*)::bigint AS total, count(*) FILTER (WHERE ok)::bigint AS ok_count @@ -732,14 +756,26 @@ func (q *Queries) RegionBucketsHourly(ctx context.Context, arg RegionBucketsHour const resultsByChecker = `-- name: ResultsByChecker :many SELECT r.time, r.monitor_id, r.region, r.ok, r.latency_ms, r.status_code, r.error FROM check_results r -WHERE r.org_id = $1 AND r.checker_id = $2 AND r.time > now() - interval '1 day' -ORDER BY r.time DESC -LIMIT 50 +WHERE r.org_id = $1 AND r.checker_id = $2 + AND ($3::timestamptz IS NULL + OR r.time <= $3 AND (r.time, r.monitor_id::text || '|' || r.region) < ($3, $4::text)) + AND ($5::timestamptz IS NULL + OR r.time >= $5 AND (r.time, r.monitor_id::text || '|' || r.region) > ($5, $6::text)) +ORDER BY + CASE WHEN $5::timestamptz IS NULL THEN r.time END DESC, + CASE WHEN $5::timestamptz IS NULL THEN r.monitor_id::text || '|' || r.region END DESC, + r.time, r.monitor_id::text || '|' || r.region +LIMIT $7 ` type ResultsByCheckerParams struct { OrgID uuid.UUID CheckerID uuid.UUID + AfterT *time.Time + AfterS *string + BeforeT *time.Time + BeforeS *string + MaxRows int32 } type ResultsByCheckerRow struct { @@ -752,9 +788,18 @@ type ResultsByCheckerRow struct { Error *string } -// The organization's latest results run by one checker instance. +// The organization's results run by one checker instance, newest first, a +// page from a keyset cursor whose string key is monitor and region. func (q *Queries) ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error) { - rows, err := q.db.Query(ctx, resultsByChecker, arg.OrgID, arg.CheckerID) + rows, err := q.db.Query(ctx, resultsByChecker, + arg.OrgID, + arg.CheckerID, + arg.AfterT, + arg.AfterS, + arg.BeforeT, + arg.BeforeS, + arg.MaxRows, + ) if err != nil { return nil, err } diff --git a/internal/store/evidence.sql.go b/internal/store/evidence.sql.go index 86cea44..c4639be 100644 --- a/internal/store/evidence.sql.go +++ b/internal/store/evidence.sql.go @@ -27,6 +27,44 @@ func (q *Queries) DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEv return err } +const evidenceBetween = `-- name: EvidenceBetween :many +SELECT id, region, time FROM check_evidence +WHERE monitor_id = $1 AND time BETWEEN $2 AND $3 +` + +type EvidenceBetweenParams struct { + MonitorID uuid.UUID + Since time.Time + Until time.Time +} + +type EvidenceBetweenRow struct { + ID uuid.UUID + Region string + Time time.Time +} + +// Evidence of a monitor in a time span, to link results to it. +func (q *Queries) EvidenceBetween(ctx context.Context, arg EvidenceBetweenParams) ([]EvidenceBetweenRow, error) { + rows, err := q.db.Query(ctx, evidenceBetween, arg.MonitorID, arg.Since, arg.Until) + if err != nil { + return nil, err + } + defer rows.Close() + items := []EvidenceBetweenRow{} + for rows.Next() { + var i EvidenceBetweenRow + if err := rows.Scan(&i.ID, &i.Region, &i.Time); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getEvidence = `-- name: GetEvidence :one SELECT id, org_id, monitor_id, region, checker_id, time, ok, status_code, error, evidence FROM check_evidence WHERE id = $1 AND monitor_id = $2 ` @@ -112,9 +150,24 @@ func (q *Queries) LastFailureEvidence(ctx context.Context, arg LastFailureEviden const listEvidence = `-- name: ListEvidence :many SELECT id, region, checker_id, time, ok, status_code, error FROM check_evidence WHERE monitor_id = $1 -ORDER BY time DESC LIMIT 100 + AND ($2::timestamptz IS NULL OR (time, id) < ($2, $3::uuid)) + AND ($4::timestamptz IS NULL OR (time, id) > ($4, $5::uuid)) +ORDER BY + CASE WHEN $4::timestamptz IS NULL THEN time END DESC, + CASE WHEN $4::timestamptz IS NULL THEN id END DESC, + time, id +LIMIT $6 ` +type ListEvidenceParams struct { + MonitorID uuid.UUID + AfterT *time.Time + AfterID *uuid.UUID + BeforeT *time.Time + BeforeID *uuid.UUID + MaxRows int32 +} + type ListEvidenceRow struct { ID uuid.UUID Region string @@ -125,8 +178,16 @@ type ListEvidenceRow struct { Error *string } -func (q *Queries) ListEvidence(ctx context.Context, monitorID uuid.UUID) ([]ListEvidenceRow, error) { - rows, err := q.db.Query(ctx, listEvidence, monitorID) +// Newest first, a page from a keyset cursor (see paging.go). +func (q *Queries) ListEvidence(ctx context.Context, arg ListEvidenceParams) ([]ListEvidenceRow, error) { + rows, err := q.db.Query(ctx, listEvidence, + arg.MonitorID, + arg.AfterT, + arg.AfterID, + arg.BeforeT, + arg.BeforeID, + arg.MaxRows, + ) if err != nil { return nil, err } diff --git a/internal/store/incidents.sql.go b/internal/store/incidents.sql.go index fdc24f4..c1581a9 100644 --- a/internal/store/incidents.sql.go +++ b/internal/store/incidents.sql.go @@ -245,10 +245,25 @@ const listIncidents = `-- name: ListIncidents :many SELECT i.id, i.org_id, i.monitor_id, i.started_at, i.resolved_at, i.cause, m.name AS monitor_name FROM incidents i JOIN monitors m ON m.id = i.monitor_id -ORDER BY i.started_at DESC -LIMIT 200 +WHERE ($1::uuid IS NULL OR i.monitor_id = $1) + AND ($2::timestamptz IS NULL OR (i.started_at, i.id) < ($2, $3::uuid)) + AND ($4::timestamptz IS NULL OR (i.started_at, i.id) > ($4, $5::uuid)) +ORDER BY + CASE WHEN $4::timestamptz IS NULL THEN i.started_at END DESC, + CASE WHEN $4::timestamptz IS NULL THEN i.id END DESC, + i.started_at, i.id +LIMIT $6 ` +type ListIncidentsParams struct { + MonitorID *uuid.UUID + AfterT *time.Time + AfterID *uuid.UUID + BeforeT *time.Time + BeforeID *uuid.UUID + MaxRows int32 +} + type ListIncidentsRow struct { ID uuid.UUID OrgID uuid.UUID @@ -259,8 +274,17 @@ type ListIncidentsRow struct { MonitorName string } -func (q *Queries) ListIncidents(ctx context.Context) ([]ListIncidentsRow, error) { - rows, err := q.db.Query(ctx, listIncidents) +// Newest first, a page from a keyset cursor (see paging.go); optionally of +// one monitor. +func (q *Queries) ListIncidents(ctx context.Context, arg ListIncidentsParams) ([]ListIncidentsRow, error) { + rows, err := q.db.Query(ctx, listIncidents, + arg.MonitorID, + arg.AfterT, + arg.AfterID, + arg.BeforeT, + arg.BeforeID, + arg.MaxRows, + ) if err != nil { return nil, err } @@ -321,37 +345,6 @@ func (q *Queries) MarkNotificationSent(ctx context.Context, id uuid.UUID) error return err } -const monitorIncidents = `-- name: MonitorIncidents :many -SELECT id, org_id, monitor_id, started_at, resolved_at, cause FROM incidents WHERE monitor_id = $1 ORDER BY started_at DESC LIMIT 20 -` - -func (q *Queries) MonitorIncidents(ctx context.Context, monitorID uuid.UUID) ([]Incident, error) { - rows, err := q.db.Query(ctx, monitorIncidents, monitorID) - if err != nil { - return nil, err - } - defer rows.Close() - items := []Incident{} - for rows.Next() { - var i Incident - if err := rows.Scan( - &i.ID, - &i.OrgID, - &i.MonitorID, - &i.StartedAt, - &i.ResolvedAt, - &i.Cause, - ); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - const notificationDetails = `-- name: NotificationDetails :many SELECT n.id, n.org_id, n.event, n.attempts, c.type AS channel_type, c.config AS channel_config, c.id AS channel_id, diff --git a/internal/store/limits.sql.go b/internal/store/limits.sql.go index 01dbde2..4df739e 100644 --- a/internal/store/limits.sql.go +++ b/internal/store/limits.sql.go @@ -29,16 +29,25 @@ LEFT JOIN LATERAL ( FROM memberships m JOIN users u ON u.id = m.user_id WHERE m.org_id = o.id AND m.is_owner ORDER BY m.created_at LIMIT 1 ) ow ON true -WHERE $1::text = '' +WHERE ($1::text = '' OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%' - OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%' -ORDER BY o.created_at DESC -LIMIT $2 + OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%') + AND ($2::timestamptz IS NULL OR (o.created_at, o.id) < ($2, $3::uuid)) + AND ($4::timestamptz IS NULL OR (o.created_at, o.id) > ($4, $5::uuid)) +ORDER BY + CASE WHEN $4::timestamptz IS NULL THEN o.created_at END DESC, + CASE WHEN $4::timestamptz IS NULL THEN o.id END DESC, + o.created_at, o.id +LIMIT $6 ` type AdminListOrgsParams struct { - Search string - MaxRows int32 + Search string + AfterT *time.Time + AfterID *uuid.UUID + BeforeT *time.Time + BeforeID *uuid.UUID + MaxRows int32 } type AdminListOrgsRow struct { @@ -64,9 +73,17 @@ type AdminListOrgsRow struct { } // System scope: organizations with their usage, limit overrides and owner, -// newest first, matching search in name, slug or owner email. +// matching search in name, slug or owner email; newest first, a page from a +// keyset cursor. func (q *Queries) AdminListOrgs(ctx context.Context, arg AdminListOrgsParams) ([]AdminListOrgsRow, error) { - rows, err := q.db.Query(ctx, adminListOrgs, arg.Search, arg.MaxRows) + rows, err := q.db.Query(ctx, adminListOrgs, + arg.Search, + arg.AfterT, + arg.AfterID, + arg.BeforeT, + arg.BeforeID, + arg.MaxRows, + ) if err != nil { return nil, err } diff --git a/internal/store/maintenance.sql.go b/internal/store/maintenance.sql.go index f93c8a9..8718ba2 100644 --- a/internal/store/maintenance.sql.go +++ b/internal/store/maintenance.sql.go @@ -168,6 +168,67 @@ func (q *Queries) ListMaintenance(ctx context.Context) ([]MaintenanceWindow, err return items, nil } +const listMaintenancePage = `-- name: ListMaintenancePage :many +SELECT id, org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until, created_at, updated_at FROM maintenance_windows +WHERE true + AND ($1::timestamptz IS NULL OR (starts_at, id) < ($1, $2::uuid)) + AND ($3::timestamptz IS NULL OR (starts_at, id) > ($3, $4::uuid)) +ORDER BY + CASE WHEN $3::timestamptz IS NULL THEN starts_at END DESC, + CASE WHEN $3::timestamptz IS NULL THEN id END DESC, + starts_at, id +LIMIT $5 +` + +type ListMaintenancePageParams struct { + AfterT *time.Time + AfterID *uuid.UUID + BeforeT *time.Time + BeforeID *uuid.UUID + MaxRows int32 +} + +// Latest start first, a page from a keyset cursor (see paging.go). +func (q *Queries) ListMaintenancePage(ctx context.Context, arg ListMaintenancePageParams) ([]MaintenanceWindow, error) { + rows, err := q.db.Query(ctx, listMaintenancePage, + arg.AfterT, + arg.AfterID, + arg.BeforeT, + arg.BeforeID, + arg.MaxRows, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []MaintenanceWindow{} + for rows.Next() { + var i MaintenanceWindow + if err := rows.Scan( + &i.ID, + &i.OrgID, + &i.Title, + &i.Description, + &i.StartsAt, + &i.DurationSeconds, + &i.TimeZone, + &i.Recurrence, + &i.Every, + &i.Weekdays, + &i.Until, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listMaintenanceTargets = `-- name: ListMaintenanceTargets :many SELECT window_id, org_id, monitor_id, group_id FROM maintenance_targets ` diff --git a/internal/store/memberships.sql.go b/internal/store/memberships.sql.go index 3551c0a..211a951 100644 --- a/internal/store/memberships.sql.go +++ b/internal/store/memberships.sql.go @@ -90,6 +90,70 @@ func (q *Queries) ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOr return items, nil } +const listOrgMembersPage = `-- name: ListOrgMembersPage :many +SELECT u.id, u.email, u.display_name, m.is_owner, m.created_at AS joined_at +FROM memberships m JOIN users u ON u.id = m.user_id +WHERE m.org_id = $1 + AND ($2::text IS NULL OR (u.email::text, u.id) > ($2, $3::uuid)) + AND ($4::text IS NULL OR (u.email::text, u.id) < ($4, $5::uuid)) +ORDER BY + CASE WHEN $4::text IS NULL THEN u.email::text END, + CASE WHEN $4::text IS NULL THEN u.id END, + u.email::text DESC, u.id DESC +LIMIT $6 +` + +type ListOrgMembersPageParams struct { + OrgID uuid.UUID + AfterS *string + AfterID *uuid.UUID + BeforeS *string + BeforeID *uuid.UUID + MaxRows int32 +} + +type ListOrgMembersPageRow struct { + ID uuid.UUID + Email string + DisplayName string + IsOwner bool + JoinedAt time.Time +} + +// By email, a page from a keyset cursor (see paging.go). +func (q *Queries) ListOrgMembersPage(ctx context.Context, arg ListOrgMembersPageParams) ([]ListOrgMembersPageRow, error) { + rows, err := q.db.Query(ctx, listOrgMembersPage, + arg.OrgID, + arg.AfterS, + arg.AfterID, + arg.BeforeS, + arg.BeforeID, + arg.MaxRows, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []ListOrgMembersPageRow{} + for rows.Next() { + var i ListOrgMembersPageRow + if err := rows.Scan( + &i.ID, + &i.Email, + &i.DisplayName, + &i.IsOwner, + &i.JoinedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listUserOrgs = `-- name: ListUserOrgs :many SELECT o.id, o.slug, o.name, o.require_totp, m.is_owner FROM memberships m diff --git a/internal/store/moderation.sql.go b/internal/store/moderation.sql.go index 3da9468..b777f0c 100644 --- a/internal/store/moderation.sql.go +++ b/internal/store/moderation.sql.go @@ -31,13 +31,22 @@ WHERE (p.published OR p.suspended_at IS NOT NULL OR o.suspended_at IS NOT NULL) OR coalesce(p.custom_domain::text, '') ILIKE '%' || $1 || '%' OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%' OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%') -ORDER BY p.created_at DESC -LIMIT $2 + AND ($2::timestamptz IS NULL OR (p.created_at, p.id) < ($2, $3::uuid)) + AND ($4::timestamptz IS NULL OR (p.created_at, p.id) > ($4, $5::uuid)) +ORDER BY + CASE WHEN $4::timestamptz IS NULL THEN p.created_at END DESC, + CASE WHEN $4::timestamptz IS NULL THEN p.id END DESC, + p.created_at, p.id +LIMIT $6 ` type AdminListStatusPagesParams struct { - Search string - MaxRows int32 + Search string + AfterT *time.Time + AfterID *uuid.UUID + BeforeT *time.Time + BeforeID *uuid.UUID + MaxRows int32 } type AdminListStatusPagesRow struct { @@ -63,10 +72,17 @@ type AdminListStatusPagesRow struct { } // System scope: public status pages and suspended ones, with their -// organization and its owner, newest first, matching search in title, -// slug, domain, organization or owner email. +// organization and its owner, matching search in title, slug, domain, +// organization or owner email; newest first, a page from a keyset cursor. func (q *Queries) AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error) { - rows, err := q.db.Query(ctx, adminListStatusPages, arg.Search, arg.MaxRows) + rows, err := q.db.Query(ctx, adminListStatusPages, + arg.Search, + arg.AfterT, + arg.AfterID, + arg.BeforeT, + arg.BeforeID, + arg.MaxRows, + ) if err != nil { return nil, err } diff --git a/internal/store/monitors.sql.go b/internal/store/monitors.sql.go index 5b469d2..0a5e9a8 100644 --- a/internal/store/monitors.sql.go +++ b/internal/store/monitors.sql.go @@ -227,6 +227,67 @@ func (q *Queries) ListMonitors(ctx context.Context) ([]Monitor, error) { return items, nil } +const listMonitorsPage = `-- name: ListMonitorsPage :many +SELECT id, org_id, name, type, target, interval_seconds, timeout_ms, config, enabled, created_at, updated_at, confirmations, group_id FROM monitors +WHERE true + AND ($1::text IS NULL OR (name, id) > ($1, $2::uuid)) + AND ($3::text IS NULL OR (name, id) < ($3, $4::uuid)) +ORDER BY + CASE WHEN $3::text IS NULL THEN name END, + CASE WHEN $3::text IS NULL THEN id END, + name DESC, id DESC +LIMIT $5 +` + +type ListMonitorsPageParams struct { + AfterS *string + AfterID *uuid.UUID + BeforeS *string + BeforeID *uuid.UUID + MaxRows int32 +} + +// By name, a page from a keyset cursor (see paging.go). +func (q *Queries) ListMonitorsPage(ctx context.Context, arg ListMonitorsPageParams) ([]Monitor, error) { + rows, err := q.db.Query(ctx, listMonitorsPage, + arg.AfterS, + arg.AfterID, + arg.BeforeS, + arg.BeforeID, + arg.MaxRows, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []Monitor{} + for rows.Next() { + var i Monitor + if err := rows.Scan( + &i.ID, + &i.OrgID, + &i.Name, + &i.Type, + &i.Target, + &i.IntervalSeconds, + &i.TimeoutMs, + &i.Config, + &i.Enabled, + &i.CreatedAt, + &i.UpdatedAt, + &i.Confirmations, + &i.GroupID, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const monitorRegions = `-- name: MonitorRegions :many SELECT region_id FROM monitor_regions WHERE monitor_id = $1 ORDER BY region_id ` diff --git a/internal/store/querier.go b/internal/store/querier.go index b15bd87..5bf9de8 100644 --- a/internal/store/querier.go +++ b/internal/store/querier.go @@ -20,11 +20,12 @@ type Querier interface { AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error // System scope: organizations with their usage, limit overrides and owner, - // newest first, matching search in name, slug or owner email. + // matching search in name, slug or owner email; newest first, a page from a + // keyset cursor. AdminListOrgs(ctx context.Context, arg AdminListOrgsParams) ([]AdminListOrgsRow, error) // System scope: public status pages and suspended ones, with their - // organization and its owner, newest first, matching search in title, - // slug, domain, organization or owner email. + // organization and its owner, matching search in title, slug, domain, + // organization or owner email; newest first, a page from a keyset cursor. AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error) AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error) // System scope: enabled alertmanager monitors of org, with when they last @@ -102,11 +103,16 @@ type Querier interface { EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error // An empty name names a new region after its key and keeps an existing name. EnsurePlatformRegion(ctx context.Context, arg EnsurePlatformRegionParams) (Region, error) + // Evidence of a monitor in a time span, to link results to it. + EvidenceBetween(ctx context.Context, arg EvidenceBetweenParams) ([]EvidenceBetweenRow, error) // System scope: resolves a request to a page by verified custom domain or // by slug. FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, error) // Alerts of org that fire and were repeated within the stale period. FiringAlerts(ctx context.Context, arg FiringAlertsParams) ([]FiringAlertsRow, error) + // FiringAlerts newest first, a page from a keyset cursor (see paging.go) + // whose string key is the fingerprint. + FiringAlertsPage(ctx context.Context, arg FiringAlertsPageParams) ([]FiringAlertsPageRow, error) // When each monitor and region first reported, to the day. FirstDataDaily(ctx context.Context, orgID uuid.UUID) ([]FirstDataDailyRow, error) // When each monitor and region first reported since $2, exactly. Used for @@ -171,24 +177,36 @@ type Querier interface { ListAlertGroups(ctx context.Context) ([]ListAlertGroupsRow, error) ListAlertmanagerReceivers(ctx context.Context) ([]ListAlertmanagerReceiversRow, error) ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error) - // Newest first, paged by time. kind narrows to one kind; the row policy - // already limits what the scope can see. + // Newest first, a page from a keyset cursor (see paging.go). kind narrows + // to one kind; the row policy already limits what the scope can see. ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error) ListChannels(ctx context.Context) ([]NotificationChannel, error) // System scope: every enabled monitor with its regions, for reconciling the // schedule. ListEnabledMonitorsForSchedule(ctx context.Context) ([]ListEnabledMonitorsForScheduleRow, error) ListEnabledSSOProviders(ctx context.Context) ([]ListEnabledSSOProvidersRow, error) - ListEvidence(ctx context.Context, monitorID uuid.UUID) ([]ListEvidenceRow, error) + // Newest first, a page from a keyset cursor (see paging.go). + ListEvidence(ctx context.Context, arg ListEvidenceParams) ([]ListEvidenceRow, error) ListGroups(ctx context.Context) ([]MonitorGroup, error) - ListIncidents(ctx context.Context) ([]ListIncidentsRow, error) + // Newest first, a page from a keyset cursor (see paging.go); optionally of + // one monitor. + ListIncidents(ctx context.Context, arg ListIncidentsParams) ([]ListIncidentsRow, error) ListMaintenance(ctx context.Context) ([]MaintenanceWindow, error) + // Latest start first, a page from a keyset cursor (see paging.go). + ListMaintenancePage(ctx context.Context, arg ListMaintenancePageParams) ([]MaintenanceWindow, error) ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error) ListMonitors(ctx context.Context) ([]Monitor, error) + // By name, a page from a keyset cursor (see paging.go). + ListMonitorsPage(ctx context.Context, arg ListMonitorsPageParams) ([]Monitor, error) ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOrgMembersRow, error) + // By email, a page from a keyset cursor (see paging.go). + ListOrgMembersPage(ctx context.Context, arg ListOrgMembersPageParams) ([]ListOrgMembersPageRow, error) ListOrgs(ctx context.Context) ([]Org, error) ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error) ListPlatformRegions(ctx context.Context) ([]Region, error) + // A monitor's results newest first, a page from a keyset cursor (see + // paging.go) whose string key is region and checker. + ListResults(ctx context.Context, arg ListResultsParams) ([]ListResultsRow, error) ListRoles(ctx context.Context) ([]Role, error) ListSSOProviders(ctx context.Context) ([]SsoProvider, error) ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([]StatusPageGroup, error) @@ -213,7 +231,6 @@ type Querier interface { MemberGrants(ctx context.Context, arg MemberGrantsParams) ([]MemberGrantsRow, error) MonitorAlertGroups(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error) MonitorAlertRoutes(ctx context.Context, monitorID uuid.UUID) ([]MonitorAlertRoutesRow, error) - MonitorIncidents(ctx context.Context, monitorID uuid.UUID) ([]Incident, error) MonitorRegions(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error) // System scope: monitors to hand to a checker of region, skipping ones that // were disabled, deleted or moved out of the region since dispatch. An @@ -251,7 +268,6 @@ type Querier interface { RangeBucketsDaily(ctx context.Context, arg RangeBucketsDailyParams) ([]RangeBucketsDailyRow, error) // The hourly aggregate rebucketed by width, for ranges of days. RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error) - RecentResults(ctx context.Context, arg RecentResultsParams) ([]RecentResultsRow, error) // One monitor's raw results per region. RegionBuckets(ctx context.Context, arg RegionBucketsParams) ([]RegionBucketsRow, error) RegionBucketsDaily(ctx context.Context, arg RegionBucketsDailyParams) ([]RegionBucketsDailyRow, error) @@ -266,7 +282,8 @@ type Querier interface { // Heartbeats of an organization wait afresh after its suspension, during // which pings were refused. RestartHeartbeatWait(ctx context.Context, orgID uuid.UUID) error - // The organization's latest results run by one checker instance. + // The organization's results run by one checker instance, newest first, a + // page from a keyset cursor whose string key is monitor and region. ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error) ScrubAuditEmail(ctx context.Context, email string) error SetAgentAllowPrivate(ctx context.Context, arg SetAgentAllowPrivateParams) (int64, error) diff --git a/internal/store/queries/alertmanager.sql b/internal/store/queries/alertmanager.sql index 3484b3a..55f8187 100644 --- a/internal/store/queries/alertmanager.sql +++ b/internal/store/queries/alertmanager.sql @@ -49,3 +49,17 @@ WHERE m.type = 'alertmanager' AND m.enabled AND (sqlc.narg(org_id)::uuid IS NULL SELECT ok, coalesce(error, '')::text AS error FROM check_results WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '2 days' ORDER BY time DESC LIMIT 1; + +-- name: FiringAlertsPage :many +-- FiringAlerts newest first, a page from a keyset cursor (see paging.go) +-- whose string key is the fingerprint. +SELECT fingerprint, labels, annotations, starts_at, generator_url, updated_at +FROM alertmanager_alerts +WHERE org_id = sqlc.arg(org_id) AND status = 'firing' AND updated_at > sqlc.arg(since) + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (starts_at, fingerprint) < (sqlc.narg(after_t), sqlc.narg(after_s)::text)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (starts_at, fingerprint) > (sqlc.narg(before_t), sqlc.narg(before_s)::text)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN starts_at END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN fingerprint END DESC, + starts_at, fingerprint +LIMIT sqlc.arg(max_rows); diff --git a/internal/store/queries/audit.sql b/internal/store/queries/audit.sql index d3c51f8..4ae7f8c 100644 --- a/internal/store/queries/audit.sql +++ b/internal/store/queries/audit.sql @@ -3,8 +3,8 @@ INSERT INTO audit_events (kind, org_id, actor_user_id, actor_token_id, action, t VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11); -- name: ListAuditEvents :many --- Newest first, paged by time. kind narrows to one kind; the row policy --- already limits what the scope can see. +-- Newest first, a page from a keyset cursor (see paging.go). kind narrows +-- to one kind; the row policy already limits what the scope can see. SELECT e.id, e.time, e.kind, e.org_id, e.actor_user_id, e.actor_token_id, e.action, e.target_id, e.details, e.status, coalesce(host(e.ip), '')::text AS ip, coalesce(e.user_agent, '') AS user_agent, coalesce(e.request_id, '') AS request_id, @@ -14,8 +14,12 @@ LEFT JOIN users u ON u.id = e.actor_user_id WHERE e.kind = sqlc.arg(kind) AND (sqlc.narg(org_id)::uuid IS NULL OR e.org_id = sqlc.narg(org_id)) AND (sqlc.narg(actor)::uuid IS NULL OR e.actor_user_id = sqlc.narg(actor)) - AND (sqlc.narg(before)::timestamptz IS NULL OR e.time < sqlc.narg(before)) -ORDER BY e.time DESC + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (e.time, e.id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (e.time, e.id) > (sqlc.narg(before_t), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN e.time END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN e.id END DESC, + e.time, e.id LIMIT sqlc.arg(max_rows); -- name: PurgeAuditEvents :execrows diff --git a/internal/store/queries/check_results.sql b/internal/store/queries/check_results.sql index 63b9685..cbc025a 100644 --- a/internal/store/queries/check_results.sql +++ b/internal/store/queries/check_results.sql @@ -12,12 +12,22 @@ FROM check_results WHERE org_id = $1 AND time > now() - interval '1 day' ORDER BY monitor_id, region, time DESC; --- name: RecentResults :many -SELECT time, region, ok, latency_ms, status_code, error, checker_id +-- name: ListResults :many +-- A monitor's results newest first, a page from a keyset cursor (see +-- paging.go) whose string key is region and checker. +SELECT time, region, ok, latency_ms, status_code, error, checker_id, + (region || '|' || checker_id::text)::text AS position FROM check_results -WHERE org_id = $1 AND monitor_id = $2 AND time > $3 -ORDER BY time DESC -LIMIT 500; +WHERE org_id = sqlc.arg(org_id) AND monitor_id = sqlc.arg(monitor_id) + AND (sqlc.narg(after_t)::timestamptz IS NULL + OR time <= sqlc.narg(after_t) AND (time, region || '|' || checker_id::text) < (sqlc.narg(after_t), sqlc.narg(after_s)::text)) + AND (sqlc.narg(before_t)::timestamptz IS NULL + OR time >= sqlc.narg(before_t) AND (time, region || '|' || checker_id::text) > (sqlc.narg(before_t), sqlc.narg(before_s)::text)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN time END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN region || '|' || checker_id::text END DESC, + time, region || '|' || checker_id::text +LIMIT sqlc.arg(max_rows); -- name: UptimeSince :many -- Uptime per monitor from the hourly aggregate, including the not yet @@ -130,12 +140,20 @@ WHERE org_id = $1 AND time >= $2 GROUP BY 1, 2; -- name: ResultsByChecker :many --- The organization's latest results run by one checker instance. +-- The organization's results run by one checker instance, newest first, a +-- page from a keyset cursor whose string key is monitor and region. SELECT r.time, r.monitor_id, r.region, r.ok, r.latency_ms, r.status_code, r.error FROM check_results r -WHERE r.org_id = $1 AND r.checker_id = sqlc.arg(checker_id) AND r.time > now() - interval '1 day' -ORDER BY r.time DESC -LIMIT 50; +WHERE r.org_id = sqlc.arg(org_id) AND r.checker_id = sqlc.arg(checker_id) + AND (sqlc.narg(after_t)::timestamptz IS NULL + OR r.time <= sqlc.narg(after_t) AND (r.time, r.monitor_id::text || '|' || r.region) < (sqlc.narg(after_t), sqlc.narg(after_s)::text)) + AND (sqlc.narg(before_t)::timestamptz IS NULL + OR r.time >= sqlc.narg(before_t) AND (r.time, r.monitor_id::text || '|' || r.region) > (sqlc.narg(before_t), sqlc.narg(before_s)::text)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN r.time END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN r.monitor_id::text || '|' || r.region END DESC, + r.time, r.monitor_id::text || '|' || r.region +LIMIT sqlc.arg(max_rows); -- name: CheckerStats :one -- How much one instance checked for the organization in the last hour. diff --git a/internal/store/queries/evidence.sql b/internal/store/queries/evidence.sql index b380d3d..a7f6c38 100644 --- a/internal/store/queries/evidence.sql +++ b/internal/store/queries/evidence.sql @@ -12,9 +12,21 @@ WHERE monitor_id = $1 AND region = $2 AND NOT ok ORDER BY time DESC LIMIT 1; -- name: ListEvidence :many +-- Newest first, a page from a keyset cursor (see paging.go). SELECT id, region, checker_id, time, ok, status_code, error FROM check_evidence -WHERE monitor_id = $1 -ORDER BY time DESC LIMIT 100; +WHERE monitor_id = sqlc.arg(monitor_id) + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (time, id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (time, id) > (sqlc.narg(before_t), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN time END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN id END DESC, + time, id +LIMIT sqlc.arg(max_rows); + +-- name: EvidenceBetween :many +-- Evidence of a monitor in a time span, to link results to it. +SELECT id, region, time FROM check_evidence +WHERE monitor_id = $1 AND time BETWEEN sqlc.arg(since) AND sqlc.arg(until); -- name: GetEvidence :one SELECT * FROM check_evidence WHERE id = $1 AND monitor_id = $2; diff --git a/internal/store/queries/incidents.sql b/internal/store/queries/incidents.sql index 6fc9fd9..1a2f77f 100644 --- a/internal/store/queries/incidents.sql +++ b/internal/store/queries/incidents.sql @@ -10,11 +10,19 @@ WHERE monitor_id = sqlc.arg(monitor_id) AND resolved_at IS NULL RETURNING *; -- name: ListIncidents :many +-- Newest first, a page from a keyset cursor (see paging.go); optionally of +-- one monitor. SELECT i.*, m.name AS monitor_name FROM incidents i JOIN monitors m ON m.id = i.monitor_id -ORDER BY i.started_at DESC -LIMIT 200; +WHERE (sqlc.narg(monitor_id)::uuid IS NULL OR i.monitor_id = sqlc.narg(monitor_id)) + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (i.started_at, i.id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (i.started_at, i.id) > (sqlc.narg(before_t), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN i.started_at END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN i.id END DESC, + i.started_at, i.id +LIMIT sqlc.arg(max_rows); -- name: EnqueueNotification :exec INSERT INTO notifications (org_id, channel_id, incident_id, event) @@ -78,9 +86,6 @@ DELETE FROM notification_channels WHERE id = $1; -- name: OpenIncidents :many SELECT * FROM incidents WHERE resolved_at IS NULL; --- name: MonitorIncidents :many -SELECT * FROM incidents WHERE monitor_id = $1 ORDER BY started_at DESC LIMIT 20; - -- name: IncidentsForMonitors :many SELECT * FROM incidents WHERE monitor_id = ANY (sqlc.arg(ids)::uuid[]) AND (resolved_at IS NULL OR resolved_at > sqlc.arg(since)) diff --git a/internal/store/queries/limits.sql b/internal/store/queries/limits.sql index 5795b5a..87669f9 100644 --- a/internal/store/queries/limits.sql +++ b/internal/store/queries/limits.sql @@ -21,7 +21,8 @@ RETURNING id, email; -- name: AdminListOrgs :many -- System scope: organizations with their usage, limit overrides and owner, --- newest first, matching search in name, slug or owner email. +-- matching search in name, slug or owner email; newest first, a page from a +-- keyset cursor. SELECT o.id, o.slug, o.name, o.created_at, o.suspended_at, o.suspended_reason, o.limit_monitors, o.limit_status_pages, o.limit_regions_per_monitor, o.limit_own_regions_count, (SELECT count(*) FROM monitors m WHERE m.org_id = o.id)::integer AS monitors, @@ -38,8 +39,13 @@ LEFT JOIN LATERAL ( FROM memberships m JOIN users u ON u.id = m.user_id WHERE m.org_id = o.id AND m.is_owner ORDER BY m.created_at LIMIT 1 ) ow ON true -WHERE sqlc.arg(search)::text = '' +WHERE (sqlc.arg(search)::text = '' OR o.name ILIKE '%' || sqlc.arg(search) || '%' OR o.slug::text ILIKE '%' || sqlc.arg(search) || '%' - OR coalesce(ow.email::text, '') ILIKE '%' || sqlc.arg(search) || '%' -ORDER BY o.created_at DESC + OR coalesce(ow.email::text, '') ILIKE '%' || sqlc.arg(search) || '%') + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (o.created_at, o.id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (o.created_at, o.id) > (sqlc.narg(before_t), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN o.created_at END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN o.id END DESC, + o.created_at, o.id LIMIT sqlc.arg(max_rows); diff --git a/internal/store/queries/maintenance.sql b/internal/store/queries/maintenance.sql index 39fc098..ca8b44e 100644 --- a/internal/store/queries/maintenance.sql +++ b/internal/store/queries/maintenance.sql @@ -47,3 +47,15 @@ covered AS ( SELECT c.monitor_id, w.id, w.title, w.description, w.starts_at, w.duration_seconds, w.time_zone, w.recurrence, w.every, w.weekdays, w.until FROM covered c JOIN maintenance_windows w ON w.id = c.window_id; + +-- name: ListMaintenancePage :many +-- Latest start first, a page from a keyset cursor (see paging.go). +SELECT * FROM maintenance_windows +WHERE true + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (starts_at, id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (starts_at, id) > (sqlc.narg(before_t), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN starts_at END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN id END DESC, + starts_at, id +LIMIT sqlc.arg(max_rows); diff --git a/internal/store/queries/memberships.sql b/internal/store/queries/memberships.sql index faba066..0366e0b 100644 --- a/internal/store/queries/memberships.sql +++ b/internal/store/queries/memberships.sql @@ -20,3 +20,16 @@ ORDER BY o.name; -- name: GetMembership :one SELECT * FROM memberships WHERE org_id = $1 AND user_id = $2; + +-- name: ListOrgMembersPage :many +-- By email, a page from a keyset cursor (see paging.go). +SELECT u.id, u.email, u.display_name, m.is_owner, m.created_at AS joined_at +FROM memberships m JOIN users u ON u.id = m.user_id +WHERE m.org_id = sqlc.arg(org_id) + AND (sqlc.narg(after_s)::text IS NULL OR (u.email::text, u.id) > (sqlc.narg(after_s), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_s)::text IS NULL OR (u.email::text, u.id) < (sqlc.narg(before_s), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_s)::text IS NULL THEN u.email::text END, + CASE WHEN sqlc.narg(before_s)::text IS NULL THEN u.id END, + u.email::text DESC, u.id DESC +LIMIT sqlc.arg(max_rows); diff --git a/internal/store/queries/moderation.sql b/internal/store/queries/moderation.sql index 5da78b3..6981c4f 100644 --- a/internal/store/queries/moderation.sql +++ b/internal/store/queries/moderation.sql @@ -1,7 +1,7 @@ -- name: AdminListStatusPages :many -- System scope: public status pages and suspended ones, with their --- organization and its owner, newest first, matching search in title, --- slug, domain, organization or owner email. +-- organization and its owner, matching search in title, slug, domain, +-- organization or owner email; newest first, a page from a keyset cursor. SELECT p.id, p.slug, p.title, p.published, p.custom_domain, p.domain_verified_at, p.suspended_at, p.suspended_reason, p.created_at, o.id AS org_id, o.slug AS org_slug, o.name AS org_name, o.suspended_at AS org_suspended_at, o.suspended_reason AS org_suspended_reason, @@ -20,7 +20,12 @@ WHERE (p.published OR p.suspended_at IS NOT NULL OR o.suspended_at IS NOT NULL) OR coalesce(p.custom_domain::text, '') ILIKE '%' || sqlc.arg(search) || '%' OR o.name ILIKE '%' || sqlc.arg(search) || '%' OR o.slug::text ILIKE '%' || sqlc.arg(search) || '%' OR coalesce(ow.email::text, '') ILIKE '%' || sqlc.arg(search) || '%') -ORDER BY p.created_at DESC + AND (sqlc.narg(after_t)::timestamptz IS NULL OR (p.created_at, p.id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_t)::timestamptz IS NULL OR (p.created_at, p.id) > (sqlc.narg(before_t), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN p.created_at END DESC, + CASE WHEN sqlc.narg(before_t)::timestamptz IS NULL THEN p.id END DESC, + p.created_at, p.id LIMIT sqlc.arg(max_rows); -- name: SuspendStatusPage :one diff --git a/internal/store/queries/monitors.sql b/internal/store/queries/monitors.sql index 4745b8f..7590c87 100644 --- a/internal/store/queries/monitors.sql +++ b/internal/store/queries/monitors.sql @@ -60,3 +60,15 @@ JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = sqlc.arg(region_ JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL WHERE m.id = ANY (sqlc.arg(ids)::uuid[]) AND m.enabled AND (sqlc.narg(agent_org)::uuid IS NULL OR m.org_id = sqlc.narg(agent_org)); + +-- name: ListMonitorsPage :many +-- By name, a page from a keyset cursor (see paging.go). +SELECT * FROM monitors +WHERE true + AND (sqlc.narg(after_s)::text IS NULL OR (name, id) > (sqlc.narg(after_s), sqlc.narg(after_id)::uuid)) + AND (sqlc.narg(before_s)::text IS NULL OR (name, id) < (sqlc.narg(before_s), sqlc.narg(before_id)::uuid)) +ORDER BY + CASE WHEN sqlc.narg(before_s)::text IS NULL THEN name END, + CASE WHEN sqlc.narg(before_s)::text IS NULL THEN id END, + name DESC, id DESC +LIMIT sqlc.arg(max_rows); diff --git a/internal/store/results_test.go b/internal/store/results_test.go index f30de7f..8f10470 100644 --- a/internal/store/results_test.go +++ b/internal/store/results_test.go @@ -23,7 +23,8 @@ func TestResultQueriesFilterByOrg(t *testing.T) { if strings.Contains(b, ":copyfrom") { continue } - if !regexp.MustCompile(`(?i)WHERE[^;]*\borg_id\s*=\s*\$1`).MatchString(b) { + // The organization is the first parameter, positional or named. + if !regexp.MustCompile(`(?i)WHERE[^;]*\borg_id\s*=\s*(\$1|sqlc\.arg\(org_id\))`).MatchString(b) { t.Errorf("query %s does not filter by org_id = $1", name) } } diff --git a/internal/web/admin_orgs.templ b/internal/web/admin_orgs.templ index e419e44..f038ea0 100644 --- a/internal/web/admin_orgs.templ +++ b/internal/web/admin_orgs.templ @@ -2,7 +2,6 @@ package web import ( "context" - "net/url" "strconv" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" @@ -21,8 +20,10 @@ type LimitsView struct { type OrgsView struct { Search string Orgs []OrgRow - Limited bool + Pager Pager Defaults LimitsView + // Next is the page to return to after an action. + Next string } // OrgRow is an organization with its usage and limits. Overrides are form @@ -40,12 +41,7 @@ type OrgRow struct { OwnerOrgLimit string } -func (v OrgsView) next() string { - if v.Search == "" { - return "/admin#orgs" - } - return "/admin?oq=" + url.QueryEscape(v.Search) + "#orgs" -} +func (v OrgsView) next() string { return v.Next } // limitText shows a limit, or "unlimited". func limitText(ctx context.Context, n int) string { @@ -97,10 +93,10 @@ templ orgsSection(v OrgsView) {
@sectionHeading("orgs.title")

{ i18n.T(ctx, "orgs.intro") }

-
+ - if v.Limited { -

{ i18n.T(ctx, "moderation.limited") }

- } } + @pager(v.Pager, "newer", "older")
} diff --git a/internal/web/admin_orgs_templ.go b/internal/web/admin_orgs_templ.go index ac8b478..f5aab8f 100644 --- a/internal/web/admin_orgs_templ.go +++ b/internal/web/admin_orgs_templ.go @@ -11,7 +11,6 @@ import templruntime "github.com/a-h/templ/runtime" import ( "context" - "net/url" "strconv" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" @@ -30,8 +29,10 @@ type LimitsView struct { type OrgsView struct { Search string Orgs []OrgRow - Limited bool + Pager Pager Defaults LimitsView + // Next is the page to return to after an action. + Next string } // OrgRow is an organization with its usage and limits. Overrides are form @@ -49,12 +50,7 @@ type OrgRow struct { OwnerOrgLimit string } -func (v OrgsView) next() string { - if v.Search == "" { - return "/admin#orgs" - } - return "/admin?oq=" + url.QueryEscape(v.Search) + "#orgs" -} +func (v OrgsView) next() string { return v.Next } // limitText shows a limit, or "unlimited". func limitText(ctx context.Context, n int) string { @@ -96,7 +92,7 @@ func limitsSection(d LimitsView) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 61, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 57, Col: 66} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -145,7 +141,7 @@ func limitsSection(d LimitsView) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_count_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 71, Col: 89} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 67, Col: 89} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -158,7 +154,7 @@ func limitsSection(d LimitsView) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 72, Col: 129} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 68, Col: 129} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -198,7 +194,7 @@ func overrideField(label, name, value string, def int, max int) templ.Component var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 81, Col: 90} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 77, Col: 90} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -211,7 +207,7 @@ func overrideField(label, name, value string, def int, max int) templ.Component var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 84, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 80, Col: 14} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7) if templ_7745c5c3_Err != nil { @@ -224,7 +220,7 @@ func overrideField(label, name, value string, def int, max int) templ.Component var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(max)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 88, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 84, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8) if templ_7745c5c3_Err != nil { @@ -237,7 +233,7 @@ func overrideField(label, name, value string, def int, max int) templ.Component var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 89, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 85, Col: 16} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9) if templ_7745c5c3_Err != nil { @@ -250,7 +246,7 @@ func overrideField(label, name, value string, def int, max int) templ.Component var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "limits.default", "Value", limitText(ctx, def))).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 90, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 86, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10) if templ_7745c5c3_Err != nil { @@ -296,20 +292,20 @@ func orgsSection(v OrgsView) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 99, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 95, Col: 74} } _, 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, 17, "

") - 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, "moderation.limited")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 189, Col: 74} - } - _, 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, 69, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "") + templ_7745c5c3_Err = pager(v.Pager, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + 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 } @@ -872,25 +853,25 @@ func usage(used, max int) templ.Component { 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, 71, " 0 && used >= max)} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var43...) + var templ_7745c5c3_Var42 = []any{templ.KV("text-down", max > 0 && used >= max)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var42...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var44 string - templ_7745c5c3_Var44, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var43).String()).Resolve(ctx) + var templ_7745c5c3_Var43 string + templ_7745c5c3_Var43, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var42).String()).Resolve(ctx) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 1, Col: 0} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var44) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var43) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "\"") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -904,33 +885,33 @@ func usage(used, max int) templ.Component { } templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, ">") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, ">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var44 string + templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(used)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 191, Col: 83} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, " / ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var45 string - templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(used)) + templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(limitText(ctx, max)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 197, Col: 83} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 191, Col: 109} } _, 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, 74, " / ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var46 string - templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(limitText(ctx, max)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 197, Col: 109} - } - _, 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, 75, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -961,7 +942,7 @@ func usageSection(u UsageView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -969,14 +950,35 @@ func usageSection(u UsageView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "
") + 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, "limits.monitors")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 204, Col: 39} + } + _, 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, 76, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = usage(u.Monitors, u.Limits.Monitors).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var48 string - templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.monitors")) + templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.status_pages")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 210, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 206, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48)) if templ_7745c5c3_Err != nil { @@ -986,7 +988,7 @@ func usageSection(u UsageView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = usage(u.Monitors, u.Limits.Monitors).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = usage(u.StatusPages, u.Limits.StatusPages).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -995,9 +997,9 @@ func usageSection(u UsageView) templ.Component { return templ_7745c5c3_Err } var templ_7745c5c3_Var49 string - templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.status_pages")) + templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.regions_per_monitor")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 212, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 208, Col: 50} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) if templ_7745c5c3_Err != nil { @@ -1007,60 +1009,39 @@ func usageSection(u UsageView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = usage(u.StatusPages, u.Limits.StatusPages).Render(ctx, templ_7745c5c3_Buffer) - 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_Var50 string - templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.regions_per_monitor")) + templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(limitText(ctx, u.Limits.RegionsPerMonitor)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 214, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 209, Col: 77} } _, 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, 82, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var51 string - templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(limitText(ctx, u.Limits.RegionsPerMonitor)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 215, Col: 77} - } - _, 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, 83, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if u.Limits.RegionsPerMonitor > 0 && !u.Limits.OwnRegionsCount { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var52 string - templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_free")) + var templ_7745c5c3_Var51 string + templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_free")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 218, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 212, Col: 78} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52)) + _, 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, 85, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/alertmanager.templ b/internal/web/alertmanager.templ index 7606742..61dbbe8 100644 --- a/internal/web/alertmanager.templ +++ b/internal/web/alertmanager.templ @@ -6,6 +6,7 @@ import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" type AlertmanagerView struct { Receivers []ReceiverRow Alerts []AlertRow + Pager Pager CanManage bool } @@ -67,6 +68,7 @@ templ AlertmanagerPage(p Page, me Me, v AlertmanagerView) { } } + @pager(v.Pager, "newer", "older") if v.CanManage {
diff --git a/internal/web/alertmanager_templ.go b/internal/web/alertmanager_templ.go index 43df563..6fac126 100644 --- a/internal/web/alertmanager_templ.go +++ b/internal/web/alertmanager_templ.go @@ -15,6 +15,7 @@ import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" type AlertmanagerView struct { Receivers []ReceiverRow Alerts []AlertRow + Pager Pager CanManage bool } @@ -86,7 +87,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.no_alerts")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 37, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 38, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -117,7 +118,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 45, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 46, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -130,7 +131,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.since", "Time", a.Since)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 46, Col: 104} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 47, Col: 104} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -148,7 +149,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Summary) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 49, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 50, Col: 54} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -171,7 +172,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(l[0] + "=" + l[1]) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 53, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 54, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -194,7 +195,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.CreateURL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 59, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 60, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8) if templ_7745c5c3_Err != nil { @@ -207,7 +208,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.create_monitor")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 59, Col: 160} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 60, Col: 160} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -226,7 +227,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(m.URL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 62, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 63, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10) if templ_7745c5c3_Err != nil { @@ -239,7 +240,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(m.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 62, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 63, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -261,6 +262,10 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { return templ_7745c5c3_Err } } + templ_7745c5c3_Err = pager(v.Pager, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + 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 @@ -287,7 +292,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 79, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 81, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -300,7 +305,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(r.Prefix) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 80, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 82, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -313,7 +318,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.last_received", "Time", r.LastSeen)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 83, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 85, Col: 115} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -326,7 +331,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/alertmanager/receivers/" + r.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 84, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 86, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15) if templ_7745c5c3_Err != nil { @@ -339,7 +344,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "alertmanager.delete_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 84, Col: 142} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 86, Col: 142} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16) if templ_7745c5c3_Err != nil { @@ -352,7 +357,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.delete")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 84, Col: 245} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 86, Col: 245} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -391,7 +396,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.copy_now")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 95, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 97, Col: 68} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { @@ -404,7 +409,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.config_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 99, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 101, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { @@ -417,7 +422,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(alertmanagerExample) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 100, Col: 117} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/alertmanager.templ`, Line: 102, Col: 117} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { diff --git a/internal/web/audit.templ b/internal/web/audit.templ index e3efc74..4c2013a 100644 --- a/internal/web/audit.templ +++ b/internal/web/audit.templ @@ -13,13 +13,11 @@ type AuditEntry struct { Failed bool } -templ AuditPage(p Page, me Me, titleID, introID string, entries []AuditEntry, next string) { +templ AuditPage(p Page, me Me, titleID, introID string, entries []AuditEntry, pg Pager) { @consoleShell(p, me) { @settingsHeading(titleID, introID) @auditList(entries) - if next != "" { - { i18n.T(ctx, "audit.older") } - } + @pager(pg, "newer", "older") } } diff --git a/internal/web/audit_templ.go b/internal/web/audit_templ.go index 7de0047..11aff55 100644 --- a/internal/web/audit_templ.go +++ b/internal/web/audit_templ.go @@ -22,7 +22,7 @@ type AuditEntry struct { Failed bool } -func AuditPage(p Page, me Me, titleID, introID string, entries []AuditEntry, next string) templ.Component { +func AuditPage(p Page, me Me, titleID, introID string, entries []AuditEntry, pg Pager) 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 { @@ -59,37 +59,9 @@ func AuditPage(p Page, me Me, titleID, introID string, entries []AuditEntry, nex if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if next != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "audit.older")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 21, Col: 126} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } + templ_7745c5c3_Err = pager(pg, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err } return nil }) @@ -119,43 +91,43 @@ func auditList(entries []AuditEntry) templ.Component { ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) if len(entries) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "audit.empty")) + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "audit.empty")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 28, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 26, Col: 60} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, e := range entries { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(e.Time) + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(e.Time) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 33, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 31, Col: 56} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -163,25 +135,25 @@ func auditList(entries []AuditEntry) templ.Component { 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, 9, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var10 string - templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(e.Action) + var templ_7745c5c3_Var8 string + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(e.Action) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 35, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 33, Col: 64} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if e.Target != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + e.Target) + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + e.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 37, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 35, Col: 51} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) 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, 11, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if e.Actor != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var12 string - templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(e.Actor) + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(e.Actor) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 40, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 38, Col: 55} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) 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, 13, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var14 string - templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(e.IP) + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(e.IP) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 43, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 41, Col: 76} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + _, 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, 19, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "") 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, 17, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/checkers.templ b/internal/web/checkers.templ index 6d2c524..942a2f6 100644 --- a/internal/web/checkers.templ +++ b/internal/web/checkers.templ @@ -23,6 +23,7 @@ type CheckerView struct { Failed int AvgLatency string Recent []CheckerResult + Pager Pager Siblings []CheckerLink } @@ -130,6 +131,7 @@ templ CheckerPage(p Page, me Me, v CheckerView) { } + @pager(v.Pager, "newer", "older") if len(v.Siblings) > 0 {
diff --git a/internal/web/checkers_templ.go b/internal/web/checkers_templ.go index 9854498..504235b 100644 --- a/internal/web/checkers_templ.go +++ b/internal/web/checkers_templ.go @@ -32,6 +32,7 @@ type CheckerView struct { Failed int AvgLatency string Recent []CheckerResult + Pager Pager Siblings []CheckerLink } @@ -113,7 +114,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.Agent) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 61, Col: 13} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 62, Col: 13} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -126,7 +127,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.ID[:8]) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 62, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 63, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -139,7 +140,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.Region) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 65, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 66, Col: 14} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -153,7 +154,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.platform")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 67, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 68, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -167,7 +168,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.own")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 69, Col: 33} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 70, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -186,7 +187,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.live")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 73, Col: 35} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 74, Col: 35} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -196,7 +197,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.gone")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 75, Col: 35} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 76, Col: 35} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -255,7 +256,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.idle")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 92, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 93, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -278,7 +279,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(r.MonitorURL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 97, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 98, Col: 44} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11) if templ_7745c5c3_Err != nil { @@ -291,7 +292,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 97, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 98, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -304,7 +305,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.for", "Duration", r.For)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 98, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 99, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -323,7 +324,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.others", "Count", v.OtherOrgs)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 102, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 103, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -346,7 +347,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.refresh_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 106, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 107, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -368,7 +369,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.no_recent")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 111, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 112, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { @@ -391,7 +392,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(r.Time) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 117, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 118, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -404,7 +405,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(r.MonitorURL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 118, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 119, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18) if templ_7745c5c3_Err != nil { @@ -417,7 +418,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 118, Col: 107} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 119, Col: 107} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { @@ -445,7 +446,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 126, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 127, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -458,7 +459,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 127, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 128, Col: 66} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { @@ -474,6 +475,10 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { return templ_7745c5c3_Err } } + templ_7745c5c3_Err = pager(v.Pager, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -499,7 +504,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(sb.URL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 139, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 141, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22) if templ_7745c5c3_Err != nil { @@ -512,7 +517,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(sb.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 139, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 141, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -562,7 +567,7 @@ func checkerFact(labelID, value string) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, labelID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 149, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 151, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -575,7 +580,7 @@ func checkerFact(labelID, value string) templ.Component { var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 150, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 152, Col: 54} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var26) if templ_7745c5c3_Err != nil { @@ -588,7 +593,7 @@ func checkerFact(labelID, value string) templ.Component { var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 150, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 152, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -627,7 +632,7 @@ func checkerCell(l CheckerLink) templ.Component { var templ_7745c5c3_Var29 string templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(l.URL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 156, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 158, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29) if templ_7745c5c3_Err != nil { @@ -640,7 +645,7 @@ func checkerCell(l CheckerLink) templ.Component { var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(l.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 156, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 158, Col: 68} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { @@ -658,7 +663,7 @@ func checkerCell(l CheckerLink) templ.Component { var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(l.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 158, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/checkers.templ`, Line: 160, Col: 36} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { diff --git a/internal/web/maintenance.templ b/internal/web/maintenance.templ index 8071e15..602ad4d 100644 --- a/internal/web/maintenance.templ +++ b/internal/web/maintenance.templ @@ -10,6 +10,7 @@ import ( // add or edit one. type MaintenanceView struct { Windows []MaintenanceRow + Pager Pager Form MaintenanceForm Monitors []TargetOption Groups []TargetOption @@ -111,6 +112,7 @@ templ MaintenancePage(p Page, me Me, v MaintenanceView) { } } + @pager(v.Pager, "later", "earlier") if v.CanWrite { @maintenanceForm(v) } diff --git a/internal/web/maintenance_templ.go b/internal/web/maintenance_templ.go index e2e7cc7..20eaaff 100644 --- a/internal/web/maintenance_templ.go +++ b/internal/web/maintenance_templ.go @@ -19,6 +19,7 @@ import ( // add or edit one. type MaintenanceView struct { Windows []MaintenanceRow + Pager Pager Form MaintenanceForm Monitors []TargetOption Groups []TargetOption @@ -97,7 +98,7 @@ func maintenanceList(items []MaintenanceItem) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 60, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 61, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -115,7 +116,7 @@ func maintenanceList(items []MaintenanceItem) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 62, Col: 95} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 63, Col: 95} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -133,7 +134,7 @@ func maintenanceList(items []MaintenanceItem) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(m.When) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 65, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 66, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -211,7 +212,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.empty")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 80, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 81, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -242,7 +243,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 88, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 89, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -260,7 +261,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 90, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 91, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -278,7 +279,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(w.Schedule) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 93, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 94, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -291,7 +292,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(w.Targets) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 94, Col: 53} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 95, Col: 53} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -309,7 +310,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.next", "Time", w.Next)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 96, Col: 102} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 97, Col: 102} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -346,7 +347,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/maintenance?edit=" + w.ID)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 106, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 107, Col: 60} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13) if templ_7745c5c3_Err != nil { @@ -359,7 +360,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.edit")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 106, Col: 125} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 107, Col: 125} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -372,7 +373,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/maintenance/" + w.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 107, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 108, Col: 70} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15) if templ_7745c5c3_Err != nil { @@ -385,7 +386,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "maintenance.delete_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 107, Col: 129} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 108, Col: 129} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16) if templ_7745c5c3_Err != nil { @@ -398,7 +399,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.delete")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 107, Col: 222} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 108, Col: 222} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -423,6 +424,10 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = pager(v.Pager, "later", "earlier").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } if v.CanWrite { templ_7745c5c3_Err = maintenanceForm(v).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { @@ -478,7 +483,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maintenanceAPI(v.Form.ID)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 128, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 130, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19) if templ_7745c5c3_Err != nil { @@ -491,7 +496,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maintenanceMethod(v.Form.ID)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 129, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 131, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20) if templ_7745c5c3_Err != nil { @@ -528,7 +533,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Title).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 134, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 136, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22) if templ_7745c5c3_Err != nil { @@ -583,7 +588,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_description")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 137, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 139, Col: 131} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -624,7 +629,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Start).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 142, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 144, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27) if templ_7745c5c3_Err != nil { @@ -695,7 +700,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(v.Form.Duration)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 145, Col: 128} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 147, Col: 128} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31) if templ_7745c5c3_Err != nil { @@ -766,7 +771,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var35 string templ_7745c5c3_Var35, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.TimeZone).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 148, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 150, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var35) if templ_7745c5c3_Err != nil { @@ -816,7 +821,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var38 string templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(tz).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 151, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 153, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38) if templ_7745c5c3_Err != nil { @@ -901,7 +906,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var42 string templ_7745c5c3_Var42, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 160, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 162, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var42) if templ_7745c5c3_Err != nil { @@ -924,7 +929,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var43 string templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.recurrence_"+r)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 160, Col: 108} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 162, Col: 108} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { @@ -968,7 +973,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var45 string templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(max(v.Form.Every, 1))).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 165, Col: 111} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 167, Col: 111} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45) if templ_7745c5c3_Err != nil { @@ -1039,7 +1044,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var49 string templ_7745c5c3_Var49, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Until).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 168, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 170, Col: 57} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var49) if templ_7745c5c3_Err != nil { @@ -1094,7 +1099,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var52 string templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_weekdays")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 172, Col: 124} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 174, Col: 124} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52)) if templ_7745c5c3_Err != nil { @@ -1112,7 +1117,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var53 string templ_7745c5c3_Var53, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 176, Col: 80} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 178, Col: 80} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var53) if templ_7745c5c3_Err != nil { @@ -1135,7 +1140,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var54 string templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "weekday."+strconv.Itoa(d))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 177, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 179, Col: 50} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54)) if templ_7745c5c3_Err != nil { @@ -1153,7 +1158,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var55 string templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.weekdays_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 181, Col: 90} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 183, Col: 90} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55)) if templ_7745c5c3_Err != nil { @@ -1166,7 +1171,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var56 string templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_groups")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 185, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 187, Col: 123} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56)) if templ_7745c5c3_Err != nil { @@ -1184,7 +1189,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var57 string templ_7745c5c3_Var57, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(indent(g.Depth)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 188, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 190, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57)) if templ_7745c5c3_Err != nil { @@ -1197,7 +1202,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var58 string templ_7745c5c3_Var58, templ_7745c5c3_Err = templruntime.NewAttributeExpression(g.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 189, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 191, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var58) if templ_7745c5c3_Err != nil { @@ -1220,7 +1225,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var59 string templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 190, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 192, Col: 16} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) if templ_7745c5c3_Err != nil { @@ -1238,7 +1243,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var60 string templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_monitors")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 196, Col: 125} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 198, Col: 125} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60)) if templ_7745c5c3_Err != nil { @@ -1256,7 +1261,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var61 string templ_7745c5c3_Var61, templ_7745c5c3_Err = templruntime.NewAttributeExpression(m.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 200, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 202, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var61) if templ_7745c5c3_Err != nil { @@ -1279,7 +1284,7 @@ func maintenanceForm(v MaintenanceView) templ.Component { var templ_7745c5c3_Var62 string templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(m.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 201, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 203, Col: 16} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62)) if templ_7745c5c3_Err != nil { @@ -1331,7 +1336,7 @@ func labeled(labelID string) templ.Component { var templ_7745c5c3_Var64 string templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, labelID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 214, Col: 105} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 216, Col: 105} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64)) if templ_7745c5c3_Err != nil { diff --git a/internal/web/monitors.templ b/internal/web/monitors.templ index f7fd3ff..3cf20a8 100644 --- a/internal/web/monitors.templ +++ b/internal/web/monitors.templ @@ -38,6 +38,9 @@ type GroupNode struct { Total int Monitors []MonitorRow Children []GroupNode + // More counts the group's own monitors not shown; MoreURL shows them. + More int + MoreURL string } // GroupOption is a group in a select; Label is indented by depth. @@ -49,7 +52,13 @@ type GroupOption struct { // DashboardView is the data of the monitor list. Root holds ungrouped // monitors and the top-level groups. type DashboardView struct { - Root GroupNode + Root GroupNode + // Search, if set, lists Results instead of the tree. + Search string + Results []MonitorRow + // Focus, if set, names the one group Root holds, paged by Pager. + Focus string + Pager Pager Empty bool CanWrite bool Counts map[Status]int @@ -155,16 +164,52 @@ templ Dashboard(p Page, me Me, v DashboardView) { } - if v.Empty { -

{ i18n.T(ctx, "console.monitors.empty") }

- } else { -
- @monitorList(v.Root.Monitors) - for _, g := range v.Root.Children { - @groupBlock(g) + if !v.Empty { + + if v.Range != "" { + } -
-

{ i18n.T(ctx, "monitors.range_note", "Range", v.Range) }

+ + + + } + switch { + case v.Empty: +

{ i18n.T(ctx, "console.monitors.empty") }

+ case v.Search != "": +

← { i18n.T(ctx, "monitors.all") }

+ if len(v.Results) == 0 { +

{ i18n.T(ctx, "monitors.no_match") }

+ } else { +
+ @monitorList(v.Results) +
+ } + @pager(v.Pager, "previous", "next") + default: + if v.Focus != "" { +

+ { i18n.T(ctx, "monitors.all") } + › + { v.Focus } +

+ } +
+ @monitorList(v.Root.Monitors) + @moreLink(v.Root) + for _, g := range v.Root.Children { + @groupBlock(g) + } +
+ @pager(v.Pager, "previous", "next") +

{ i18n.T(ctx, "monitors.range_note", "Range", v.Range) }

}

{ i18n.T(ctx, "groups.manage") }

} @@ -193,6 +238,13 @@ templ monitorList(ms []MonitorRow) { } } +// moreLink leads to the monitors of a group that are not shown. +templ moreLink(g GroupNode) { + if g.More > 0 { + { i18n.T(ctx, "monitors.show_all", "Count", g.More+len(g.Monitors)) } → + } +} + // groupBlock renders a group and, recursively, its subgroups.
// makes groups collapsible without JavaScript. templ groupBlock(g GroupNode) { @@ -204,6 +256,7 @@ templ groupBlock(g GroupNode) {
@monitorList(g.Monitors) + @moreLink(g) for _, c := range g.Children { @groupBlock(c) } @@ -248,6 +301,10 @@ type MonitorDetailView struct { Latency LatencyLine Recent []ResultRow Incidents []IncidentRow + // MoreIncidents is set when the monitor has more incidents than shown. + MoreIncidents bool + // MoreResults is set when the monitor has more results than shown. + MoreResults bool CanWrite bool // Maintenance lists current and upcoming maintenance. Maintenance []MaintenanceItem @@ -366,6 +423,9 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
@sectionHeading("incidents.title") @incidentList(v.Incidents, false) + if v.MoreIncidents { + { i18n.T(ctx, "incidents.all_of_monitor") } → + }
} if len(v.Evidence) > 0 { @@ -373,37 +433,64 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) { }
@sectionHeading("monitors.recent") - - - for _, r := range v.Recent { - - - - - - - - - } - -
{ r.Time }{ r.Region } - @checkerCell(r.Checker) - - if r.OK { - ● - } else { - ● - } - { r.Latency } - { r.Detail } - if r.EvidenceURL != "" { - { i18n.T(ctx, "evidence.show") } - } -
+ @resultTable(v.Recent) + if v.MoreResults { + { i18n.T(ctx, "monitors.all_results") } → + }
} } +templ resultTable(rows []ResultRow) { + + + for _, r := range rows { + + + + + + + + + } + +
{ r.Time }{ r.Region } + @checkerCell(r.Checker) + + if r.OK { + ● + } else { + ● + } + { r.Latency } + { r.Detail } + if r.EvidenceURL != "" { + { i18n.T(ctx, "evidence.show") } + } +
+} + +// ResultsView is a page of a monitor's check results. +type ResultsView struct { + MonitorID, Monitor string + Rows []ResultRow + Pager Pager +} + +templ ResultsPage(p Page, me Me, v ResultsView) { + @consoleShell(p, me) { +

← { v.Monitor }

+ @settingsHeading("monitors.results_title", "") + if len(v.Rows) == 0 { +

{ i18n.T(ctx, "monitors.no_results") }

+ } else { + @resultTable(v.Rows) + } + @pager(v.Pager, "newer", "older") + } +} + templ incidentList(rows []IncidentRow, showMonitor bool) {
    for _, r := range rows { @@ -428,14 +515,29 @@ templ incidentList(rows []IncidentRow, showMonitor bool) {
} -templ IncidentsPage(p Page, me Me, rows []IncidentRow) { +// IncidentsView is a page of incidents, of one monitor if Monitor is set. +type IncidentsView struct { + Rows []IncidentRow + Pager Pager + Monitor, MonitorID string +} + +templ IncidentsPage(p Page, me Me, v IncidentsView) { @consoleShell(p, me) { @settingsHeading("incidents.title", "") - if len(rows) == 0 { + if v.Monitor != "" { +

+ { i18n.T(ctx, "incidents.of_monitor") } + { v.Monitor } + { i18n.T(ctx, "incidents.all") } +

+ } + if len(v.Rows) == 0 {

{ i18n.T(ctx, "incidents.none") }

} else { - @incidentList(rows, true) + @incidentList(v.Rows, v.Monitor == "") } + @pager(v.Pager, "newer", "older") } } diff --git a/internal/web/monitors_templ.go b/internal/web/monitors_templ.go index 122a967..23c1907 100644 --- a/internal/web/monitors_templ.go +++ b/internal/web/monitors_templ.go @@ -47,6 +47,9 @@ type GroupNode struct { Total int Monitors []MonitorRow Children []GroupNode + // More counts the group's own monitors not shown; MoreURL shows them. + More int + MoreURL string } // GroupOption is a group in a select; Label is indented by depth. @@ -58,7 +61,13 @@ type GroupOption struct { // DashboardView is the data of the monitor list. Root holds ungrouped // monitors and the top-level groups. type DashboardView struct { - Root GroupNode + Root GroupNode + // Search, if set, lists Results instead of the tree. + Search string + Results []MonitorRow + // Focus, if set, names the one group Root holds, paged by Pager. + Focus string + Pager Pager Empty bool CanWrite bool Counts map[Status]int @@ -116,7 +125,7 @@ func rangeSwitch(opts []RangeOption) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "monitors.range")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 87, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 96, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2) if templ_7745c5c3_Err != nil { @@ -135,7 +144,7 @@ func rangeSwitch(opts []RangeOption) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(o.Key) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 90, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 99, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -153,7 +162,7 @@ func rangeSwitch(opts []RangeOption) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "monitors.range_not_enough")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 92, Col: 105} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 101, Col: 105} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4) if templ_7745c5c3_Err != nil { @@ -166,7 +175,7 @@ func rangeSwitch(opts []RangeOption) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(o.Key) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 92, Col: 136} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 101, Col: 136} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -184,7 +193,7 @@ func rangeSwitch(opts []RangeOption) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(o.URL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 94, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 103, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6) if templ_7745c5c3_Err != nil { @@ -197,7 +206,7 @@ func rangeSwitch(opts []RangeOption) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(o.Key) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 94, Col: 88} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 103, Col: 88} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -269,7 +278,7 @@ func statusDot(s Status) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "status."+string(s))).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 109, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 118, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11) if templ_7745c5c3_Err != nil { @@ -321,7 +330,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression("0 0 " + strconv.Itoa(len(bs)*4) + " " + strconv.Itoa(height)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 115, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 124, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13) if templ_7745c5c3_Err != nil { @@ -334,7 +343,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("height:" + strconv.Itoa(height) + "px") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 118, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 127, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -347,7 +356,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "monitors.uptime_chart")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 120, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 129, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15) if templ_7745c5c3_Err != nil { @@ -369,7 +378,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(i * 4)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 124, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 133, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16) if templ_7745c5c3_Err != nil { @@ -382,7 +391,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(height)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 127, Col: 33} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 136, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17) if templ_7745c5c3_Err != nil { @@ -430,7 +439,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(b.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 133, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 142, Col: 20} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -485,7 +494,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 142, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 151, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -516,7 +525,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.Counts[s])) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 149, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 158, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -536,7 +545,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.new")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 154, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 163, Col: 131} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -551,26 +560,202 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if v.Empty { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

") + if !v.Empty { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var26 string - templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 159, Col: 111} + if v.Range != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "") + var templ_7745c5c3_Var27 string + templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Search).Resolve(ctx) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 175, Col: 21} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "\" placeholder=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var28 string + templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "monitors.search")).Resolve(ctx) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 176, Col: 49} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "\" aria-label=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var29 string + templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "monitors.search")).Resolve(ctx) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 177, Col: 48} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "\" class=\"w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink\"> ") + 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 + } + switch { + case v.Empty: + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var31 string + templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 185, Col: 112} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + case v.Search != "": + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "

← ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var32 string + templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.all")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 187, Col: 107} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(v.Results) == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var33 string + templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.no_match")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 189, Col: 108} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = monitorList(v.Results).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = pager(v.Pager, "previous", "next").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + default: + if v.Focus != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var34 string + templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.all")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 199, Col: 81} + } + _, 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, 54, " › ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var35 string + templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(v.Focus) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 201, Col: 41} + } + _, 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, 55, "

") + 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 } @@ -578,44 +763,56 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = moreLink(v.Root).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } for _, g := range v.Root.Children { templ_7745c5c3_Err = groupBlock(g).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var27 string - templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.range_note", "Range", v.Range)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 167, Col: 103} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) + templ_7745c5c3_Err = pager(v.Pager, "previous", "next").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var36 string + templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.range_note", "Range", v.Range)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 212, Col: 104} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) + 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var28 string - templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "groups.manage")) + var templ_7745c5c3_Var37 string + templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "groups.manage")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 169, Col: 108} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 214, Col: 108} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) 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, 61, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -647,25 +844,25 @@ func monitorList(ms []MonitorRow) templ.Component { ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) if len(ms) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) +} + +// moreLink leads to the monitors of a group that are not shown. +func moreLink(g GroupNode) 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 g.More > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "") + 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.show_all", "Count", g.More+len(g.Monitors))) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 244, Col: 182} + } + _, 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, 75, " →") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -779,7 +1030,7 @@ func groupBlock(g GroupNode) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -787,33 +1038,33 @@ func groupBlock(g GroupNode) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var37 string - templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) + var templ_7745c5c3_Var49 string + templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 202, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 254, Col: 17} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) + _, 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, 55, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var38 string - templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(g.Total)) + var templ_7745c5c3_Var50 string + templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(g.Total)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 203, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 255, Col: 81} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38)) + _, 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, 56, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -821,13 +1072,17 @@ func groupBlock(g GroupNode) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = moreLink(g).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } for _, c := range g.Children { templ_7745c5c3_Err = groupBlock(c).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -872,7 +1127,11 @@ type MonitorDetailView struct { Latency LatencyLine Recent []ResultRow Incidents []IncidentRow - CanWrite bool + // MoreIncidents is set when the monitor has more incidents than shown. + MoreIncidents bool + // MoreResults is set when the monitor has more results than shown. + MoreResults bool + CanWrite bool // Maintenance lists current and upcoming maintenance. Maintenance []MaintenanceItem // PingURL is set for heartbeat monitors the viewer may change. @@ -906,7 +1165,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var40 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var52 := 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 { @@ -918,20 +1177,20 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "

← ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "

← ") 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, "console.monitors.title")) + var templ_7745c5c3_Var53 string + templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 270, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 327, Col: 115} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) + _, 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, 59, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -939,110 +1198,110 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var42 string - templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Name) + var templ_7745c5c3_Var54 string + templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 275, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 332, Col: 23} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42)) + _, 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, 61, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var43 string - templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.type_"+v.Row.Type)) + var templ_7745c5c3_Var55 string + templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.type_"+v.Row.Type)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 278, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 335, Col: 47} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.Row.Target != "" { - var templ_7745c5c3_Var44 string - templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + v.Row.Target) + var templ_7745c5c3_Var56 string + templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + v.Row.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 280, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 337, Col: 29} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44)) + _, 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, 63, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - var templ_7745c5c3_Var45 string - templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + v.Interval) + var templ_7745c5c3_Var57 string + templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + v.Interval) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 282, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 339, Col: 26} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45)) + _, 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, 64, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "\" class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">") 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, "sso.action.edit")) + var templ_7745c5c3_Var59 string + templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 286, Col: 173} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 343, Col: 173} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "") + 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, 68, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var48 string - templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.history", "Range", v.Range)) + var templ_7745c5c3_Var60 string + templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.history", "Range", v.Range)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 291, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 348, Col: 123} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48)) + _, 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, 69, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1050,33 +1309,33 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "
") 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, "monitors.sla")) + var templ_7745c5c3_Var61 string + templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.sla")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 295, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 352, Col: 39} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) + _, 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, 71, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var50 string - templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Uptime) + var templ_7745c5c3_Var62 string + templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Uptime) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 296, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 353, Col: 49} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50)) + _, 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, 72, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1085,69 +1344,69 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { return templ_7745c5c3_Err } if v.Latency.Points != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "
") 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, "monitors.latency")) + var templ_7745c5c3_Var63 string + templ_7745c5c3_Var63, 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/monitors.templ`, Line: 301, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 358, Col: 44} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51)) + _, 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, 74, " max ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, " max ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var52 string - templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.Latency.MaxMS)) + var templ_7745c5c3_Var64 string + templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.Latency.MaxMS)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 302, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 359, Col: 46} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52)) + _, 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, 75, " ms
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "\" fill=\"none\" class=\"stroke-ink\" stroke-width=\"1.5\" vector-effect=\"non-scaling-stroke\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(v.Regions) > 1 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1155,25 +1414,25 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range v.Regions { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var55 string - templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) + var templ_7745c5c3_Var67 string + templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 315, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 372, Col: 38} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1185,38 +1444,38 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { 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, 83, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var59 string - templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(r.Uptime) + var templ_7745c5c3_Var71 string + templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(r.Uptime) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 317, Col: 140} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 374, Col: 140} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "

    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "

") 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, "monitors.by_region_hint")) + var templ_7745c5c3_Var72 string + templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.by_region_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 321, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 378, Col: 79} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1276,12 +1535,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(v.Maintenance) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1293,12 +1552,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1306,7 +1565,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1315,38 +1574,38 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { 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, 96, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, ">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var64 string - templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(e.Label) + var templ_7745c5c3_Var76 string + templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(e.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 338, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 395, Col: 56} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var65 string - templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(e.Value) + var templ_7745c5c3_Var77 string + templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(e.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 339, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 396, Col: 45} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1399,20 +1658,20 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var66 string - templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(v.Uptime90) + var templ_7745c5c3_Var78 string + templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(v.Uptime90) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 347, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 404, Col: 48} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1420,7 +1679,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1428,12 +1687,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range v.Row.Regions { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1441,43 +1700,43 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var67 string - templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) + var templ_7745c5c3_Var79 string + templ_7745c5c3_Var79, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 358, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 415, Col: 21} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var79)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var68 string - templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) + var templ_7745c5c3_Var80 string + templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 359, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 416, Col: 77} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var80)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(v.Incidents) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1489,12 +1748,44 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "
") + if v.MoreIncidents { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var82 string + templ_7745c5c3_Var82, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.all_of_monitor")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 427, Col: 166} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var82)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, " →") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1504,7 +1795,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 141, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1512,134 +1803,307 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "") + templ_7745c5c3_Err = resultTable(v.Recent).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for _, r := range v.Recent { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 144, " →") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "
") + if v.MoreResults { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 143, "\" class=\"mt-3 inline-block text-sm text-muted hover:text-ink\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var70 string - templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(r.Region) + var templ_7745c5c3_Var84 string + templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.all_results")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 381, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 438, Col: 165} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = checkerCell(r.Checker).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if r.OK { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "●") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "●") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var71 string - templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 392, Col: 60} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var72 string - templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 394, Col: 18} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if r.EvidenceURL != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var74 string - templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "evidence.show")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 396, Col: 137} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 145, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var40), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var52), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func resultTable(rows []ResultRow) 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, 146, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, r := range rows { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var86 string + templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(r.Time) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 449, Col: 84} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 148, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var87 string + templ_7745c5c3_Var87, templ_7745c5c3_Err = templ.JoinStringErrs(r.Region) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 450, Col: 39} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var87)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 149, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = checkerCell(r.Checker).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 150, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if r.OK { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 151, "●") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 152, "●") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 153, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var88 string + templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 461, Col: 58} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 154, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var89 string + templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 463, Col: 16} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 155, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if r.EvidenceURL != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 156, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var91 string + templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "evidence.show")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 465, Col: 135} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +// ResultsView is a page of a monitor's check results. +type ResultsView struct { + MonitorID, Monitor string + Rows []ResultRow + Pager Pager +} + +func ResultsPage(p Page, me Me, v ResultsView) 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_Var93 := 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, 161, "

← ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var95 string + templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(v.Monitor) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 483, Col: 129} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = settingsHeading("monitors.results_title", "").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(v.Rows) == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var96 string + templ_7745c5c3_Var96, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.no_results")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 486, Col: 108} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var96)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 165, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = resultTable(v.Rows).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 166, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = pager(v.Pager, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var93), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1664,139 +2128,139 @@ func incidentList(rows []IncidentRow, showMonitor bool) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 167, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range rows { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 168, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if r.Open { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 169, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var76 string - templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing")) + var templ_7745c5c3_Var98 string + templ_7745c5c3_Var98, 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/monitors.templ`, Line: 413, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 500, Col: 76} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var98)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 170, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 171, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var77 string - templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved")) + var templ_7745c5c3_Var99 string + templ_7745c5c3_Var99, 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/monitors.templ`, Line: 415, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 502, Col: 63} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var99)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 172, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if showMonitor { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 174, "\" class=\"hover:underline\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var79 string - templ_7745c5c3_Var79, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) + var templ_7745c5c3_Var101 string + templ_7745c5c3_Var101, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 418, Col: 95} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 505, Col: 95} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var79)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var101)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 175, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 176, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var80 string - templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.JoinStringErrs(r.Started) + var templ_7745c5c3_Var102 string + templ_7745c5c3_Var102, templ_7745c5c3_Err = templ.JoinStringErrs(r.Started) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 420, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 507, Col: 59} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var80)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var102)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 141, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 177, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var81 string - templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(r.Duration) + var templ_7745c5c3_Var103 string + templ_7745c5c3_Var103, templ_7745c5c3_Err = templ.JoinStringErrs(r.Duration) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 421, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 508, Col: 57} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var103)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 178, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(r.Cause) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 143, "

      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 179, "

      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var82 string - templ_7745c5c3_Var82, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(r.Cause, " · ")) + var templ_7745c5c3_Var104 string + templ_7745c5c3_Var104, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(r.Cause, " · ")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 424, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 511, Col: 81} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var82)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var104)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 144, "

      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 180, "

      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 145, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 181, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 146, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 182, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1804,7 +2268,14 @@ func incidentList(rows []IncidentRow, showMonitor bool) templ.Component { }) } -func IncidentsPage(p Page, me Me, rows []IncidentRow) templ.Component { +// IncidentsView is a page of incidents, of one monitor if Monitor is set. +type IncidentsView struct { + Rows []IncidentRow + Pager Pager + Monitor, MonitorID string +} + +func IncidentsPage(p Page, me Me, v IncidentsView) 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 { @@ -1821,7 +2292,7 @@ func IncidentsPage(p Page, me Me, rows []IncidentRow) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var84 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var106 := 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 { @@ -1837,33 +2308,103 @@ func IncidentsPage(p Page, me Me, rows []IncidentRow) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if len(rows) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, "

") + if v.Monitor != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 183, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var85 string - templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.none")) + var templ_7745c5c3_Var107 string + templ_7745c5c3_Var107, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.of_monitor")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 435, Col: 103} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 530, Col: 41} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var107)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 148, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 184, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var109 string + templ_7745c5c3_Var109, templ_7745c5c3_Err = templ.JoinStringErrs(v.Monitor) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 531, Col: 105} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var109)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 186, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var110 string + templ_7745c5c3_Var110, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.all")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 532, Col: 94} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var110)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 187, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 188, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(v.Rows) == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 189, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var111 string + templ_7745c5c3_Var111, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.none")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 536, Col: 103} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var111)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 190, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = incidentList(v.Rows, v.Monitor == "").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 191, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = pager(v.Pager, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var84), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var106), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2005,46 +2546,46 @@ func headersField(value string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 149, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2068,46 +2609,46 @@ func typeFields(typ, current string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var90 := templ.GetChildren(ctx) + templ_7745c5c3_Var116 := templ.GetChildren(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 153, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 200, " class=\"mb-2\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ_7745c5c3_Var90.Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = templ_7745c5c3_Var116.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 201, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2132,95 +2673,95 @@ func numberField(label, name string, value, min, max int, hint string) templ.Com } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2245,7 +2786,7 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var100 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var126 := 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 { @@ -2257,115 +2798,115 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 168, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 211, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if f.ID == "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 169, "← ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 212, "← ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var101 string - templ_7745c5c3_Var101, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) + var templ_7745c5c3_Var127 string + templ_7745c5c3_Var127, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 595, Col: 93} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 697, Col: 93} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var101)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var127)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 170, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 213, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 171, "← ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 215, "\" class=\"text-muted hover:text-ink\">← ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var103 string - templ_7745c5c3_Var103, templ_7745c5c3_Err = templ.JoinStringErrs(f.Name) + var templ_7745c5c3_Var129 string + templ_7745c5c3_Var129, templ_7745c5c3_Err = templ.JoinStringErrs(f.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 597, Col: 97} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 699, Col: 97} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var103)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var129)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 173, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 216, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 174, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 217, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var104 string - templ_7745c5c3_Var104, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID)) + var templ_7745c5c3_Var130 string + templ_7745c5c3_Var130, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 600, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 702, Col: 65} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var104)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var130)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 175, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 223, " class=\"grid max-w-4xl gap-x-12 md:grid-cols-2\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2377,20 +2918,20 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 181, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 224, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var107 string - templ_7745c5c3_Var107, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alert_groups.title")) + var templ_7745c5c3_Var133 string + templ_7745c5c3_Var133, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alert_groups.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 616, Col: 117} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 718, Col: 117} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var107)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var133)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 182, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 225, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2398,33 +2939,33 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 183, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 226, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var108 string - templ_7745c5c3_Var108, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alert_groups.monitor_hint")) + var templ_7745c5c3_Var134 string + templ_7745c5c3_Var134, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alert_groups.monitor_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 618, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 720, Col: 82} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var108)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var134)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 184, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 238, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2509,25 +3050,25 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 196, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 239, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var113 string - templ_7745c5c3_Var113, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.target_hint")) + var templ_7745c5c3_Var139 string + templ_7745c5c3_Var139, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.target_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 634, Col: 83} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 736, Col: 83} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var113)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var139)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 197, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 240, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, t := range []string{"postgres", "mysql", "mssql", "mongodb", "redis"} { - templ_7745c5c3_Var114 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var140 := 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 { @@ -2545,13 +3086,13 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields(t, f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var114), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields(t, f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var140), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } for _, t := range []string{"mqtt", "kafka", "rabbitmq"} { - templ_7745c5c3_Var115 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var141 := 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 { @@ -2569,12 +3110,12 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields(t, f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var115), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields(t, f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var141), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Var116 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var142 := 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 { @@ -2586,20 +3127,20 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 198, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 241, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var117 string - templ_7745c5c3_Var117, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.grpc_hint")) + var templ_7745c5c3_Var143 string + templ_7745c5c3_Var143, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.grpc_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 647, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 749, Col: 75} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var117)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var143)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 199, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 242, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2613,11 +3154,11 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields("grpc", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var116), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("grpc", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var142), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var118 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var144 := 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 { @@ -2629,20 +3170,20 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 200, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 243, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var119 string - templ_7745c5c3_Var119, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.smtp_hint")) + var templ_7745c5c3_Var145 string + templ_7745c5c3_Var145, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.smtp_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 652, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 754, Col: 75} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var119)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var145)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 201, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 244, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2656,11 +3197,11 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields("smtp", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var118), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("smtp", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var144), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var120 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var146 := 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 { @@ -2672,20 +3213,20 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 202, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 245, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var121 string - templ_7745c5c3_Var121, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.radius_hint")) + var templ_7745c5c3_Var147 string + templ_7745c5c3_Var147, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.radius_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 657, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 759, Col: 77} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var121)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var147)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 203, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 246, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2707,11 +3248,11 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields("radius", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var120), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("radius", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var146), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var122 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var148 := 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 { @@ -2723,79 +3264,79 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 204, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 247, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var123 string - templ_7745c5c3_Var123, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.snmp_hint")) + var templ_7745c5c3_Var149 string + templ_7745c5c3_Var149, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.snmp_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 664, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 766, Col: 75} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var123)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var149)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 205, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2807,66 +3348,66 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 213, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = typeFields("snmp", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var122), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var130 := 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, 222, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var131 string - templ_7745c5c3_Var131, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.steam_hint")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 688, Col: 76} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var131)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 223, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = numberField(i18n.T(ctx, "monitors.game_min_free_slots"), "config.min_free_slots", f.Game.MinFreeSlots, 0, 10000, i18n.T(ctx, "monitors.game_min_free_slots_hint")).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = typeFields("steam", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var130), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var132 := 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, 224, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var133 string - templ_7745c5c3_Var133, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.minecraft_hint")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 692, Col: 80} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var133)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 225, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = numberField(i18n.T(ctx, "monitors.game_min_free_slots"), "config.min_free_slots", f.Game.MinFreeSlots, 0, 10000, i18n.T(ctx, "monitors.game_min_free_slots_hint")).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = typeFields("minecraft", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var132), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var137 := 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, 233, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var138 string - templ_7745c5c3_Var138, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.docker_hint")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 704, Col: 77} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var138)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 234, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = valueField(i18n.T(ctx, "monitors.docker_host"), "config.host", f.DockerHost, "unix:///var/run/docker.sock", false).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = typeFields("docker", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var137), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var139 := 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, 235, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var140 string - templ_7745c5c3_Var140, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.alertmanager_hint")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 709, Col: 49} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var140)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 236, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var141 string - templ_7745c5c3_Var141, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.title")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 710, Col: 111} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var141)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 237, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var142 string - templ_7745c5c3_Var142, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.matchers")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 713, Col: 123} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var142)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 238, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for i, m := range f.Matchers { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 239, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 254, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var153 string - templ_7745c5c3_Var153, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.matchers_hint")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 725, Col: 80} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var153)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 255, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = numberField(i18n.T(ctx, "monitors.stale_hours"), "config.stale_hours", f.StaleHours, 1, 720, i18n.T(ctx, "monitors.stale_hours_hint")).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = typeFields("alertmanager", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var139), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var154 := 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, 256, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var155 string - templ_7745c5c3_Var155, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.heartbeat_hint")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 730, Col: 80} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var155)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 257, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = numberField(i18n.T(ctx, "monitors.grace"), "config.grace_seconds", f.GraceSeconds, 0, 86400, i18n.T(ctx, "monitors.grace_hint")).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = typeFields("heartbeat", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var154), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("snmp", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var148), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3349,66 +3437,519 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 258, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 315, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 358, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = typeFields("json", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var173), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("json", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var199), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var191 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var217 := 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 { @@ -3985,66 +4526,66 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 316, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4058,11 +4599,11 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields("dns", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var191), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("dns", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var217), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var195 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var221 := 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 { @@ -4084,11 +4625,11 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { } return nil }) - templ_7745c5c3_Err = typeFields("tls", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var195), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = typeFields("tls", f.Type).Render(templ.WithChildren(ctx, templ_7745c5c3_Var221), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 324, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 367, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4096,17 +4637,17 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 325, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 370, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4114,7 +4655,7 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 328, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 371, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4122,141 +4663,141 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 329, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 375, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var196 string - templ_7745c5c3_Var196, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.regions")) + var templ_7745c5c3_Var222 string + templ_7745c5c3_Var222, 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/monitors.templ`, Line: 840, Col: 121} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 942, Col: 121} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var196)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var222)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 333, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 376, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var197 string - templ_7745c5c3_Var197, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.regions_hint")) + var templ_7745c5c3_Var223 string + templ_7745c5c3_Var223, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.regions_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 841, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 943, Col: 78} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var197)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var223)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 334, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 377, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range f.Regions { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 335, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 386, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 344, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 387, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4269,57 +4810,57 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { return templ_7745c5c3_Err } if f.ID != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 345, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 391, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 349, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 392, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var100), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var126), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4363,7 +4904,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var207 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var233 := 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 { @@ -4379,7 +4920,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 350, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 393, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4388,12 +4929,12 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } if len(v.Channels) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 351, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 394, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, ch := range v.Channels { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 352, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 395, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4408,149 +4949,149 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 353, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 396, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var208 string - templ_7745c5c3_Var208, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Name) + var templ_7745c5c3_Var234 string + templ_7745c5c3_Var234, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 906, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1008, Col: 22} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var208)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var234)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 354, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 397, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var209 string - templ_7745c5c3_Var209, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.type_"+ch.Type)) + var templ_7745c5c3_Var235 string + templ_7745c5c3_Var235, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.type_"+ch.Type)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 907, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1009, Col: 71} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var209)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var235)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 355, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 398, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var210 string - templ_7745c5c3_Var210, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Target) + var templ_7745c5c3_Var236 string + templ_7745c5c3_Var236, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 908, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1010, Col: 78} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var210)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var236)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 356, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 399, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 357, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 406, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 364, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 407, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 365, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 408, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 366, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 409, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 367, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 410, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4558,7 +5099,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 368, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 411, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4566,7 +5107,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 369, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 412, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4582,46 +5123,46 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 370, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 416, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4630,7 +5171,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } if v.EmailAvailable { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 374, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 417, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4638,7 +5179,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 375, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 418, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4646,79 +5187,79 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 376, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4726,30 +5267,30 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 385, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 428, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 386, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 429, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var224 string - templ_7745c5c3_Var224, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.email_not_configured")) + var templ_7745c5c3_Var250 string + templ_7745c5c3_Var250, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.email_not_configured")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 960, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1062, Col: 79} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var224)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var250)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 387, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 430, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 388, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 431, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4757,20 +5298,20 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 389, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 432, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var225 string - templ_7745c5c3_Var225, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.service_intro")) + var templ_7745c5c3_Var251 string + templ_7745c5c3_Var251, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.service_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 965, Col: 89} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1067, Col: 89} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var225)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var251)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 390, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 433, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4778,81 +5319,81 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 391, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4860,118 +5401,118 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 400, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 450, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for i, pr := range v.Providers { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 408, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 455, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if pr.Help != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 413, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 456, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var234 string - templ_7745c5c3_Var234, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Help) + var templ_7745c5c3_Var260 string + templ_7745c5c3_Var260, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Help) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 997, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1099, Col: 54} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var234)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var260)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 414, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 457, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4982,7 +5523,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 415, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 458, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4991,14 +5532,14 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 416, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 459, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var207), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var233), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5042,208 +5583,208 @@ func providerField(f ProviderField) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 417, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 484, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5268,85 +5809,85 @@ func groupSelect(name string, groups []GroupOption, selected string, allowNone b } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 442, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 494, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5389,7 +5930,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var252 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var278 := 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 { @@ -5401,20 +5942,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 452, "

← ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 495, "

← ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var253 string - templ_7745c5c3_Var253, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) + var templ_7745c5c3_Var279 string + templ_7745c5c3_Var279, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1093, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1195, Col: 115} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var253)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var279)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 453, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 496, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5423,69 +5964,69 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { return templ_7745c5c3_Err } if len(v.Groups) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 454, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 497, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, g := range v.Groups { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 455, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 499, "\">
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var255 string - templ_7745c5c3_Var255, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) + var templ_7745c5c3_Var281 string + templ_7745c5c3_Var281, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1100, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1202, Col: 21} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var255)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var281)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 457, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 500, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if g.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 458, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 501, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var256 string - templ_7745c5c3_Var256, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) + var templ_7745c5c3_Var282 string + templ_7745c5c3_Var282, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1103, Col: 99} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1205, Col: 99} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var256)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var282)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 459, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 503, "\" data-method=\"put\" data-next=\"/groups\" class=\"mt-3 w-72\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5497,20 +6038,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 461, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 506, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5526,66 +6067,66 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 464, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 510, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 468, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 511, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 469, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 512, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 470, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 513, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 471, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 514, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5593,7 +6134,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 472, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 515, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5605,20 +6146,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 473, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 518, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5634,14 +6175,14 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 476, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 519, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var252), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var278), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5673,7 +6214,7 @@ func pingSection(url string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 477, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 520, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5681,55 +6222,55 @@ func pingSection(url string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 478, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 521, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var264 string - templ_7745c5c3_Var264, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_intro")) + var templ_7745c5c3_Var290 string + templ_7745c5c3_Var290, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1148, Col: 83} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1250, Col: 83} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var264)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var290)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 479, "

")
+		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 522, "

")
 		if templ_7745c5c3_Err != nil {
 			return templ_7745c5c3_Err
 		}
-		var templ_7745c5c3_Var265 string
-		templ_7745c5c3_Var265, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 " + url + "\n")
+		var templ_7745c5c3_Var291 string
+		templ_7745c5c3_Var291, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 " + url + "\n")
 		if templ_7745c5c3_Err != nil {
-			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1149, Col: 137}
+			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1251, Col: 137}
 		}
-		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var265))
+		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var291))
 		if templ_7745c5c3_Err != nil {
 			return templ_7745c5c3_Err
 		}
-		var templ_7745c5c3_Var266 string
-		templ_7745c5c3_Var266, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 --data-raw \"$output\" " + url + "/fail")
+		var templ_7745c5c3_Var292 string
+		templ_7745c5c3_Var292, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 --data-raw \"$output\" " + url + "/fail")
 		if templ_7745c5c3_Err != nil {
-			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1149, Col: 208}
+			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1251, Col: 208}
 		}
-		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var266))
+		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var292))
 		if templ_7745c5c3_Err != nil {
 			return templ_7745c5c3_Err
 		}
-		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 480, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 523, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var267 string - templ_7745c5c3_Var267, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_secret")) + var templ_7745c5c3_Var293 string + templ_7745c5c3_Var293, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_secret")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1150, Col: 84} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1252, Col: 84} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var267)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var293)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 481, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 524, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5775,20 +6316,20 @@ func dbFields(typ string, d DBForm) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 482, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 525, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var269 string - templ_7745c5c3_Var269, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.db_hint")) + var templ_7745c5c3_Var295 string + templ_7745c5c3_Var295, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.db_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1176, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1278, Col: 69} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var269)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var295)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 483, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 526, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5816,33 +6357,33 @@ func dbFields(typ string, d DBForm) templ.Component { return templ_7745c5c3_Err } if typ != "redis" && typ != "mongodb" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 484, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5874,56 +6415,56 @@ func secretField(label, name string, set bool) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 487, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5949,66 +6490,66 @@ func tlsField(value string, modes ...string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 493, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -6033,20 +6574,20 @@ func brokerFields(typ string, b BrokerForm) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 501, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 544, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var281 string - templ_7745c5c3_Var281, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.broker_hint_"+typ)) + var templ_7745c5c3_Var307 string + templ_7745c5c3_Var307, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.broker_hint_"+typ)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1224, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1326, Col: 78} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var281)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var307)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 502, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 545, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -6073,66 +6614,66 @@ func brokerFields(typ string, b BrokerForm) templ.Component { return templ_7745c5c3_Err } case "kafka": - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 503, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/org.templ b/internal/web/org.templ index 23d86ac..6a6e2bc 100644 --- a/internal/web/org.templ +++ b/internal/web/org.templ @@ -43,6 +43,7 @@ type PendingInvite struct { // MembersView is the data of the members page. type MembersView struct { Members []Member + Pager Pager Roles []Role Invitations []PendingInvite CanManage bool @@ -152,6 +153,7 @@ templ MembersPage(p Page, me Me, v MembersView) { } + @pager(v.Pager, "previous", "next") if v.CanManage {
diff --git a/internal/web/org_templ.go b/internal/web/org_templ.go index 3a3a761..7174a07 100644 --- a/internal/web/org_templ.go +++ b/internal/web/org_templ.go @@ -52,6 +52,7 @@ type PendingInvite struct { // MembersView is the data of the members page. type MembersView struct { Members []Member + Pager Pager Roles []Role Invitations []PendingInvite CanManage bool @@ -90,7 +91,7 @@ func settingsHeading(titleID, introID string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 61, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 62, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -108,7 +109,7 @@ func settingsHeading(titleID, introID string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, introID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 63, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 64, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -147,7 +148,7 @@ func sectionHeading(id string) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, id)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 68, Col: 91} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 69, Col: 91} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -185,7 +186,7 @@ func roleSelect(roles []Role, name string) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 72, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 73, Col: 20} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7) if templ_7745c5c3_Err != nil { @@ -203,7 +204,7 @@ func roleSelect(roles []Role, name string) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 74, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 75, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8) if templ_7745c5c3_Err != nil { @@ -216,7 +217,7 @@ func roleSelect(roles []Role, name string) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 74, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 75, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -275,7 +276,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.field.email")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 85, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 86, Col: 72} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -288,7 +289,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.roles")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 86, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 87, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -306,7 +307,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(m.Email) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 94, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 95, Col: 16} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -324,7 +325,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(m.DisplayName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 96, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 97, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -347,7 +348,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.owner")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 101, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 102, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { @@ -370,7 +371,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(a.RoleName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 106, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 107, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -388,7 +389,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(a.Scope) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 108, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 109, Col: 48} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { @@ -407,7 +408,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/assignments/" + a.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 113, Col: 52} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 114, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19) if templ_7745c5c3_Err != nil { @@ -420,7 +421,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.unassign")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 115, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 116, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20) if templ_7745c5c3_Err != nil { @@ -448,7 +449,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 125, Col: 99} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 126, Col: 99} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { @@ -461,7 +462,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID + "/roles").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 127, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 128, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22) if templ_7745c5c3_Err != nil { @@ -486,7 +487,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 131, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 132, Col: 123} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -499,7 +500,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope_org")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 133, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 134, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -517,7 +518,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(sc.Value).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 135, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 136, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25) if templ_7745c5c3_Err != nil { @@ -530,7 +531,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(sc.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 135, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 136, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -556,7 +557,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 143, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 144, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27) if templ_7745c5c3_Err != nil { @@ -569,7 +570,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var28 string templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.remove_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 144, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 145, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28) if templ_7745c5c3_Err != nil { @@ -582,7 +583,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var29 string templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.remove")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 146, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 147, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) if templ_7745c5c3_Err != nil { @@ -602,6 +603,10 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = pager(v.Pager, "previous", "next").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } if v.CanManage { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
") if templ_7745c5c3_Err != nil { @@ -630,7 +635,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.role")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 163, Col: 117} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 165, Col: 117} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { @@ -659,7 +664,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.invite_link")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 168, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 170, Col: 67} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { @@ -690,7 +695,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var32 string templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(inv.Email) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 179, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 181, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { @@ -703,7 +708,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var33 string templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inv.RoleName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 179, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 181, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) if templ_7745c5c3_Err != nil { @@ -716,7 +721,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var34 string templ_7745c5c3_Var34, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/invitations/" + inv.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 180, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 182, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var34) if templ_7745c5c3_Err != nil { @@ -729,7 +734,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component { var templ_7745c5c3_Var35 string templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 180, Col: 142} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 182, Col: 142} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) if templ_7745c5c3_Err != nil { @@ -834,7 +839,7 @@ func permissionChecks(all, grantable, checked []string) templ.Component { var templ_7745c5c3_Var39 string templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression(perm).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 207, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 209, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39) if templ_7745c5c3_Err != nil { @@ -863,7 +868,7 @@ func permissionChecks(all, grantable, checked []string) templ.Component { var templ_7745c5c3_Var40 string templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 213, Col: 31} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 215, Col: 31} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) if templ_7745c5c3_Err != nil { @@ -927,7 +932,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var43 string templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 227, Col: 15} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 229, Col: 15} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { @@ -945,7 +950,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var44 string templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.built_in")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 229, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 231, Col: 77} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44)) if templ_7745c5c3_Err != nil { @@ -968,7 +973,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var45 string templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 235, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 237, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45) if templ_7745c5c3_Err != nil { @@ -981,7 +986,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var46 string templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "roles.delete_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 236, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 238, Col: 58} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46) if templ_7745c5c3_Err != nil { @@ -994,7 +999,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var47 string templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.delete")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 238, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 240, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) if templ_7745c5c3_Err != nil { @@ -1017,7 +1022,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var48 string templ_7745c5c3_Var48, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 242, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 244, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var48) if templ_7745c5c3_Err != nil { @@ -1060,7 +1065,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component { var templ_7745c5c3_Var49 string templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 251, Col: 80} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 253, Col: 80} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) if templ_7745c5c3_Err != nil { @@ -1206,7 +1211,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var52 string templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.policy", "Count", v.MaxDays)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 305, Col: 83} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 307, Col: 83} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52)) if templ_7745c5c3_Err != nil { @@ -1229,7 +1234,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var53 string templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.name")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 311, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 313, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53)) if templ_7745c5c3_Err != nil { @@ -1247,7 +1252,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var54 string templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.owner")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 313, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 315, Col: 70} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54)) if templ_7745c5c3_Err != nil { @@ -1265,7 +1270,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var55 string templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.permissions")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 315, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 317, Col: 75} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55)) if templ_7745c5c3_Err != nil { @@ -1278,7 +1283,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var56 string templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.created")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 316, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 318, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56)) if templ_7745c5c3_Err != nil { @@ -1291,7 +1296,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var57 string templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 317, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 319, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57)) if templ_7745c5c3_Err != nil { @@ -1304,7 +1309,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var58 string templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.last_used")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 318, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 320, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58)) if templ_7745c5c3_Err != nil { @@ -1322,7 +1327,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var59 string templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(t.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 325, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 327, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) if templ_7745c5c3_Err != nil { @@ -1335,7 +1340,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var60 string templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(t.Prefix) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 325, Col: 101} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 327, Col: 101} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60)) if templ_7745c5c3_Err != nil { @@ -1353,7 +1358,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var61 string templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(t.UserEmail) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 327, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 329, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61)) if templ_7745c5c3_Err != nil { @@ -1376,7 +1381,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var62 string templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 332, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 334, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62)) if templ_7745c5c3_Err != nil { @@ -1394,7 +1399,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var63 string templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(t.CreatedAt) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 336, Col: 80} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 338, Col: 80} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63)) if templ_7745c5c3_Err != nil { @@ -1407,7 +1412,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var64 string templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(t.ExpiresAt) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 337, Col: 80} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 339, Col: 80} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64)) if templ_7745c5c3_Err != nil { @@ -1420,7 +1425,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var65 string templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(t.LastUsedAt) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 338, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 340, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65)) if templ_7745c5c3_Err != nil { @@ -1433,7 +1438,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var66 string templ_7745c5c3_Var66, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/tokens/" + t.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 342, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 344, Col: 44} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var66) if templ_7745c5c3_Err != nil { @@ -1446,7 +1451,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var67 string templ_7745c5c3_Var67, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "tokens.revoke_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 343, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 345, Col: 60} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var67) if templ_7745c5c3_Err != nil { @@ -1459,7 +1464,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var68 string templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 345, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 347, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68)) if templ_7745c5c3_Err != nil { @@ -1510,7 +1515,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var69 string templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 360, Col: 117} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 362, Col: 117} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69)) if templ_7745c5c3_Err != nil { @@ -1529,7 +1534,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var70 string templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.never")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 364, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 366, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70)) if templ_7745c5c3_Err != nil { @@ -1547,7 +1552,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var71 string templ_7745c5c3_Var71, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 366, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 368, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var71) if templ_7745c5c3_Err != nil { @@ -1570,7 +1575,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var72 string templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.days", "Count", d)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 366, Col: 103} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 368, Col: 103} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72)) if templ_7745c5c3_Err != nil { @@ -1597,7 +1602,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component { var templ_7745c5c3_Var73 string templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.copy_now")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 373, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 375, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73)) if templ_7745c5c3_Err != nil { @@ -1697,7 +1702,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component { var templ_7745c5c3_Var76 string templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_totp_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 404, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 406, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76)) if templ_7745c5c3_Err != nil { @@ -1718,7 +1723,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component { var templ_7745c5c3_Var77 string templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_sso_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 406, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 408, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77)) if templ_7745c5c3_Err != nil { @@ -1731,7 +1736,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component { var templ_7745c5c3_Var78 string templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 408, Col: 121} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 410, Col: 121} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78)) if templ_7745c5c3_Err != nil { @@ -1744,7 +1749,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component { var templ_7745c5c3_Var79 string templ_7745c5c3_Var79, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maxDaysValue(v.TokenMaxDays)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 415, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 417, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var79) if templ_7745c5c3_Err != nil { @@ -1757,7 +1762,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component { var templ_7745c5c3_Var80 string templ_7745c5c3_Var80, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "org.token_max_days_none")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 416, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 418, Col: 58} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var80) if templ_7745c5c3_Err != nil { @@ -1770,7 +1775,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component { var templ_7745c5c3_Var81 string templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 420, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 422, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81)) if templ_7745c5c3_Err != nil { @@ -1858,7 +1863,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var84 string templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_invalid")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 444, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 446, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84)) if templ_7745c5c3_Err != nil { @@ -1876,7 +1881,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var85 string templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.summary", "Org", v.OrgName, "Role", v.RoleName)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 446, Col: 96} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 448, Col: 96} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85)) if templ_7745c5c3_Err != nil { @@ -1889,7 +1894,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var86 string templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(v.Email) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 447, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 449, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86)) if templ_7745c5c3_Err != nil { @@ -1908,7 +1913,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var87 string templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/accept").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 450, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 452, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87) if templ_7745c5c3_Err != nil { @@ -1938,7 +1943,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var88 string templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_email_mismatch")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 455, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 457, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88)) if templ_7745c5c3_Err != nil { @@ -1951,7 +1956,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var89 string templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 456, Col: 110} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 110} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89)) if templ_7745c5c3_Err != nil { @@ -1969,7 +1974,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var90 string templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/login?next=/invite/" + v.Token)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 460, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90) if templ_7745c5c3_Err != nil { @@ -1982,7 +1987,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var91 string templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.sign_in")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 153} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 460, Col: 153} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91)) if templ_7745c5c3_Err != nil { @@ -2000,7 +2005,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var92 string templ_7745c5c3_Var92, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/signup").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 460, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 462, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var92) if templ_7745c5c3_Err != nil { @@ -2074,7 +2079,7 @@ func tokenUsage() templ.Component { var templ_7745c5c3_Var94 string templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.usage")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 481, Col: 31} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 483, Col: 31} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94)) if templ_7745c5c3_Err != nil { @@ -2087,7 +2092,7 @@ func tokenUsage() templ.Component { var templ_7745c5c3_Var95 string templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "apidocs.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 484, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 486, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95)) if templ_7745c5c3_Err != nil { diff --git a/internal/web/pager.templ b/internal/web/pager.templ new file mode 100644 index 0000000..875b474 --- /dev/null +++ b/internal/web/pager.templ @@ -0,0 +1,30 @@ +package web + +import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" + +// Pager links the neighbouring pages of a list; empty links are at the +// list's ends. +type Pager struct { + // Prev leads to newer, or earlier, items; First to the list's start. + Prev, First string + // Next leads to older, or later, items. + Next string +} + +// pager shows the page links. prevID and nextID name them, e.g. "newer" +// and "older" for lists newest first. +templ pager(pg Pager, prevID, nextID string) { + if pg.Prev != "" || pg.Next != "" { + + } +} diff --git a/internal/web/pager_templ.go b/internal/web/pager_templ.go new file mode 100644 index 0000000..b95157b --- /dev/null +++ b/internal/web/pager_templ.go @@ -0,0 +1,165 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.1118 + +package web + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" + +// Pager links the neighbouring pages of a list; empty links are at the +// list's ends. +type Pager struct { + // Prev leads to newer, or earlier, items; First to the list's start. + Prev, First string + // Next leads to older, or later, items. + Next string +} + +// pager shows the page links. prevID and nextID name them, e.g. "newer" +// and "older" for lists newest first. +func pager(pg Pager, prevID, nextID 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 { + 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 pg.Prev != "" || pg.Next != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/internal/web/regions.templ b/internal/web/regions.templ index 36f6b2d..7c23791 100644 --- a/internal/web/regions.templ +++ b/internal/web/regions.templ @@ -1,10 +1,6 @@ package web -import ( - "net/url" - - "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" -) +import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" // Region is a row in a region list. type Region struct { @@ -163,16 +159,11 @@ templ RegionsPage(p Page, me Me, v RegionsView) { } } -templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView, orgs OrgsView) { +templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, limits LimitsView) { @consoleShell(p, me) { @settingsHeading("admin.title", "admin.intro") -

- { i18n.T(ctx, "audit.platform_title") } - { i18n.T(ctx, "legal.platform_title") } -

- @moderationSection(mod) - @orgsSection(orgs) - @limitsSection(orgs.Defaults) + @adminLinks() + @limitsSection(limits) @regionsBody(v) @checkerNetworkSection(platformPrivate) @checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro") @@ -223,8 +214,9 @@ templ checkTypesSection(types []CheckTypeOption, api, next, introID string) { type ModerationView struct { Search string Pages []ModeratedPage - // Limited is set when more pages match than are shown. - Limited bool + Pager Pager + // Next is the page to return to after an action. + Next string } // ModeratedPage is a status page with the organization and account @@ -245,18 +237,13 @@ type ModeratedTarget struct { Admin bool } -func (v ModerationView) next() string { - if v.Search == "" { - return "/admin#moderation" - } - return "/admin?q=" + url.QueryEscape(v.Search) + "#moderation" -} +func (v ModerationView) next() string { return v.Next } templ moderationSection(v ModerationView) {
@sectionHeading("moderation.title")

{ i18n.T(ctx, "moderation.intro") }

-
+
- if v.Limited { -

{ i18n.T(ctx, "moderation.limited") }

- } } + @pager(v.Pager, "newer", "older")
} @@ -374,3 +359,26 @@ templ moderationActions(kind, api, suspended, name, next string) { >{ i18n.T(ctx, "moderation.delete_"+kind) }
} + +templ adminLinks() { +

+ { i18n.T(ctx, "moderation.title") } + { i18n.T(ctx, "orgs.title") } + { i18n.T(ctx, "audit.platform_title") } + { i18n.T(ctx, "legal.platform_title") } +

+} + +templ AdminStatusPagesPage(p Page, me Me, v ModerationView) { + @consoleShell(p, me) { +

← { i18n.T(ctx, "admin.title") }

+ @moderationSection(v) + } +} + +templ AdminOrgsPage(p Page, me Me, v OrgsView) { + @consoleShell(p, me) { +

← { i18n.T(ctx, "admin.title") }

+ @orgsSection(v) + } +} diff --git a/internal/web/regions_templ.go b/internal/web/regions_templ.go index 92467d8..abae729 100644 --- a/internal/web/regions_templ.go +++ b/internal/web/regions_templ.go @@ -9,11 +9,7 @@ package web import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import ( - "net/url" - - "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" -) +import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" // Region is a row in a region list. type Region struct { @@ -85,7 +81,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.name")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 53, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 49, Col: 70} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -98,7 +94,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.key")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 54, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 50, Col: 67} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -111,7 +107,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.owner")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 55, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 51, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -124,7 +120,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.instances")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 56, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 52, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -142,7 +138,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 63, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 59, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -155,7 +151,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(r.Key) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 64, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 60, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -173,7 +169,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.platform")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 67, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 63, Col: 66} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -187,7 +183,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.own")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 69, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 65, Col: 36} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -241,7 +237,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.live", "Count", int(r.Instances))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 73, Col: 171} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 69, Col: 171} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -259,7 +255,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.APIBase + "/regions/" + r.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 77, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 73, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13) if templ_7745c5c3_Err != nil { @@ -272,7 +268,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "regions.delete_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 77, Col: 129} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 73, Col: 129} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14) if templ_7745c5c3_Err != nil { @@ -285,7 +281,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.delete")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 77, Col: 198} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 73, Col: 198} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -316,7 +312,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.APIBase + "/regions").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 88, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 84, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16) if templ_7745c5c3_Err != nil { @@ -329,7 +325,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Next).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 88, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 84, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17) if templ_7745c5c3_Err != nil { @@ -370,7 +366,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.APIBase + "/agents").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 97, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 93, Col: 41} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18) if templ_7745c5c3_Err != nil { @@ -395,7 +391,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.kind")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 101, Col: 114} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 97, Col: 114} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { @@ -408,7 +404,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.kind_checker")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 103, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 99, Col: 66} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -421,7 +417,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.kind_statuspage")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 104, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 100, Col: 72} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { @@ -434,7 +430,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.region")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 108, Col: 116} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 104, Col: 116} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { @@ -447,7 +443,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.no_region")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 110, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 106, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -465,7 +461,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 112, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 108, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var24) if templ_7745c5c3_Err != nil { @@ -478,7 +474,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 112, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 108, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -505,7 +501,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.allow_private_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 118, Col: 93} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 114, Col: 93} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -527,7 +523,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.token_now")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 122, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 118, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -558,7 +554,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var28 string templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 135, Col: 15} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 131, Col: 15} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { @@ -571,7 +567,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var29 string templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.kind_"+a.Kind)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 136, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 132, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) if templ_7745c5c3_Err != nil { @@ -589,7 +585,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(a.Region) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 138, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 134, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { @@ -607,7 +603,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(a.Prefix) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 140, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 136, Col: 66} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { @@ -620,7 +616,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var32 string templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(a.LastSeen) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 140, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 136, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { @@ -638,7 +634,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var33 string templ_7745c5c3_Var33, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.APIBase + "/agents/" + a.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 143, Col: 53} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 139, Col: 53} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var33) if templ_7745c5c3_Err != nil { @@ -661,7 +657,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var34 string templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.allow_private_short")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 146, Col: 52} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 142, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) if templ_7745c5c3_Err != nil { @@ -679,7 +675,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var35 string templ_7745c5c3_Var35, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.APIBase + "/agents/" + a.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 151, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 147, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var35) if templ_7745c5c3_Err != nil { @@ -692,7 +688,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var36 string templ_7745c5c3_Var36, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "agents.revoke_confirm")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 151, Col: 125} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 147, Col: 125} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var36) if templ_7745c5c3_Err != nil { @@ -705,7 +701,7 @@ func regionsBody(v RegionsView) templ.Component { var templ_7745c5c3_Var37 string templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 151, Col: 194} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 147, Col: 194} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { @@ -772,7 +768,7 @@ func RegionsPage(p Page, me Me, v RegionsView) templ.Component { }) } -func AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView, orgs OrgsView) templ.Component { +func AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, limits LimitsView) 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 { @@ -805,45 +801,11 @@ func AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []C if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "

") + templ_7745c5c3_Err = adminLinks().Render(ctx, templ_7745c5c3_Buffer) 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, "audit.platform_title")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 170, Col: 100} - } - _, 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, 64, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var43 string - templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "legal.platform_title")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 171, Col: 100} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) - 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 - } - templ_7745c5c3_Err = moderationSection(mod).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = orgsSection(orgs).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = limitsSection(orgs.Defaults).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = limitsSection(limits).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -896,7 +858,7 @@ func checkerNetworkSection(allow bool) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -904,7 +866,7 @@ func checkerNetworkSection(allow bool) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -916,33 +878,33 @@ func checkerNetworkSection(allow bool) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "

") 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, "admin.platform_private_hint")) + var templ_7745c5c3_Var43 string + templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.platform_private_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 195, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 186, Col: 87} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -969,7 +931,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -977,46 +939,46 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "

") + 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, introID)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 197, Col: 59} + } + _, 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, 70, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1024,66 +986,66 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, t := range types { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1095,8 +1057,9 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ type ModerationView struct { Search string Pages []ModeratedPage - // Limited is set when more pages match than are shown. - Limited bool + Pager Pager + // Next is the page to return to after an action. + Next string } // ModeratedPage is a status page with the organization and account @@ -1117,12 +1080,7 @@ type ModeratedTarget struct { Admin bool } -func (v ModerationView) next() string { - if v.Search == "" { - return "/admin#moderation" - } - return "/admin?q=" + url.QueryEscape(v.Search) + "#moderation" -} +func (v ModerationView) next() string { return v.Next } func moderationSection(v ModerationView) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -1141,7 +1099,7 @@ func moderationSection(v ModerationView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1149,185 +1107,219 @@ func moderationSection(v ModerationView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var53 string + templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.intro")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 245, Col: 80} + } + _, 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, 83, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(v.Pages) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var58 string + templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.none")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 258, Col: 65} + } + _, 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, 89, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var59 string + templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.page")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 264, Col: 73} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) + 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 } var templ_7745c5c3_Var60 string - templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.none")) + templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.org")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 271, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 265, Col: 72} } _, 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, 92, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, pg := range v.Pages { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "") 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, "moderation.page")) + templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 277, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 266, Col: 74} } _, 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, 94, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var62 string - templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.org")) + templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.created")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 278, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 267, Col: 76} } _, 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, 95, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var63 string - templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 279, Col: 74} - } - _, 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, 96, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var64 string - templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.created")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 280, Col: 76} - } - _, 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, 97, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var64 string + templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 274, Col: 119} + } + _, 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, 97, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var65 string - templ_7745c5c3_Var65, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(pg.URL)).ResolveURL(ctx) + templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Slug) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 287, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 275, Col: 67} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var65) + _, 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, 99, "\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"hover:underline\">") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = moderationState(pg.Suspended, !pg.Published).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var66 string - templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Title) + templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Org.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 287, Col: 119} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 279, Col: 22} } _, 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, 100, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var67 string - templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Slug) + templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Org.Detail) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 288, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 280, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67)) if templ_7745c5c3_Err != nil { @@ -1337,7 +1329,7 @@ func moderationSection(v ModerationView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = moderationState(pg.Suspended, !pg.Published).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = moderationState(pg.Org.Suspended, false).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1345,55 +1337,21 @@ func moderationSection(v ModerationView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var68 string - templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Org.Name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 292, Col: 22} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var69 string - templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Org.Detail) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 293, Col: 73} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = moderationState(pg.Org.Suspended, false).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } if pg.Owner != nil { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var70 string - templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Owner.Name) + var templ_7745c5c3_Var68 string + templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Owner.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 298, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 285, Col: 49} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1402,38 +1360,38 @@ func moderationSection(v ModerationView) templ.Component { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "–") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "–") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var71 string - templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Created) + var templ_7745c5c3_Var69 string + templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Created) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 304, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 291, Col: 73} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var72 string - templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.actions")) + var templ_7745c5c3_Var70 string + templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.actions")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 309, Col: 103} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 296, Col: 103} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1446,20 +1404,20 @@ func moderationSection(v ModerationView) templ.Component { return templ_7745c5c3_Err } if pg.Owner != nil && pg.Owner.Admin { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var73 string - templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner_is_admin")) + var templ_7745c5c3_Var71 string + templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner_is_admin")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 314, Col: 84} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 301, Col: 84} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1469,36 +1427,21 @@ func moderationSection(v ModerationView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if v.Limited { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var74 string - templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.limited")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 327, Col: 74} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "
") + templ_7745c5c3_Err = pager(v.Pager, "newer", "older").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1524,61 +1467,61 @@ func moderationState(suspended string, draft bool) templ.Component { ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) if suspended != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var76 string - templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.suspended")) + var templ_7745c5c3_Var73 string + templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.suspended")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 336, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 321, Col: 40} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if suspended != "-" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var77 string - templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs("· " + suspended) + var templ_7745c5c3_Var74 string + templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs("· " + suspended) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 338, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 323, Col: 60} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else if draft { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var78 string - templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.draft")) + var templ_7745c5c3_Var75 string + templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.draft")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 342, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 327, Col: 81} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1606,46 +1549,46 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var80 string - templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.target_"+kind)) + var templ_7745c5c3_Var77 string + templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.target_"+kind)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 350, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 335, Col: 115} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var80)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "\" class=\"mb-2\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1654,121 +1597,318 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component return templ_7745c5c3_Err } if suspended != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var88 string - templ_7745c5c3_Var88, templ_7745c5c3_Err = templruntime.NewAttributeExpression(next).Resolve(ctx) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 371, Col: 19} + return nil + }) +} + +func adminLinks() 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_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var88) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err + 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 + } + }() } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, "\" data-confirm=\"") + ctx = templ.InitializeContext(ctx) + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var89 string - templ_7745c5c3_Var89, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "moderation.delete_confirm_"+kind, "Name", name)).Resolve(ctx) + templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 372, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 365, Col: 102} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var89) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "\" class=\"text-muted hover:text-down\">") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var90 string - templ_7745c5c3_Var90, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.delete_"+kind)) + templ_7745c5c3_Var90, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 374, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 366, Col: 88} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var90)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var91 string + templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "audit.platform_title")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 367, Col: 99} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var92 string + templ_7745c5c3_Var92, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "legal.platform_title")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 368, Col: 99} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var92)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func AdminStatusPagesPage(p Page, me Me, v ModerationView) 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_Var94 := 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, 141, "

← ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var95 string + templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.title")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 374, Col: 109} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = moderationSection(v).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var94), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func AdminOrgsPage(p Page, me Me, v OrgsView) 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_Var97 := 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, 143, "

← ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var98 string + templ_7745c5c3_Var98, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.title")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 381, Col: 109} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var98)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 144, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = orgsSection(v).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var97), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }