feat: page long and truncated lists
ci / image (pull_request) Successful in 3m18s
ci / build (pull_request) Successful in 8m38s
ci / test (pull_request) Successful in 12m6s
ci / lint (pull_request) Successful in 15m0s

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 21:40:25 +01:00
1 parent 98fb5d3a82
commit d7c5cd711e
63 files changed
+5427 -3041

No files matched your search

+29 -9
View File
@@ -327,22 +327,34 @@ type alertMonitorRef struct {
// firingAlertViews lists the organization's firing alerts and which // firingAlertViews lists the organization's firing alerts and which
// monitors they hold down, so alerts no monitor follows stand out. // 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() now := time.Now()
var ( var (
alerts []firingAlert rows []store.FiringAlertsPageRow
monitors []store.AlertmanagerMonitorsRow monitors []store.AlertmanagerMonitorsRow
) )
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err 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 return err
} }
monitors, err = q.AlertmanagerMonitors(ctx, &p.Org.ID) monitors, err = q.AlertmanagerMonitors(ctx, &p.Org.ID)
return err return err
}) })
if err != nil { 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)) out := make([]alertView, len(alerts))
for i, a := range 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) { 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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 // 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) { func (s *Server) alertmanagerPage(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) {
ctx := c.Request.Context() 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 { if err != nil {
return nil, err 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 { for _, a := range alerts {
row := web.AlertRow{ row := web.AlertRow{
Name: a.Labels["alertname"], Summary: a.Annotations["summary"], Name: a.Labels["alertname"], Summary: a.Annotations["summary"],
+23 -16
View File
@@ -12,6 +12,12 @@ import (
// sessionStarted is the answer of requests that sign in. // sessionStarted is the answer of requests that sign in.
var sessionStarted = obj{"status": "", "csrf_token": ""} 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 // endpoints documents every route under /api/v1, in the order the docs
// show them. // show them.
var endpoints = []endpoint{ 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, {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{}}}, 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", {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)", {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{}}, 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, {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 // Monitors
{method: "GET", path: "/api/v1/org/monitors", tag: "Monitors", summary: "List monitors with their latest results", {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.", 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: obj{"monitors": []monitorView{}}}, perm: "monitors.read", resp: paged(obj{"monitors": []monitorView{}})},
{method: "POST", path: "/api/v1/org/monitors", tag: "Monitors", summary: "Create a monitor", {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.", 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{}}, 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", {method: "DELETE", path: "/api/v1/org/monitors/:id", tag: "Monitors", summary: "Delete a monitor and its history", perm: "monitors.write",
status: http.StatusNoContent}, status: http.StatusNoContent},
{method: "GET", path: "/api/v1/org/monitors/:id/evidence", tag: "Monitors", summary: "What checkers saw: captured responses", {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", {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.", 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{}}}, 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", {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{}}, resp: checkerActivity{}},
{method: "GET", path: "/api/v1/org/limits", tag: "Organization", summary: "Limits in effect for the organization and its usage", {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.", 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", {method: "DELETE", path: "/api/v1/org/groups/:id", tag: "Monitors", summary: "Delete a group; its content moves up", perm: "monitors.write",
status: http.StatusNoContent}, status: http.StatusNoContent},
{method: "GET", path: "/api/v1/org/maintenance", tag: "Monitors", summary: "List maintenance windows", perm: "monitors.read", {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", {method: "POST", path: "/api/v1/org/maintenance", tag: "Monitors", summary: "Plan maintenance",
description: "During maintenance, failures open no incidents and send no notifications.", description: "During maintenance, failures open no incidents and send no notifications.",
perm: "monitors.write", req: maintenanceRequest{}, status: http.StatusCreated, resp: maintenanceView{}}, 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", {method: "DELETE", path: "/api/v1/org/maintenance/:id", tag: "Monitors", summary: "Delete maintenance", perm: "monitors.write",
status: http.StatusNoContent}, status: http.StatusNoContent},
{method: "GET", path: "/api/v1/org/alertmanager/alerts", tag: "Monitors", summary: "Alerts Alertmanager reports as firing", {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.", description: "Paged, newest first. With the alertmanager monitors each alert holds down; alerts no monitor follows have none.",
perm: "monitors.read", resp: obj{"alerts": []alertView{}}}, 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", {method: "GET", path: "/api/v1/org/alertmanager/receivers", tag: "Monitors", summary: "List Alertmanager receivers", perm: "org.manage",
resp: obj{"receivers": []receiverView{}}}, resp: obj{"receivers": []receiverView{}}},
{method: "POST", path: "/api/v1/org/alertmanager/receivers", tag: "Monitors", summary: "Create a receiver URL for Alertmanager's webhook", {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, {method: "DELETE", path: "/api/v1/org/alertmanager/receivers/:id", tag: "Monitors", summary: "Delete a receiver", perm: "org.manage", sessionOnly: true,
status: http.StatusNoContent}, status: http.StatusNoContent},
{method: "GET", path: "/api/v1/org/incidents", tag: "Monitors", summary: "List incidents", perm: "incidents.read", {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 // Status pages
{method: "GET", path: "/api/v1/org/statuspages", tag: "Status pages", summary: "List status pages", resp: obj{"pages": []statusPageView{}}}, {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, {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)}}, 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", {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, {method: "DELETE", path: "/api/v1/org/members/:user", tag: "Organization", summary: "Remove a member", perm: "members.manage", sessionOnly: true,
status: http.StatusNoContent}, 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", {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", description: "Markdown or a link; a link wins. Both empty removes the document.", perm: "org.manage",
req: legalRequest{}, status: http.StatusNoContent}, req: legalRequest{}, status: http.StatusNoContent},
{method: "GET", path: "/api/v1/org/audit", tag: "Organization", summary: "The organization's audit log", perm: "audit.read", {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.", description: "Paged, newest first.", resp: paged(obj{"events": []auditEventView{}})},
resp: obj{"events": []auditEventView{}}},
{method: "GET", path: "/api/v1/org/export", tag: "Organization", summary: "Export the organization's data", perm: "org.manage", sessionOnly: true, {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{}}, 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, {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 // Platform
{method: "GET", path: "/api/v1/admin/audit", tag: "Platform", summary: "Platform audit log", perm: "platform admin", {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", {method: "GET", path: "/api/v1/admin/legal", tag: "Platform", summary: "Platform legal notice and privacy policy", perm: "platform admin",
resp: obj{"documents": []legalView{}}}, resp: obj{"documents": []legalView{}}},
{method: "PUT", path: "/api/v1/admin/legal/:kind", tag: "Platform", summary: "Set a platform legal document", perm: "platform admin", {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.", 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}, perm: "platform admin", req: limitsRequest{}, status: http.StatusNoContent},
{method: "GET", path: "/api/v1/admin/orgs", tag: "Platform", summary: "Organizations with usage, limits and owner", {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", {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}, 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", {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}, 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", {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.", description: "Paged, newest first. `q` searches title, slug, domain, organization and owner email.",
perm: "platform admin", resp: obj{"status_pages": []moderatedPage{}}}, 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", {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.", 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}, perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent},
+33 -37
View File
@@ -6,7 +6,6 @@ import (
"encoding/json" "encoding/json"
"net/http" "net/http"
"net/netip" "net/netip"
"net/url"
"strings" "strings"
"time" "time"
@@ -282,23 +281,17 @@ func (s *Server) writeAudit(c *gin.Context, e store.InsertAuditEventParams, deta
} }
} }
const auditPageSize = 100 // 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) {
// auditQuery reads one page of entries; before pages back in time. p.AfterT, p.AfterID, p.BeforeT, p.BeforeID, p.MaxRows = pg.afterT(), pg.afterID(), pg.beforeT(), pg.beforeID(), pg.fetch()
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
}
var rows []store.ListAuditEventsRow var rows []store.ListAuditEventsRow
err := s.db.Tx(ctx, scope, func(q *store.Queries) error { err := s.db.Tx(ctx, scope, func(q *store.Queries) error {
var err error var err error
rows, err = q.ListAuditEvents(ctx, p) rows, err = q.ListAuditEvents(ctx, p)
return err 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 { type auditEventView struct {
@@ -316,7 +309,7 @@ type auditEventView struct {
RequestID string `json:"request_id,omitempty"` 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 { if err != nil {
internalError(c, err) internalError(c, err)
return return
@@ -329,28 +322,30 @@ func auditJSON(c *gin.Context, rows []store.ListAuditEventsRow, err error) {
IP: r.Ip, UserAgent: r.UserAgent, RequestID: r.RequestID, IP: r.Ip, UserAgent: r.UserAgent, RequestID: r.RequestID,
} }
} }
resp := gin.H{"events": out} c.JSON(http.StatusOK, gin.H{"events": out, "next_cursor": info.Next, "prev_cursor": info.Prev})
if len(rows) == auditPageSize {
resp["next_before"] = rows[len(rows)-1].Time.Format(time.RFC3339Nano)
}
c.JSON(http.StatusOK, resp)
} }
func (s *Server) listOrgAudit(c *gin.Context) { func (s *Server) listOrgAudit(c *gin.Context) {
p := current(c) if pg, ok := parsePage(c, apiPageSize); ok {
rows, err := s.auditQuery(c.Request.Context(), p.scope(), store.ListAuditEventsParams{Kind: "org", OrgID: &p.Org.ID}, c.Query("before")) p := current(c)
auditJSON(c, rows, err) 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) { func (s *Server) listMyAudit(c *gin.Context) {
sess := auth.Current(c) if pg, ok := parsePage(c, apiPageSize); ok {
rows, err := s.auditQuery(c.Request.Context(), tenant.User(sess.UserID), store.ListAuditEventsParams{Kind: "user", Actor: &sess.UserID}, c.Query("before")) sess := auth.Current(c)
auditJSON(c, rows, err) 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) { func (s *Server) listPlatformAudit(c *gin.Context) {
rows, err := s.auditQuery(c.Request.Context(), tenant.System(), store.ListAuditEventsParams{Kind: "platform"}, c.Query("before")) if pg, ok := parsePage(c, apiPageSize); ok {
auditJSON(c, rows, err) 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 // 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) { 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 { if err != nil {
return nil, err 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) { func (s *Server) adminAuditPage(c *gin.Context) {
@@ -403,17 +402,14 @@ func (s *Server) adminAuditPage(c *gin.Context) {
if !ok { if !ok {
return 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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))) 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)))
}
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))
} }
+36 -5
View File
@@ -1,6 +1,7 @@
package api package api
import ( import (
"context"
"crypto/rand" "crypto/rand"
"encoding/base64" "encoding/base64"
"encoding/hex" "encoding/hex"
@@ -290,15 +291,45 @@ type incidentView struct {
Cause map[string]string `json:"cause"` Cause map[string]string `json:"cause"`
} }
func (s *Server) listIncidents(c *gin.Context) { // incidentPage reads a page of incidents, newest first, of one monitor
p := current(c) // if monitor is set.
ctx := c.Request.Context() func (s *Server) incidentPage(ctx context.Context, p *principal, pg pageReq, monitor *uuid.UUID) ([]store.ListIncidentsRow, pageInfo, error) {
var rows []store.ListIncidentsRow var rows []store.ListIncidentsRow
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err 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 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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} 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) _ = 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})
} }
+47 -20
View File
@@ -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 // Platform checkers work for every organization: only the viewer's own
// monitors are named, the rest is counted. // monitors are named, the rest is counted.
type checkerActivity struct { type checkerActivity struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
Agent string `json:"agent"` Agent string `json:"agent"`
Region string `json:"region"` Region string `json:"region"`
Platform bool `json:"platform"` Platform bool `json:"platform"`
Release string `json:"release"` Release string `json:"release"`
StartedAt time.Time `json:"started_at"` StartedAt time.Time `json:"started_at"`
LastSeenAt time.Time `json:"last_seen_at"` LastSeenAt time.Time `json:"last_seen_at"`
Live bool `json:"live"` Live bool `json:"live"`
Queued int64 `json:"queued"` Queued int64 `json:"queued"`
Running []runningView `json:"running"` Running []runningView `json:"running"`
OtherOrgs int `json:"running_for_others"` OtherOrgs int `json:"running_for_others"`
LastHour checkerHourStats `json:"last_hour"` LastHour checkerHourStats `json:"last_hour"`
Recent []recentByCheck `json:"recent"` Recent []recentByCheck `json:"recent"`
Siblings []uuid.UUID `json:"other_instances"` // 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 regionID string
monitorName map[uuid.UUID]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 // loadCheckerActivity gathers the activity of a checker instance visible to
// p: platform instances and those of p's organization. // 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() now := time.Now()
a := checkerActivity{ID: instance, Running: []runningView{}, Recent: []recentByCheck{}, Siblings: []uuid.UUID{}, monitorName: map[uuid.UUID]string{}} a := checkerActivity{ID: instance, Running: []runningView{}, Recent: []recentByCheck{}, Siblings: []uuid.UUID{}, monitorName: map[uuid.UUID]string{}}
t, err := s.loadGroupTree(ctx, p.scope()) t, err := s.loadGroupTree(ctx, p.scope())
@@ -194,7 +197,15 @@ func (s *Server) loadCheckerActivity(ctx context.Context, p *principal, instance
return err return err
} }
a.LastHour = checkerHourStats{Checks: stats.Total, Failed: stats.Failed, AvgLatencyMS: stats.AvgLatencyMs} 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 { for _, r := range recent {
if readable[r.MonitorID] { if readable[r.MonitorID] {
a.Recent = append(a.Recent, recentByCheck{ a.Recent = append(a.Recent, recentByCheck{
@@ -237,7 +248,11 @@ func (s *Server) getChecker(c *gin.Context) {
fail(c, http.StatusNotFound, "not_found") fail(c, http.StatusNotFound, "not_found")
return 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) { if errors.Is(err, errNoChecker) {
fail(c, http.StatusNotFound, "not_found") fail(c, http.StatusNotFound, "not_found")
return return
@@ -254,7 +269,11 @@ func (s *Server) checkerPage(c *gin.Context, p *principal, page web.Page, me web
if err != nil { if err != nil {
return notFoundPage(c) 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) { if errors.Is(err, errNoChecker) {
return notFoundPage(c) 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(), 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 { for _, r := range a.Recent {
row := web.CheckerResult{ 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), OK: r.OK, Latency: "–", Detail: deref(r.Error),
} }
if r.LatencyMS != nil { 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 { for _, sb := range a.Siblings {
v.Siblings = append(v.Siblings, web.CheckerLink{URL: "/checkers/" + sb.String(), Label: shortID(sb)}) 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 return web.CheckerPage(page, me, v), nil
} }
+237 -39
View File
@@ -1,11 +1,13 @@
package api package api
import ( import (
"cmp"
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strconv" "strconv"
"strings" "strings"
@@ -39,6 +41,7 @@ func (s *Server) registerConsole(r gin.IRouter) {
r.GET("/groups", s.orgPage("groups.title", "", s.groupsView)) r.GET("/groups", s.orgPage("groups.title", "", s.groupsView))
r.GET("/settings", s.settingsIndex) r.GET("/settings", s.settingsIndex)
r.GET("/incidents", s.orgPage("incidents.title", authz.IncidentsRead, s.incidentsView)) 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("/maintenance", s.orgPage("maintenance.title", "", s.maintenancePage))
r.GET("/settings/alertmanager", s.orgPage("alertmanager.title", authz.MonitorsRead, s.alertmanagerPage)) r.GET("/settings/alertmanager", s.orgPage("alertmanager.title", authz.MonitorsRead, s.alertmanagerPage))
r.GET("/settings/channels", s.orgPage("channels.title", authz.NotificationsRead, s.channelsView)) 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.Root = buildGroupNodes(data.tree, data.rows)
v.Empty = len(data.rows) == 0 && len(v.Root.Children) == 0 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.CanWrite = writableAnywhere(p, data.tree)
v.Range = data.rng.Key v.Range = data.rng.Key
var earliest time.Time 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)) 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 { type monitorData struct {
// heartbeatLabel names the pseudo-region of heartbeat results. // heartbeatLabel names the pseudo-region of heartbeat results.
heartbeatLabel string heartbeatLabel string
@@ -366,8 +471,8 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w
} }
var ( var (
daily []store.DailyBucketsRow daily []store.DailyBucketsRow
recent []store.RecentResultsRow recent []store.ListResultsRow
incidents []store.Incident incidents []store.ListIncidentsRow
) )
now := time.Now() now := time.Now()
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { 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 { if daily, err = q.DailyBuckets(ctx, store.DailyBucketsParams{OrgID: p.Org.ID, MonitorID: id, Bucket: now.AddDate(0, 0, -90)}); err != nil {
return err 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 return err
} }
incidents, err = q.MonitorIncidents(ctx, id) incidents, err = q.ListIncidents(ctx, store.ListIncidentsParams{MonitorID: &id, MaxRows: monitorIncidentsShown + 1})
return err return err
}) })
if err != nil { 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 { if u := web.Uptime(buckets); u >= 0 {
v.Uptime90 = web.Percent(u) v.Uptime90 = web.Percent(u)
} }
var evidenceOf map[string]string
if v.CanWrite { 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 return nil, err
} }
} }
shown := recent[:min(len(recent), 50)] more := len(recent) > monitorResultsShown
var checkerIDs []uuid.UUID if more {
for _, r := range shown { recent = recent[:monitorResultsShown]
if r.CheckerID != uuid.Nil && !slices.Contains(checkerIDs, r.CheckerID) { v.MoreResults = true
checkerIDs = append(checkerIDs, r.CheckerID)
}
} }
checkers, err := s.checkerLinks(ctx, p, checkerIDs) if v.Recent, err = s.resultRows(ctx, p, d, m, recent, v.CanWrite); err != nil {
if err != nil {
return nil, err return nil, err
} }
for _, r := range shown { for n, i := range incidents {
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)} if n == monitorIncidentsShown {
row.Checker = checkers[r.CheckerID] v.MoreIncidents = true
if row.Checker.Label == "" && r.CheckerID != uuid.Nil { break
// Instances seen before names were recorded, or of a deleted
// agent.
row.Checker.Label = shortID(r.CheckerID)
} }
row.EvidenceURL = evidenceOf[evidenceKey(r.Region, r.Time)] v.Incidents = append(v.Incidents, d.incidentRow(store.Incident{
if r.LatencyMs != nil { ID: i.ID, OrgID: i.OrgID, MonitorID: i.MonitorID, StartedAt: i.StartedAt, ResolvedAt: i.ResolvedAt, Cause: i.Cause,
row.Latency = fmt.Sprintf("%d ms", *r.LatencyMs) }, m.Name))
}
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))
} }
page.TitleID = "console.monitors.title" page.TitleID = "console.monitors.title"
return web.MonitorDetail(page, me, v), nil 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) { // monitorIncidentsShown is how many incidents a monitor's page lists
ctx := c.Request.Context() // before linking to all of them.
var rows []store.ListIncidentsRow 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 { err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err 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 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 { if err != nil {
return nil, err return nil, err
} }
@@ -704,13 +897,18 @@ func (s *Server) incidentsView(c *gin.Context, p *principal, page web.Page, me w
if err != nil { if err != nil {
return nil, err 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 { 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, ID: r.ID, OrgID: r.OrgID, MonitorID: r.MonitorID, StartedAt: r.StartedAt, ResolvedAt: r.ResolvedAt, Cause: r.Cause,
}, r.MonitorName) }, 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) { func (s *Server) channelsView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) {
+55 -15
View File
@@ -131,22 +131,29 @@ func (s *Server) listEvidence(c *gin.Context) {
if !ok { if !ok {
return return
} }
pg, ok := parsePage(c, apiPageSize)
if !ok {
return
}
ctx := c.Request.Context() ctx := c.Request.Context()
var rows []store.ListEvidenceRow var rows []store.ListEvidenceRow
err := s.db.Tx(ctx, current(c).scope(), func(q *store.Queries) error { err := s.db.Tx(ctx, current(c).scope(), func(q *store.Queries) error {
var err 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 return err
}) })
if err != nil { if err != nil {
internalError(c, err) internalError(c, err)
return return
} }
rows, info := paginate(pg, rows, func(r store.ListEvidenceRow) cursor { return cursor{T: r.Time, ID: r.ID} })
out := make([]evidenceSummary, len(rows)) out := make([]evidenceSummary, len(rows))
for i, r := range 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} 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) { 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() return buf.String()
} }
// evidenceRows lists stored evidence of m for its page. // evidenceShown is how much of a monitor's evidence its page lists.
func (s *Server) evidenceRows(ctx context.Context, p *principal, d monitorData, m store.Monitor) ([]web.EvidenceRow, map[string]string, error) { 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 var rows []store.ListEvidenceRow
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err 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 return err
}) })
byResult := map[string]string{} out := make([]web.EvidenceRow, 0, len(rows))
out := make([]web.EvidenceRow, 0, min(len(rows), 20)) for _, r := range rows {
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
}
detail := deref(r.Error) detail := deref(r.Error)
if detail == "" && r.StatusCode != nil { if detail == "" && r.StatusCode != nil {
detail = strconv.Itoa(int(*r.StatusCode)) 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. // evidenceKey matches evidence with the check result it belongs to.
func evidenceKey(region string, t time.Time) string { func evidenceKey(region string, t time.Time) string {
return region + "@" + strconv.FormatInt(t.UnixMicro(), 10) 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})
}
+17 -10
View File
@@ -325,15 +325,17 @@ type adminOwner struct {
Orgs int `json:"orgs"` 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 var rows []store.AdminListOrgsRow
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
var err error var err error
rows, err = q.AdminListOrgs(ctx, store.AdminListOrgsParams{ 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 return err
}) })
rows, info := paginate(pg, rows, func(r store.AdminListOrgsRow) cursor { return cursor{T: r.CreatedAt, ID: r.ID} })
defaults := s.platformLimits(ctx) defaults := s.platformLimits(ctx)
out := make([]adminOrg, len(rows)) out := make([]adminOrg, len(rows))
for i, r := range 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) { 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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) } func webLimits(l Limits) web.LimitsView { return web.LimitsView(l) }
@@ -376,12 +382,13 @@ func optInt(v *int32) string {
return strconv.Itoa(int(*v)) 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() ctx := c.Request.Context()
// The admin page searches organizations with oq; q is the status page orgs, info, err := s.adminOrgs(ctx, c.Query("q"), pg)
// search. v := web.OrgsView{
orgs, err := s.adminOrgs(ctx, c.Query("oq")) Search: strings.TrimSpace(c.Query("q")), Pager: pager(c, info), Next: c.Request.URL.RequestURI(),
v := web.OrgsView{Search: strings.TrimSpace(c.Query("oq")), Limited: len(orgs) == moderationRows, Defaults: webLimits(s.platformLimits(ctx))} Defaults: webLimits(s.platformLimits(ctx)),
}
state := func(at *time.Time, reason string) string { state := func(at *time.Time, reason string) string {
switch { switch {
case at == nil: case at == nil:
+1 -1
View File
@@ -148,7 +148,7 @@ func TestLimits(t *testing.T) {
if st, _ := owner.do("GET", "/api/v1/admin/orgs", nil); st != http.StatusForbidden { if st, _ := owner.do("GET", "/api/v1/admin/orgs", nil); st != http.StatusForbidden {
t.Errorf("non-admin org list = %d", st) 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") t.Error("the admin page lacks the organization list")
} }
if _, _, html := owner.page("/settings/org"); !strings.Contains(html, "3 / 10") { if _, _, html := owner.page("/settings/org"); !strings.Contains(html, "3 / 10") {
+20 -7
View File
@@ -266,19 +266,24 @@ func (ms maintenanceScope) can(p *principal, perm authz.Permission, monitors, gr
return n == len(monitors)+len(groups) 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 ( var (
windows []store.MaintenanceWindow windows []store.MaintenanceWindow
targets []store.MaintenanceTarget targets []store.MaintenanceTarget
) )
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err 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 return err
} }
targets, err = q.ListMaintenanceTargets(ctx) targets, err = q.ListMaintenanceTargets(ctx)
return err return err
}) })
windows, info := paginate(pg, windows, func(w store.MaintenanceWindow) cursor { return cursor{T: w.StartsAt, ID: w.ID} })
out := []maintenanceView{} out := []maintenanceView{}
now := time.Now() now := time.Now()
for _, w := range windows { for _, w := range windows {
@@ -287,7 +292,7 @@ func (s *Server) listMaintenanceViews(ctx context.Context, p *principal, ms main
out = append(out, v) out = append(out, v)
} }
} }
return out, err return out, info, err
} }
func (s *Server) listMaintenance(c *gin.Context) { func (s *Server) listMaintenance(c *gin.Context) {
@@ -298,12 +303,16 @@ func (s *Server) listMaintenance(c *gin.Context) {
internalError(c, err) internalError(c, err)
return 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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) { 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 { if err != nil {
return nil, err 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 { if err != nil {
return nil, err 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) { ms.tree.walk(func(g store.MonitorGroup, depth int) {
if canInGroup(p, authz.MonitorsWrite, ms.tree, &g.ID) { 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}) v.Groups = append(v.Groups, web.TargetOption{ID: g.ID.String(), Name: g.Name, Depth: depth})
+14 -5
View File
@@ -32,15 +32,20 @@ type memberView struct {
Assignments []assignmentView `json:"assignments"` 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) p := current(c)
ctx := c.Request.Context() ctx := c.Request.Context()
var out []memberView var out []memberView
var info pageInfo
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { 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 { if err != nil {
return err 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) assigns, err := q.ListAssignments(ctx, p.Org.ID)
if err != nil { if err != nil {
return err return err
@@ -64,16 +69,20 @@ func (s *Server) loadMembers(c *gin.Context) ([]memberView, error) {
} }
return nil return nil
}) })
return out, err return out, info, err
} }
func (s *Server) listMembers(c *gin.Context) { 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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 // removeMember requires the actor to hold every permission the member holds
+15 -11
View File
@@ -1,6 +1,7 @@
package api package api
import ( import (
"context"
"errors" "errors"
"net/http" "net/http"
"strings" "strings"
@@ -51,18 +52,17 @@ type moderatedUser struct {
Admin bool `json:"admin,omitempty"` Admin bool `json:"admin,omitempty"`
} }
const moderationRows = 500 func (s *Server) moderatedPages(ctx context.Context, search string, pg pageReq) ([]moderatedPage, pageInfo, error) {
func (s *Server) moderatedPages(c *gin.Context) ([]moderatedPage, error) {
ctx := c.Request.Context()
var rows []store.AdminListStatusPagesRow var rows []store.AdminListStatusPagesRow
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
var err error var err error
rows, err = q.AdminListStatusPages(ctx, store.AdminListStatusPagesParams{ 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 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)) out := make([]moderatedPage, len(rows))
for i, r := range rows { for i, r := range rows {
p := &out[i] 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} 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) { 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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 { type suspensionRequest struct {
@@ -273,9 +277,9 @@ func (s *Server) adminDeleteUser(c *gin.Context) {
c.Status(http.StatusNoContent) c.Status(http.StatusNoContent)
} }
func (s *Server) moderationView(c *gin.Context) (web.ModerationView, error) { func (s *Server) moderationView(c *gin.Context, pg pageReq) (web.ModerationView, error) {
pages, err := s.moderatedPages(c) pages, info, err := s.moderatedPages(c.Request.Context(), c.Query("q"), pg)
v := web.ModerationView{Search: strings.TrimSpace(c.Query("q")), Limited: len(pages) == moderationRows} 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 { state := func(at *time.Time, reason string) string {
switch { switch {
case at == nil: case at == nil:
+1 -1
View File
@@ -189,7 +189,7 @@ func TestModeration(t *testing.T) {
} }
// The admin page shows the list. // 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") t.Error("the admin page lacks the status page list")
} }
} }
+11 -2
View File
@@ -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 // listMonitors returns the monitors the principal may read, org-wide or
// through a group assignment. // through a group assignment.
func (s *Server) listMonitors(c *gin.Context) { func (s *Server) listMonitors(c *gin.Context) {
pg, ok := parsePage(c, apiPageSize)
if !ok {
return
}
p := current(c) p := current(c)
ctx := c.Request.Context() ctx := c.Request.Context()
var info pageInfo
t, err := s.loadGroupTree(ctx, p.scope()) t, err := s.loadGroupTree(ctx, p.scope())
if err != nil { if err != nil {
internalError(c, err) internalError(c, err)
@@ -199,10 +204,14 @@ func (s *Server) listMonitors(c *gin.Context) {
} }
out := []monitorView{} out := []monitorView{}
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { 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 { if err != nil {
return err 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) assignments, err := q.AllMonitorAlertGroups(ctx)
if err != nil { if err != nil {
return err return err
@@ -253,7 +262,7 @@ func (s *Server) listMonitors(c *gin.Context) {
internalError(c, err) internalError(c, err)
return 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) { func (s *Server) createMonitor(c *gin.Context) {
+4 -1
View File
@@ -306,7 +306,10 @@ func buildOpenAPI(publicURL string) map[string]any {
"description": "Manage monitors, status pages, alerting and members of an organization.\n\n" + "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; " + "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 " + "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"}, "license": map[string]any{"name": "AGPL-3.0-only", "identifier": "AGPL-3.0-only"},
}, },
"servers": []any{map[string]any{"url": strings.TrimSuffix(publicURL, "/")}}, "servers": []any{map[string]any{"url": strings.TrimSuffix(publicURL, "/")}},
+36 -6
View File
@@ -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("/settings/audit", s.orgPage("audit.title", authz.AuditRead, s.auditView))
r.GET("/admin", s.adminPage) r.GET("/admin", s.adminPage)
r.GET("/admin/audit", s.adminAuditPage) 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("/admin/legal", s.adminLegalPage)
r.GET("/settings/legal", s.orgPage("legal.org_title", authz.OrgManage, s.orgLegalView)) r.GET("/settings/legal", s.orgPage("legal.org_title", authz.OrgManage, s.orgLegalView))
r.GET("/legal/:kind", s.legalPage) r.GET("/legal/:kind", s.legalPage)
@@ -218,7 +220,7 @@ func (s *Server) securityPage(c *gin.Context) {
return 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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) { func (s *Server) membersView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) {
c.Set(ctxPrincipal, p) 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 { if err != nil {
return nil, err return nil, err
} }
@@ -322,7 +328,7 @@ func (s *Server) membersView(c *gin.Context, p *principal, page web.Page, me web
if err != nil { if err != nil {
return nil, err 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) scopeNames, scopes, err := s.scopeOptions(ctx, p)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -511,17 +517,41 @@ func (s *Server) adminPage(c *gin.Context) {
for _, t := range check.Types { for _, t := range check.Types {
types = append(types, web.CheckTypeOption{Type: string(t), Enabled: !off[string(t)]}) 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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 { if err != nil {
internalError(c, err) internalError(c, err)
return 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) { func (s *Server) buildRegionsView(ctx context.Context, regions []store.Region, agents []store.ListAgentsRow, apiBase, next string, manageable func(store.Region) bool) (web.RegionsView, error) {
+218
View File
@@ -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)
}
+75
View File
@@ -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)
}
}
+184
View File
@@ -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], "&amp;", "&")
}
// 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")
}
}
+1
View File
@@ -140,6 +140,7 @@ func (s *Server) Mount(r gin.IRouter) {
org.PUT("/monitors/:id", s.updateMonitor) org.PUT("/monitors/:id", s.updateMonitor)
org.DELETE("/monitors/:id", s.deleteMonitor) org.DELETE("/monitors/:id", s.deleteMonitor)
org.GET("/monitors/:id/evidence", s.listEvidence) org.GET("/monitors/:id/evidence", s.listEvidence)
org.GET("/monitors/:id/results", s.listResults)
org.GET("/checkers/:id", s.getChecker) org.GET("/checkers/:id", s.getChecker)
org.GET("/monitors/:id/evidence/:evidence", s.getEvidence) org.GET("/monitors/:id/evidence/:evidence", s.getEvidence)
org.GET("/alertmanager/receivers", can(authz.OrgManage), s.listReceivers) org.GET("/alertmanager/receivers", can(authz.OrgManage), s.listReceivers)
+1
View File
@@ -171,6 +171,7 @@ func TestDynamicFamilies(t *testing.T) {
"moderation.delete_": {"page", "org", "owner"}, "moderation.delete_": {"page", "org", "owner"},
"moderation.delete_confirm_": {"page", "org", "owner"}, "moderation.delete_confirm_": {"page", "org", "owner"},
"limits.own_": {"true", "false"}, "limits.own_": {"true", "false"},
"pager.": {"newer", "older", "previous", "next", "later", "earlier"},
"weekday.": {"0", "1", "2", "3", "4", "5", "6"}, "weekday.": {"0", "1", "2", "3", "4", "5", "6"},
"md.": {"heading", "bold", "italic", "strike", "link", "ul", "ol", "quote", "code", "codeblock", "table", "hr"}, "md.": {"heading", "bold", "italic", "strike", "link", "ul", "ol", "quote", "code", "codeblock", "table", "hr"},
"maintenance.recurrence_": {"none", "daily", "weekly", "monthly"}, "maintenance.recurrence_": {"none", "daily", "weekly", "monthly"},
+21 -2
View File
@@ -131,7 +131,6 @@
"audit.deleted_user": "Gelöschter Benutzer", "audit.deleted_user": "Gelöschter Benutzer",
"audit.empty": "Noch keine Einträge.", "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.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_intro": "Änderungen an Plattform-Regionen und -Agents sowie Anmeldeversuche für unbekannte Konten.",
"audit.platform_title": "Plattform-Audit-Log", "audit.platform_title": "Plattform-Audit-Log",
"audit.title": "Audit-Log", "audit.title": "Audit-Log",
@@ -495,6 +494,7 @@
"error.invalid_code": "Code ungültig.", "error.invalid_code": "Code ungültig.",
"error.invalid_config": "Die Check-Einstellungen sind ungültig.", "error.invalid_config": "Die Check-Einstellungen sind ungültig.",
"error.invalid_credentials": "E-Mail oder Passwort falsch.", "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_domain": "Eine der Domains ist ungültig.",
"error.invalid_email": "Bitte eine gültige E-Mail-Adresse eingeben.", "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.", "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_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_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_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_duration": "Die Dauer muss zwischen 1 Minute und 30 Tagen liegen.",
"error.invalid_maintenance_time": "Prüfe Beginn, Wochentage und letzten Tag.", "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.", "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.none": "– oberste Ebene –",
"groups.parent": "In Gruppe", "groups.parent": "In Gruppe",
"groups.title": "Monitor-Gruppen", "groups.title": "Monitor-Gruppen",
"incidents.all": "Alle Vorfälle",
"incidents.all_of_monitor": "Alle Vorfälle dieses Monitors",
"incidents.none": "Bisher keine Incidents.", "incidents.none": "Bisher keine Incidents.",
"incidents.of_monitor": "Vorfälle von",
"incidents.ongoing": "laufend", "incidents.ongoing": "laufend",
"incidents.resolved": "behoben", "incidents.resolved": "behoben",
"incidents.title": "Incidents", "incidents.title": "Incidents",
@@ -847,7 +851,6 @@
"moderation.delete_owner": "Account löschen", "moderation.delete_owner": "Account löschen",
"moderation.delete_page": "Statusseite 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.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.none": "Keine Statusseite gefunden.",
"moderation.org": "Organisation", "moderation.org": "Organisation",
"moderation.owner": "Inhaber", "moderation.owner": "Inhaber",
@@ -864,6 +867,8 @@
"moderation.target_page": "Statusseite", "moderation.target_page": "Statusseite",
"moderation.title": "Öffentliche Statusseiten", "moderation.title": "Öffentliche Statusseiten",
"monitors.alertmanager_hint": "Ausgefallen, solange ein Alert feuert, der alle Matcher erfüllt. Alerts kommen über einen Empfänger:", "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_op": "Operator",
"monitors.assertion_path": "Pfad", "monitors.assertion_path": "Pfad",
"monitors.assertion_value": "Wert", "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_hint": "Ziel ist host:port (Java meist 25565, Bedrock 19132). Pingt den Server wie die Serverliste im Spiel.",
"monitors.minecraft_java": "Java Edition", "monitors.minecraft_java": "Java Edition",
"monitors.new": "Neuer Monitor", "monitors.new": "Neuer Monitor",
"monitors.no_match": "Kein Monitor gefunden.",
"monitors.no_results": "Noch keine Ergebnisse.",
"monitors.op_absent": "fehlt", "monitors.op_absent": "fehlt",
"monitors.op_contains": "enthält", "monitors.op_contains": "enthält",
"monitors.op_eq": "gleich", "monitors.op_eq": "gleich",
@@ -963,7 +970,10 @@
"monitors.recent": "Letzte Checks", "monitors.recent": "Letzte Checks",
"monitors.regions": "Regionen", "monitors.regions": "Regionen",
"monitors.regions_hint": "Geprüft von einem zufälligen Checker jeder gewählten Region. Deine eigenen Regionen stehen oben.", "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.secret_unchanged": "unverändert",
"monitors.show_all": "Alle {{.Count}} anzeigen",
"monitors.sla": "SLA", "monitors.sla": "SLA",
"monitors.sla_table": "SLA nach Zeitraum", "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.", "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_steam": "Steam-Spieleserver",
"monitors.type_tcp": "TCP-Port", "monitors.type_tcp": "TCP-Port",
"monitors.type_tls": "TLS-Zertifikat", "monitors.type_tls": "TLS-Zertifikat",
"monitors.ungrouped": "Ohne Gruppe",
"monitors.uptime_chart": "Uptime pro Zeitraum", "monitors.uptime_chart": "Uptime pro Zeitraum",
"monitors.verify_tls": "TLS-Zertifikat prüfen", "monitors.verify_tls": "TLS-Zertifikat prüfen",
"notify.duration": "Ausgefallen für {{.Duration}}", "notify.duration": "Ausgefallen für {{.Duration}}",
@@ -1063,6 +1074,14 @@
"page.status.unknown": "Status derzeit nicht verfügbar", "page.status.unknown": "Status derzeit nicht verfügbar",
"page.today": "Heute", "page.today": "Heute",
"page.updated": "Aktualisiert {{.Time}}", "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.accent": "Akzentfarbe (#rrggbb)",
"pages.components": "Monitore auf dieser Seite", "pages.components": "Monitore auf dieser Seite",
"pages.create": "Statuspage anlegen", "pages.create": "Statuspage anlegen",
+21 -2
View File
@@ -131,7 +131,6 @@
"audit.deleted_user": "Deleted user", "audit.deleted_user": "Deleted user",
"audit.empty": "No entries yet.", "audit.empty": "No entries yet.",
"audit.intro": "Changes in this organization: who did what and when, from which address. Entries cannot be edited.", "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_intro": "Changes to platform regions and agents, and sign-in attempts for unknown accounts.",
"audit.platform_title": "Platform audit log", "audit.platform_title": "Platform audit log",
"audit.title": "Audit log", "audit.title": "Audit log",
@@ -495,6 +494,7 @@
"error.invalid_code": "Invalid code.", "error.invalid_code": "Invalid code.",
"error.invalid_config": "The check settings are not valid.", "error.invalid_config": "The check settings are not valid.",
"error.invalid_credentials": "Wrong email or password.", "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_domain": "One of the domains is not valid.",
"error.invalid_email": "Please enter a valid email address.", "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.", "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_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_json_body": "The request body is not valid JSON.",
"error.invalid_legal_url": "The link must be an http or https URL.", "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_duration": "The duration must be between 1 minute and 30 days.",
"error.invalid_maintenance_time": "Check start, weekdays and last day.", "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.", "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.none": "– top level –",
"groups.parent": "Inside group", "groups.parent": "Inside group",
"groups.title": "Monitor groups", "groups.title": "Monitor groups",
"incidents.all": "All incidents",
"incidents.all_of_monitor": "All incidents of this monitor",
"incidents.none": "No incidents so far.", "incidents.none": "No incidents so far.",
"incidents.of_monitor": "Incidents of",
"incidents.ongoing": "ongoing", "incidents.ongoing": "ongoing",
"incidents.resolved": "resolved", "incidents.resolved": "resolved",
"incidents.title": "Incidents", "incidents.title": "Incidents",
@@ -847,7 +851,6 @@
"moderation.delete_owner": "Delete account", "moderation.delete_owner": "Delete account",
"moderation.delete_page": "Delete status page", "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.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.none": "No status page matches.",
"moderation.org": "Organization", "moderation.org": "Organization",
"moderation.owner": "Owner", "moderation.owner": "Owner",
@@ -864,6 +867,8 @@
"moderation.target_page": "Status page", "moderation.target_page": "Status page",
"moderation.title": "Public status pages", "moderation.title": "Public status pages",
"monitors.alertmanager_hint": "Down while an alert matching all matchers fires. Alerts arrive through a receiver:", "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_op": "Operator",
"monitors.assertion_path": "Path", "monitors.assertion_path": "Path",
"monitors.assertion_value": "Value", "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_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.minecraft_java": "Java Edition",
"monitors.new": "New monitor", "monitors.new": "New monitor",
"monitors.no_match": "No monitor matches.",
"monitors.no_results": "No results yet.",
"monitors.op_absent": "is absent", "monitors.op_absent": "is absent",
"monitors.op_contains": "contains", "monitors.op_contains": "contains",
"monitors.op_eq": "equals", "monitors.op_eq": "equals",
@@ -963,7 +970,10 @@
"monitors.recent": "Recent checks", "monitors.recent": "Recent checks",
"monitors.regions": "Regions", "monitors.regions": "Regions",
"monitors.regions_hint": "Checked from a random checker in each selected region. Your own regions are listed first.", "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.secret_unchanged": "unchanged",
"monitors.show_all": "Show all {{.Count}}",
"monitors.sla": "SLA", "monitors.sla": "SLA",
"monitors.sla_table": "SLA by period", "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.", "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_steam": "Steam game server",
"monitors.type_tcp": "TCP port", "monitors.type_tcp": "TCP port",
"monitors.type_tls": "TLS certificate", "monitors.type_tls": "TLS certificate",
"monitors.ungrouped": "Without group",
"monitors.uptime_chart": "Uptime per period", "monitors.uptime_chart": "Uptime per period",
"monitors.verify_tls": "Verify TLS certificate", "monitors.verify_tls": "Verify TLS certificate",
"notify.duration": "Down for {{.Duration}}", "notify.duration": "Down for {{.Duration}}",
@@ -1063,6 +1074,14 @@
"page.status.unknown": "Status currently unavailable", "page.status.unknown": "Status currently unavailable",
"page.today": "Today", "page.today": "Today",
"page.updated": "Updated {{.Time}}", "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.accent": "Accent color (#rrggbb)",
"pages.components": "Monitors on this page", "pages.components": "Monitors on this page",
"pages.create": "Create status page", "pages.create": "Create status page",
+69
View File
@@ -185,6 +185,75 @@ func (q *Queries) FiringAlerts(ctx context.Context, arg FiringAlertsParams) ([]F
return items, nil 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 const latestResultForMonitor = `-- name: LatestResultForMonitor :one
SELECT ok, coalesce(error, '')::text AS error FROM check_results SELECT ok, coalesce(error, '')::text AS error FROM check_results
WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '2 days' WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '2 days'
+21 -11
View File
@@ -59,17 +59,24 @@ LEFT JOIN users u ON u.id = e.actor_user_id
WHERE e.kind = $1 WHERE e.kind = $1
AND ($2::uuid IS NULL OR e.org_id = $2) AND ($2::uuid IS NULL OR e.org_id = $2)
AND ($3::uuid IS NULL OR e.actor_user_id = $3) AND ($3::uuid IS NULL OR e.actor_user_id = $3)
AND ($4::timestamptz IS NULL OR e.time < $4) AND ($4::timestamptz IS NULL OR (e.time, e.id) < ($4, $5::uuid))
ORDER BY e.time DESC AND ($6::timestamptz IS NULL OR (e.time, e.id) > ($6, $7::uuid))
LIMIT $5 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 { type ListAuditEventsParams struct {
Kind string Kind string
OrgID *uuid.UUID OrgID *uuid.UUID
Actor *uuid.UUID Actor *uuid.UUID
Before *time.Time AfterT *time.Time
MaxRows int32 AfterID *uuid.UUID
BeforeT *time.Time
BeforeID *uuid.UUID
MaxRows int32
} }
type ListAuditEventsRow struct { type ListAuditEventsRow struct {
@@ -90,14 +97,17 @@ type ListAuditEventsRow struct {
ActorName string ActorName string
} }
// Newest first, paged by time. kind narrows to one kind; the row policy // Newest first, a page from a keyset cursor (see paging.go). kind narrows
// already limits what the scope can see. // to one kind; the row policy already limits what the scope can see.
func (q *Queries) ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error) { func (q *Queries) ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error) {
rows, err := q.db.Query(ctx, listAuditEvents, rows, err := q.db.Query(ctx, listAuditEvents,
arg.Kind, arg.Kind,
arg.OrgID, arg.OrgID,
arg.Actor, arg.Actor,
arg.Before, arg.AfterT,
arg.AfterID,
arg.BeforeT,
arg.BeforeID,
arg.MaxRows, arg.MaxRows,
) )
if err != nil { if err != nil {
+102 -57
View File
@@ -343,6 +343,82 @@ func (q *Queries) LatestResultsForMonitor(ctx context.Context, arg LatestResults
return items, nil 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 const rangeBuckets = `-- name: RangeBuckets :many
SELECT monitor_id, time_bucket($2::text::interval, time)::timestamptz AS bucket, SELECT monitor_id, time_bucket($2::text::interval, time)::timestamptz AS bucket,
count(*)::bigint AS total, count(*) FILTER (WHERE ok)::bigint AS ok_count, 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 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 const regionBuckets = `-- name: RegionBuckets :many
SELECT region, time_bucket($2::text::interval, time)::timestamptz AS bucket, SELECT region, time_bucket($2::text::interval, time)::timestamptz AS bucket,
count(*)::bigint AS total, count(*) FILTER (WHERE ok)::bigint AS ok_count 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 const resultsByChecker = `-- name: ResultsByChecker :many
SELECT r.time, r.monitor_id, r.region, r.ok, r.latency_ms, r.status_code, r.error SELECT r.time, r.monitor_id, r.region, r.ok, r.latency_ms, r.status_code, r.error
FROM check_results r FROM check_results r
WHERE r.org_id = $1 AND r.checker_id = $2 AND r.time > now() - interval '1 day' WHERE r.org_id = $1 AND r.checker_id = $2
ORDER BY r.time DESC AND ($3::timestamptz IS NULL
LIMIT 50 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 { type ResultsByCheckerParams struct {
OrgID uuid.UUID OrgID uuid.UUID
CheckerID uuid.UUID CheckerID uuid.UUID
AfterT *time.Time
AfterS *string
BeforeT *time.Time
BeforeS *string
MaxRows int32
} }
type ResultsByCheckerRow struct { type ResultsByCheckerRow struct {
@@ -752,9 +788,18 @@ type ResultsByCheckerRow struct {
Error *string 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) { 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 { if err != nil {
return nil, err return nil, err
} }
+64 -3
View File
@@ -27,6 +27,44 @@ func (q *Queries) DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEv
return err 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 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 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 const listEvidence = `-- name: ListEvidence :many
SELECT id, region, checker_id, time, ok, status_code, error FROM check_evidence SELECT id, region, checker_id, time, ok, status_code, error FROM check_evidence
WHERE monitor_id = $1 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 { type ListEvidenceRow struct {
ID uuid.UUID ID uuid.UUID
Region string Region string
@@ -125,8 +178,16 @@ type ListEvidenceRow struct {
Error *string Error *string
} }
func (q *Queries) ListEvidence(ctx context.Context, monitorID uuid.UUID) ([]ListEvidenceRow, error) { // Newest first, a page from a keyset cursor (see paging.go).
rows, err := q.db.Query(ctx, listEvidence, monitorID) 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 { if err != nil {
return nil, err return nil, err
} }
+28 -35
View File
@@ -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 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 FROM incidents i
JOIN monitors m ON m.id = i.monitor_id JOIN monitors m ON m.id = i.monitor_id
ORDER BY i.started_at DESC WHERE ($1::uuid IS NULL OR i.monitor_id = $1)
LIMIT 200 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 { type ListIncidentsRow struct {
ID uuid.UUID ID uuid.UUID
OrgID uuid.UUID OrgID uuid.UUID
@@ -259,8 +274,17 @@ type ListIncidentsRow struct {
MonitorName string MonitorName string
} }
func (q *Queries) ListIncidents(ctx context.Context) ([]ListIncidentsRow, error) { // Newest first, a page from a keyset cursor (see paging.go); optionally of
rows, err := q.db.Query(ctx, listIncidents) // 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 { if err != nil {
return nil, err return nil, err
} }
@@ -321,37 +345,6 @@ func (q *Queries) MarkNotificationSent(ctx context.Context, id uuid.UUID) error
return err 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 const notificationDetails = `-- name: NotificationDetails :many
SELECT n.id, n.org_id, n.event, n.attempts, 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, c.type AS channel_type, c.config AS channel_config, c.id AS channel_id,
+25 -8
View File
@@ -29,16 +29,25 @@ LEFT JOIN LATERAL (
FROM memberships m JOIN users u ON u.id = m.user_id 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 WHERE m.org_id = o.id AND m.is_owner ORDER BY m.created_at LIMIT 1
) ow ON true ) ow ON true
WHERE $1::text = '' WHERE ($1::text = ''
OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%' OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%'
OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%' OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%')
ORDER BY o.created_at DESC AND ($2::timestamptz IS NULL OR (o.created_at, o.id) < ($2, $3::uuid))
LIMIT $2 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 { type AdminListOrgsParams struct {
Search string Search string
MaxRows int32 AfterT *time.Time
AfterID *uuid.UUID
BeforeT *time.Time
BeforeID *uuid.UUID
MaxRows int32
} }
type AdminListOrgsRow struct { type AdminListOrgsRow struct {
@@ -64,9 +73,17 @@ type AdminListOrgsRow struct {
} }
// System scope: organizations with their usage, limit overrides and owner, // 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) { 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 { if err != nil {
return nil, err return nil, err
} }
+61
View File
@@ -168,6 +168,67 @@ func (q *Queries) ListMaintenance(ctx context.Context) ([]MaintenanceWindow, err
return items, nil 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 const listMaintenanceTargets = `-- name: ListMaintenanceTargets :many
SELECT window_id, org_id, monitor_id, group_id FROM maintenance_targets SELECT window_id, org_id, monitor_id, group_id FROM maintenance_targets
` `
+64
View File
@@ -90,6 +90,70 @@ func (q *Queries) ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOr
return items, nil 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 const listUserOrgs = `-- name: ListUserOrgs :many
SELECT o.id, o.slug, o.name, o.require_totp, m.is_owner SELECT o.id, o.slug, o.name, o.require_totp, m.is_owner
FROM memberships m FROM memberships m
+23 -7
View File
@@ -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 coalesce(p.custom_domain::text, '') ILIKE '%' || $1 || '%'
OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%' OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%'
OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%') OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%')
ORDER BY p.created_at DESC AND ($2::timestamptz IS NULL OR (p.created_at, p.id) < ($2, $3::uuid))
LIMIT $2 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 { type AdminListStatusPagesParams struct {
Search string Search string
MaxRows int32 AfterT *time.Time
AfterID *uuid.UUID
BeforeT *time.Time
BeforeID *uuid.UUID
MaxRows int32
} }
type AdminListStatusPagesRow struct { type AdminListStatusPagesRow struct {
@@ -63,10 +72,17 @@ type AdminListStatusPagesRow struct {
} }
// System scope: public status pages and suspended ones, with their // System scope: public status pages and suspended ones, with their
// organization and its owner, newest first, matching search in title, // organization and its owner, matching search in title, slug, domain,
// slug, domain, organization or owner email. // organization or owner email; newest first, a page from a keyset cursor.
func (q *Queries) AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error) { 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 { if err != nil {
return nil, err return nil, err
} }
+61
View File
@@ -227,6 +227,67 @@ func (q *Queries) ListMonitors(ctx context.Context) ([]Monitor, error) {
return items, nil 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 const monitorRegions = `-- name: MonitorRegions :many
SELECT region_id FROM monitor_regions WHERE monitor_id = $1 ORDER BY region_id SELECT region_id FROM monitor_regions WHERE monitor_id = $1 ORDER BY region_id
` `
+27 -10
View File
@@ -20,11 +20,12 @@ type Querier interface {
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
// System scope: organizations with their usage, limit overrides and owner, // 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) AdminListOrgs(ctx context.Context, arg AdminListOrgsParams) ([]AdminListOrgsRow, error)
// System scope: public status pages and suspended ones, with their // System scope: public status pages and suspended ones, with their
// organization and its owner, newest first, matching search in title, // organization and its owner, matching search in title, slug, domain,
// slug, domain, organization or owner email. // organization or owner email; newest first, a page from a keyset cursor.
AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error) AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error)
AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error) AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error)
// System scope: enabled alertmanager monitors of org, with when they last // 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 EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
// An empty name names a new region after its key and keeps an existing name. // An empty name names a new region after its key and keeps an existing name.
EnsurePlatformRegion(ctx context.Context, arg EnsurePlatformRegionParams) (Region, error) 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 // System scope: resolves a request to a page by verified custom domain or
// by slug. // by slug.
FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, error) FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, error)
// Alerts of org that fire and were repeated within the stale period. // Alerts of org that fire and were repeated within the stale period.
FiringAlerts(ctx context.Context, arg FiringAlertsParams) ([]FiringAlertsRow, error) 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. // When each monitor and region first reported, to the day.
FirstDataDaily(ctx context.Context, orgID uuid.UUID) ([]FirstDataDailyRow, error) FirstDataDaily(ctx context.Context, orgID uuid.UUID) ([]FirstDataDailyRow, error)
// When each monitor and region first reported since $2, exactly. Used for // 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) ListAlertGroups(ctx context.Context) ([]ListAlertGroupsRow, error)
ListAlertmanagerReceivers(ctx context.Context) ([]ListAlertmanagerReceiversRow, error) ListAlertmanagerReceivers(ctx context.Context) ([]ListAlertmanagerReceiversRow, error)
ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error) ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error)
// Newest first, paged by time. kind narrows to one kind; the row policy // Newest first, a page from a keyset cursor (see paging.go). kind narrows
// already limits what the scope can see. // to one kind; the row policy already limits what the scope can see.
ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error) ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error)
ListChannels(ctx context.Context) ([]NotificationChannel, error) ListChannels(ctx context.Context) ([]NotificationChannel, error)
// System scope: every enabled monitor with its regions, for reconciling the // System scope: every enabled monitor with its regions, for reconciling the
// schedule. // schedule.
ListEnabledMonitorsForSchedule(ctx context.Context) ([]ListEnabledMonitorsForScheduleRow, error) ListEnabledMonitorsForSchedule(ctx context.Context) ([]ListEnabledMonitorsForScheduleRow, error)
ListEnabledSSOProviders(ctx context.Context) ([]ListEnabledSSOProvidersRow, 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) 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) 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) ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error)
ListMonitors(ctx context.Context) ([]Monitor, 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) 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) ListOrgs(ctx context.Context) ([]Org, error)
ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error) ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error)
ListPlatformRegions(ctx context.Context) ([]Region, 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) ListRoles(ctx context.Context) ([]Role, error)
ListSSOProviders(ctx context.Context) ([]SsoProvider, error) ListSSOProviders(ctx context.Context) ([]SsoProvider, error)
ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([]StatusPageGroup, 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) MemberGrants(ctx context.Context, arg MemberGrantsParams) ([]MemberGrantsRow, error)
MonitorAlertGroups(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error) MonitorAlertGroups(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
MonitorAlertRoutes(ctx context.Context, monitorID uuid.UUID) ([]MonitorAlertRoutesRow, 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) MonitorRegions(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
// System scope: monitors to hand to a checker of region, skipping ones that // 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 // 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) RangeBucketsDaily(ctx context.Context, arg RangeBucketsDailyParams) ([]RangeBucketsDailyRow, error)
// The hourly aggregate rebucketed by width, for ranges of days. // The hourly aggregate rebucketed by width, for ranges of days.
RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error) RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error)
RecentResults(ctx context.Context, arg RecentResultsParams) ([]RecentResultsRow, error)
// One monitor's raw results per region. // One monitor's raw results per region.
RegionBuckets(ctx context.Context, arg RegionBucketsParams) ([]RegionBucketsRow, error) RegionBuckets(ctx context.Context, arg RegionBucketsParams) ([]RegionBucketsRow, error)
RegionBucketsDaily(ctx context.Context, arg RegionBucketsDailyParams) ([]RegionBucketsDailyRow, 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 // Heartbeats of an organization wait afresh after its suspension, during
// which pings were refused. // which pings were refused.
RestartHeartbeatWait(ctx context.Context, orgID uuid.UUID) error 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) ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error)
ScrubAuditEmail(ctx context.Context, email string) error ScrubAuditEmail(ctx context.Context, email string) error
SetAgentAllowPrivate(ctx context.Context, arg SetAgentAllowPrivateParams) (int64, error) SetAgentAllowPrivate(ctx context.Context, arg SetAgentAllowPrivateParams) (int64, error)
+14
View File
@@ -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 SELECT ok, coalesce(error, '')::text AS error FROM check_results
WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '2 days' WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '2 days'
ORDER BY time DESC LIMIT 1; 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);
+8 -4
View File
@@ -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); VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);
-- name: ListAuditEvents :many -- name: ListAuditEvents :many
-- Newest first, paged by time. kind narrows to one kind; the row policy -- Newest first, a page from a keyset cursor (see paging.go). kind narrows
-- already limits what the scope can see. -- 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, 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, 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, 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) 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(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(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)) AND (sqlc.narg(after_t)::timestamptz IS NULL OR (e.time, e.id) < (sqlc.narg(after_t), sqlc.narg(after_id)::uuid))
ORDER BY e.time DESC 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); LIMIT sqlc.arg(max_rows);
-- name: PurgeAuditEvents :execrows -- name: PurgeAuditEvents :execrows
+27 -9
View File
@@ -12,12 +12,22 @@ FROM check_results
WHERE org_id = $1 AND time > now() - interval '1 day' WHERE org_id = $1 AND time > now() - interval '1 day'
ORDER BY monitor_id, region, time DESC; ORDER BY monitor_id, region, time DESC;
-- name: RecentResults :many -- name: ListResults :many
SELECT time, region, ok, latency_ms, status_code, error, checker_id -- 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 FROM check_results
WHERE org_id = $1 AND monitor_id = $2 AND time > $3 WHERE org_id = sqlc.arg(org_id) AND monitor_id = sqlc.arg(monitor_id)
ORDER BY time DESC AND (sqlc.narg(after_t)::timestamptz IS NULL
LIMIT 500; 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 -- name: UptimeSince :many
-- Uptime per monitor from the hourly aggregate, including the not yet -- 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; GROUP BY 1, 2;
-- name: ResultsByChecker :many -- 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 SELECT r.time, r.monitor_id, r.region, r.ok, r.latency_ms, r.status_code, r.error
FROM check_results r FROM check_results r
WHERE r.org_id = $1 AND r.checker_id = sqlc.arg(checker_id) AND r.time > now() - interval '1 day' WHERE r.org_id = sqlc.arg(org_id) AND r.checker_id = sqlc.arg(checker_id)
ORDER BY r.time DESC AND (sqlc.narg(after_t)::timestamptz IS NULL
LIMIT 50; 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 -- name: CheckerStats :one
-- How much one instance checked for the organization in the last hour. -- How much one instance checked for the organization in the last hour.
+14 -2
View File
@@ -12,9 +12,21 @@ WHERE monitor_id = $1 AND region = $2 AND NOT ok
ORDER BY time DESC LIMIT 1; ORDER BY time DESC LIMIT 1;
-- name: ListEvidence :many -- 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 SELECT id, region, checker_id, time, ok, status_code, error FROM check_evidence
WHERE monitor_id = $1 WHERE monitor_id = sqlc.arg(monitor_id)
ORDER BY time DESC LIMIT 100; 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 -- name: GetEvidence :one
SELECT * FROM check_evidence WHERE id = $1 AND monitor_id = $2; SELECT * FROM check_evidence WHERE id = $1 AND monitor_id = $2;
+10 -5
View File
@@ -10,11 +10,19 @@ WHERE monitor_id = sqlc.arg(monitor_id) AND resolved_at IS NULL
RETURNING *; RETURNING *;
-- name: ListIncidents :many -- 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 SELECT i.*, m.name AS monitor_name
FROM incidents i FROM incidents i
JOIN monitors m ON m.id = i.monitor_id JOIN monitors m ON m.id = i.monitor_id
ORDER BY i.started_at DESC WHERE (sqlc.narg(monitor_id)::uuid IS NULL OR i.monitor_id = sqlc.narg(monitor_id))
LIMIT 200; 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 -- name: EnqueueNotification :exec
INSERT INTO notifications (org_id, channel_id, incident_id, event) INSERT INTO notifications (org_id, channel_id, incident_id, event)
@@ -78,9 +86,6 @@ DELETE FROM notification_channels WHERE id = $1;
-- name: OpenIncidents :many -- name: OpenIncidents :many
SELECT * FROM incidents WHERE resolved_at IS NULL; 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 -- name: IncidentsForMonitors :many
SELECT * FROM incidents SELECT * FROM incidents
WHERE monitor_id = ANY (sqlc.arg(ids)::uuid[]) AND (resolved_at IS NULL OR resolved_at > sqlc.arg(since)) WHERE monitor_id = ANY (sqlc.arg(ids)::uuid[]) AND (resolved_at IS NULL OR resolved_at > sqlc.arg(since))
+10 -4
View File
@@ -21,7 +21,8 @@ RETURNING id, email;
-- name: AdminListOrgs :many -- name: AdminListOrgs :many
-- System scope: organizations with their usage, limit overrides and owner, -- 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, 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, 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, (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 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 WHERE m.org_id = o.id AND m.is_owner ORDER BY m.created_at LIMIT 1
) ow ON true ) 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 o.name ILIKE '%' || sqlc.arg(search) || '%' OR o.slug::text ILIKE '%' || sqlc.arg(search) || '%'
OR coalesce(ow.email::text, '') ILIKE '%' || sqlc.arg(search) || '%' OR coalesce(ow.email::text, '') ILIKE '%' || sqlc.arg(search) || '%')
ORDER BY o.created_at DESC 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); LIMIT sqlc.arg(max_rows);
+12
View File
@@ -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, 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 w.recurrence, w.every, w.weekdays, w.until
FROM covered c JOIN maintenance_windows w ON w.id = c.window_id; 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);
+13
View File
@@ -20,3 +20,16 @@ ORDER BY o.name;
-- name: GetMembership :one -- name: GetMembership :one
SELECT * FROM memberships WHERE org_id = $1 AND user_id = $2; 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);
+8 -3
View File
@@ -1,7 +1,7 @@
-- name: AdminListStatusPages :many -- name: AdminListStatusPages :many
-- System scope: public status pages and suspended ones, with their -- System scope: public status pages and suspended ones, with their
-- organization and its owner, newest first, matching search in title, -- organization and its owner, matching search in title, slug, domain,
-- slug, domain, organization or owner email. -- 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, 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, 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, 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 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 o.name ILIKE '%' || sqlc.arg(search) || '%' OR o.slug::text ILIKE '%' || sqlc.arg(search) || '%'
OR coalesce(ow.email::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); LIMIT sqlc.arg(max_rows);
-- name: SuspendStatusPage :one -- name: SuspendStatusPage :one
+12
View File
@@ -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 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 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)); 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);
+2 -1
View File
@@ -23,7 +23,8 @@ func TestResultQueriesFilterByOrg(t *testing.T) {
if strings.Contains(b, ":copyfrom") { if strings.Contains(b, ":copyfrom") {
continue 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) t.Errorf("query %s does not filter by org_id = $1", name)
} }
} }
+7 -13
View File
@@ -2,7 +2,6 @@ package web
import ( import (
"context" "context"
"net/url"
"strconv" "strconv"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
@@ -21,8 +20,10 @@ type LimitsView struct {
type OrgsView struct { type OrgsView struct {
Search string Search string
Orgs []OrgRow Orgs []OrgRow
Limited bool Pager Pager
Defaults LimitsView 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 // OrgRow is an organization with its usage and limits. Overrides are form
@@ -40,12 +41,7 @@ type OrgRow struct {
OwnerOrgLimit string OwnerOrgLimit string
} }
func (v OrgsView) next() string { func (v OrgsView) next() string { return v.Next }
if v.Search == "" {
return "/admin#orgs"
}
return "/admin?oq=" + url.QueryEscape(v.Search) + "#orgs"
}
// limitText shows a limit, or "unlimited". // limitText shows a limit, or "unlimited".
func limitText(ctx context.Context, n int) string { func limitText(ctx context.Context, n int) string {
@@ -97,10 +93,10 @@ templ orgsSection(v OrgsView) {
<section id="orgs" class="mb-12"> <section id="orgs" class="mb-12">
@sectionHeading("orgs.title") @sectionHeading("orgs.title")
<p class="mb-4 max-w-3xl text-sm text-muted">{ i18n.T(ctx, "orgs.intro") }</p> <p class="mb-4 max-w-3xl text-sm text-muted">{ i18n.T(ctx, "orgs.intro") }</p>
<form method="get" action="/admin#orgs" class="mb-4 flex max-w-xl gap-2"> <form method="get" action="/admin/orgs" class="mb-4 flex max-w-xl gap-2">
<input <input
type="search" type="search"
name="oq" name="q"
value={ v.Search } value={ v.Search }
placeholder={ i18n.T(ctx, "orgs.search") } placeholder={ i18n.T(ctx, "orgs.search") }
aria-label={ i18n.T(ctx, "orgs.search") } aria-label={ i18n.T(ctx, "orgs.search") }
@@ -185,10 +181,8 @@ templ orgsSection(v OrgsView) {
</tbody> </tbody>
</table> </table>
</div> </div>
if v.Limited {
<p class="mt-3 text-xs text-muted">{ i18n.T(ctx, "moderation.limited") }</p>
}
} }
@pager(v.Pager, "newer", "older")
</section> </section>
} }
+109 -128
View File
@@ -11,7 +11,6 @@ import templruntime "github.com/a-h/templ/runtime"
import ( import (
"context" "context"
"net/url"
"strconv" "strconv"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
@@ -30,8 +29,10 @@ type LimitsView struct {
type OrgsView struct { type OrgsView struct {
Search string Search string
Orgs []OrgRow Orgs []OrgRow
Limited bool Pager Pager
Defaults LimitsView 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 // OrgRow is an organization with its usage and limits. Overrides are form
@@ -49,12 +50,7 @@ type OrgRow struct {
OwnerOrgLimit string OwnerOrgLimit string
} }
func (v OrgsView) next() string { func (v OrgsView) next() string { return v.Next }
if v.Search == "" {
return "/admin#orgs"
}
return "/admin?oq=" + url.QueryEscape(v.Search) + "#orgs"
}
// limitText shows a limit, or "unlimited". // limitText shows a limit, or "unlimited".
func limitText(ctx context.Context, n int) string { func limitText(ctx context.Context, n int) string {
@@ -96,7 +92,7 @@ func limitsSection(d LimitsView) templ.Component {
var templ_7745c5c3_Var2 string var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.intro")) templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.intro"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -145,7 +141,7 @@ func limitsSection(d LimitsView) templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_count_hint")) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_count_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -158,7 +154,7 @@ func limitsSection(d LimitsView) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save")) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { 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 var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(label) templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil { 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 var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx) templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
if templ_7745c5c3_Err != nil { 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 var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(max)).Resolve(ctx) templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(max)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
if templ_7745c5c3_Err != nil { 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 var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx) templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
if templ_7745c5c3_Err != nil { 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 var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "limits.default", "Value", limitText(ctx, def))).Resolve(ctx) templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "limits.default", "Value", limitText(ctx, def))).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -296,20 +292,20 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.intro")) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.intro"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</p><form method=\"get\" action=\"/admin#orgs\" class=\"mb-4 flex max-w-xl gap-2\"><input type=\"search\" name=\"oq\" value=\"") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</p><form method=\"get\" action=\"/admin/orgs\" class=\"mb-4 flex max-w-xl gap-2\"><input type=\"search\" name=\"q\" value=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Search).Resolve(ctx) templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Search).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 104, Col: 20} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 100, Col: 20}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -322,7 +318,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "orgs.search")).Resolve(ctx) templ_7745c5c3_Var14, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "orgs.search")).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 105, Col: 44} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 101, Col: 44}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -335,7 +331,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "orgs.search")).Resolve(ctx) templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "orgs.search")).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 106, Col: 43} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 102, Col: 43}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -348,7 +344,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.search_button")) templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.search_button"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 109, Col: 142} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 105, Col: 142}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -366,7 +362,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.none")) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.none"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 112, Col: 59} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 108, Col: 59}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -384,7 +380,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var18 string var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.org")) templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.org"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 118, Col: 72} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 114, Col: 72}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -397,7 +393,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var19 string var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner")) templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 119, Col: 74} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 115, Col: 74}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -410,7 +406,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var20 string var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.monitors")) templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.monitors"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 120, Col: 73} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 116, Col: 73}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -423,7 +419,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var21 string var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.status_pages")) templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.status_pages"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 121, Col: 77} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 117, Col: 77}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -436,7 +432,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var22 string var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.created")) templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.created"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 122, Col: 76} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 118, Col: 76}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -454,7 +450,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var23 string var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name) templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 129, Col: 17} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 125, Col: 17}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -467,7 +463,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var24 string var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(o.Slug) templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(o.Slug)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 130, Col: 66} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 126, Col: 66}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -493,7 +489,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var25 string var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(o.Owner.Name) templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(o.Owner.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 135, Col: 48} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 131, Col: 48}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -536,7 +532,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var26 string var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(o.Created) templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(o.Created)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 143, Col: 72} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 139, Col: 72}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -549,7 +545,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var27 string var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.manage")) templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.manage"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 148, Col: 96} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 144, Col: 96}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -562,7 +558,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var28 string var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/admin/orgs/" + o.ID + "/limits").Resolve(ctx) templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/admin/orgs/" + o.ID + "/limits").Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 150, Col: 61} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 146, Col: 61}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -575,7 +571,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var29 string var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.next()).Resolve(ctx) templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.next()).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 150, Col: 102} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 146, Col: 102}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -588,7 +584,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var30 string var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.limits")) templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.limits"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 151, Col: 113} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 147, Col: 113}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -621,7 +617,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var31 string var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_count")) templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_count"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 157, Col: 135} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 153, Col: 135}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -644,7 +640,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var32 string var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.default", "Value", i18n.T(ctx, "limits.own_"+strconv.FormatBool(v.Defaults.OwnRegionsCount)))) templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.default", "Value", i18n.T(ctx, "limits.own_"+strconv.FormatBool(v.Defaults.OwnRegionsCount))))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 159, Col: 187} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 155, Col: 187}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -667,7 +663,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var33 string var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_true")) templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_true"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 160, Col: 112} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 156, Col: 112}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -690,7 +686,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var34 string var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_false")) templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_false"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 161, Col: 115} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 157, Col: 115}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -703,7 +699,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var35 string var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save")) templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 164, Col: 130} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 160, Col: 130}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -725,7 +721,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var36 string var templ_7745c5c3_Var36 string
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner_is_admin")) templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner_is_admin"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 168, Col: 84} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 164, Col: 84}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -743,7 +739,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var37 string var templ_7745c5c3_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/admin/users/" + o.Owner.ID + "/limits").Resolve(ctx) templ_7745c5c3_Var37, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/admin/users/" + o.Owner.ID + "/limits").Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 171, Col: 70} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 167, Col: 70}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -756,7 +752,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var38 string var templ_7745c5c3_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.next()).Resolve(ctx) templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.next()).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 171, Col: 111} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 167, Col: 111}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -769,7 +765,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var39 string var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.target_owner")) templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.target_owner"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 172, Col: 127} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 168, Col: 127}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -794,7 +790,7 @@ func orgsSection(v OrgsView) templ.Component {
var templ_7745c5c3_Var40 string var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save")) templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 175, Col: 132} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 171, Col: 132}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -822,27 +818,12 @@ func orgsSection(v OrgsView) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if v.Limited {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "<p class=\"mt-3 text-xs text-muted\">")
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, "</p>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "</section>") 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, "</section>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -872,25 +853,25 @@ func usage(used, max int) templ.Component {
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
templ_7745c5c3_Buffer := templ.GetBuffer() templ_7745c5c3_Buffer := templ.GetBuffer()
var templ_7745c5c3_ElementScripts []templ.ComponentScript var templ_7745c5c3_ElementScripts []templ.ComponentScript
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "<span class=\"") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "<span class=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var43 = []any{templ.KV("text-down", max > 0 && used >= max)} var templ_7745c5c3_Var42 = []any{templ.KV("text-down", max > 0 && used >= max)}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var43...) templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var42...)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var44 string var templ_7745c5c3_Var43 string
templ_7745c5c3_Var44, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var43).String()).Resolve(ctx) templ_7745c5c3_Var43, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var42).String()).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/admin_orgs.templ`, Line: 1, Col: 0} 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -904,33 +885,33 @@ func usage(used, max int) templ.Component {
} }
templ.ReleaseBuffer(templ_7745c5c3_Buffer) 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var45 string 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 { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, " / ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "</span>")
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, "</span>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -961,7 +942,7 @@ func usageSection(u UsageView) templ.Component {
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "<section class=\"mb-12 max-w-xl\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "<section class=\"mb-12 max-w-xl\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -969,14 +950,35 @@ func usageSection(u UsageView) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "<dl class=\"grid grid-cols-[1fr_auto] gap-x-6 gap-y-1.5 text-sm\"><dt>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "<dl class=\"grid grid-cols-[1fr_auto] gap-x-6 gap-y-1.5 text-sm\"><dt>")
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, "</dt><dd class=\"font-mono text-xs\">")
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, "</dd><dt>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var48 string 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 { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -986,7 +988,7 @@ func usageSection(u UsageView) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -995,9 +997,9 @@ func usageSection(u UsageView) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var49 string 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 { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1007,60 +1009,39 @@ func usageSection(u UsageView) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err 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, "</dd><dt>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var50 string 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 { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "</dt><dd class=\"font-mono text-xs\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "</dd></dl>")
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, "</dd></dl>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if u.Limits.RegionsPerMonitor > 0 && !u.Limits.OwnRegionsCount { if u.Limits.RegionsPerMonitor > 0 && !u.Limits.OwnRegionsCount {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "<p class=\"mt-2 text-xs text-muted\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "<p class=\"mt-2 text-xs text-muted\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var52 string var templ_7745c5c3_Var51 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_free")) templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "limits.own_regions_free"))
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "</p>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "</p>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "</section>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "</section>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
+2
View File
@@ -6,6 +6,7 @@ import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
type AlertmanagerView struct { type AlertmanagerView struct {
Receivers []ReceiverRow Receivers []ReceiverRow
Alerts []AlertRow Alerts []AlertRow
Pager Pager
CanManage bool CanManage bool
} }
@@ -67,6 +68,7 @@ templ AlertmanagerPage(p Page, me Me, v AlertmanagerView) {
} }
</ul> </ul>
} }
@pager(v.Pager, "newer", "older")
</section> </section>
if v.CanManage { if v.CanManage {
<section class="max-w-2xl"> <section class="max-w-2xl">
+23 -18
View File
@@ -15,6 +15,7 @@ import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
type AlertmanagerView struct { type AlertmanagerView struct {
Receivers []ReceiverRow Receivers []ReceiverRow
Alerts []AlertRow Alerts []AlertRow
Pager Pager
CanManage bool CanManage bool
} }
@@ -86,7 +87,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.no_alerts")) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.no_alerts"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -117,7 +118,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -130,7 +131,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var5 string var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.since", "Time", a.Since)) templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.since", "Time", a.Since))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -148,7 +149,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Summary) templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Summary)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -171,7 +172,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(l[0] + "=" + l[1]) templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(l[0] + "=" + l[1])
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -194,7 +195,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.CreateURL)).ResolveURL(ctx) templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.CreateURL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -207,7 +208,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.create_monitor")) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.create_monitor"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -226,7 +227,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(m.URL)).ResolveURL(ctx) templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(m.URL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -239,7 +240,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(m.Label) templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(m.Label)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -261,6 +262,10 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
return templ_7745c5c3_Err 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, "</section>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</section>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@@ -287,7 +292,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -300,7 +305,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(r.Prefix) templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(r.Prefix)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -313,7 +318,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.last_received", "Time", r.LastSeen)) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.last_received", "Time", r.LastSeen))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -326,7 +331,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/alertmanager/receivers/" + r.ID).Resolve(ctx) templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/alertmanager/receivers/" + r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -339,7 +344,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "alertmanager.delete_confirm")).Resolve(ctx) templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "alertmanager.delete_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -352,7 +357,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.delete")) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.delete"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -391,7 +396,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var18 string var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.copy_now")) templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.copy_now"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -404,7 +409,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var19 string var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.config_hint")) templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "alertmanager.config_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -417,7 +422,7 @@ func AlertmanagerPage(p Page, me Me, v AlertmanagerView) templ.Component {
var templ_7745c5c3_Var20 string var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(alertmanagerExample) templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(alertmanagerExample)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
+2 -4
View File
@@ -13,13 +13,11 @@ type AuditEntry struct {
Failed bool 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) { @consoleShell(p, me) {
@settingsHeading(titleID, introID) @settingsHeading(titleID, introID)
@auditList(entries) @auditList(entries)
if next != "" { @pager(pg, "newer", "older")
<a href={ templ.SafeURL(next) } class="mt-4 inline-block text-sm underline underline-offset-2">{ i18n.T(ctx, "audit.older") }</a>
}
} }
} }
+54 -82
View File
@@ -22,7 +22,7 @@ type AuditEntry struct {
Failed bool 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) { 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 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if next != "" { templ_7745c5c3_Err = pager(pg, "newer", "older").Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<a href=\"") if templ_7745c5c3_Err != nil {
if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(next)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 21, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" class=\"mt-4 inline-block text-sm underline underline-offset-2\">")
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, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} }
return nil return nil
}) })
@@ -119,43 +91,43 @@ func auditList(entries []AuditEntry) templ.Component {
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
if len(entries) == 0 { if len(entries) == 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<p class=\"text-sm text-muted\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<p class=\"text-sm text-muted\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "audit.empty")) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "audit.empty"))
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</p>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</p>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} else { } else {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<ul class=\"divide-y divide-rule border-y border-rule text-sm\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<ul class=\"divide-y divide-rule border-y border-rule text-sm\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
for _, e := range entries { for _, e := range entries {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<li class=\"grid gap-x-4 gap-y-0.5 py-2 sm:grid-cols-[10rem_1fr_auto]\"><span class=\"font-mono text-xs text-muted\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<li class=\"grid gap-x-4 gap-y-0.5 py-2 sm:grid-cols-[10rem_1fr_auto]\"><span class=\"font-mono text-xs text-muted\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var5 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(e.Time) templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(e.Time)
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</span> <span>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</span> <span>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -163,25 +135,25 @@ func auditList(entries []AuditEntry) templ.Component {
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
templ_7745c5c3_Buffer := templ.GetBuffer() templ_7745c5c3_Buffer := templ.GetBuffer()
var templ_7745c5c3_ElementScripts []templ.ComponentScript var templ_7745c5c3_ElementScripts []templ.ComponentScript
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<span class=\"") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<span class=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var8 = []any{templ.KV("text-down", e.Failed)} var templ_7745c5c3_Var6 = []any{templ.KV("text-down", e.Failed)}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var8...) templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var6...)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var8).String()).Resolve(ctx) templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var6).String()).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 1, Col: 0} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 1, Col: 0}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\"") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -195,93 +167,93 @@ func auditList(entries []AuditEntry) templ.Component {
} }
templ.ReleaseBuffer(templ_7745c5c3_Buffer) templ.ReleaseBuffer(templ_7745c5c3_Buffer)
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, ">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, ">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(e.Action) templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(e.Action)
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</span> ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</span> ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if e.Target != "" { if e.Target != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<span class=\"text-muted\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<span class=\"text-muted\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + e.Target) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + e.Target)
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</span> ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</span> ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
if e.Actor != "" { if e.Actor != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<span class=\"block text-xs text-muted\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<span class=\"block text-xs text-muted\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(e.Actor) templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(e.Actor)
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</span>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</span>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</span> <span class=\"font-mono text-xs text-muted\" title=\"") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</span> <span class=\"font-mono text-xs text-muted\" title=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(e.RequestID).Resolve(ctx) templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(e.RequestID).Resolve(ctx)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 43, Col: 67} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/audit.templ`, Line: 41, Col: 67}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(e.IP) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(e.IP)
if templ_7745c5c3_Err != nil { 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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</span></li>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</span></li>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</ul>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</ul>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
+2
View File
@@ -23,6 +23,7 @@ type CheckerView struct {
Failed int Failed int
AvgLatency string AvgLatency string
Recent []CheckerResult Recent []CheckerResult
Pager Pager
Siblings []CheckerLink Siblings []CheckerLink
} }
@@ -130,6 +131,7 @@ templ CheckerPage(p Page, me Me, v CheckerView) {
</tbody> </tbody>
</table> </table>
} }
@pager(v.Pager, "newer", "older")
</section> </section>
if len(v.Siblings) > 0 { if len(v.Siblings) > 0 {
<section> <section>
+32 -27
View File
@@ -32,6 +32,7 @@ type CheckerView struct {
Failed int Failed int
AvgLatency string AvgLatency string
Recent []CheckerResult Recent []CheckerResult
Pager Pager
Siblings []CheckerLink Siblings []CheckerLink
} }
@@ -113,7 +114,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.Agent) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.Agent)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -126,7 +127,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.ID[:8]) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.ID[:8])
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -139,7 +140,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var5 string var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.Region) templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.Region)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -153,7 +154,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.platform")) templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.platform"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -167,7 +168,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.own")) templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "regions.own"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -186,7 +187,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.live")) templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.live"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -196,7 +197,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.gone")) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.gone"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -255,7 +256,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.idle")) templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.idle"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -278,7 +279,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(r.MonitorURL)).ResolveURL(ctx) templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(r.MonitorURL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -291,7 +292,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -304,7 +305,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.for", "Duration", r.For)) templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.for", "Duration", r.For))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -323,7 +324,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.others", "Count", v.OtherOrgs)) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.others", "Count", v.OtherOrgs))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -346,7 +347,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.refresh_hint")) templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.refresh_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -368,7 +369,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.no_recent")) templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "checkers.no_recent"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -391,7 +392,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(r.Time) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(r.Time)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -404,7 +405,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var18 string var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(r.MonitorURL)).ResolveURL(ctx) templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(r.MonitorURL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -417,7 +418,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var19 string var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -445,7 +446,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var20 string var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency) templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -458,7 +459,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var21 string var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -474,6 +475,10 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
return templ_7745c5c3_Err 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, "</section>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</section>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@@ -499,7 +504,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var22 string var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(sb.URL)).ResolveURL(ctx) templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(sb.URL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -512,7 +517,7 @@ func CheckerPage(p Page, me Me, v CheckerView) templ.Component {
var templ_7745c5c3_Var23 string var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(sb.Label) templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(sb.Label)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -562,7 +567,7 @@ func checkerFact(labelID, value string) templ.Component {
var templ_7745c5c3_Var25 string var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, labelID)) templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, labelID))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -575,7 +580,7 @@ func checkerFact(labelID, value string) templ.Component {
var templ_7745c5c3_Var26 string var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx) templ_7745c5c3_Var26, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var26)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -588,7 +593,7 @@ func checkerFact(labelID, value string) templ.Component {
var templ_7745c5c3_Var27 string var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(value) templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(value)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -627,7 +632,7 @@ func checkerCell(l CheckerLink) templ.Component {
var templ_7745c5c3_Var29 string var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(l.URL)).ResolveURL(ctx) templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(l.URL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -640,7 +645,7 @@ func checkerCell(l CheckerLink) templ.Component {
var templ_7745c5c3_Var30 string var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(l.Label) templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(l.Label)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -658,7 +663,7 @@ func checkerCell(l CheckerLink) templ.Component {
var templ_7745c5c3_Var31 string var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(l.Label) templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(l.Label)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
+2
View File
@@ -10,6 +10,7 @@ import (
// add or edit one. // add or edit one.
type MaintenanceView struct { type MaintenanceView struct {
Windows []MaintenanceRow Windows []MaintenanceRow
Pager Pager
Form MaintenanceForm Form MaintenanceForm
Monitors []TargetOption Monitors []TargetOption
Groups []TargetOption Groups []TargetOption
@@ -111,6 +112,7 @@ templ MaintenancePage(p Page, me Me, v MaintenanceView) {
} }
</ul> </ul>
} }
@pager(v.Pager, "later", "earlier")
if v.CanWrite { if v.CanWrite {
@maintenanceForm(v) @maintenanceForm(v)
} }
+43 -38
View File
@@ -19,6 +19,7 @@ import (
// add or edit one. // add or edit one.
type MaintenanceView struct { type MaintenanceView struct {
Windows []MaintenanceRow Windows []MaintenanceRow
Pager Pager
Form MaintenanceForm Form MaintenanceForm
Monitors []TargetOption Monitors []TargetOption
Groups []TargetOption Groups []TargetOption
@@ -97,7 +98,7 @@ func maintenanceList(items []MaintenanceItem) templ.Component {
var templ_7745c5c3_Var2 string var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title) templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -115,7 +116,7 @@ func maintenanceList(items []MaintenanceItem) templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress")) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -133,7 +134,7 @@ func maintenanceList(items []MaintenanceItem) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(m.When) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(m.When)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -211,7 +212,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.empty")) templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.empty"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -242,7 +243,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.Title) templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.Title)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -260,7 +261,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress")) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -278,7 +279,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(w.Schedule) templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(w.Schedule)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -291,7 +292,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(w.Targets) templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(w.Targets)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -309,7 +310,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.next", "Time", w.Next)) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.next", "Time", w.Next))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -346,7 +347,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/maintenance?edit=" + w.ID)).ResolveURL(ctx) templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/maintenance?edit=" + w.ID)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -359,7 +360,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.edit")) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.edit"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -372,7 +373,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/maintenance/" + w.ID).Resolve(ctx) templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/maintenance/" + w.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -385,7 +386,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "maintenance.delete_confirm")).Resolve(ctx) templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "maintenance.delete_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -398,7 +399,7 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.delete")) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.delete"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -423,6 +424,10 @@ func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err 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 { if v.CanWrite {
templ_7745c5c3_Err = maintenanceForm(v).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = maintenanceForm(v).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -478,7 +483,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var19 string var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maintenanceAPI(v.Form.ID)).Resolve(ctx) templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maintenanceAPI(v.Form.ID)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -491,7 +496,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var20 string var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maintenanceMethod(v.Form.ID)).Resolve(ctx) templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maintenanceMethod(v.Form.ID)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -528,7 +533,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var22 string var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Title).Resolve(ctx) templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Title).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -583,7 +588,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var25 string var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_description")) templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_description"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -624,7 +629,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var27 string var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Start).Resolve(ctx) templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Start).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -695,7 +700,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var31 string var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(v.Form.Duration)).Resolve(ctx) templ_7745c5c3_Var31, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(v.Form.Duration)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -766,7 +771,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var35 string var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.TimeZone).Resolve(ctx) templ_7745c5c3_Var35, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.TimeZone).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var35)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -816,7 +821,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var38 string var templ_7745c5c3_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(tz).Resolve(ctx) templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(tz).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -901,7 +906,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var42 string var templ_7745c5c3_Var42 string
templ_7745c5c3_Var42, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r).Resolve(ctx) templ_7745c5c3_Var42, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var42)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -924,7 +929,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var43 string var templ_7745c5c3_Var43 string
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.recurrence_"+r)) templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.recurrence_"+r))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -968,7 +973,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var45 string var templ_7745c5c3_Var45 string
templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(max(v.Form.Every, 1))).Resolve(ctx) templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(max(v.Form.Every, 1))).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1039,7 +1044,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var49 string var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Until).Resolve(ctx) templ_7745c5c3_Var49, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Form.Until).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var49)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1094,7 +1099,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var52 string var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_weekdays")) templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_weekdays"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1112,7 +1117,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var53 string var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx) templ_7745c5c3_Var53, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var53)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1135,7 +1140,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var54 string var templ_7745c5c3_Var54 string
templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "weekday."+strconv.Itoa(d))) templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "weekday."+strconv.Itoa(d)))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1153,7 +1158,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var55 string var templ_7745c5c3_Var55 string
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.weekdays_hint")) templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.weekdays_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1166,7 +1171,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var56 string var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_groups")) templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_groups"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1184,7 +1189,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var57 string var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(indent(g.Depth)) templ_7745c5c3_Var57, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(indent(g.Depth))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1197,7 +1202,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var58 string var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58, templ_7745c5c3_Err = templruntime.NewAttributeExpression(g.ID).Resolve(ctx) templ_7745c5c3_Var58, templ_7745c5c3_Err = templruntime.NewAttributeExpression(g.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var58)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1220,7 +1225,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var59 string var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1238,7 +1243,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var60 string var templ_7745c5c3_Var60 string
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_monitors")) templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_monitors"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1256,7 +1261,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var61 string var templ_7745c5c3_Var61 string
templ_7745c5c3_Var61, templ_7745c5c3_Err = templruntime.NewAttributeExpression(m.ID).Resolve(ctx) templ_7745c5c3_Var61, templ_7745c5c3_Err = templruntime.NewAttributeExpression(m.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var61)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1279,7 +1284,7 @@ func maintenanceForm(v MaintenanceView) templ.Component {
var templ_7745c5c3_Var62 string var templ_7745c5c3_Var62 string
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(m.Name) templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(m.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1331,7 +1336,7 @@ func labeled(labelID string) templ.Component {
var templ_7745c5c3_Var64 string var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, labelID)) templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, labelID))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
+142 -40
View File
@@ -38,6 +38,9 @@ type GroupNode struct {
Total int Total int
Monitors []MonitorRow Monitors []MonitorRow
Children []GroupNode 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. // 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 // DashboardView is the data of the monitor list. Root holds ungrouped
// monitors and the top-level groups. // monitors and the top-level groups.
type DashboardView struct { 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 Empty bool
CanWrite bool CanWrite bool
Counts map[Status]int Counts map[Status]int
@@ -155,16 +164,52 @@ templ Dashboard(p Page, me Me, v DashboardView) {
} }
</div> </div>
</div> </div>
if v.Empty { if !v.Empty {
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "console.monitors.empty") }</p> <form method="get" action="/" class="mb-4 flex max-w-md gap-2">
} else { if v.Range != "" {
<div class="border-t border-rule"> <input type="hidden" name="range" value={ v.Range }/>
@monitorList(v.Root.Monitors)
for _, g := range v.Root.Children {
@groupBlock(g)
} }
</div> <input
<p class="mt-3 text-right text-xs text-muted">{ i18n.T(ctx, "monitors.range_note", "Range", v.Range) }</p> type="search"
name="q"
value={ v.Search }
placeholder={ i18n.T(ctx, "monitors.search") }
aria-label={ i18n.T(ctx, "monitors.search") }
class="w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"
/>
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "moderation.search_button") }</button>
</form>
}
switch {
case v.Empty:
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "console.monitors.empty") }</p>
case v.Search != "":
<p class="mb-3 text-sm"><a href="/" class="text-muted hover:text-ink">← { i18n.T(ctx, "monitors.all") }</a></p>
if len(v.Results) == 0 {
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "monitors.no_match") }</p>
} else {
<div class="border-t border-rule">
@monitorList(v.Results)
</div>
}
@pager(v.Pager, "previous", "next")
default:
if v.Focus != "" {
<p class="mb-3 text-sm">
<a href="/" class="text-muted hover:text-ink">{ i18n.T(ctx, "monitors.all") }</a>
<span class="text-muted">›</span>
<span class="font-medium">{ v.Focus }</span>
</p>
}
<div class="border-t border-rule">
@monitorList(v.Root.Monitors)
@moreLink(v.Root)
for _, g := range v.Root.Children {
@groupBlock(g)
}
</div>
@pager(v.Pager, "previous", "next")
<p class="mt-3 text-right text-xs text-muted">{ i18n.T(ctx, "monitors.range_note", "Range", v.Range) }</p>
} }
<p class="mt-8 text-sm"><a href="/groups" class="text-muted hover:text-ink">{ i18n.T(ctx, "groups.manage") }</a></p> <p class="mt-8 text-sm"><a href="/groups" class="text-muted hover:text-ink">{ i18n.T(ctx, "groups.manage") }</a></p>
} }
@@ -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 {
<a href={ templ.SafeURL(g.MoreURL) } class="block border-b border-rule py-2.5 text-sm text-muted hover:text-ink">{ i18n.T(ctx, "monitors.show_all", "Count", g.More+len(g.Monitors)) } →</a>
}
}
// groupBlock renders a group and, recursively, its subgroups. <details> // groupBlock renders a group and, recursively, its subgroups. <details>
// makes groups collapsible without JavaScript. // makes groups collapsible without JavaScript.
templ groupBlock(g GroupNode) { templ groupBlock(g GroupNode) {
@@ -204,6 +256,7 @@ templ groupBlock(g GroupNode) {
</summary> </summary>
<div class="ml-4 border-l border-rule pl-4"> <div class="ml-4 border-l border-rule pl-4">
@monitorList(g.Monitors) @monitorList(g.Monitors)
@moreLink(g)
for _, c := range g.Children { for _, c := range g.Children {
@groupBlock(c) @groupBlock(c)
} }
@@ -248,6 +301,10 @@ type MonitorDetailView struct {
Latency LatencyLine Latency LatencyLine
Recent []ResultRow Recent []ResultRow
Incidents []IncidentRow 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 CanWrite bool
// Maintenance lists current and upcoming maintenance. // Maintenance lists current and upcoming maintenance.
Maintenance []MaintenanceItem Maintenance []MaintenanceItem
@@ -366,6 +423,9 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
<section class="mb-10"> <section class="mb-10">
@sectionHeading("incidents.title") @sectionHeading("incidents.title")
@incidentList(v.Incidents, false) @incidentList(v.Incidents, false)
if v.MoreIncidents {
<a href={ templ.SafeURL("/incidents?monitor=" + v.Row.ID) } class="mt-3 inline-block text-sm text-muted hover:text-ink">{ i18n.T(ctx, "incidents.all_of_monitor") } →</a>
}
</section> </section>
} }
if len(v.Evidence) > 0 { if len(v.Evidence) > 0 {
@@ -373,37 +433,64 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {
} }
<section> <section>
@sectionHeading("monitors.recent") @sectionHeading("monitors.recent")
<table class="w-full text-left text-sm"> @resultTable(v.Recent)
<tbody class="divide-y divide-rule border-y border-rule"> if v.MoreResults {
for _, r := range v.Recent { <a href={ templ.SafeURL("/monitors/" + v.Row.ID + "/results") } class="mt-3 inline-block text-sm text-muted hover:text-ink">{ i18n.T(ctx, "monitors.all_results") } →</a>
<tr> }
<td class="py-1.5 pr-4 font-mono text-xs whitespace-nowrap text-muted">{ r.Time }</td>
<td class="py-1.5 pr-4">{ r.Region }</td>
<td class="py-1.5 pr-4 font-mono text-xs">
@checkerCell(r.Checker)
</td>
<td class="py-1.5 pr-4">
if r.OK {
<span class="text-up">●</span>
} else {
<span class="text-down">●</span>
}
</td>
<td class="py-1.5 pr-4 font-mono text-xs">{ r.Latency }</td>
<td class="py-1.5 font-mono text-xs text-muted">
{ r.Detail }
if r.EvidenceURL != "" {
<a href={ templ.SafeURL(r.EvidenceURL) } class="ml-2 underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "evidence.show") }</a>
}
</td>
</tr>
}
</tbody>
</table>
</section> </section>
} }
} }
templ resultTable(rows []ResultRow) {
<table class="w-full text-left text-sm">
<tbody class="divide-y divide-rule border-y border-rule">
for _, r := range rows {
<tr>
<td class="py-1.5 pr-4 font-mono text-xs whitespace-nowrap text-muted">{ r.Time }</td>
<td class="py-1.5 pr-4">{ r.Region }</td>
<td class="py-1.5 pr-4 font-mono text-xs">
@checkerCell(r.Checker)
</td>
<td class="py-1.5 pr-4">
if r.OK {
<span class="text-up">●</span>
} else {
<span class="text-down">●</span>
}
</td>
<td class="py-1.5 pr-4 font-mono text-xs">{ r.Latency }</td>
<td class="py-1.5 font-mono text-xs text-muted">
{ r.Detail }
if r.EvidenceURL != "" {
<a href={ templ.SafeURL(r.EvidenceURL) } class="ml-2 underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "evidence.show") }</a>
}
</td>
</tr>
}
</tbody>
</table>
}
// 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) {
<p class="mb-4 text-sm"><a href={ templ.SafeURL("/monitors/" + v.MonitorID) } class="text-muted hover:text-ink">← { v.Monitor }</a></p>
@settingsHeading("monitors.results_title", "")
if len(v.Rows) == 0 {
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "monitors.no_results") }</p>
} else {
@resultTable(v.Rows)
}
@pager(v.Pager, "newer", "older")
}
}
templ incidentList(rows []IncidentRow, showMonitor bool) { templ incidentList(rows []IncidentRow, showMonitor bool) {
<ul class="divide-y divide-rule border-y border-rule text-sm"> <ul class="divide-y divide-rule border-y border-rule text-sm">
for _, r := range rows { for _, r := range rows {
@@ -428,14 +515,29 @@ templ incidentList(rows []IncidentRow, showMonitor bool) {
</ul> </ul>
} }
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) { @consoleShell(p, me) {
@settingsHeading("incidents.title", "") @settingsHeading("incidents.title", "")
if len(rows) == 0 { if v.Monitor != "" {
<p class="-mt-4 mb-6 text-sm">
{ i18n.T(ctx, "incidents.of_monitor") }
<a href={ templ.SafeURL("/monitors/" + v.MonitorID) } class="font-medium hover:underline">{ v.Monitor }</a>
<a href="/incidents" class="ml-3 text-muted hover:text-ink">{ i18n.T(ctx, "incidents.all") }</a>
</p>
}
if len(v.Rows) == 0 {
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "incidents.none") }</p> <p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "incidents.none") }</p>
} else { } else {
@incidentList(rows, true) @incidentList(v.Rows, v.Monitor == "")
} }
@pager(v.Pager, "newer", "older")
} }
} }
File diff suppressed because it is too large. Load diff
+2
View File
@@ -43,6 +43,7 @@ type PendingInvite struct {
// MembersView is the data of the members page. // MembersView is the data of the members page.
type MembersView struct { type MembersView struct {
Members []Member Members []Member
Pager Pager
Roles []Role Roles []Role
Invitations []PendingInvite Invitations []PendingInvite
CanManage bool CanManage bool
@@ -152,6 +153,7 @@ templ MembersPage(p Page, me Me, v MembersView) {
} }
</tbody> </tbody>
</table> </table>
@pager(v.Pager, "previous", "next")
if v.CanManage { if v.CanManage {
<div class="grid gap-12 md:grid-cols-2"> <div class="grid gap-12 md:grid-cols-2">
<section> <section>
+83 -78
View File
@@ -52,6 +52,7 @@ type PendingInvite struct {
// MembersView is the data of the members page. // MembersView is the data of the members page.
type MembersView struct { type MembersView struct {
Members []Member Members []Member
Pager Pager
Roles []Role Roles []Role
Invitations []PendingInvite Invitations []PendingInvite
CanManage bool CanManage bool
@@ -90,7 +91,7 @@ func settingsHeading(titleID, introID string) templ.Component {
var templ_7745c5c3_Var2 string var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID)) templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -108,7 +109,7 @@ func settingsHeading(titleID, introID string) templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, introID)) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, introID))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -147,7 +148,7 @@ func sectionHeading(id string) templ.Component {
var templ_7745c5c3_Var5 string var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, id)) templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, id))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -185,7 +186,7 @@ func roleSelect(roles []Role, name string) templ.Component {
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx) templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -203,7 +204,7 @@ func roleSelect(roles []Role, name string) templ.Component {
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r.ID).Resolve(ctx) templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -216,7 +217,7 @@ func roleSelect(roles []Role, name string) templ.Component {
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -275,7 +276,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.field.email")) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.field.email"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -288,7 +289,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.roles")) templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.roles"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -306,7 +307,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(m.Email) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(m.Email)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -324,7 +325,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(m.DisplayName) templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(m.DisplayName)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -347,7 +348,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.owner")) templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.owner"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -370,7 +371,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(a.RoleName) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(a.RoleName)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -388,7 +389,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var18 string var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(a.Scope) templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(a.Scope)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -407,7 +408,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var19 string var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/assignments/" + a.ID).Resolve(ctx) templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/assignments/" + a.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -420,7 +421,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var20 string var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.unassign")).Resolve(ctx) templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.unassign")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -448,7 +449,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var21 string var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -461,7 +462,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var22 string var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID + "/roles").Resolve(ctx) templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID + "/roles").Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -486,7 +487,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var23 string var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope")) templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -499,7 +500,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var24 string var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope_org")) templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope_org"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -517,7 +518,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var25 string var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(sc.Value).Resolve(ctx) templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(sc.Value).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -530,7 +531,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var26 string var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(sc.Label) templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(sc.Label)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -556,7 +557,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var27 string var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID).Resolve(ctx) templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -569,7 +570,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var28 string var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.remove_confirm")).Resolve(ctx) templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.remove_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -582,7 +583,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var29 string var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.remove")) templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.remove"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -602,6 +603,10 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err 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 { if v.CanManage {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "<div class=\"grid gap-12 md:grid-cols-2\"><section>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "<div class=\"grid gap-12 md:grid-cols-2\"><section>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -630,7 +635,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var30 string var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.role")) templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.role"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -659,7 +664,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var31 string var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.invite_link")) templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.invite_link"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -690,7 +695,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var32 string var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(inv.Email) templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(inv.Email)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -703,7 +708,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var33 string var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inv.RoleName) templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inv.RoleName)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -716,7 +721,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var34 string var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/invitations/" + inv.ID).Resolve(ctx) templ_7745c5c3_Var34, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/invitations/" + inv.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var34)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -729,7 +734,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var35 string var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke")) templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -834,7 +839,7 @@ func permissionChecks(all, grantable, checked []string) templ.Component {
var templ_7745c5c3_Var39 string var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression(perm).Resolve(ctx) templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression(perm).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -863,7 +868,7 @@ func permissionChecks(all, grantable, checked []string) templ.Component {
var templ_7745c5c3_Var40 string var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm)) templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -927,7 +932,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var43 string var templ_7745c5c3_Var43 string
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -945,7 +950,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var44 string var templ_7745c5c3_Var44 string
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.built_in")) templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.built_in"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -968,7 +973,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var45 string var templ_7745c5c3_Var45 string
templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx) templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -981,7 +986,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var46 string var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "roles.delete_confirm")).Resolve(ctx) templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "roles.delete_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -994,7 +999,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var47 string var templ_7745c5c3_Var47 string
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.delete")) templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.delete"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1017,7 +1022,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var48 string var templ_7745c5c3_Var48 string
templ_7745c5c3_Var48, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx) templ_7745c5c3_Var48, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var48)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1060,7 +1065,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var49 string var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm)) templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1206,7 +1211,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var52 string var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.policy", "Count", v.MaxDays)) templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.policy", "Count", v.MaxDays))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1229,7 +1234,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var53 string var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.name")) templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.name"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1247,7 +1252,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var54 string var templ_7745c5c3_Var54 string
templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.owner")) templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.owner"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1265,7 +1270,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var55 string var templ_7745c5c3_Var55 string
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.permissions")) templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.permissions"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1278,7 +1283,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var56 string var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.created")) templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.created"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1291,7 +1296,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var57 string var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires")) templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1304,7 +1309,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var58 string var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.last_used")) templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.last_used"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1322,7 +1327,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var59 string var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(t.Name) templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(t.Name)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1335,7 +1340,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var60 string var templ_7745c5c3_Var60 string
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(t.Prefix) templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(t.Prefix)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1353,7 +1358,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var61 string var templ_7745c5c3_Var61 string
templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(t.UserEmail) templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(t.UserEmail)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1376,7 +1381,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var62 string var templ_7745c5c3_Var62 string
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm)) templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1394,7 +1399,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var63 string var templ_7745c5c3_Var63 string
templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(t.CreatedAt) templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(t.CreatedAt)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1407,7 +1412,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var64 string var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(t.ExpiresAt) templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(t.ExpiresAt)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1420,7 +1425,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var65 string var templ_7745c5c3_Var65 string
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(t.LastUsedAt) templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(t.LastUsedAt)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1433,7 +1438,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var66 string var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/tokens/" + t.ID).Resolve(ctx) templ_7745c5c3_Var66, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/tokens/" + t.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var66)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1446,7 +1451,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var67 string var templ_7745c5c3_Var67 string
templ_7745c5c3_Var67, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "tokens.revoke_confirm")).Resolve(ctx) templ_7745c5c3_Var67, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "tokens.revoke_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var67)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1459,7 +1464,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var68 string var templ_7745c5c3_Var68 string
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke")) templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1510,7 +1515,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var69 string var templ_7745c5c3_Var69 string
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires")) templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1529,7 +1534,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var70 string var templ_7745c5c3_Var70 string
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.never")) templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.never"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1547,7 +1552,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var71 string var templ_7745c5c3_Var71 string
templ_7745c5c3_Var71, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx) templ_7745c5c3_Var71, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var71)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1570,7 +1575,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var72 string var templ_7745c5c3_Var72 string
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.days", "Count", d)) templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.days", "Count", d))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1597,7 +1602,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var73 string var templ_7745c5c3_Var73 string
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.copy_now")) templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.copy_now"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1697,7 +1702,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var76 string var templ_7745c5c3_Var76 string
templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_totp_hint")) templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_totp_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1718,7 +1723,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var77 string var templ_7745c5c3_Var77 string
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_sso_hint")) templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_sso_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1731,7 +1736,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var78 string var templ_7745c5c3_Var78 string
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days")) templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1744,7 +1749,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var79 string var templ_7745c5c3_Var79 string
templ_7745c5c3_Var79, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maxDaysValue(v.TokenMaxDays)).Resolve(ctx) templ_7745c5c3_Var79, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maxDaysValue(v.TokenMaxDays)).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var79)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1757,7 +1762,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var80 string var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "org.token_max_days_none")).Resolve(ctx) templ_7745c5c3_Var80, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "org.token_max_days_none")).Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var80)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1770,7 +1775,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var81 string var templ_7745c5c3_Var81 string
templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days_hint")) templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days_hint"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1858,7 +1863,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var84 string var templ_7745c5c3_Var84 string
templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_invalid")) templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_invalid"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1876,7 +1881,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var85 string var templ_7745c5c3_Var85 string
templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.summary", "Org", v.OrgName, "Role", v.RoleName)) templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.summary", "Org", v.OrgName, "Role", v.RoleName))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1889,7 +1894,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var86 string var templ_7745c5c3_Var86 string
templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(v.Email) templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(v.Email)
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1908,7 +1913,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var87 string var templ_7745c5c3_Var87 string
templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/accept").Resolve(ctx) templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/accept").Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1938,7 +1943,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var88 string var templ_7745c5c3_Var88 string
templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_email_mismatch")) templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_email_mismatch"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1951,7 +1956,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var89 string var templ_7745c5c3_Var89 string
templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout")) templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1969,7 +1974,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var90 string var templ_7745c5c3_Var90 string
templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/login?next=/invite/" + v.Token)).ResolveURL(ctx) templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/login?next=/invite/" + v.Token)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -1982,7 +1987,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var91 string var templ_7745c5c3_Var91 string
templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.sign_in")) templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.sign_in"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -2000,7 +2005,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var92 string var templ_7745c5c3_Var92 string
templ_7745c5c3_Var92, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/signup").Resolve(ctx) templ_7745c5c3_Var92, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/signup").Resolve(ctx)
if templ_7745c5c3_Err != nil { 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var92)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -2074,7 +2079,7 @@ func tokenUsage() templ.Component {
var templ_7745c5c3_Var94 string var templ_7745c5c3_Var94 string
templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.usage")) templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.usage"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -2087,7 +2092,7 @@ func tokenUsage() templ.Component {
var templ_7745c5c3_Var95 string var templ_7745c5c3_Var95 string
templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "apidocs.title")) templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "apidocs.title"))
if templ_7745c5c3_Err != nil { 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)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
+30
View File
@@ -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 != "" {
<nav class="mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-sm" aria-label={ i18n.T(ctx, "pager.label") }>
if pg.First != "" {
<a href={ templ.SafeURL(pg.First) } class="text-muted hover:text-ink">{ i18n.T(ctx, "pager.first") }</a>
}
if pg.Prev != "" {
<a href={ templ.SafeURL(pg.Prev) } rel="prev" class="text-muted hover:text-ink">← { i18n.T(ctx, "pager."+prevID) }</a>
}
if pg.Next != "" {
<a href={ templ.SafeURL(pg.Next) } rel="next" class="ml-auto text-muted hover:text-ink">{ i18n.T(ctx, "pager."+nextID) } →</a>
}
</nav>
}
}
+165
View File
@@ -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, "<nav class=\"mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-sm\" aria-label=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "pager.label")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 18, Col: 111}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if pg.First != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(pg.First)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 20, Col: 37}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" class=\"text-muted hover:text-ink\">")
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, "pager.first"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 20, Col: 102}
}
_, 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, "</a> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if pg.Prev != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(pg.Prev)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 23, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\" rel=\"prev\" class=\"text-muted hover:text-ink\">← ")
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, "pager."+prevID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 23, Col: 118}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</a> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if pg.Next != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(pg.Next)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 26, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" rel=\"next\" class=\"ml-auto text-muted hover:text-ink\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pager."+nextID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/pager.templ`, Line: 26, Col: 122}
}
_, 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, 11, " →</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</nav>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return nil
})
}
var _ = templruntime.GeneratedTemplate
+33 -25
View File
@@ -1,10 +1,6 @@
package web package web
import ( import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
"net/url"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
// Region is a row in a region list. // Region is a row in a region list.
type Region struct { 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) { @consoleShell(p, me) {
@settingsHeading("admin.title", "admin.intro") @settingsHeading("admin.title", "admin.intro")
<p class="-mt-4 mb-8 flex gap-4 text-sm"> @adminLinks()
<a href="/admin/audit" class="underline underline-offset-2">{ i18n.T(ctx, "audit.platform_title") }</a> @limitsSection(limits)
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
</p>
@moderationSection(mod)
@orgsSection(orgs)
@limitsSection(orgs.Defaults)
@regionsBody(v) @regionsBody(v)
@checkerNetworkSection(platformPrivate) @checkerNetworkSection(platformPrivate)
@checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro") @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 { type ModerationView struct {
Search string Search string
Pages []ModeratedPage Pages []ModeratedPage
// Limited is set when more pages match than are shown. Pager Pager
Limited bool // Next is the page to return to after an action.
Next string
} }
// ModeratedPage is a status page with the organization and account // ModeratedPage is a status page with the organization and account
@@ -245,18 +237,13 @@ type ModeratedTarget struct {
Admin bool Admin bool
} }
func (v ModerationView) next() string { func (v ModerationView) next() string { return v.Next }
if v.Search == "" {
return "/admin#moderation"
}
return "/admin?q=" + url.QueryEscape(v.Search) + "#moderation"
}
templ moderationSection(v ModerationView) { templ moderationSection(v ModerationView) {
<section id="moderation" class="mb-12"> <section id="moderation" class="mb-12">
@sectionHeading("moderation.title") @sectionHeading("moderation.title")
<p class="mb-4 max-w-3xl text-sm text-muted">{ i18n.T(ctx, "moderation.intro") }</p> <p class="mb-4 max-w-3xl text-sm text-muted">{ i18n.T(ctx, "moderation.intro") }</p>
<form method="get" action="/admin#moderation" class="mb-4 flex max-w-xl gap-2"> <form method="get" action="/admin/status-pages" class="mb-4 flex max-w-xl gap-2">
<input <input
type="search" type="search"
name="q" name="q"
@@ -323,10 +310,8 @@ templ moderationSection(v ModerationView) {
</tbody> </tbody>
</table> </table>
</div> </div>
if v.Limited {
<p class="mt-3 text-xs text-muted">{ i18n.T(ctx, "moderation.limited") }</p>
}
} }
@pager(v.Pager, "newer", "older")
</section> </section>
} }
@@ -374,3 +359,26 @@ templ moderationActions(kind, api, suspended, name, next string) {
>{ i18n.T(ctx, "moderation.delete_"+kind) }</button> >{ i18n.T(ctx, "moderation.delete_"+kind) }</button>
</div> </div>
} }
templ adminLinks() {
<p class="-mt-4 mb-8 flex flex-wrap gap-x-4 gap-y-1 text-sm">
<a href="/admin/status-pages" class="underline underline-offset-2">{ i18n.T(ctx, "moderation.title") }</a>
<a href="/admin/orgs" class="underline underline-offset-2">{ i18n.T(ctx, "orgs.title") }</a>
<a href="/admin/audit" class="underline underline-offset-2">{ i18n.T(ctx, "audit.platform_title") }</a>
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
</p>
}
templ AdminStatusPagesPage(p Page, me Me, v ModerationView) {
@consoleShell(p, me) {
<p class="mb-4 text-sm"><a href="/admin" class="text-muted hover:text-ink">← { i18n.T(ctx, "admin.title") }</a></p>
@moderationSection(v)
}
}
templ AdminOrgsPage(p Page, me Me, v OrgsView) {
@consoleShell(p, me) {
<p class="mb-4 text-sm"><a href="/admin" class="text-muted hover:text-ink">← { i18n.T(ctx, "admin.title") }</a></p>
@orgsSection(v)
}
}
File diff suppressed because it is too large. Load diff