From 561321fbd770d2251cbf9ecdf1b6f180ab8b656d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 10:38:31 +0100 Subject: [PATCH 1/4] test(sso): always change the PKCE verifier when tampering with it The test replaced the first character with "x", which left about one in 64 random verifiers unchanged and failed the test spuriously. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/sso/sso_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/sso/sso_test.go b/internal/sso/sso_test.go index d79cda0..3d92beb 100644 --- a/internal/sso/sso_test.go +++ b/internal/sso/sso_test.go @@ -70,7 +70,14 @@ func TestExchangeRejects(t *testing.T) { }{ {"wrong nonce", func(i *ssotest.IDP, _ *sso.Flow) { i.NonceOverride = "other" }}, {"wrong audience", func(i *ssotest.IDP, _ *sso.Flow) { i.AudienceOverride = "someone-else" }}, - {"wrong pkce verifier", func(_ *ssotest.IDP, f *sso.Flow) { f.Verifier = "x" + f.Verifier[1:] }}, + {"wrong pkce verifier", func(_ *ssotest.IDP, f *sso.Flow) { + // Replacing the first character must change it, whatever it is. + first := "x" + if f.Verifier[0] == 'x' { + first = "y" + } + f.Verifier = first + f.Verifier[1:] + }}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { -- 2.54.1 From c5f700582904242c3a5d1d0c0cc7b91ec6b4f7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 10:38:31 +0100 Subject: [PATCH 2/4] feat(maintenance): compute one-off and recurring maintenance occurrences Daily, weekly on chosen weekdays and monthly repeats every N periods, optionally until a date, keeping their wall-clock time across daylight saving changes. Months without the start's day are skipped. Refs #71 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/maintenance/maintenance.go | 209 +++++++++++++++++++++++ internal/maintenance/maintenance_test.go | 136 +++++++++++++++ 2 files changed, 345 insertions(+) create mode 100644 internal/maintenance/maintenance.go create mode 100644 internal/maintenance/maintenance_test.go diff --git a/internal/maintenance/maintenance.go b/internal/maintenance/maintenance.go new file mode 100644 index 0000000..dcfa5c8 --- /dev/null +++ b/internal/maintenance/maintenance.go @@ -0,0 +1,209 @@ +// Package maintenance computes when planned maintenance takes place. +// +// A window starts at a wall-clock time in a time zone and lasts a fixed +// duration. It happens once or repeats every N days, every N weeks on chosen +// weekdays, or every N months on the start's day of the month, optionally +// until a date. Repeats keep their wall-clock time across daylight saving +// changes: "Tuesdays 02:00 Europe/Berlin" stays at 02:00 local time. +package maintenance + +import ( + "errors" + "slices" + "time" +) + +// Recurrence names how a window repeats. +type Recurrence string + +// Recurrences. +const ( + Once Recurrence = "none" + Daily Recurrence = "daily" + Weekly Recurrence = "weekly" + Monthly Recurrence = "monthly" +) + +// Rule describes when a window takes place. +type Rule struct { + // Start is the first occurrence; its wall clock in Location is kept for + // repeats. + Start time.Time + Duration time.Duration + Location *time.Location + Recurrence Recurrence + // Every repeats every Nth day, week or month; zero means 1. + Every int + // Weekdays of weekly windows; empty means the start's weekday. + Weekdays []time.Weekday + // Until ends the repetition: no occurrence starts after it. + Until *time.Time +} + +// Span is one occurrence. +type Span struct { + Start, End time.Time +} + +// Validation errors. +var ( + ErrDuration = errors.New("maintenance: duration must be between one minute and 30 days") + ErrOverlap = errors.New("maintenance: a repeating window must end before it repeats") + ErrRecurrence = errors.New("maintenance: unknown recurrence") + ErrUntil = errors.New("maintenance: the repetition ends before it starts") + ErrEvery = errors.New("maintenance: interval must be between 1 and 365") +) + +// Validate rejects rules whose occurrences would be meaningless. +func (r Rule) Validate() error { + if r.Duration < time.Minute || r.Duration > 30*24*time.Hour { + return ErrDuration + } + if r.Every < 0 || r.Every > 365 { + return ErrEvery + } + if r.Until != nil && r.Until.Before(r.Start) { + return ErrUntil + } + every := time.Duration(r.every()) + switch r.Recurrence { + case Once: + case Daily: + if r.Duration > every*24*time.Hour { + return ErrOverlap + } + case Weekly: + if r.Duration > minWeekdayGap(r.weekdays())*24*time.Hour { + return ErrOverlap + } + case Monthly: + if r.Duration > 28*24*time.Hour { + return ErrOverlap + } + default: + return ErrRecurrence + } + return nil +} + +func (r Rule) every() int { return max(r.Every, 1) } + +func (r Rule) loc() *time.Location { + if r.Location == nil { + return time.UTC + } + return r.Location +} + +func (r Rule) weekdays() []time.Weekday { + if len(r.Weekdays) == 0 { + return []time.Weekday{r.Start.In(r.loc()).Weekday()} + } + ws := slices.Clone(r.Weekdays) + slices.Sort(ws) + return slices.Compact(ws) +} + +// minWeekdayGap is the fewest days between two consecutive weekdays of ws, +// wrapping around the week. +func minWeekdayGap(ws []time.Weekday) time.Duration { + gap := 7 + for i, w := range ws { + next := ws[(i+1)%len(ws)] + d := (int(next) - int(w) + 7) % 7 + if d == 0 { + d = 7 + } + gap = min(gap, d) + } + return time.Duration(gap) +} + +// maxSteps bounds the work for absurd ranges. +const maxSteps = 5000 + +// Occurrences returns the occurrences overlapping [from, to), oldest first. +func (r Rule) Occurrences(from, to time.Time) []Span { + var out []Span + add := func(start time.Time) bool { + if !start.Before(to) || (r.Until != nil && start.After(*r.Until)) { + return false + } + if end := start.Add(r.Duration); end.After(from) && !start.Before(r.Start) { + out = append(out, Span{Start: start, End: end}) + } + return true + } + ls := r.Start.In(r.loc()) + at := func(y int, m time.Month, d int) time.Time { + return time.Date(y, m, d, ls.Hour(), ls.Minute(), ls.Second(), 0, r.loc()) + } + // Skip ahead to shortly before from instead of walking from the start. + skip := func(period time.Duration) int { + if n := int(from.Sub(r.Start)-r.Duration) / int(period); n > 1 { + return n - 1 + } + return 0 + } + n := r.every() + switch r.Recurrence { + case Once: + add(r.Start) + case Daily: + for i := skip(time.Duration(n)*24*time.Hour) * n; i < maxSteps*n; i += n { + if !add(at(ls.Year(), ls.Month(), ls.Day()+i)) { + break + } + } + case Weekly: + monday := ls.Day() - (int(ls.Weekday())+6)%7 + ws := r.weekdays() + weeks: + for w := skip(time.Duration(n)*7*24*time.Hour) * n; w < maxSteps*n; w += n { + for _, wd := range ws { + if !add(at(ls.Year(), ls.Month(), monday+7*w+(int(wd)+6)%7)) { + break weeks + } + } + } + case Monthly: + months := (from.Year()-ls.Year())*12 + int(from.Month()-ls.Month()) - 2 + for i := max(months, 0) / n * n; i < maxSteps*n; i += n { + start := at(ls.Year(), ls.Month()+time.Month(i), ls.Day()) + // Months without the day, like 31 in April, are skipped + // rather than spilling into the next month. + if start.Day() != ls.Day() { + continue + } + if !add(start) { + break + } + } + } + return out +} + +// ActiveAt returns the occurrence in progress at t. +func (r Rule) ActiveAt(t time.Time) (Span, bool) { + for _, s := range r.Occurrences(t, t.Add(time.Nanosecond)) { + if !t.Before(s.Start) && t.Before(s.End) { + return s, true + } + } + return Span{}, false +} + +// Next returns the first occurrence that ends after t: the current one or +// the next to come. It looks horizon past t, or past the first occurrence if +// that is later. +func (r Rule) Next(t time.Time, horizon time.Duration) (Span, bool) { + end := t.Add(horizon) + if r.Start.After(t) { + end = r.Start.Add(horizon) + } + occ := r.Occurrences(t, end) + if len(occ) == 0 { + return Span{}, false + } + return occ[0], true +} diff --git a/internal/maintenance/maintenance_test.go b/internal/maintenance/maintenance_test.go new file mode 100644 index 0000000..e8e9d35 --- /dev/null +++ b/internal/maintenance/maintenance_test.go @@ -0,0 +1,136 @@ +package maintenance + +import ( + "testing" + "time" +) + +var berlin, _ = time.LoadLocation("Europe/Berlin") + +func starts(spans []Span, loc *time.Location) []string { + out := make([]string, len(spans)) + for i, s := range spans { + out[i] = s.Start.In(loc).Format("2006-01-02 15:04 Mon") + } + return out +} + +func equal(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} + +func TestOccurrences(t *testing.T) { + start := time.Date(2026, 3, 24, 2, 0, 0, 0, berlin) // a Tuesday before the DST change + until := time.Date(2026, 4, 3, 0, 0, 0, 0, berlin) + tests := []struct { + name string + r Rule + from time.Time + to time.Time + want []string + }{ + {"once", Rule{Start: start, Duration: time.Hour, Location: berlin, Recurrence: Once}, + start.Add(-time.Hour), start.Add(48 * time.Hour), []string{"2026-03-24 02:00 Tue"}}, + {"every second day", Rule{Start: start, Duration: time.Hour, Location: berlin, Recurrence: Daily, Every: 2}, + start, start.AddDate(0, 0, 7), []string{"2026-03-24 02:00 Tue", "2026-03-26 02:00 Thu", "2026-03-28 02:00 Sat", "2026-03-30 02:00 Mon"}}, + // Daylight saving starts on 2026-03-29; the wall clock stays 02:00. + {"weekly Tue and Thu across DST", Rule{Start: start, Duration: time.Hour, Location: berlin, Recurrence: Weekly, Weekdays: []time.Weekday{time.Thursday, time.Tuesday}}, + start, start.AddDate(0, 0, 14), []string{"2026-03-24 02:00 Tue", "2026-03-26 02:00 Thu", "2026-03-31 02:00 Tue", "2026-04-02 02:00 Thu"}}, + {"until", Rule{Start: start, Duration: time.Hour, Location: berlin, Recurrence: Weekly, Weekdays: []time.Weekday{time.Tuesday, time.Thursday}, Until: &until}, + start, start.AddDate(0, 1, 0), []string{"2026-03-24 02:00 Tue", "2026-03-26 02:00 Thu", "2026-03-31 02:00 Tue", "2026-04-02 02:00 Thu"}}, + {"monthly on the 31st skips short months", Rule{Start: time.Date(2026, 1, 31, 22, 0, 0, 0, berlin), Duration: time.Hour, Location: berlin, Recurrence: Monthly}, + time.Date(2026, 1, 1, 0, 0, 0, 0, berlin), time.Date(2026, 6, 1, 0, 0, 0, 0, berlin), []string{"2026-01-31 22:00 Sat", "2026-03-31 22:00 Tue", "2026-05-31 22:00 Sun"}}, + {"weekly starting mid-week skips earlier weekdays", Rule{Start: start.AddDate(0, 0, 1), Duration: time.Hour, Location: berlin, Recurrence: Weekly, Weekdays: []time.Weekday{time.Monday, time.Wednesday}}, + start, start.AddDate(0, 0, 9), []string{"2026-03-25 02:00 Wed", "2026-03-30 02:00 Mon", "2026-04-01 02:00 Wed"}}, + {"an occurrence in progress at from counts", Rule{Start: start, Duration: 3 * time.Hour, Location: berlin, Recurrence: Daily}, + start.Add(time.Hour), start.Add(2 * time.Hour), []string{"2026-03-24 02:00 Tue"}}, + } + for _, tt := range tests { + if got := starts(tt.r.Occurrences(tt.from, tt.to), berlin); !equal(got, tt.want) { + t.Errorf("%s: Occurrences() = %v, want %v", tt.name, got, tt.want) + } + } + // The UTC hour moves with DST while the local time stays. + occ := Rule{Start: start, Duration: time.Hour, Location: berlin, Recurrence: Weekly}.Occurrences(start, start.AddDate(0, 0, 8)) + if occ[0].Start.UTC().Hour() != 1 || occ[1].Start.UTC().Hour() != 0 { + t.Errorf("UTC hours = %d, %d, want 1 and 0", occ[0].Start.UTC().Hour(), occ[1].Start.UTC().Hour()) + } +} + +// Skipping ahead must find exactly what walking from the start finds. +func TestSkipAheadMatchesFullWalk(t *testing.T) { + start := time.Date(2025, 1, 31, 23, 30, 0, 0, berlin) + rules := []Rule{ + {Start: start, Duration: 2 * time.Hour, Location: berlin, Recurrence: Daily, Every: 3}, + {Start: start, Duration: 2 * time.Hour, Location: berlin, Recurrence: Weekly, Every: 2, Weekdays: []time.Weekday{time.Sunday, time.Wednesday}}, + {Start: start, Duration: 2 * time.Hour, Location: berlin, Recurrence: Monthly, Every: 2}, + {Start: start, Duration: 2 * time.Hour, Location: berlin, Recurrence: Monthly}, + } + for _, r := range rules { + for from := start; from.Before(start.AddDate(2, 0, 0)); from = from.Add(97 * time.Hour) { + to := from.AddDate(0, 0, 40) + var want []string + for _, s := range r.Occurrences(start.Add(-time.Hour), to) { + if s.End.After(from) { + want = append(want, s.Start.String()) + } + } + var got []string + for _, s := range r.Occurrences(from, to) { + got = append(got, s.Start.String()) + } + if !equal(got, want) { + t.Fatalf("%s every %d from %v: got %v, want %v", r.Recurrence, r.Every, from, got, want) + } + } + } +} + +func TestActiveAndNext(t *testing.T) { + start := time.Date(2026, 5, 1, 22, 0, 0, 0, time.UTC) + r := Rule{Start: start, Duration: 2 * time.Hour, Recurrence: Daily} + if _, ok := r.ActiveAt(start.Add(-time.Minute)); ok { + t.Error("active before the start") + } + if s, ok := r.ActiveAt(start.AddDate(0, 0, 3).Add(90 * time.Minute)); !ok || !s.Start.Equal(start.AddDate(0, 0, 3)) { + t.Errorf("ActiveAt() = %v %t", s, ok) + } + if _, ok := r.ActiveAt(start.Add(2 * time.Hour)); ok { + t.Error("active at the end") + } + if s, ok := r.Next(start.Add(3*time.Hour), 7*24*time.Hour); !ok || !s.Start.Equal(start.AddDate(0, 0, 1)) { + t.Errorf("Next() = %v %t", s, ok) + } + if s, ok := r.Next(start.AddDate(-5, 0, 0), 24*time.Hour); !ok || !s.Start.Equal(start) { + t.Errorf("Next() long before the first occurrence = %v %t", s, ok) + } +} + +func TestValidate(t *testing.T) { + start := time.Now() + for _, tc := range []struct { + r Rule + ok bool + }{ + {Rule{Start: start, Duration: time.Hour, Recurrence: Once}, true}, + {Rule{Start: start, Duration: 30 * time.Second, Recurrence: Once}, false}, + {Rule{Start: start, Duration: 25 * time.Hour, Recurrence: Daily}, false}, + {Rule{Start: start, Duration: 47 * time.Hour, Recurrence: Daily, Every: 2}, true}, + {Rule{Start: start, Duration: 25 * time.Hour, Recurrence: Weekly, Weekdays: []time.Weekday{time.Monday, time.Tuesday}}, false}, + {Rule{Start: start, Duration: 25 * time.Hour, Recurrence: Weekly, Weekdays: []time.Weekday{time.Monday, time.Thursday}}, true}, + {Rule{Start: start, Duration: time.Hour, Recurrence: "hourly"}, false}, + {Rule{Start: start, Duration: time.Hour, Recurrence: Daily, Until: new(start.Add(-time.Hour))}, false}, + } { + if err := tc.r.Validate(); (err == nil) != tc.ok { + t.Errorf("%+v.Validate() = %v, want ok=%t", tc.r, err, tc.ok) + } + } +} -- 2.54.1 From 259b3b8e0541e2d6ce513b61e98ef9efb5eb11a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 10:38:31 +0100 Subject: [PATCH 3/4] feat(store): store maintenance windows for monitors and groups Groups cover their subgroups; a recursive query resolves which windows apply to a monitor. Status page descriptions may be longer now that they are Markdown. Refs #71 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/migrations/sql/00026_maintenance.sql | 49 +++ .../sql/00027_status_page_markdown.sql | 8 + internal/store/maintenance.sql.go | 318 ++++++++++++++++++ internal/store/models.go | 23 ++ internal/store/querier.go | 11 + internal/store/queries/maintenance.sql | 49 +++ 6 files changed, 458 insertions(+) create mode 100644 internal/migrations/sql/00026_maintenance.sql create mode 100644 internal/migrations/sql/00027_status_page_markdown.sql create mode 100644 internal/store/maintenance.sql.go create mode 100644 internal/store/queries/maintenance.sql diff --git a/internal/migrations/sql/00026_maintenance.sql b/internal/migrations/sql/00026_maintenance.sql new file mode 100644 index 0000000..9f7cc36 --- /dev/null +++ b/internal/migrations/sql/00026_maintenance.sql @@ -0,0 +1,49 @@ +-- +goose Up +-- Planned maintenance. starts_at is the first occurrence; repeats keep its +-- wall-clock time in time_zone (see package maintenance). +CREATE TABLE maintenance_windows ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + org_id uuid NOT NULL REFERENCES orgs (id) ON DELETE CASCADE, + title text NOT NULL CHECK (length(title) BETWEEN 1 AND 200), + description text NOT NULL DEFAULT '' CHECK (length(description) <= 20000), + starts_at timestamptz NOT NULL, + duration_seconds integer NOT NULL CHECK (duration_seconds BETWEEN 60 AND 2592000), + time_zone text NOT NULL, + recurrence text NOT NULL CHECK (recurrence IN ('none', 'daily', 'weekly', 'monthly')), + every integer NOT NULL DEFAULT 1 CHECK (every BETWEEN 1 AND 365), + weekdays smallint[] NOT NULL DEFAULT '{}', + until timestamptz, + created_at timestamptz NOT NULL DEFAULT now(), + updated_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (id, org_id) +); + +-- A target is a monitor or a group; a group covers its subgroups. +CREATE TABLE maintenance_targets ( + window_id uuid NOT NULL, + org_id uuid NOT NULL, + monitor_id uuid, + group_id uuid, + CHECK ((monitor_id IS NULL) <> (group_id IS NULL)), + FOREIGN KEY (window_id, org_id) REFERENCES maintenance_windows (id, org_id) ON DELETE CASCADE, + FOREIGN KEY (monitor_id, org_id) REFERENCES monitors (id, org_id) ON DELETE CASCADE, + FOREIGN KEY (group_id, org_id) REFERENCES monitor_groups (id, org_id) ON DELETE CASCADE, + UNIQUE NULLS NOT DISTINCT (window_id, monitor_id, group_id) +); +CREATE INDEX maintenance_targets_monitor_idx ON maintenance_targets (monitor_id) WHERE monitor_id IS NOT NULL; +CREATE INDEX maintenance_targets_group_idx ON maintenance_targets (group_id) WHERE group_id IS NOT NULL; + +ALTER TABLE maintenance_windows ENABLE ROW LEVEL SECURITY; +ALTER TABLE maintenance_windows FORCE ROW LEVEL SECURITY; +CREATE POLICY maintenance_windows_tenant ON maintenance_windows FOR ALL + USING (app_scope_system() OR org_id = app_org_id()) + WITH CHECK (app_scope_system() OR org_id = app_org_id()); +ALTER TABLE maintenance_targets ENABLE ROW LEVEL SECURITY; +ALTER TABLE maintenance_targets FORCE ROW LEVEL SECURITY; +CREATE POLICY maintenance_targets_tenant ON maintenance_targets FOR ALL + USING (app_scope_system() OR org_id = app_org_id()) + WITH CHECK (app_scope_system() OR org_id = app_org_id()); + +-- +goose Down +DROP TABLE maintenance_targets; +DROP TABLE maintenance_windows; diff --git a/internal/migrations/sql/00027_status_page_markdown.sql b/internal/migrations/sql/00027_status_page_markdown.sql new file mode 100644 index 0000000..41e0e85 --- /dev/null +++ b/internal/migrations/sql/00027_status_page_markdown.sql @@ -0,0 +1,8 @@ +-- +goose Up +-- Descriptions are Markdown now, which needs more room than plain text. +ALTER TABLE status_pages DROP CONSTRAINT status_pages_description_check; +ALTER TABLE status_pages ADD CONSTRAINT status_pages_description_check CHECK (length(description) <= 10000); + +-- +goose Down +ALTER TABLE status_pages DROP CONSTRAINT status_pages_description_check; +ALTER TABLE status_pages ADD CONSTRAINT status_pages_description_check CHECK (length(description) <= 2000); diff --git a/internal/store/maintenance.sql.go b/internal/store/maintenance.sql.go new file mode 100644 index 0000000..f93c8a9 --- /dev/null +++ b/internal/store/maintenance.sql.go @@ -0,0 +1,318 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: maintenance.sql + +package store + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const addMaintenanceTarget = `-- name: AddMaintenanceTarget :exec +INSERT INTO maintenance_targets (window_id, org_id, monitor_id, group_id) VALUES ($1, $2, $3, $4) +` + +type AddMaintenanceTargetParams struct { + WindowID uuid.UUID + OrgID uuid.UUID + MonitorID *uuid.UUID + GroupID *uuid.UUID +} + +func (q *Queries) AddMaintenanceTarget(ctx context.Context, arg AddMaintenanceTargetParams) error { + _, err := q.db.Exec(ctx, addMaintenanceTarget, + arg.WindowID, + arg.OrgID, + arg.MonitorID, + arg.GroupID, + ) + return err +} + +const clearMaintenanceTargets = `-- name: ClearMaintenanceTargets :exec +DELETE FROM maintenance_targets WHERE window_id = $1 +` + +func (q *Queries) ClearMaintenanceTargets(ctx context.Context, windowID uuid.UUID) error { + _, err := q.db.Exec(ctx, clearMaintenanceTargets, windowID) + return err +} + +const createMaintenance = `-- name: CreateMaintenance :one +INSERT INTO maintenance_windows (org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) +RETURNING id, org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until, created_at, updated_at +` + +type CreateMaintenanceParams struct { + OrgID uuid.UUID + Title string + Description string + StartsAt time.Time + DurationSeconds int32 + TimeZone string + Recurrence string + Every int32 + Weekdays []int16 + Until *time.Time +} + +func (q *Queries) CreateMaintenance(ctx context.Context, arg CreateMaintenanceParams) (MaintenanceWindow, error) { + row := q.db.QueryRow(ctx, createMaintenance, + arg.OrgID, + arg.Title, + arg.Description, + arg.StartsAt, + arg.DurationSeconds, + arg.TimeZone, + arg.Recurrence, + arg.Every, + arg.Weekdays, + arg.Until, + ) + var i MaintenanceWindow + err := row.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, + ) + return i, err +} + +const deleteMaintenance = `-- name: DeleteMaintenance :execrows +DELETE FROM maintenance_windows WHERE id = $1 +` + +func (q *Queries) DeleteMaintenance(ctx context.Context, id uuid.UUID) (int64, error) { + result, err := q.db.Exec(ctx, deleteMaintenance, id) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} + +const getMaintenance = `-- name: GetMaintenance :one +SELECT id, org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until, created_at, updated_at FROM maintenance_windows WHERE id = $1 +` + +func (q *Queries) GetMaintenance(ctx context.Context, id uuid.UUID) (MaintenanceWindow, error) { + row := q.db.QueryRow(ctx, getMaintenance, id) + var i MaintenanceWindow + err := row.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, + ) + return i, err +} + +const listMaintenance = `-- name: ListMaintenance :many +SELECT id, org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until, created_at, updated_at FROM maintenance_windows ORDER BY starts_at, title +` + +func (q *Queries) ListMaintenance(ctx context.Context) ([]MaintenanceWindow, error) { + rows, err := q.db.Query(ctx, listMaintenance) + if err != nil { + return nil, err + } + defer rows.Close() + items := []MaintenanceWindow{} + for rows.Next() { + var i MaintenanceWindow + if err := rows.Scan( + &i.ID, + &i.OrgID, + &i.Title, + &i.Description, + &i.StartsAt, + &i.DurationSeconds, + &i.TimeZone, + &i.Recurrence, + &i.Every, + &i.Weekdays, + &i.Until, + &i.CreatedAt, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listMaintenanceTargets = `-- name: ListMaintenanceTargets :many +SELECT window_id, org_id, monitor_id, group_id FROM maintenance_targets +` + +func (q *Queries) ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error) { + rows, err := q.db.Query(ctx, listMaintenanceTargets) + if err != nil { + return nil, err + } + defer rows.Close() + items := []MaintenanceTarget{} + for rows.Next() { + var i MaintenanceTarget + if err := rows.Scan( + &i.WindowID, + &i.OrgID, + &i.MonitorID, + &i.GroupID, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const maintenanceForMonitors = `-- name: MaintenanceForMonitors :many +WITH RECURSIVE chain AS ( + SELECT m.id AS monitor_id, m.group_id + FROM monitors m WHERE m.id = ANY ($1::uuid[]) AND m.group_id IS NOT NULL + UNION ALL + SELECT c.monitor_id, g.parent_id + FROM chain c JOIN monitor_groups g ON g.id = c.group_id + WHERE g.parent_id IS NOT NULL +), +covered AS ( + SELECT t.window_id, t.monitor_id FROM maintenance_targets t WHERE t.monitor_id = ANY ($1::uuid[]) + UNION + SELECT t.window_id, c.monitor_id FROM maintenance_targets t JOIN chain c ON c.group_id = t.group_id +) +SELECT c.monitor_id, w.id, w.title, w.description, w.starts_at, w.duration_seconds, w.time_zone, + w.recurrence, w.every, w.weekdays, w.until +FROM covered c JOIN maintenance_windows w ON w.id = c.window_id +` + +type MaintenanceForMonitorsRow struct { + MonitorID *uuid.UUID + ID uuid.UUID + Title string + Description string + StartsAt time.Time + DurationSeconds int32 + TimeZone string + Recurrence string + Every int32 + Weekdays []int16 + Until *time.Time +} + +// System scope: windows covering any of the monitors, directly or through +// their group or one of its ancestors. +func (q *Queries) MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error) { + rows, err := q.db.Query(ctx, maintenanceForMonitors, ids) + if err != nil { + return nil, err + } + defer rows.Close() + items := []MaintenanceForMonitorsRow{} + for rows.Next() { + var i MaintenanceForMonitorsRow + if err := rows.Scan( + &i.MonitorID, + &i.ID, + &i.Title, + &i.Description, + &i.StartsAt, + &i.DurationSeconds, + &i.TimeZone, + &i.Recurrence, + &i.Every, + &i.Weekdays, + &i.Until, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateMaintenance = `-- name: UpdateMaintenance :one +UPDATE maintenance_windows +SET title = $2, description = $3, starts_at = $4, duration_seconds = $5, time_zone = $6, + recurrence = $7, every = $8, weekdays = $9, until = $10, updated_at = now() +WHERE id = $1 +RETURNING id, org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until, created_at, updated_at +` + +type UpdateMaintenanceParams struct { + ID uuid.UUID + Title string + Description string + StartsAt time.Time + DurationSeconds int32 + TimeZone string + Recurrence string + Every int32 + Weekdays []int16 + Until *time.Time +} + +func (q *Queries) UpdateMaintenance(ctx context.Context, arg UpdateMaintenanceParams) (MaintenanceWindow, error) { + row := q.db.QueryRow(ctx, updateMaintenance, + arg.ID, + arg.Title, + arg.Description, + arg.StartsAt, + arg.DurationSeconds, + arg.TimeZone, + arg.Recurrence, + arg.Every, + arg.Weekdays, + arg.Until, + ) + var i MaintenanceWindow + err := row.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, + ) + return i, err +} diff --git a/internal/store/models.go b/internal/store/models.go index c286443..a8ed474 100644 --- a/internal/store/models.go +++ b/internal/store/models.go @@ -123,6 +123,29 @@ type LegalDocument struct { UpdatedAt time.Time } +type MaintenanceTarget struct { + WindowID uuid.UUID + OrgID uuid.UUID + MonitorID *uuid.UUID + GroupID *uuid.UUID +} + +type MaintenanceWindow struct { + ID uuid.UUID + OrgID uuid.UUID + Title string + Description string + StartsAt time.Time + DurationSeconds int32 + TimeZone string + Recurrence string + Every int32 + Weekdays []int16 + Until *time.Time + CreatedAt time.Time + UpdatedAt time.Time +} + type Membership struct { OrgID uuid.UUID UserID uuid.UUID diff --git a/internal/store/querier.go b/internal/store/querier.go index 42ffda2..9861681 100644 --- a/internal/store/querier.go +++ b/internal/store/querier.go @@ -13,6 +13,7 @@ import ( type Querier interface { APITokenOrg(ctx context.Context, hash []byte) (uuid.UUID, error) + AddMaintenanceTarget(ctx context.Context, arg AddMaintenanceTargetParams) error AddMembership(ctx context.Context, arg AddMembershipParams) error AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error @@ -23,6 +24,7 @@ type Querier interface { ClaimNotifications(ctx context.Context, max int32) ([]uuid.UUID, error) // Shortens tokens that would outlive a newly set maximum lifetime. ClampAPITokenExpiry(ctx context.Context, arg ClampAPITokenExpiryParams) (int64, error) + ClearMaintenanceTargets(ctx context.Context, windowID uuid.UUID) error ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error) CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error) @@ -33,6 +35,7 @@ type Querier interface { CreateGroup(ctx context.Context, arg CreateGroupParams) (MonitorGroup, error) CreateIdentity(ctx context.Context, arg CreateIdentityParams) error CreateInvitation(ctx context.Context, arg CreateInvitationParams) (Invitation, error) + CreateMaintenance(ctx context.Context, arg CreateMaintenanceParams) (MaintenanceWindow, error) CreateMonitor(ctx context.Context, arg CreateMonitorParams) (Monitor, error) CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, error) CreateRegion(ctx context.Context, arg CreateRegionParams) (Region, error) @@ -52,6 +55,7 @@ type Querier interface { DeleteInvitation(ctx context.Context, id uuid.UUID) (int64, error) DeleteInvitationsForEmail(ctx context.Context, email string) error DeleteLegalDocument(ctx context.Context, arg DeleteLegalDocumentParams) error + DeleteMaintenance(ctx context.Context, id uuid.UUID) (int64, error) DeleteMonitor(ctx context.Context, id uuid.UUID) (int64, error) DeleteMonitorRegions(ctx context.Context, monitorID uuid.UUID) error DeleteOrg(ctx context.Context, id uuid.UUID) (int64, error) @@ -88,6 +92,7 @@ type Querier interface { GetIdentity(ctx context.Context, arg GetIdentityParams) (UserIdentity, error) GetInvitation(ctx context.Context, id uuid.UUID) (Invitation, error) GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, error) + GetMaintenance(ctx context.Context, id uuid.UUID) (MaintenanceWindow, error) GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error) GetMonitor(ctx context.Context, id uuid.UUID) (Monitor, error) GetOrg(ctx context.Context, id uuid.UUID) (Org, error) @@ -130,6 +135,8 @@ type Querier interface { ListEnabledSSOProviders(ctx context.Context) ([]ListEnabledSSOProvidersRow, error) ListGroups(ctx context.Context) ([]MonitorGroup, error) ListIncidents(ctx context.Context) ([]ListIncidentsRow, error) + ListMaintenance(ctx context.Context) ([]MaintenanceWindow, error) + ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error) ListMonitors(ctx context.Context) ([]Monitor, error) ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOrgMembersRow, error) ListOrgs(ctx context.Context) ([]Org, error) @@ -143,6 +150,9 @@ type Querier interface { // Row-level security limits this to platform regions and the scope's org; // the org's own regions come first. ListVisibleRegions(ctx context.Context) ([]Region, error) + // System scope: windows covering any of the monitors, directly or through + // their group or one of its ancestors. + MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error) MakeAdmin(ctx context.Context, id uuid.UUID) error MarkDomainVerified(ctx context.Context, id uuid.UUID) error MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (int64, error) @@ -212,6 +222,7 @@ type Querier interface { TouchIdentity(ctx context.Context, arg TouchIdentityParams) error UpdateChannel(ctx context.Context, arg UpdateChannelParams) (NotificationChannel, error) UpdateGroup(ctx context.Context, arg UpdateGroupParams) (MonitorGroup, error) + UpdateMaintenance(ctx context.Context, arg UpdateMaintenanceParams) (MaintenanceWindow, error) UpdateMonitor(ctx context.Context, arg UpdateMonitorParams) (Monitor, error) UpdateOrgPolicy(ctx context.Context, arg UpdateOrgPolicyParams) (Org, error) UpdateRole(ctx context.Context, arg UpdateRoleParams) (Role, error) diff --git a/internal/store/queries/maintenance.sql b/internal/store/queries/maintenance.sql new file mode 100644 index 0000000..39fc098 --- /dev/null +++ b/internal/store/queries/maintenance.sql @@ -0,0 +1,49 @@ +-- name: CreateMaintenance :one +INSERT INTO maintenance_windows (org_id, title, description, starts_at, duration_seconds, time_zone, recurrence, every, weekdays, until) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) +RETURNING *; + +-- name: UpdateMaintenance :one +UPDATE maintenance_windows +SET title = $2, description = $3, starts_at = $4, duration_seconds = $5, time_zone = $6, + recurrence = $7, every = $8, weekdays = $9, until = $10, updated_at = now() +WHERE id = $1 +RETURNING *; + +-- name: DeleteMaintenance :execrows +DELETE FROM maintenance_windows WHERE id = $1; + +-- name: GetMaintenance :one +SELECT * FROM maintenance_windows WHERE id = $1; + +-- name: ListMaintenance :many +SELECT * FROM maintenance_windows ORDER BY starts_at, title; + +-- name: ClearMaintenanceTargets :exec +DELETE FROM maintenance_targets WHERE window_id = $1; + +-- name: AddMaintenanceTarget :exec +INSERT INTO maintenance_targets (window_id, org_id, monitor_id, group_id) VALUES ($1, $2, $3, $4); + +-- name: ListMaintenanceTargets :many +SELECT * FROM maintenance_targets; + +-- name: MaintenanceForMonitors :many +-- System scope: windows covering any of the monitors, directly or through +-- their group or one of its ancestors. +WITH RECURSIVE chain AS ( + SELECT m.id AS monitor_id, m.group_id + FROM monitors m WHERE m.id = ANY (sqlc.arg(ids)::uuid[]) AND m.group_id IS NOT NULL + UNION ALL + SELECT c.monitor_id, g.parent_id + FROM chain c JOIN monitor_groups g ON g.id = c.group_id + WHERE g.parent_id IS NOT NULL +), +covered AS ( + SELECT t.window_id, t.monitor_id FROM maintenance_targets t WHERE t.monitor_id = ANY (sqlc.arg(ids)::uuid[]) + UNION + SELECT t.window_id, c.monitor_id FROM maintenance_targets t JOIN chain c ON c.group_id = t.group_id +) +SELECT c.monitor_id, w.id, w.title, w.description, w.starts_at, w.duration_seconds, w.time_zone, + w.recurrence, w.every, w.weekdays, w.until +FROM covered c JOIN maintenance_windows w ON w.id = c.window_id; -- 2.54.1 From 43b0a35f208b05737d49ed3de11cc698a51a676a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 10:38:31 +0100 Subject: [PATCH 4/4] feat: maintenance windows and Markdown descriptions Monitors and groups get one-off or recurring maintenance. While it is in progress, failures neither open incidents nor alert, so the SLA is not affected; successes still resolve earlier incidents. The console shows monitors under maintenance and lists windows on a new page and on monitor pages. Status pages announce maintenance in progress and planned for the next two weeks and mark affected components; the occurrences are part of the snapshot and evaluated when the page is shown, so this also works from cache during an API outage. Maintenance and status page descriptions are rendered as Markdown. Closes #71 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/agentapi/pages.go | 97 ++ internal/api/alerting.go | 11 + internal/api/audit.go | 3 + internal/api/console.go | 68 +- internal/api/maintenance.go | 581 ++++++++++ internal/api/maintenance_test.go | 174 +++ internal/api/server.go | 4 + internal/api/statuspages.go | 87 +- internal/i18n/i18n_test.go | 21 +- internal/i18n/locales/de.json | 65 +- internal/i18n/locales/en.json | 65 +- internal/statuspage/statuspage.go | 2 +- internal/statuspage/statuspage_test.go | 35 + internal/web/assets/app.css | 1 + internal/web/assets/app.js | 5 + internal/web/charts.go | 3 + internal/web/console.templ | 1 + internal/web/console_templ.go | 455 ++++---- internal/web/maintenance.go | 27 + internal/web/maintenance.templ | 217 ++++ internal/web/maintenance_templ.go | 1419 ++++++++++++++++++++++++ internal/web/monitors.templ | 19 +- internal/web/monitors_templ.go | 715 ++++++------ internal/web/public.go | 14 + internal/web/public.templ | 39 +- internal/web/public_templ.go | 288 +++-- internal/web/statuspages.templ | 3 +- internal/web/statuspages_templ.go | 393 +++---- 28 files changed, 3918 insertions(+), 894 deletions(-) create mode 100644 internal/api/maintenance.go create mode 100644 internal/api/maintenance_test.go create mode 100644 internal/web/maintenance.go create mode 100644 internal/web/maintenance.templ create mode 100644 internal/web/maintenance_templ.go diff --git a/internal/agentapi/pages.go b/internal/agentapi/pages.go index e71cb3e..f611bd0 100644 --- a/internal/agentapi/pages.go +++ b/internal/agentapi/pages.go @@ -14,6 +14,8 @@ const ( PageDegraded = "degraded" PageOutage = "outage" PageUnknown = "unknown" + // PageUnderMaintenance marks planned maintenance in progress. + PageUnderMaintenance = "maintenance" ) // Theme customizes a page. @@ -67,6 +69,101 @@ type PageSnapshot struct { // They travel with the snapshot so they stay available during an API // outage, which some jurisdictions require. Legal []LegalDoc `json:"legal,omitempty"` + // Maintenance lists occurrences of planned maintenance from shortly + // before generation to two weeks ahead. Whether one is in progress is + // decided when the page is shown, see WithMaintenance, so a cached + // snapshot stays right while the API is unreachable. + Maintenance []PageMaintenance `json:"maintenance,omitempty"` +} + +// PageMaintenance is one occurrence of planned maintenance. +type PageMaintenance struct { + Title string `json:"title"` + // Description is Markdown. + Description string `json:"description,omitempty"` + Start time.Time `json:"start"` + End time.Time `json:"end"` + // Components are the names of the affected components. + Components []string `json:"components"` +} + +// Summarize derives a page state from component states. Unknown components +// do not make a page look broken, and a single failed component is a partial +// problem: only when all fail is it an outage. +func Summarize(states []string) string { + rank := map[string]int{PageOperational: 0, PageUnknown: 0, PageDegraded: 1, PageOutage: 2} + worst, allUnknown, allDown := PageOperational, true, len(states) > 0 + for _, s := range states { + if rank[s] > rank[worst] { + worst = s + } + allUnknown = allUnknown && s == PageUnknown + allDown = allDown && s == PageOutage + } + switch { + case allUnknown: + return PageUnknown + case worst == PageOutage && !allDown: + return PageDegraded + } + return worst +} + +// WithMaintenance returns s as of now: components under maintenance in +// progress show as such and the page state leaves them out. +func (s PageSnapshot) WithMaintenance(now time.Time) PageSnapshot { + affected := map[string]bool{} + for _, m := range s.Maintenance { + if !now.Before(m.Start) && now.Before(m.End) { + for _, c := range m.Components { + affected[c] = true + } + } + } + if len(affected) == 0 { + return s + } + sections := make([]Section, len(s.Sections)) + var states []string + for i, sec := range s.Sections { + sections[i] = Section{Name: sec.Name, Components: make([]Component, len(sec.Components))} + for j, c := range sec.Components { + if affected[c.Name] { + c.Status = PageUnderMaintenance + } else { + states = append(states, c.Status) + } + sections[i].Components[j] = c + } + } + s.Sections = sections + s.Status = Summarize(states) + if len(states) == 0 || s.Status == PageOperational { + s.Status = PageUnderMaintenance + } + return s +} + +// Ongoing returns occurrences in progress at now. +func (s PageSnapshot) Ongoing(now time.Time) []PageMaintenance { + var out []PageMaintenance + for _, m := range s.Maintenance { + if !now.Before(m.Start) && now.Before(m.End) { + out = append(out, m) + } + } + return out +} + +// Upcoming returns occurrences that have not started at now. +func (s PageSnapshot) Upcoming(now time.Time) []PageMaintenance { + var out []PageMaintenance + for _, m := range s.Maintenance { + if now.Before(m.Start) { + out = append(out, m) + } + } + return out } // LegalDoc is a legal notice ("imprint") or privacy policy ("privacy"): diff --git a/internal/api/alerting.go b/internal/api/alerting.go index 49af148..a28bb69 100644 --- a/internal/api/alerting.go +++ b/internal/api/alerting.go @@ -29,11 +29,22 @@ const ( // acts on the resulting transitions. func (s *Server) evaluateResults(ctx context.Context, region string, results []agentapi.Result, monitors map[uuid.UUID]store.MonitorsForResultsRow) { slices.SortFunc(results, func(a, b agentapi.Result) int { return a.StartedAt.Compare(b.StartedAt) }) + ids := make([]uuid.UUID, 0, len(monitors)) + for id := range monitors { + ids = append(ids, id) + } + planned := s.monitorsInMaintenance(ctx, ids) for _, r := range results { m, ok := monitors[r.MonitorID] if !ok { continue } + // Failures during planned maintenance are expected: they neither + // open incidents nor count towards one afterwards. Successes still + // go through, so an incident from before can resolve. + if _, _, active := inMaintenance(planned[m.ID], r.StartedAt); active && !r.OK { + continue + } t, err := s.eval.Observe(ctx, evaluate.Observation{ MonitorID: m.ID, Region: region, OK: r.OK, At: r.StartedAt, Interval: time.Duration(m.IntervalSeconds) * time.Second, Confirmations: int(m.Confirmations), Regions: m.Regions, diff --git a/internal/api/audit.go b/internal/api/audit.go index c59fe9d..18b8e09 100644 --- a/internal/api/audit.go +++ b/internal/api/audit.go @@ -45,6 +45,9 @@ var auditActions = map[string]string{ "POST /api/v1/org/monitors": "monitor.create", "PUT /api/v1/org/monitors/:id": "monitor.update", "DELETE /api/v1/org/monitors/:id": "monitor.delete", + "POST /api/v1/org/maintenance": "maintenance.create", + "PUT /api/v1/org/maintenance/:id": "maintenance.update", + "DELETE /api/v1/org/maintenance/:id": "maintenance.delete", "POST /api/v1/org/groups": "group.create", "PUT /api/v1/org/groups/:id": "group.update", "DELETE /api/v1/org/groups/:id": "group.delete", diff --git a/internal/api/console.go b/internal/api/console.go index 0b48beb..0242305 100644 --- a/internal/api/console.go +++ b/internal/api/console.go @@ -18,6 +18,7 @@ import ( "git.zb-server.de/ZB-Server/uptimesebi/internal/auth" "git.zb-server.de/ZB-Server/uptimesebi/internal/authz" "git.zb-server.de/ZB-Server/uptimesebi/internal/check" + "git.zb-server.de/ZB-Server/uptimesebi/internal/maintenance" "git.zb-server.de/ZB-Server/uptimesebi/internal/store" "git.zb-server.de/ZB-Server/uptimesebi/internal/web" ) @@ -33,6 +34,7 @@ func (s *Server) registerConsole(r gin.IRouter) { r.GET("/groups", s.orgPage("groups.title", "", s.groupsView)) r.GET("/settings", s.settingsIndex) r.GET("/incidents", s.orgPage("incidents.title", authz.IncidentsRead, s.incidentsView)) + r.GET("/maintenance", s.orgPage("maintenance.title", "", s.maintenancePage)) r.GET("/settings/channels", s.orgPage("channels.title", authz.NotificationsRead, s.channelsView)) r.GET("/statuspages", s.orgPage("pages.title", "", s.statusPagesView)) r.GET("/statuspages/:id", s.orgPage("pages.title", "", s.statusPageEditor)) @@ -78,9 +80,10 @@ func (s *Server) dashboard(c *gin.Context) { } type monitorData struct { - tree groupTree - rows []web.MonitorRow - byID map[uuid.UUID]store.Monitor + tree groupTree + maint map[uuid.UUID][]store.MaintenanceWindow + rows []web.MonitorRow + byID map[uuid.UUID]store.Monitor // buckets cover the selected range at its resolution. buckets map[uuid.UUID][]web.Bucket down map[uuid.UUID][]web.Span @@ -211,6 +214,13 @@ func (s *Server) loadMonitorData(ctx context.Context, p *principal, rng web.Time if d.first, d.firstRegion, err = loadFirstData(ctx, q, p.Org.ID, now); err != nil { return err } + ids := make([]uuid.UUID, len(monitors)) + for i, m := range monitors { + ids[i] = m.ID + } + if d.maint, err = maintenanceFor(ctx, q, ids); err != nil { + return err + } d.buckets, err = rangeBuckets(ctx, q, p.Org.ID, nil, rng, now) return err }) @@ -276,6 +286,8 @@ func (s *Server) loadMonitorData(ctx context.Context, p *principal, rng web.Time switch { case !m.Enabled: row.Status = web.StatusPaused + case inMaintenanceNow(d.maint[m.ID], now): + row.Status = web.StatusMaintenance case down[m.ID]: row.Status = web.StatusDown case reported == 0: @@ -297,8 +309,7 @@ func (s *Server) loadMonitorData(ctx context.Context, p *principal, rng web.Time d.rows = append(d.rows, row) } // Problems first, then by name. - rank := map[web.Status]int{web.StatusDown: 0, web.StatusDegraded: 1, web.StatusUnknown: 2, web.StatusUp: 3, web.StatusPaused: 4} - slices.SortStableFunc(d.rows, func(a, b web.MonitorRow) int { return rank[a.Status] - rank[b.Status] }) + slices.SortStableFunc(d.rows, func(a, b web.MonitorRow) int { return statusRank[a.Status] - statusRank[b.Status] }) return d, nil } @@ -325,12 +336,13 @@ func (s *Server) monitorDetail(c *gin.Context, p *principal, page web.Page, me w return notFoundPage(c) } v := web.MonitorDetailView{ - Interval: (time.Duration(m.IntervalSeconds) * time.Second).String(), - CanWrite: canInGroup(p, authz.MonitorsWrite, d.tree, m.GroupID), - Latency: web.Latency(d.buckets[id], d.now.Add(-d.rng.Window).Truncate(d.rng.Bucket), d.now, 480, 96), - Range: d.rng.Key, - Ranges: rangeOptions(c, d.rng, d.first[id], d.now), - Uptime90: "–", + Interval: (time.Duration(m.IntervalSeconds) * time.Second).String(), + CanWrite: canInGroup(p, authz.MonitorsWrite, d.tree, m.GroupID), + Latency: web.Latency(d.buckets[id], d.now.Add(-d.rng.Window).Truncate(d.rng.Bucket), d.now, 480, 96), + Maintenance: maintenanceItems(d.maint[id], d.now), + Range: d.rng.Key, + Ranges: rangeOptions(c, d.rng, d.first[id], d.now), + Uptime90: "–", } for _, r := range d.rows { if r.ID == id.String() { @@ -662,7 +674,8 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m } // rank orders statuses from worst to best for aggregation. -var statusRank = map[web.Status]int{web.StatusDown: 0, web.StatusDegraded: 1, web.StatusUnknown: 2, web.StatusUp: 3, web.StatusPaused: 4} +// statusRank orders problems first. +var statusRank = map[web.Status]int{web.StatusDown: 0, web.StatusDegraded: 1, web.StatusUnknown: 2, web.StatusMaintenance: 3, web.StatusUp: 4, web.StatusPaused: 5} // buildGroupNodes arranges monitor rows into the group tree. Groups show the // worst status below them; empty groups are kept so the structure is @@ -816,3 +829,34 @@ func (s *Server) regionHistory(ctx context.Context, p *principal, d monitorData, } return out, nil } + +func inMaintenanceNow(ws []store.MaintenanceWindow, now time.Time) bool { + _, _, ok := inMaintenance(ws, now) + return ok +} + +// maintenanceItems lists the occurrences of ws from now to the horizon, +// soonest first, with descriptions rendered from Markdown. +func maintenanceItems(ws []store.MaintenanceWindow, now time.Time) []web.MaintenanceItem { + type occ struct { + w store.MaintenanceWindow + s maintenance.Span + } + var all []occ + for _, w := range ws { + for _, s := range ruleOf(w).Occurrences(now, now.Add(upcomingHorizon)) { + all = append(all, occ{w, s}) + } + } + slices.SortFunc(all, func(a, b occ) int { return a.s.Start.Compare(b.s.Start) }) + out := make([]web.MaintenanceItem, 0, len(all)) + for _, o := range all[:min(len(all), 10)] { + html, _ := web.RenderMarkdown(o.w.Description) + loc := loadLocation(o.w.TimeZone) + out = append(out, web.MaintenanceItem{ + Title: o.w.Title, Description: html, Active: !now.Before(o.s.Start), + When: o.s.Start.In(loc).Format("2006-01-02 15:04") + " – " + o.s.End.In(loc).Format("15:04") + " " + o.w.TimeZone, + }) + } + return out +} diff --git a/internal/api/maintenance.go b/internal/api/maintenance.go new file mode 100644 index 0000000..e5a8b9f --- /dev/null +++ b/internal/api/maintenance.go @@ -0,0 +1,581 @@ +package api + +import ( + "context" + "encoding/json" + "errors" + "net/http" + "slices" + "strconv" + "strings" + "time" + + "github.com/a-h/templ" + "github.com/gin-gonic/gin" + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/authz" + "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" + "git.zb-server.de/ZB-Server/uptimesebi/internal/maintenance" + "git.zb-server.de/ZB-Server/uptimesebi/internal/store" + "git.zb-server.de/ZB-Server/uptimesebi/internal/tenant" + "git.zb-server.de/ZB-Server/uptimesebi/internal/web" +) + +// upcomingHorizon is how far ahead status pages and the console list +// maintenance. +const upcomingHorizon = 14 * 24 * time.Hour + +func loadLocation(name string) *time.Location { + if loc, err := time.LoadLocation(name); err == nil { + return loc + } + return time.UTC +} + +func weekdaysOf(ws []int16) []time.Weekday { + out := make([]time.Weekday, len(ws)) + for i, w := range ws { + out[i] = time.Weekday(w) + } + return out +} + +func ruleOf(w store.MaintenanceWindow) maintenance.Rule { + return maintenance.Rule{ + Start: w.StartsAt, Duration: time.Duration(w.DurationSeconds) * time.Second, Location: loadLocation(w.TimeZone), + Recurrence: maintenance.Recurrence(w.Recurrence), Every: int(w.Every), Weekdays: weekdaysOf(w.Weekdays), Until: w.Until, + } +} + +func windowOf(r store.MaintenanceForMonitorsRow) store.MaintenanceWindow { + return store.MaintenanceWindow{ + ID: r.ID, Title: r.Title, Description: r.Description, StartsAt: r.StartsAt, DurationSeconds: r.DurationSeconds, + TimeZone: r.TimeZone, Recurrence: r.Recurrence, Every: r.Every, Weekdays: r.Weekdays, Until: r.Until, + } +} + +// maintenanceFor loads the windows covering monitors, by monitor. +func maintenanceFor(ctx context.Context, q *store.Queries, ids []uuid.UUID) (map[uuid.UUID][]store.MaintenanceWindow, error) { + rows, err := q.MaintenanceForMonitors(ctx, ids) + out := map[uuid.UUID][]store.MaintenanceWindow{} + for _, r := range rows { + if r.MonitorID != nil { + out[*r.MonitorID] = append(out[*r.MonitorID], windowOf(r)) + } + } + return out, err +} + +// inMaintenance returns the window of ws in progress at t. +func inMaintenance(ws []store.MaintenanceWindow, t time.Time) (store.MaintenanceWindow, maintenance.Span, bool) { + for _, w := range ws { + if s, ok := ruleOf(w).ActiveAt(t); ok { + return w, s, true + } + } + return store.MaintenanceWindow{}, maintenance.Span{}, false +} + +// flexInts accepts numbers or numeric strings, as HTML forms send them. +type flexInts []int + +// UnmarshalJSON implements json.Unmarshaler. +func (f *flexInts) UnmarshalJSON(b []byte) error { + var raw []json.RawMessage + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + *f = make(flexInts, 0, len(raw)) + for _, r := range raw { + s := strings.Trim(string(r), `"`) + n, err := strconv.Atoi(s) + if err != nil { + return err + } + *f = append(*f, n) + } + return nil +} + +type maintenanceRequest struct { + Title string `json:"title" binding:"required,max=200"` + Description string `json:"description" binding:"max=20000"` + // Start is the local wall-clock time of the first occurrence, + // "2006-01-02T15:04", in TimeZone. + Start string `json:"start" binding:"required"` + TimeZone string `json:"time_zone" binding:"required,max=64"` + DurationMinutes int `json:"duration_minutes" binding:"required"` + Recurrence string `json:"recurrence"` + Every int `json:"every"` + Weekdays flexInts `json:"weekdays"` + // Until is the last day occurrences may start on, "2006-01-02". + Until string `json:"until"` + MonitorIDs []uuid.UUID `json:"monitor_ids"` + GroupIDs []uuid.UUID `json:"group_ids"` +} + +// params validates req into the stored form. +func (req maintenanceRequest) params() (store.CreateMaintenanceParams, string) { + loc, err := time.LoadLocation(req.TimeZone) + if err != nil || req.TimeZone == "" || req.TimeZone == "Local" { + return store.CreateMaintenanceParams{}, "invalid_time_zone" + } + start, err := time.ParseInLocation("2006-01-02T15:04", req.Start, loc) + if err != nil { + return store.CreateMaintenanceParams{}, "invalid_maintenance_time" + } + p := store.CreateMaintenanceParams{ + Title: strings.TrimSpace(req.Title), Description: strings.TrimSpace(req.Description), StartsAt: start, + DurationSeconds: int32(req.DurationMinutes * 60), TimeZone: req.TimeZone, + Recurrence: req.Recurrence, Every: int32(max(req.Every, 1)), Weekdays: []int16{}, + } + if p.Recurrence == "" { + p.Recurrence = string(maintenance.Once) + } + if p.Title == "" { + return p, "invalid_input" + } + if p.Recurrence == string(maintenance.Weekly) { + for _, w := range req.Weekdays { + if w < 0 || w > 6 { + return p, "invalid_maintenance_time" + } + p.Weekdays = append(p.Weekdays, int16(w)) + } + } + if req.Until != "" && p.Recurrence != string(maintenance.Once) { + day, err := time.ParseInLocation("2006-01-02", req.Until, loc) + if err != nil { + return p, "invalid_maintenance_time" + } + end := day.AddDate(0, 0, 1).Add(-time.Second) + p.Until = &end + } + if err := ruleOf(store.MaintenanceWindow{ + StartsAt: p.StartsAt, DurationSeconds: p.DurationSeconds, TimeZone: p.TimeZone, Recurrence: p.Recurrence, + Every: p.Every, Weekdays: p.Weekdays, Until: p.Until, + }).Validate(); err != nil { + switch { + case errors.Is(err, maintenance.ErrOverlap): + return p, "maintenance_overlaps" + case errors.Is(err, maintenance.ErrDuration): + return p, "invalid_maintenance_duration" + } + return p, "invalid_maintenance_time" + } + if len(req.MonitorIDs)+len(req.GroupIDs) == 0 { + return p, "maintenance_without_targets" + } + return p, "" +} + +type maintenanceSpan struct { + Start time.Time `json:"start"` + End time.Time `json:"end"` +} + +type maintenanceView struct { + ID uuid.UUID `json:"id"` + Title string `json:"title"` + Description string `json:"description"` + Start string `json:"start"` + StartsAt time.Time `json:"starts_at"` + TimeZone string `json:"time_zone"` + DurationMinutes int `json:"duration_minutes"` + Recurrence string `json:"recurrence"` + Every int32 `json:"every"` + Weekdays []int16 `json:"weekdays"` + Until string `json:"until,omitempty"` + MonitorIDs []uuid.UUID `json:"monitor_ids"` + GroupIDs []uuid.UUID `json:"group_ids"` + Active bool `json:"active"` + Next *maintenanceSpan `json:"next"` +} + +func viewMaintenance(w store.MaintenanceWindow, targets []store.MaintenanceTarget, now time.Time) maintenanceView { + loc := loadLocation(w.TimeZone) + v := maintenanceView{ + ID: w.ID, Title: w.Title, Description: w.Description, Start: w.StartsAt.In(loc).Format("2006-01-02T15:04"), + StartsAt: w.StartsAt, TimeZone: w.TimeZone, DurationMinutes: int(w.DurationSeconds / 60), Recurrence: w.Recurrence, + Every: w.Every, Weekdays: w.Weekdays, MonitorIDs: []uuid.UUID{}, GroupIDs: []uuid.UUID{}, + } + if w.Until != nil { + v.Until = w.Until.In(loc).Format("2006-01-02") + } + for _, t := range targets { + if t.WindowID != w.ID { + continue + } + if t.MonitorID != nil { + v.MonitorIDs = append(v.MonitorIDs, *t.MonitorID) + } else if t.GroupID != nil { + v.GroupIDs = append(v.GroupIDs, *t.GroupID) + } + } + if s, ok := ruleOf(w).Next(now, 400*24*time.Hour); ok { + v.Next = &maintenanceSpan{Start: s.Start, End: s.End} + v.Active = !now.Before(s.Start) + } + return v +} + +// maintenanceScope holds what permission checks on windows need. +type maintenanceScope struct { + tree groupTree + monitors map[uuid.UUID]store.Monitor +} + +func (s *Server) loadMaintenanceScope(ctx context.Context, p *principal) (maintenanceScope, error) { + ms := maintenanceScope{monitors: map[uuid.UUID]store.Monitor{}} + var err error + if ms.tree, err = s.loadGroupTree(ctx, p.scope()); err != nil { + return ms, err + } + err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { + rows, err := q.ListMonitors(ctx) + for _, m := range rows { + ms.monitors[m.ID] = m + } + return err + }) + return ms, err +} + +// can reports whether p holds perm on every target, or with any=true on at +// least one. Unknown targets fail. +func (ms maintenanceScope) can(p *principal, perm authz.Permission, monitors, groups []uuid.UUID, any bool) bool { + n := 0 + check := func(ok bool) { + if ok { + n++ + } + } + for _, id := range monitors { + m, ok := ms.monitors[id] + check(ok && canInGroup(p, perm, ms.tree, m.GroupID)) + } + for _, id := range groups { + _, ok := ms.tree.byID[id] + check(ok && canInGroup(p, perm, ms.tree, &id)) + } + if any { + return n > 0 + } + return n == len(monitors)+len(groups) +} + +func (s *Server) listMaintenanceViews(ctx context.Context, p *principal, ms maintenanceScope) ([]maintenanceView, error) { + var ( + windows []store.MaintenanceWindow + targets []store.MaintenanceTarget + ) + err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { + var err error + if windows, err = q.ListMaintenance(ctx); err != nil { + return err + } + targets, err = q.ListMaintenanceTargets(ctx) + return err + }) + out := []maintenanceView{} + now := time.Now() + for _, w := range windows { + v := viewMaintenance(w, targets, now) + if ms.can(p, authz.MonitorsRead, v.MonitorIDs, v.GroupIDs, true) { + out = append(out, v) + } + } + return out, err +} + +func (s *Server) listMaintenance(c *gin.Context) { + p := current(c) + ctx := c.Request.Context() + ms, err := s.loadMaintenanceScope(ctx, p) + if err != nil { + internalError(c, err) + return + } + out, err := s.listMaintenanceViews(ctx, p, ms) + if err != nil { + internalError(c, err) + return + } + c.JSON(http.StatusOK, gin.H{"maintenance": out}) +} + +func (s *Server) saveMaintenance(c *gin.Context, id *uuid.UUID) { + var req maintenanceRequest + if !bind(c, &req) { + return + } + params, code := req.params() + if code != "" { + fail(c, http.StatusUnprocessableEntity, code) + return + } + p := current(c) + ctx := c.Request.Context() + ms, err := s.loadMaintenanceScope(ctx, p) + if err != nil { + internalError(c, err) + return + } + if !ms.can(p, authz.MonitorsWrite, req.MonitorIDs, req.GroupIDs, false) { + fail(c, http.StatusForbidden, "forbidden") + return + } + params.OrgID = p.Org.ID + var ( + w store.MaintenanceWindow + targets []store.MaintenanceTarget + ) + err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { + var err error + if id == nil { + w, err = q.CreateMaintenance(ctx, params) + } else { + old, err := q.GetMaintenance(ctx, *id) + if err != nil { + return err + } + prev, err := q.ListMaintenanceTargets(ctx) + if err != nil { + return err + } + // Changing a window needs write access to what it covered too. + v := viewMaintenance(old, prev, time.Now()) + if !ms.can(p, authz.MonitorsWrite, v.MonitorIDs, v.GroupIDs, false) { + return errForbidden + } + w, err = q.UpdateMaintenance(ctx, store.UpdateMaintenanceParams{ + ID: *id, Title: params.Title, Description: params.Description, StartsAt: params.StartsAt, + DurationSeconds: params.DurationSeconds, TimeZone: params.TimeZone, Recurrence: params.Recurrence, + Every: params.Every, Weekdays: params.Weekdays, Until: params.Until, + }) + if err != nil { + return err + } + if err := q.ClearMaintenanceTargets(ctx, w.ID); err != nil { + return err + } + } + if err != nil { + return err + } + for _, m := range dedupe(req.MonitorIDs) { + if err := q.AddMaintenanceTarget(ctx, store.AddMaintenanceTargetParams{WindowID: w.ID, OrgID: p.Org.ID, MonitorID: &m}); err != nil { + return err + } + targets = append(targets, store.MaintenanceTarget{WindowID: w.ID, MonitorID: &m}) + } + for _, g := range dedupe(req.GroupIDs) { + if err := q.AddMaintenanceTarget(ctx, store.AddMaintenanceTargetParams{WindowID: w.ID, OrgID: p.Org.ID, GroupID: &g}); err != nil { + return err + } + targets = append(targets, store.MaintenanceTarget{WindowID: w.ID, GroupID: &g}) + } + return nil + }) + switch { + case errors.Is(err, pgx.ErrNoRows): + fail(c, http.StatusNotFound, "not_found") + return + case errors.Is(err, errForbidden): + fail(c, http.StatusForbidden, "forbidden") + return + case err != nil: + internalError(c, err) + return + } + status := http.StatusOK + if id == nil { + status = http.StatusCreated + } + c.JSON(status, viewMaintenance(w, targets, time.Now())) +} + +var errForbidden = errors.New("api: forbidden") + +func dedupe(ids []uuid.UUID) []uuid.UUID { + seen := map[uuid.UUID]bool{} + var out []uuid.UUID + for _, id := range ids { + if !seen[id] { + seen[id] = true + out = append(out, id) + } + } + return out +} + +func (s *Server) createMaintenance(c *gin.Context) { s.saveMaintenance(c, nil) } + +func (s *Server) updateMaintenance(c *gin.Context) { + id, err := uuid.Parse(c.Param("id")) + if err != nil { + fail(c, http.StatusNotFound, "not_found") + return + } + s.saveMaintenance(c, &id) +} + +func (s *Server) deleteMaintenance(c *gin.Context) { + id, err := uuid.Parse(c.Param("id")) + if err != nil { + fail(c, http.StatusNotFound, "not_found") + return + } + p := current(c) + ctx := c.Request.Context() + ms, err := s.loadMaintenanceScope(ctx, p) + if err != nil { + internalError(c, err) + return + } + err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { + w, err := q.GetMaintenance(ctx, id) + if err != nil { + return err + } + targets, err := q.ListMaintenanceTargets(ctx) + if err != nil { + return err + } + v := viewMaintenance(w, targets, time.Now()) + if !ms.can(p, authz.MonitorsWrite, v.MonitorIDs, v.GroupIDs, false) { + return errForbidden + } + auditDetail(c, "name", w.Title) + _, err = q.DeleteMaintenance(ctx, id) + return err + }) + switch { + case errors.Is(err, pgx.ErrNoRows): + fail(c, http.StatusNotFound, "not_found") + case errors.Is(err, errForbidden): + fail(c, http.StatusForbidden, "forbidden") + case err != nil: + internalError(c, err) + default: + c.Status(http.StatusNoContent) + } +} + +// monitorsInMaintenance loads, in system scope, which of ids are covered by +// which windows; used while evaluating results. +func (s *Server) monitorsInMaintenance(ctx context.Context, ids []uuid.UUID) map[uuid.UUID][]store.MaintenanceWindow { + var out map[uuid.UUID][]store.MaintenanceWindow + err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { + var err error + out, err = maintenanceFor(ctx, q, ids) + return err + }) + if err != nil { + // Without the windows, failures alert as usual: better a page + // during maintenance than silence during an outage. + s.log.ErrorContext(ctx, "loading maintenance windows failed", "error", err) + } + return out +} + +// scheduleText describes when a window repeats, e.g. "Every 2 weeks on +// Tue, Thu until 2026-12-31". +func scheduleText(ctx context.Context, v maintenanceView) string { + var s string + switch v.Recurrence { + case string(maintenance.Daily): + s = i18n.T(ctx, "maintenance.schedule_daily", "Count", int(v.Every)) + case string(maintenance.Weekly): + days := v.Weekdays + if len(days) == 0 { + days = []int16{int16(v.StartsAt.In(loadLocation(v.TimeZone)).Weekday())} + } + names := make([]string, 0, len(days)) + for _, d := range []int16{1, 2, 3, 4, 5, 6, 0} { + if slices.Contains(days, d) { + names = append(names, i18n.T(ctx, "weekday."+strconv.Itoa(int(d)))) + } + } + s = i18n.T(ctx, "maintenance.schedule_weekly", "Count", int(v.Every), "Days", strings.Join(names, ", ")) + case string(maintenance.Monthly): + s = i18n.T(ctx, "maintenance.schedule_monthly", "Count", int(v.Every), "Day", v.StartsAt.In(loadLocation(v.TimeZone)).Day()) + default: + s = i18n.T(ctx, "maintenance.schedule_once") + } + start := strings.Replace(v.Start, "T", " ", 1) + s += " · " + i18n.T(ctx, "maintenance.schedule_from", "Time", start, "Minutes", v.DurationMinutes, "Zone", v.TimeZone) + if v.Until != "" { + s += " · " + i18n.T(ctx, "maintenance.schedule_until", "Date", v.Until) + } + return s +} + +func (s *Server) maintenancePage(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) { + ctx := c.Request.Context() + ms, err := s.loadMaintenanceScope(ctx, p) + if err != nil { + return nil, err + } + windows, err := s.listMaintenanceViews(ctx, p, ms) + if err != nil { + return nil, err + } + v := web.MaintenanceView{Form: web.MaintenanceForm{Duration: 60, Recurrence: "none", Every: 1}} + ms.tree.walk(func(g store.MonitorGroup, depth int) { + if canInGroup(p, authz.MonitorsWrite, ms.tree, &g.ID) { + v.Groups = append(v.Groups, web.TargetOption{ID: g.ID.String(), Name: g.Name, Depth: depth}) + } + }) + names := map[uuid.UUID]string{} + for _, m := range ms.monitors { + names[m.ID] = m.Name + if canInGroup(p, authz.MonitorsWrite, ms.tree, m.GroupID) { + v.Monitors = append(v.Monitors, web.TargetOption{ID: m.ID.String(), Name: m.Name}) + } + } + slices.SortFunc(v.Monitors, func(a, b web.TargetOption) int { return strings.Compare(a.Name, b.Name) }) + v.CanWrite = len(v.Monitors)+len(v.Groups) > 0 + for id, g := range ms.tree.byID { + names[id] = g.Name + } + for _, w := range windows { + row := web.MaintenanceRow{ + ID: w.ID.String(), Title: w.Title, Schedule: scheduleText(ctx, w), Active: w.Active, + CanWrite: ms.can(p, authz.MonitorsWrite, w.MonitorIDs, w.GroupIDs, false), + } + row.Description, _ = web.RenderMarkdown(w.Description) + var targets []string + for _, id := range w.GroupIDs { + targets = append(targets, i18n.T(ctx, "maintenance.group_target", "Name", names[id])) + } + for _, id := range w.MonitorIDs { + targets = append(targets, names[id]) + } + row.Targets = strings.Join(targets, ", ") + if w.Next != nil && !w.Active { + row.Next = w.Next.Start.In(loadLocation(w.TimeZone)).Format("2006-01-02 15:04") + } + v.Windows = append(v.Windows, row) + if w.ID.String() == c.Query("edit") && row.CanWrite { + f := web.MaintenanceForm{ + ID: row.ID, Title: w.Title, Description: w.Description, Start: w.Start, TimeZone: w.TimeZone, + Duration: w.DurationMinutes, Recurrence: w.Recurrence, Every: int(w.Every), Until: w.Until, + Weekdays: map[int]bool{}, Monitors: map[string]bool{}, Groups: map[string]bool{}, + } + for _, d := range w.Weekdays { + f.Weekdays[int(d)] = true + } + for _, id := range w.MonitorIDs { + f.Monitors[id.String()] = true + } + for _, id := range w.GroupIDs { + f.Groups[id.String()] = true + } + v.Form = f + } + } + return web.MaintenancePage(page, me, v), nil +} diff --git a/internal/api/maintenance_test.go b/internal/api/maintenance_test.go new file mode 100644 index 0000000..fd52f64 --- /dev/null +++ b/internal/api/maintenance_test.go @@ -0,0 +1,174 @@ +package api_test + +import ( + "context" + "net/http" + "strings" + "testing" + "time" + + "github.com/google/uuid" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi" +) + +func TestMaintenance(t *testing.T) { + e := newEnv(t) + token, region := e.platformChecker(t, uniq("eu-")) + client := agentapi.NewClient(e.srv.URL, token, uuid.New(), "test").WithHTTPClient(e.srv.Client()) + owner := e.browser(t) + owner.signup("o@"+uniq("mt")+".test", uniq("mt-")) + + infra := owner.group("Infra", "") + db := owner.group("Databases", infra) + other := owner.group("Other", "") + st, body := owner.do("POST", "/api/v1/org/monitors", map[string]any{ + "name": "Postgres", "type": "tcp", "target": "db.example.com:5432", "interval_seconds": 3600, + "confirmations": 1, "regions": []string{region}, "group_id": db, + }) + if st != http.StatusCreated { + t.Fatalf("create monitor = %d %v", st, body) + } + monitor := uuid.MustParse(body["id"].(string)) + + now := time.Now().UTC() + window := map[string]any{ + "title": "DB upgrade", "description": "Upgrade to **Postgres 18**.", + "start": now.Add(-10 * time.Minute).Format("2006-01-02T15:04"), "time_zone": "UTC", "duration_minutes": 60, + "group_ids": []string{infra}, + } + for name, tc := range map[string]struct { + change map[string]any + code string + }{ + "time zone": {map[string]any{"time_zone": "Mars/Olympus"}, "invalid_time_zone"}, + "no targets": {map[string]any{"group_ids": []string{}}, "maintenance_without_targets"}, + "overlapping": {map[string]any{"recurrence": "daily", "duration_minutes": 25 * 60}, "maintenance_overlaps"}, + } { + req := map[string]any{} + for k, v := range window { + req[k] = v + } + for k, v := range tc.change { + req[k] = v + } + st, body := owner.do("POST", "/api/v1/org/maintenance", req) + expect(t, name, st, body, http.StatusUnprocessableEntity, tc.code) + } + st, body = owner.do("POST", "/api/v1/org/maintenance", window) + if st != http.StatusCreated || body["active"] != true { + t.Fatalf("create maintenance = %d %v", st, body) + } + windowID := body["id"].(string) + + // A failure during maintenance of a parent group opens no incident. + report := func(ok bool) { + t.Helper() + if err := client.Report(context.Background(), []agentapi.Result{{MonitorID: monitor, ScheduledAt: time.Now(), StartedAt: time.Now(), OK: ok}}); err != nil { + t.Fatal(err) + } + } + report(false) + report(false) + if _, inc := owner.do("GET", "/api/v1/org/incidents", nil); len(inc["incidents"].([]any)) != 0 { + t.Fatalf("incident opened during maintenance: %v", inc) + } + _, _, dash := owner.page("/") + if !strings.Contains(dash, `title="maintenance"`) && !strings.Contains(dash, `title="Wartung"`) { + t.Error("dashboard does not show the monitor under maintenance") + } + if _, _, page := owner.page("/maintenance"); !strings.Contains(page, "Postgres 18") { + t.Error("maintenance page does not render the Markdown description") + } + + // Status pages show the component under maintenance. + slug := uniq("mtp-") + _, sp := owner.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": slug, "title": "Acme", "description": "See [docs](https://docs.example)"}) + pageID := sp["id"].(string) + _, m2 := owner.do("POST", "/api/v1/org/monitors", map[string]any{ + "name": "Replica", "type": "tcp", "target": "db2.example.com:5432", "interval_seconds": 3600, "regions": []string{region}, "group_id": db, + }) + owner.do("PUT", "/api/v1/org/statuspages/"+pageID+"/monitors", map[string]any{"monitors": []map[string]any{ + {"monitor_id": monitor.String(), "section": "", "label": "Database"}, + {"monitor_id": m2["id"].(string), "section": "", "label": "Replica"}, + }}) + owner.do("PUT", "/api/v1/org/statuspages/"+pageID, map[string]any{"slug": slug, "title": "Acme", "description": "See [docs](https://docs.example)", "published": true}) + snap, err := e.statuspageClient(t, nil).Page(context.Background(), "", slug) + if err != nil { + t.Fatal(err) + } + // One occurrence covering two components is listed once. + if len(snap.Maintenance) != 1 || strings.Join(snap.Maintenance[0].Components, ",") != "Database,Replica" { + t.Fatalf("snapshot maintenance = %+v", snap.Maintenance) + } + if got := snap.WithMaintenance(time.Now()); got.Status != agentapi.PageUnderMaintenance || got.Sections[0].Components[0].Status != agentapi.PageUnderMaintenance { + t.Errorf("WithMaintenance() = %s / %+v", got.Status, got.Sections) + } + if got := snap.WithMaintenance(time.Now().Add(2 * time.Hour)); got.Status == agentapi.PageUnderMaintenance { + t.Error("page still under maintenance after it ended") + } + + // Members limited to another group may not plan maintenance here. + scopedEmail := "s@" + uniq("mt") + ".test" + scoped := e.joinVia(t, owner.invite(scopedEmail, owner.roleID("viewer"))) + st, body = owner.do("POST", "/api/v1/org/members/"+owner.userID(scopedEmail)+"/roles", map[string]any{ + "role_id": owner.roleID("editor"), "resource_type": "monitor_group", "resource_id": other, + }) + expect(t, "assign scoped editor", st, body, http.StatusCreated, "") + st, body = scoped.do("POST", "/api/v1/org/maintenance", window) + expect(t, "scoped editor targets foreign group", st, body, http.StatusForbidden, "forbidden") + st, body = scoped.do("DELETE", "/api/v1/org/maintenance/"+windowID, nil) + expect(t, "scoped editor deletes foreign maintenance", st, body, http.StatusForbidden, "forbidden") + w2 := map[string]any{} + for k, v := range window { + w2[k] = v + } + w2["group_ids"] = []string{other} + w2["recurrence"], w2["weekdays"] = "weekly", []string{"1", "4"} + st, body = scoped.do("POST", "/api/v1/org/maintenance", w2) + if st != http.StatusCreated || body["next"] == nil { + t.Errorf("scoped editor plans weekly maintenance for own group = %d %v", st, body) + } + + // Without maintenance the failure alerts again. + st, body = owner.do("DELETE", "/api/v1/org/maintenance/"+windowID, nil) + expect(t, "delete maintenance", st, body, http.StatusNoContent, "") + report(false) + if _, inc := owner.do("GET", "/api/v1/org/incidents", nil); len(inc["incidents"].([]any)) != 1 { + t.Errorf("no incident after the maintenance ended: %v", inc) + } +} + +func TestEditMaintenanceReplacesTargets(t *testing.T) { + e := newEnv(t) + _, region := e.platformChecker(t, uniq("eu-")) + owner := e.browser(t) + owner.signup("o@"+uniq("me")+".test", uniq("me-")) + a, b := owner.group("A", ""), owner.group("B", "") + _, m := owner.do("POST", "/api/v1/org/monitors", map[string]any{ + "name": "M", "type": "tcp", "target": "example.com:443", "interval_seconds": 3600, "regions": []string{region}, + }) + req := map[string]any{ + "title": "Patch", "start": "2030-01-01T02:00", "time_zone": "Europe/Berlin", "duration_minutes": 30, + "recurrence": "monthly", "until": "2030-12-31", "group_ids": []string{a}, + } + _, body := owner.do("POST", "/api/v1/org/maintenance", req) + id := body["id"].(string) + req["group_ids"], req["monitor_ids"], req["title"] = []string{b}, []string{m["id"].(string)}, "Patch v2" + st, body := owner.do("PUT", "/api/v1/org/maintenance/"+id, req) + if st != http.StatusOK || body["title"] != "Patch v2" { + t.Fatalf("update = %d %v", st, body) + } + _, list := owner.do("GET", "/api/v1/org/maintenance", nil) + got := list["maintenance"].([]any)[0].(map[string]any) + if mustJSON(got["group_ids"]) != `["`+b+`"]` || len(got["monitor_ids"].([]any)) != 1 || got["until"] != "2030-12-31" { + t.Errorf("after update = %v", got) + } + next, _ := time.Parse(time.RFC3339, got["next"].(map[string]any)["start"].(string)) + if want := time.Date(2030, 1, 1, 1, 0, 0, 0, time.UTC); !next.Equal(want) { + t.Errorf("next start = %v, want 02:00 Berlin = %v", next, want) + } + if _, _, page := owner.page("/maintenance?edit=" + id); !strings.Contains(page, `value="Patch v2"`) { + t.Error("edit form is not prefilled") + } +} diff --git a/internal/api/server.go b/internal/api/server.go index 2890511..598af42 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -123,6 +123,10 @@ func (s *Server) Mount(r gin.IRouter) { org.POST("/monitors", s.createMonitor) org.PUT("/monitors/:id", s.updateMonitor) org.DELETE("/monitors/:id", s.deleteMonitor) + org.GET("/maintenance", s.listMaintenance) + org.POST("/maintenance", s.createMaintenance) + org.PUT("/maintenance/:id", s.updateMaintenance) + org.DELETE("/maintenance/:id", s.deleteMaintenance) org.GET("/groups", s.listGroups) org.POST("/groups", s.createGroup) org.PUT("/groups/:id", s.updateGroup) diff --git a/internal/api/statuspages.go b/internal/api/statuspages.go index 1ad1f8c..5fc607e 100644 --- a/internal/api/statuspages.go +++ b/internal/api/statuspages.go @@ -52,6 +52,7 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen open []store.Incident daily []store.DailyBucketsForMonitorsRow incidents []store.Incident + planned map[uuid.UUID][]store.MaintenanceWindow ) now := time.Now() err := s.db.Tx(ctx, tenant.Org(page.OrgID, uuid.Nil), func(q *store.Queries) error { @@ -77,6 +78,9 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen if incidents, err = q.IncidentsForMonitors(ctx, store.IncidentsForMonitorsParams{Ids: ids, Since: ptr(now.Add(-incidentLookback))}); err != nil { return err } + if planned, err = maintenanceFor(ctx, q, ids); err != nil { + return err + } docs, err := q.LegalDocuments(ctx, &page.OrgID) snap.Legal = mergeLegal(docs) return err @@ -101,8 +105,7 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen days[d.MonitorID] = append(days[d.MonitorID], web.Bucket{Start: d.Bucket, Total: d.Total, OK: d.OkCount}) } names := map[uuid.UUID]string{} - worst := agentapi.PageOperational - allUnknown, allDown := true, len(listed) > 0 + var states []string for _, m := range listed { name := m.Label if name == "" { @@ -120,44 +123,21 @@ func (s *Server) buildSnapshot(ctx context.Context, page store.StatusPage) (agen default: comp.Status = agentapi.PageOperational } - if comp.Status != agentapi.PageUnknown { - allUnknown = false - } - if comp.Status != agentapi.PageOutage { - allDown = false - } - worst = worse(worst, comp.Status) + states = append(states, comp.Status) if n := len(snap.Sections); n == 0 || snap.Sections[n-1].Name != m.Section { snap.Sections = append(snap.Sections, agentapi.Section{Name: m.Section}) } last := &snap.Sections[len(snap.Sections)-1] last.Components = append(last.Components, comp) } - // A single failed component is a partial problem; only a complete - // failure is reported as an outage of the whole page. - snap.Status = worst - switch { - case allUnknown: - snap.Status = agentapi.PageUnknown - case worst == agentapi.PageOutage && !allDown: - snap.Status = agentapi.PageDegraded - } + snap.Status = agentapi.Summarize(states) + snap.Maintenance = pageMaintenance(planned, names, now) for _, i := range incidents { snap.Incidents = append(snap.Incidents, agentapi.PageIncident{Component: names[i.MonitorID], StartedAt: i.StartedAt, ResolvedAt: i.ResolvedAt}) } return snap, nil } -// worse returns the more severe state; unknown components do not make the -// whole page look broken. -func worse(a, b string) string { - rank := map[string]int{agentapi.PageOperational: 0, agentapi.PageUnknown: 0, agentapi.PageDegraded: 1, agentapi.PageOutage: 2} - if rank[b] > rank[a] { - return b - } - return a -} - func dayHistory(buckets []web.Bucket, now time.Time) []agentapi.Day { byDay := map[string]web.Bucket{} for _, b := range buckets { @@ -214,7 +194,7 @@ func (s *Server) agentPage(c *gin.Context) { type statusPageRequest struct { Slug string `json:"slug" binding:"required,max=63"` Title string `json:"title" binding:"required,max=200"` - Description string `json:"description" binding:"max=2000"` + Description string `json:"description" binding:"max=10000"` Published bool `json:"published"` Theme agentapi.Theme `json:"theme"` } @@ -568,5 +548,52 @@ func (s *Server) exportStatusPage(c *gin.Context) { return } c.Header("Content-Disposition", `attachment; filename="`+row.Slug+`.html"`) - web.Render(c, http.StatusOK, web.PublicStatusPage(snap, web.PublicAssets{InlineCSS: css})) + web.Render(c, http.StatusOK, web.PublicStatusPage(snap.WithMaintenance(time.Now()), web.PublicAssets{InlineCSS: css, Now: time.Now()})) +} + +// pageMaintenance lists the occurrences affecting the page's components +// from an hour ago, so a snapshot cached just before still knows about +// maintenance in progress, to two weeks ahead. +func pageMaintenance(planned map[uuid.UUID][]store.MaintenanceWindow, names map[uuid.UUID]string, now time.Time) []agentapi.PageMaintenance { + // Occurrences are matched by instant: time.Time values of the same + // instant differ as map keys when their locations were loaded apart. + type key struct { + window uuid.UUID + start int64 + } + byKey := map[key]*agentapi.PageMaintenance{} + var order []key + for monitor, ws := range planned { + name, listed := names[monitor] + if !listed { + continue + } + for _, w := range ws { + for _, occ := range ruleOf(w).Occurrences(now.Add(-time.Hour), now.Add(upcomingHorizon)) { + k := key{w.ID, occ.Start.UnixNano()} + m, ok := byKey[k] + if !ok { + m = &agentapi.PageMaintenance{Title: w.Title, Description: w.Description, Start: occ.Start, End: occ.End} + byKey[k] = m + order = append(order, k) + } + if !slices.Contains(m.Components, name) { + m.Components = append(m.Components, name) + } + } + } + } + out := make([]agentapi.PageMaintenance, 0, len(order)) + for _, k := range order { + m := *byKey[k] + slices.Sort(m.Components) + out = append(out, m) + } + slices.SortFunc(out, func(a, b agentapi.PageMaintenance) int { + if c := a.Start.Compare(b.Start); c != 0 { + return c + } + return strings.Compare(a.Title, b.Title) + }) + return out } diff --git a/internal/i18n/i18n_test.go b/internal/i18n/i18n_test.go index 195a288..4061794 100644 --- a/internal/i18n/i18n_test.go +++ b/internal/i18n/i18n_test.go @@ -70,6 +70,7 @@ var usagePatterns = []struct { {re: regexp.MustCompile(`code = "([a-z_]+)"`), prefix: "error."}, {re: regexp.MustCompile(`\binvalid\("([a-z_]+)"\)`), prefix: "error."}, {re: regexp.MustCompile(`NoticeID = "([a-z0-9_.]+)"`)}, + {re: regexp.MustCompile(`@labeled\("([a-z0-9_.]+)"\)`)}, {re: regexp.MustCompile(`@(?:settingsHeading|sectionHeading)\("([a-z0-9_.]+)"`)}, {re: regexp.MustCompile(`@settingsHeading\("[a-z0-9_.]+", "([a-z0-9_.]+)"`)}, {re: regexp.MustCompile(`@policyBanner\("([a-z0-9_.]+)", "([a-z0-9_.]+)"`)}, @@ -149,15 +150,17 @@ func TestEveryMailEventHasTexts(t *testing.T) { func TestDynamicFamilies(t *testing.T) { en := catalogKeys(t)["en"] families := map[string][]string{ - "status.": {"up", "degraded", "down", "unknown", "paused"}, - "monitors.type_": {"http", "tcp", "tls", "dns", "icmp"}, - "channels.type_": {"webhook", "email"}, - "agents.kind_": {"checker", "statuspage"}, - "page.status.": {"operational", "degraded", "outage", "unknown"}, - "page.component.": {"operational", "degraded", "outage", "unknown"}, - "storage.level_": {"raw", "1h", "1d"}, - "legal.": {"imprint", "privacy"}, - "storage.job_": {"compression", "retention", "refresh_continuous_aggregate", "job_stat_history_retention"}, + "status.": {"up", "degraded", "down", "unknown", "paused", "maintenance"}, + "monitors.type_": {"http", "tcp", "tls", "dns", "icmp"}, + "channels.type_": {"webhook", "email"}, + "agents.kind_": {"checker", "statuspage"}, + "page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"}, + "page.component.": {"operational", "degraded", "outage", "unknown", "maintenance"}, + "storage.level_": {"raw", "1h", "1d"}, + "legal.": {"imprint", "privacy"}, + "weekday.": {"0", "1", "2", "3", "4", "5", "6"}, + "maintenance.recurrence_": {"none", "daily", "weekly", "monthly"}, + "storage.job_": {"compression", "retention", "refresh_continuous_aggregate", "job_stat_history_retention"}, } for prefix, values := range families { for _, v := range values { diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index 2af18d8..e84b18c 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -32,6 +32,9 @@ "audit.action.group.update": "Gruppe geändert", "audit.action.invitation.create": "Einladung verschickt", "audit.action.invitation.delete": "Einladung zurückgezogen", + "audit.action.maintenance.create": "Wartung geplant", + "audit.action.maintenance.delete": "Wartung gelöscht", + "audit.action.maintenance.update": "Wartung geändert", "audit.action.member.join": "Der Organisation beigetreten", "audit.action.member.remove": "Mitglied entfernt", "audit.action.member.role_assign": "Rolle zugewiesen", @@ -104,6 +107,9 @@ "channels.type_email": "E-Mail", "channels.type_webhook": "Webhook", "channels.url": "Webhook-URL", + "common.delete": "Löschen", + "common.edit": "Bearbeiten", + "common.markdown_hint": "Markdown wird unterstützt: **fett**, _kursiv_, [Links](https://…), Listen. HTML wird nicht dargestellt.", "common.no": "nein", "common.save": "Speichern", "common.yes": "ja", @@ -152,6 +158,8 @@ "error.invalid_input": "Eingaben prüfen.", "error.invalid_interval": "Das Intervall muss mindestens {{.Min}} Sekunden und höchstens einen Tag betragen.", "error.invalid_legal_url": "Der Link muss eine http- oder https-URL sein.", + "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_method": "Nur GET- und HEAD-Anfragen werden unterstützt.", "error.invalid_monitor": "Einer der Monitore existiert nicht oder ist doppelt aufgeführt.", "error.invalid_permissions": "Mindestens eine Berechtigung auswählen.", @@ -162,6 +170,7 @@ "error.invalid_slug": "Kurzname: 2–63 Zeichen, a–z, 0–9 und Bindestrich.", "error.invalid_target": "Das Ziel passt nicht zu diesem Check-Typ.", "error.invalid_theme": "Die Theme-Einstellungen sind ungültig: Akzent als #rrggbb, Logo als https-URL, CSS ohne \"short _gaps_.", Components: []string{"Database"}, + Start: now.Add(30 * time.Minute), End: now.Add(90 * time.Minute), + }}, + } + h := newHarness(t, src, t.TempDir(), &now) + _, page := h.get("status.example.test", "/acme") + if !strings.Contains(page, "Geplante Wartung") || strings.Contains(page, "Laufende Wartung") { + t.Error("upcoming maintenance is not announced as planned") + } + if !strings.Contains(page, "Acme") || !strings.Contains(page, "gaps") || strings.Contains(page, "short") { + t.Error("descriptions are not rendered as safe Markdown") + } + + src.mu.Lock() + src.err = errors.New("connection refused") + src.mu.Unlock() + now = now.Add(45 * time.Minute) + _, page = h.get("status.example.test", "/acme") + if !strings.Contains(page, "Laufende Wartung") || !strings.Contains(page, "Geplante Wartung läuft") { + t.Error("maintenance in progress is not shown from the cache") + } + now = now.Add(time.Hour) + if _, page = h.get("status.example.test", "/acme"); strings.Contains(page, "Wartung") { + t.Error("ended maintenance is still shown") + } +} diff --git a/internal/web/assets/app.css b/internal/web/assets/app.css index fe21ab8..cceb604 100644 --- a/internal/web/assets/app.css +++ b/internal/web/assets/app.css @@ -54,6 +54,7 @@ --color-down: #b3361f; --color-degraded: #b57b14; --color-unknown: #8a8a86; + --color-maintenance: #3d6fa6; --radius-box: 2px; } diff --git a/internal/web/assets/app.js b/internal/web/assets/app.js index 62c5fa2..146746f 100644 --- a/internal/web/assets/app.js +++ b/internal/web/assets/app.js @@ -188,3 +188,8 @@ location.reload(); }); })(); + +// Time zone fields start with the browser's zone. +for (const el of document.querySelectorAll("input[data-tz-default]")) { + if (!el.value) el.value = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"; +} diff --git a/internal/web/charts.go b/internal/web/charts.go index 07dafd6..be6c6ef 100644 --- a/internal/web/charts.go +++ b/internal/web/charts.go @@ -17,6 +17,9 @@ const ( StatusDown Status = "down" StatusUnknown Status = "unknown" StatusPaused Status = "paused" + // StatusMaintenance covers planned maintenance, during which failures + // are expected. + StatusMaintenance Status = "maintenance" ) // Bar is one bucket of an uptime bar chart. diff --git a/internal/web/console.templ b/internal/web/console.templ index d4b9f9a..b340e80 100644 --- a/internal/web/console.templ +++ b/internal/web/console.templ @@ -54,6 +54,7 @@ templ consoleShell(p Page, me Me) { } if me.Can["incidents.read"] { { i18n.T(ctx, "incidents.title") } + { i18n.T(ctx, "maintenance.title") } } ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -274,7 +287,7 @@ func consoleShell(p Page, me Me) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -286,7 +299,7 @@ func consoleShell(p Page, me Me) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -323,7 +336,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var13 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var14 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -335,51 +348,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var14 string - templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 90, Col: 72} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading")) + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 92, Col: 114} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 91, Col: 72} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "

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

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var16 string + templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 93, Col: 114} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if me.TOTP { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "

● ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "

● ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var16 string - templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active")) + var templ_7745c5c3_Var17 string + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 94, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 95, Col: 98} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -387,25 +400,25 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer templ_7745c5c3_Buffer := templ.GetBuffer() var templ_7745c5c3_ElementScripts []templ.ComponentScript - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "

= 3)} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var17...) + var templ_7745c5c3_Var18 = []any{"mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var18...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var18 string - templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var17).String()).Resolve(ctx) + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var18).String()).Resolve(ctx) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 1, Col: 0} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "\"") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -419,33 +432,33 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud } templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, ">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var19 string - templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 96, Col: 75} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var20 string - templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.regenerate")) + templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 99, Col: 116} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 97, Col: 75} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var21 string + templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.regenerate")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 100, Col: 116} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -469,20 +482,20 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var21 string - templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.disable")) + var templ_7745c5c3_Var22 string + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.disable")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 109, Col: 109} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 110, Col: 109} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -502,51 +515,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "

● ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.inactive")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 118, Col: 105} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var25 string - templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading")) + var templ_7745c5c3_Var26 string + templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 135, Col: 113} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 136, Col: 113} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(identities) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var26 string - templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none")) + var templ_7745c5c3_Var27 string + templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 137, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 138, Col: 73} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, id := range identities { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
    • ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var27 string - templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 141, Col: 69} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var28 string - templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email) + templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 141, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 142, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var29 string + templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 142, Col: 131} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if canLink { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "\" class=\"inline-block border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var31 string + templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.link")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 147, Col: 190} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -688,20 +701,20 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var31 string - templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.activity_intro")) + var templ_7745c5c3_Var32 string + templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.activity_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 151, Col: 88} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 152, Col: 88} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -709,7 +722,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -719,7 +732,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var13), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -746,33 +759,33 @@ func recoveryOutput() templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -797,46 +810,46 @@ func policyBanner(msgID, actionID, href string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var36 string - templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, msgID)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 171, Col: 23} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var37 string - templ_7745c5c3_Var37, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx) + templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, msgID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 172, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 172, Col: 23} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\" class=\"underline underline-offset-2\">") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\" class=\"underline underline-offset-2\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var39 string + templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, actionID)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 173, Col: 95} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -861,46 +874,46 @@ func settingsLink(href, titleID, hintID string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\" class=\"block border border-rule p-4 hover:border-ink\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var42 string - templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, hintID)) + templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 180, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 180, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var43 string + templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, hintID)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 181, Col: 67} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -926,7 +939,7 @@ func SettingsIndex(p Page, me Me) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var44 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var45 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -942,7 +955,7 @@ func SettingsIndex(p Page, me Me) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1000,13 +1013,13 @@ func SettingsIndex(p Page, me Me) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var44), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var45), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/maintenance.go b/internal/web/maintenance.go new file mode 100644 index 0000000..5fc2362 --- /dev/null +++ b/internal/web/maintenance.go @@ -0,0 +1,27 @@ +package web + +import "fmt" + +const inputClass = "w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink" + +// commonTimeZones are suggested in the time zone field; any IANA name works. +var commonTimeZones = []string{ + "UTC", "Europe/Berlin", "Europe/Vienna", "Europe/Zurich", "Europe/London", "Europe/Paris", + "Europe/Amsterdam", "America/New_York", "America/Chicago", "America/Los_Angeles", "Asia/Tokyo", "Asia/Singapore", "Australia/Sydney", +} + +func maintenanceAPI(id string) string { + if id == "" { + return "/org/maintenance" + } + return "/org/maintenance/" + id +} + +func maintenanceMethod(id string) string { + if id == "" { + return "post" + } + return "put" +} + +func indent(depth int) string { return fmt.Sprintf("padding-left:%drem", depth) } diff --git a/internal/web/maintenance.templ b/internal/web/maintenance.templ new file mode 100644 index 0000000..ea04b94 --- /dev/null +++ b/internal/web/maintenance.templ @@ -0,0 +1,217 @@ +package web + +import ( + "strconv" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" +) + +// MaintenanceView is the maintenance page: planned windows and the form to +// add or edit one. +type MaintenanceView struct { + Windows []MaintenanceRow + Form MaintenanceForm + Monitors []TargetOption + Groups []TargetOption + CanWrite bool +} + +// MaintenanceRow is one planned window. +type MaintenanceRow struct { + ID string + Title string + Schedule string + Targets string + Next string + Active bool + Description string + CanWrite bool +} + +// MaintenanceForm holds the values of the form; ID is empty for a new window. +type MaintenanceForm struct { + ID string + Title string + Description string + Start string + TimeZone string + Duration int + Recurrence string + Every int + Weekdays map[int]bool + Until string + Monitors map[string]bool + Groups map[string]bool +} + +// TargetOption is a monitor or group to choose; Depth indents groups. +type TargetOption struct { + ID string + Name string + Depth int +} + +templ maintenanceList(items []MaintenanceItem) { +
    + for _, m := range items { +
  • +
    + @statusDot(StatusMaintenance) + { m.Title } + if m.Active { + { i18n.T(ctx, "maintenance.in_progress") } + } +
    +

    { m.When }

    + if m.Description != "" { + + } +
  • + } +
+} + +templ MaintenancePage(p Page, me Me, v MaintenanceView) { + @consoleShell(p, me) { + @settingsHeading("maintenance.title", "maintenance.intro") + if len(v.Windows) == 0 { +

{ i18n.T(ctx, "maintenance.empty") }

+ } else { +
    + for _, w := range v.Windows { +
  • +
    +
    + @statusDot(StatusMaintenance) + { w.Title } + if w.Active { + { i18n.T(ctx, "maintenance.in_progress") } + } +
    +

    { w.Schedule }

    +

    { w.Targets }

    + if w.Next != "" { +

    { i18n.T(ctx, "maintenance.next", "Time", w.Next) }

    + } + if w.Description != "" { + + } +
    + if w.CanWrite { +
    + { i18n.T(ctx, "common.edit") } + +
    + } +
  • + } +
+ } + if v.CanWrite { + @maintenanceForm(v) + } + } +} + +templ maintenanceForm(v MaintenanceView) { +
+ if v.Form.ID == "" { + @sectionHeading("maintenance.new") + } else { + @sectionHeading("maintenance.edit") + } +
+ @formError() + @labeled("maintenance.field_title") { + + } + @labeled("maintenance.field_description") { + + { i18n.T(ctx, "common.markdown_hint") } + } +
+ @labeled("maintenance.field_start") { + + } + @labeled("maintenance.field_duration") { + + } + @labeled("maintenance.field_time_zone") { + + + for _, tz := range commonTimeZones { + + } + + } +
+
+ @labeled("maintenance.field_recurrence") { + + } + @labeled("maintenance.field_every") { + + } + @labeled("maintenance.field_until") { + + } +
+
+ { i18n.T(ctx, "maintenance.field_weekdays") } +
+ for _, d := range []int{1, 2, 3, 4, 5, 6, 0} { + + } +
+ { i18n.T(ctx, "maintenance.weekdays_hint") } +
+
+
+ { i18n.T(ctx, "maintenance.field_groups") } +
+ for _, g := range v.Groups { + + } +
+
+
+ { i18n.T(ctx, "maintenance.field_monitors") } +
+ for _, m := range v.Monitors { + + } +
+
+
+ @submit(i18n.T(ctx, "common.save")) +
+
+} + +templ labeled(labelID string) { + +} diff --git a/internal/web/maintenance_templ.go b/internal/web/maintenance_templ.go new file mode 100644 index 0000000..ec3bd30 --- /dev/null +++ b/internal/web/maintenance_templ.go @@ -0,0 +1,1419 @@ +// 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 ( + "strconv" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" +) + +// MaintenanceView is the maintenance page: planned windows and the form to +// add or edit one. +type MaintenanceView struct { + Windows []MaintenanceRow + Form MaintenanceForm + Monitors []TargetOption + Groups []TargetOption + CanWrite bool +} + +// MaintenanceRow is one planned window. +type MaintenanceRow struct { + ID string + Title string + Schedule string + Targets string + Next string + Active bool + Description string + CanWrite bool +} + +// MaintenanceForm holds the values of the form; ID is empty for a new window. +type MaintenanceForm struct { + ID string + Title string + Description string + Start string + TimeZone string + Duration int + Recurrence string + Every int + Weekdays map[int]bool + Until string + Monitors map[string]bool + Groups map[string]bool +} + +// TargetOption is a monitor or group to choose; Depth indents groups. +type TargetOption struct { + ID string + Name string + Depth int +} + +func maintenanceList(items []MaintenanceItem) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, m := range items { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = statusDot(StatusMaintenance).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 60, Col: 40} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if m.Active { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 62, Col: 95} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(m.When) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 65, Col: 64} + } + _, 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, 8, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if m.Description != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.Raw(m.Description).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func MaintenancePage(p Page, me Me, v MaintenanceView) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = settingsHeading("maintenance.title", "maintenance.intro").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(v.Windows) == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var7 string + templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.empty")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 80, Col: 73} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, w := range v.Windows { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = statusDot(StatusMaintenance).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var8 string + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.Title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 88, Col: 43} + } + _, 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, 18, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if w.Active { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.in_progress")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 90, Col: 98} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(w.Schedule) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 93, Col: 61} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var11 string + templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(w.Targets) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 94, Col: 53} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if w.Next != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.next", "Time", w.Next)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 96, Col: 102} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + if w.Description != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.Raw(w.Description).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if w.CanWrite { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var14 string + templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.edit")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 106, Col: 125} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if v.CanWrite { + templ_7745c5c3_Err = maintenanceForm(v).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func maintenanceForm(v MaintenanceView) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if v.Form.ID == "" { + templ_7745c5c3_Err = sectionHeading("maintenance.new").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = sectionHeading("maintenance.edit").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = formError().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var21 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_title").Render(templ.WithChildren(ctx, templ_7745c5c3_Var21), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var25 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var29 string + templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.markdown_hint")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 138, Col: 85} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_description").Render(templ.WithChildren(ctx, templ_7745c5c3_Var25), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var30 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_start").Render(templ.WithChildren(ctx, templ_7745c5c3_Var30), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var34 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_duration").Render(templ.WithChildren(ctx, templ_7745c5c3_Var34), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var38 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, tz := range commonTimeZones { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_time_zone").Render(templ.WithChildren(ctx, templ_7745c5c3_Var38), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var43 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_recurrence").Render(templ.WithChildren(ctx, templ_7745c5c3_Var43), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var48 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_every").Render(templ.WithChildren(ctx, templ_7745c5c3_Var48), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var52 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + { + templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer + templ_7745c5c3_Buffer := templ.GetBuffer() + var templ_7745c5c3_ElementScripts []templ.ComponentScript + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = labeled("maintenance.field_until").Render(templ.WithChildren(ctx, templ_7745c5c3_Var52), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var56 string + templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_weekdays")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 172, Col: 124} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, d := range []int{1, 2, 3, 4, 5, 6, 0} { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var59 string + templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.weekdays_hint")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 181, Col: 90} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var60 string + templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_groups")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 185, Col: 123} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, g := range v.Groups { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var64 string + templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.field_monitors")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/maintenance.templ`, Line: 196, Col: 125} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, m := range v.Monitors { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = submit(i18n.T(ctx, "common.save")).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func labeled(labelID 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) + templ_7745c5c3_Var67 := templ.GetChildren(ctx) + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/internal/web/monitors.templ b/internal/web/monitors.templ index 5ebbd51..6a6c06b 100644 --- a/internal/web/monitors.templ +++ b/internal/web/monitors.templ @@ -103,6 +103,7 @@ templ statusDot(s Status) { templ.KV("bg-degraded", s == StatusDegraded), templ.KV("bg-down", s == StatusDown), templ.KV("bg-unknown", s == StatusUnknown), + templ.KV("bg-maintenance", s == StatusMaintenance), templ.KV("border border-unknown", s == StatusPaused) } title={ i18n.T(ctx, "status."+string(s)) } > @@ -140,7 +141,7 @@ templ Dashboard(p Page, me Me, v DashboardView) {

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

@rangeSwitch(v.Ranges) - for _, s := range []Status{StatusUp, StatusDegraded, StatusDown, StatusPaused} { + for _, s := range []Status{StatusUp, StatusDegraded, StatusDown, StatusMaintenance, StatusPaused} { if v.Counts[s] > 0 { @statusDot(s) @@ -243,6 +244,16 @@ type MonitorDetailView struct { Recent []ResultRow Incidents []IncidentRow CanWrite bool + // Maintenance lists current and upcoming maintenance. + Maintenance []MaintenanceItem +} + +// MaintenanceItem is one occurrence of planned maintenance. +type MaintenanceItem struct { + Title string + When string + Description string + Active bool } templ MonitorDetail(p Page, me Me, v MonitorDetailView) { @@ -295,6 +306,12 @@ templ MonitorDetail(p Page, me Me, v MonitorDetailView) {

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

} + if len(v.Maintenance) > 0 { +
+ @sectionHeading("maintenance.title") + @maintenanceList(v.Maintenance) +
+ }
@sectionHeading("monitors.sla_table")
diff --git a/internal/web/monitors_templ.go b/internal/web/monitors_templ.go index 0b4fe9f..3413de3 100644 --- a/internal/web/monitors_templ.go +++ b/internal/web/monitors_templ.go @@ -246,6 +246,7 @@ func statusDot(s Status) templ.Component { templ.KV("bg-degraded", s == StatusDegraded), templ.KV("bg-down", s == StatusDown), templ.KV("bg-unknown", s == StatusUnknown), + templ.KV("bg-maintenance", s == StatusMaintenance), templ.KV("border border-unknown", s == StatusPaused)} templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var9...) if templ_7745c5c3_Err != nil { @@ -267,7 +268,7 @@ func statusDot(s Status) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "status."+string(s))).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 107, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 108, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11) if templ_7745c5c3_Err != nil { @@ -319,7 +320,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templruntime.NewAttributeExpression("0 0 " + strconv.Itoa(len(bs)*4) + " " + strconv.Itoa(height)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 113, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 114, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13) if templ_7745c5c3_Err != nil { @@ -332,7 +333,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("height:" + strconv.Itoa(height) + "px") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 116, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 117, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -345,7 +346,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "monitors.uptime_chart")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 118, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 119, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15) if templ_7745c5c3_Err != nil { @@ -367,7 +368,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(i * 4)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 122, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 123, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16) if templ_7745c5c3_Err != nil { @@ -380,7 +381,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(height)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 125, Col: 33} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 126, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17) if templ_7745c5c3_Err != nil { @@ -428,7 +429,7 @@ func bars(bs []Bar, height int) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(b.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 131, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 132, Col: 20} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -483,7 +484,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 140, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 141, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -497,7 +498,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for _, s := range []Status{StatusUp, StatusDegraded, StatusDown, StatusPaused} { + for _, s := range []Status{StatusUp, StatusDegraded, StatusDown, StatusMaintenance, StatusPaused} { if v.Counts[s] > 0 { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "") if templ_7745c5c3_Err != nil { @@ -514,7 +515,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.Counts[s])) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 147, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 148, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -534,7 +535,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.new")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 152, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 153, Col: 131} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -557,7 +558,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 157, Col: 111} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 158, Col: 111} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -589,7 +590,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.range_note", "Range", v.Range)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 165, Col: 103} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 166, Col: 103} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -607,7 +608,7 @@ func Dashboard(p Page, me Me, v DashboardView) templ.Component { var templ_7745c5c3_Var28 string templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "groups.manage")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 167, Col: 108} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 168, Col: 108} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { @@ -657,7 +658,7 @@ func monitorList(ms []MonitorRow) templ.Component { var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/monitors/" + m.ID)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 176, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 177, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30) if templ_7745c5c3_Err != nil { @@ -678,7 +679,7 @@ func monitorList(ms []MonitorRow) templ.Component { var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(m.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 180, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 181, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { @@ -691,7 +692,7 @@ func monitorList(ms []MonitorRow) templ.Component { var templ_7745c5c3_Var32 string templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(m.Type) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 181, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 182, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { @@ -704,7 +705,7 @@ func monitorList(ms []MonitorRow) templ.Component { var templ_7745c5c3_Var33 string templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(m.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 181, Col: 90} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 182, Col: 90} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) if templ_7745c5c3_Err != nil { @@ -725,7 +726,7 @@ func monitorList(ms []MonitorRow) templ.Component { var templ_7745c5c3_Var34 string templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(m.Latency) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 185, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 186, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) if templ_7745c5c3_Err != nil { @@ -738,7 +739,7 @@ func monitorList(ms []MonitorRow) templ.Component { var templ_7745c5c3_Var35 string templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(m.Uptime) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 186, Col: 83} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 187, Col: 83} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) if templ_7745c5c3_Err != nil { @@ -792,7 +793,7 @@ func groupBlock(g GroupNode) templ.Component { var templ_7745c5c3_Var37 string templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 200, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 201, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { @@ -805,7 +806,7 @@ func groupBlock(g GroupNode) templ.Component { var templ_7745c5c3_Var38 string templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(g.Total)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 201, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 202, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38)) if templ_7745c5c3_Err != nil { @@ -867,6 +868,16 @@ type MonitorDetailView struct { Recent []ResultRow Incidents []IncidentRow CanWrite bool + // Maintenance lists current and upcoming maintenance. + Maintenance []MaintenanceItem +} + +// MaintenanceItem is one occurrence of planned maintenance. +type MaintenanceItem struct { + Title string + When string + Description string + Active bool } func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { @@ -905,7 +916,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var41 string templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 250, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 261, Col: 115} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) if templ_7745c5c3_Err != nil { @@ -926,7 +937,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var42 string templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 255, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 266, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42)) if templ_7745c5c3_Err != nil { @@ -939,7 +950,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var43 string templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Type) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 257, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 268, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { @@ -952,7 +963,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var44 string templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 257, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 268, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44)) if templ_7745c5c3_Err != nil { @@ -965,7 +976,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var45 string templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(v.Interval) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 257, Col: 99} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 268, Col: 99} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45)) if templ_7745c5c3_Err != nil { @@ -983,7 +994,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var46 string templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/monitors/" + v.Row.ID + "/edit")).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 260, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 271, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46) if templ_7745c5c3_Err != nil { @@ -996,7 +1007,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var47 string templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 260, Col: 173} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 271, Col: 173} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) if templ_7745c5c3_Err != nil { @@ -1014,7 +1025,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var48 string templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.history", "Range", v.Range)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 265, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 276, Col: 123} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48)) if templ_7745c5c3_Err != nil { @@ -1035,7 +1046,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var49 string templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.sla")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 269, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 280, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) if templ_7745c5c3_Err != nil { @@ -1048,7 +1059,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var50 string templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(v.Row.Uptime) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 270, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 281, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50)) if templ_7745c5c3_Err != nil { @@ -1070,7 +1081,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var51 string templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.latency")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 275, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 286, Col: 44} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51)) if templ_7745c5c3_Err != nil { @@ -1083,7 +1094,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var52 string templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.Latency.MaxMS)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 276, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 287, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52)) if templ_7745c5c3_Err != nil { @@ -1096,7 +1107,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var53 string templ_7745c5c3_Var53, templ_7745c5c3_Err = templruntime.NewAttributeExpression("0 0 " + strconv.Itoa(v.Latency.Width) + " " + strconv.Itoa(v.Latency.Height)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 278, Col: 96} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 289, Col: 96} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var53) if templ_7745c5c3_Err != nil { @@ -1109,7 +1120,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var54 string templ_7745c5c3_Var54, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Latency.Points).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 279, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 290, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var54) if templ_7745c5c3_Err != nil { @@ -1145,7 +1156,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var55 string templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 289, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 300, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55)) if templ_7745c5c3_Err != nil { @@ -1188,7 +1199,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var58 string templ_7745c5c3_Var58, templ_7745c5c3_Err = templruntime.NewAttributeExpression(partialTitle(ctx, !r.Enough)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 291, Col: 127} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 302, Col: 127} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var58) if templ_7745c5c3_Err != nil { @@ -1215,7 +1226,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var59 string templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(r.Uptime) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 291, Col: 140} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 302, Col: 140} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59)) if templ_7745c5c3_Err != nil { @@ -1233,7 +1244,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { var templ_7745c5c3_Var60 string templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.by_region_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 295, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 306, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60)) if templ_7745c5c3_Err != nil { @@ -1244,7 +1255,29 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(v.Maintenance) > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sectionHeading("maintenance.title").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = maintenanceList(v.Maintenance).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1252,7 +1285,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1261,7 +1294,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer templ_7745c5c3_Buffer := templ.GetBuffer() var templ_7745c5c3_ElementScripts []templ.ComponentScript - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, ">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var64 string templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(e.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 303, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 320, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var65 string templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(e.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 304, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 321, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1345,20 +1378,20 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var66 string templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(v.Uptime90) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 312, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 329, Col: 48} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1366,7 +1399,7 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1374,12 +1407,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range v.Row.Regions { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1387,43 +1420,43 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var67 string templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 323, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 340, Col: 21} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var68 string templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 324, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 341, Col: 77} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(v.Incidents) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1435,12 +1468,12 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1448,84 +1481,84 @@ func MonitorDetail(p Page, me Me, v MonitorDetailView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range v.Recent { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var69 string templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(r.Time) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 342, Col: 86} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 359, Col: 86} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var70 string templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(r.Region) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 343, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 360, Col: 41} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if r.OK { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "●") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "●") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "●") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "●") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var71 string templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(r.Latency) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 351, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 368, Col: 60} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var72 string templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(r.Detail) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 352, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 369, Col: 65} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1556,139 +1589,139 @@ func incidentList(rows []IncidentRow, showMonitor bool) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range rows { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if r.Open { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var74 string templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 367, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 384, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var75 string templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 369, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 386, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } if showMonitor { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, "\" class=\"hover:underline\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var77 string templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(r.Monitor) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 372, Col: 95} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 389, Col: 95} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var78 string templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(r.Started) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 374, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 391, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var79 string templ_7745c5c3_Var79, templ_7745c5c3_Err = templ.JoinStringErrs(r.Duration) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 375, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 392, Col: 57} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var79)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(r.Cause) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "

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

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

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

      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1730,20 +1763,20 @@ func IncidentsPage(p Page, me Me, rows []IncidentRow) templ.Component { return templ_7745c5c3_Err } if len(rows) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, "

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

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

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1820,36 +1853,36 @@ func typeFields(typ, current string) templ.Component { ctx = templ.InitializeContext(ctx) templ_7745c5c3_Var84 := templ.GetChildren(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 146, " class=\"mb-2\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1857,7 +1890,7 @@ func typeFields(typ, current string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 144, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -1882,95 +1915,95 @@ func numberField(label, name string, value, min, max int, hint string) templ.Com } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 145, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2007,115 +2040,115 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 154, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if f.ID == "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 155, "← ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "← ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var95 string templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 463, Col: 93} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 480, Col: 93} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 156, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 157, "← ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var97 string - templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(f.Name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 465, Col: 97} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "← ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var97 string + templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(f.Name) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 482, Col: 97} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "

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

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

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 169, " class=\"grid max-w-4xl gap-x-12 md:grid-cols-2\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2127,20 +2160,20 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 167, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 179, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2215,20 +2248,20 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 177, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var105 string templ_7745c5c3_Var105, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.target_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 496, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 513, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var105)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 178, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2244,66 +2277,66 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 179, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2341,66 +2374,66 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 187, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2444,7 +2477,7 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 195, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 198, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2460,74 +2493,74 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 196, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 199, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var115 string templ_7745c5c3_Var115, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.regions")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 536, Col: 121} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 553, Col: 121} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var115)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 197, "

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

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

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, r := range f.Regions { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 199, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 210, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 208, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 211, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2591,51 +2624,51 @@ func MonitorEditor(p Page, me Me, f MonitorForm) templ.Component { return templ_7745c5c3_Err } if f.ID != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 209, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 215, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 213, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 216, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2700,12 +2733,12 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } if len(v.Channels) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 214, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 217, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, ch := range v.Channels { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 215, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 218, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2720,149 +2753,149 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 216, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 219, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var127 string templ_7745c5c3_Var127, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 598, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 615, Col: 21} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var127)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 217, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 220, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var128 string templ_7745c5c3_Var128, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.type_"+ch.Type)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 599, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 616, Col: 70} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var128)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 218, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 221, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var129 string templ_7745c5c3_Var129, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 600, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 617, Col: 77} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var129)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 219, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 222, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 220, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 229, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 227, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 230, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 228, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 231, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 229, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 232, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 230, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 233, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2870,7 +2903,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 231, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 234, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2878,7 +2911,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 232, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 235, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2894,20 +2927,20 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 233, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 237, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2916,7 +2949,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } if v.EmailAvailable { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 235, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 238, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2924,7 +2957,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 236, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 239, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2932,79 +2965,79 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 237, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3012,30 +3045,30 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 246, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 249, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 247, "

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

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

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 249, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 252, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3067,85 +3100,85 @@ func groupSelect(name string, groups []GroupOption, selected string, allowNone b } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 250, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 262, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3200,20 +3233,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 260, "

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

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

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3222,69 +3255,69 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { return templ_7745c5c3_Err } if len(v.Groups) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 262, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 265, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, g := range v.Groups { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 263, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 267, "\">
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var151 string templ_7745c5c3_Var151, templ_7745c5c3_Err = templ.JoinStringErrs(g.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 695, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 712, Col: 21} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var151)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 265, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 268, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if g.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 266, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 269, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var152 string templ_7745c5c3_Var152, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 698, Col: 99} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 715, Col: 99} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var152)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 267, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 271, "\" data-method=\"put\" data-next=\"/groups\" class=\"mt-3 w-72\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3296,20 +3329,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 269, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 274, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3325,66 +3358,66 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 272, "
      ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 278, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 276, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 279, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 277, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 280, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 278, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 281, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 279, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 282, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3392,7 +3425,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 280, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 283, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3404,20 +3437,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 281, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 286, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -3433,7 +3466,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 284, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 287, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/public.go b/internal/web/public.go index a6789ed..b425727 100644 --- a/internal/web/public.go +++ b/internal/web/public.go @@ -19,6 +19,18 @@ type PublicAssets struct { // "/acme/" or "/" on a custom domain. Empty leaves them out, as in a // single-file export, which can only link elsewhere. LegalBase string + // Now is the moment the page shows, deciding which maintenance is in + // progress. + Now time.Time +} + +// Markdown renders src for display, or returns "" when it cannot. +func Markdown(src string) string { + html, err := RenderMarkdown(src) + if err != nil { + return "" + } + return html } // StylesheetText returns the built stylesheet for inlining. @@ -49,6 +61,8 @@ func PageStatus(s string) Status { return StatusDegraded case agentapi.PageOutage: return StatusDown + case agentapi.PageUnderMaintenance: + return StatusMaintenance } return StatusUnknown } diff --git a/internal/web/public.templ b/internal/web/public.templ index a4a5066..8094802 100644 --- a/internal/web/public.templ +++ b/internal/web/public.templ @@ -1,6 +1,7 @@ package web import ( + "strings" "time" "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi" @@ -35,7 +36,9 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) { }

{ s.Title }

if s.Description != "" { -

{ s.Description }

+ } if !a.StaleSince.IsZero() { @@ -48,10 +51,12 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) { templ.KV("border-up", s.Status == agentapi.PageOperational), templ.KV("border-degraded", s.Status == agentapi.PageDegraded), templ.KV("border-down", s.Status == agentapi.PageOutage), - templ.KV("border-unknown", s.Status == agentapi.PageUnknown) } + templ.KV("border-unknown", s.Status == agentapi.PageUnknown), + templ.KV("border-maintenance", s.Status == agentapi.PageUnderMaintenance) } >

{ i18n.T(ctx, "page.status."+s.Status) }

+ @pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now)) for _, sec := range s.Sections {
if sec.Name != "" { @@ -76,6 +81,7 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
} + @pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))

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

if len(s.Incidents) == 0 { @@ -115,3 +121,32 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) { } + +templ pageMaintenance(heading string, items []agentapi.PageMaintenance) { + if len(items) > 0 { +
+

{ heading }

+
    + for _, m := range items { +
  • +
    + + @statusDot(StatusMaintenance) + { m.Title } + + + { m.Start.UTC().Format("2006-01-02 15:04") + " – " + m.End.UTC().Format("15:04") + " UTC" } + +
    +

    { strings.Join(m.Components, ", ") }

    + if m.Description != "" { + + } +
  • + } +
+
+ } +} diff --git a/internal/web/public_templ.go b/internal/web/public_templ.go index 4ca5964..3719b37 100644 --- a/internal/web/public_templ.go +++ b/internal/web/public_templ.go @@ -10,6 +10,7 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( + "strings" "time" "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi" @@ -40,7 +41,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.Lang(ctx)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 12, Col: 28} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 13, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2) if templ_7745c5c3_Err != nil { @@ -53,7 +54,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 17, Col: 19} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 18, Col: 19} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -76,7 +77,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templruntime.NewAttributeExpression(a.CSSHref).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 21, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 22, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4) if templ_7745c5c3_Err != nil { @@ -111,7 +112,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templruntime.NewAttributeExpression(s.Theme.LogoURL).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 34, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 35, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5) if templ_7745c5c3_Err != nil { @@ -124,7 +125,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(s.Title).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 34, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 35, Col: 48} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6) if templ_7745c5c3_Err != nil { @@ -142,7 +143,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 36, Col: 90} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 37, Col: 90} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -153,20 +154,15 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { return templ_7745c5c3_Err } if s.Description != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(s.Description) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 38, Col: 48} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) + templ_7745c5c3_Err = templ.Raw(Markdown(s.Description)).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -180,12 +176,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC")) + var templ_7745c5c3_Var8 string + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 43, Col: 95} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 46, Col: 95} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -202,21 +198,22 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var10 = []any{"mb-12 border-l-4 py-3 pl-4", + var templ_7745c5c3_Var9 = []any{"mb-12 border-l-4 py-3 pl-4", templ.KV("border-up", s.Status == agentapi.PageOperational), templ.KV("border-degraded", s.Status == agentapi.PageDegraded), templ.KV("border-down", s.Status == agentapi.PageOutage), - templ.KV("border-unknown", s.Status == agentapi.PageUnknown)} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var10...) + templ.KV("border-unknown", s.Status == agentapi.PageUnknown), + templ.KV("border-maintenance", s.Status == agentapi.PageUnderMaintenance)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var9...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var10).String()).Resolve(ctx) + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var9).String()).Resolve(ctx) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 1, Col: 0} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -238,12 +235,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var12 string - templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.status."+s.Status)) + var templ_7745c5c3_Var11 string + templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.status."+s.Status)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 53, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 57, 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_Var11)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -251,6 +248,10 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now)).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } for _, sec := range s.Sections { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") if templ_7745c5c3_Err != nil { @@ -261,12 +262,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(sec.Name) + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(sec.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 58, Col: 90} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 63, Col: 90} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -292,12 +293,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var14 string - templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name) + var templ_7745c5c3_Var13 string + templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 65, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 70, Col: 27} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -305,12 +306,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status)) + var templ_7745c5c3_Var14 string + templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 66, Col: 95} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 71, Col: 95} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -326,12 +327,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var16 string - templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days))) + var templ_7745c5c3_Var15 string + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 70, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 75, Col: 71} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -339,12 +340,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var17 string - templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime)) + var templ_7745c5c3_Var16 string + templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 71, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 76, Col: 41} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -352,12 +353,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var18 string - templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today")) + var templ_7745c5c3_Var17 string + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 72, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 77, Col: 43} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -371,16 +372,20 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { return templ_7745c5c3_Err } } + templ_7745c5c3_Err = pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now)).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var19 string - templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.incidents")) + var templ_7745c5c3_Var18 string + templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.incidents")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 80, Col: 109} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 86, Col: 109} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -393,12 +398,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var20 string - templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.no_incidents")) + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.no_incidents")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 82, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 88, Col: 70} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -421,12 +426,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var21 string - templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing")) + var templ_7745c5c3_Var20 string + templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 88, Col: 80} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 94, Col: 80} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -439,12 +444,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved")) + var templ_7745c5c3_Var21 string + templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 90, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 96, Col: 67} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -457,12 +462,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var23 string - templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Component) + var templ_7745c5c3_Var22 string + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Component) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 92, Col: 30} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 98, Col: 30} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -470,12 +475,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var24 string - templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(inc.StartedAt.UTC().Format("2006-01-02 15:04")) + var templ_7745c5c3_Var23 string + templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(inc.StartedAt.UTC().Format("2006-01-02 15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 94, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 100, Col: 58} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -488,12 +493,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var25 string - templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(inc.ResolvedAt.UTC().Format("15:04")) + var templ_7745c5c3_Var24 string + templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(inc.ResolvedAt.UTC().Format("15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 96, Col: 53} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 102, Col: 53} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -516,12 +521,12 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var26 string - templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.updated", "Time", s.GeneratedAt.UTC().Format(time.DateTime)+" UTC")) + var templ_7745c5c3_Var25 string + templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.updated", "Time", s.GeneratedAt.UTC().Format(time.DateTime)+" UTC")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 106, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 112, Col: 98} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -543,4 +548,119 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component { }) } +func pageMaintenance(heading string, items []agentapi.PageMaintenance) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + ctx = templ.ClearChildren(ctx) + if len(items) > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var27 string + templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(heading) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 128, Col: 85} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, m := range items { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = statusDot(StatusMaintenance).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var28 string + templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 135, Col: 17} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var29 string + templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(m.Start.UTC().Format("2006-01-02 15:04") + " – " + m.End.UTC().Format("15:04") + " UTC") + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 138, Col: 99} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var30 string + templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(m.Components, ", ")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 141, Col: 80} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if m.Description != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.Raw(Markdown(m.Description)).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) +} + var _ = templruntime.GeneratedTemplate diff --git a/internal/web/statuspages.templ b/internal/web/statuspages.templ index 4e1ce37..83911f8 100644 --- a/internal/web/statuspages.templ +++ b/internal/web/statuspages.templ @@ -106,7 +106,8 @@ templ StatusPageEditor(p Page, me Me, e PageEditor) { @valueField(i18n.T(ctx, "pages.slug"), "slug", e.Slug, "", true) @checkbox(i18n.T(ctx, "pages.published"), "published", e.Published)

{ i18n.T(ctx, "pages.theme") }

diff --git a/internal/web/statuspages_templ.go b/internal/web/statuspages_templ.go index 2fcf7f0..f705840 100644 --- a/internal/web/statuspages_templ.go +++ b/internal/web/statuspages_templ.go @@ -458,20 +458,33 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var22 string + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.markdown_hint")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 110, Col: 87} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -479,20 +492,20 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.theme")) + var templ_7745c5c3_Var23 string + templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.theme")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 112, Col: 111} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 113, Col: 111} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -504,33 +517,33 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -538,46 +551,46 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\" data-next=\"/statuspages\" class=\"mt-6 text-sm text-down hover:underline\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var28 string + templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.delete")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 128, Col: 34} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -585,33 +598,33 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "\" data-method=\"put\" data-rows=\"monitors\" data-next=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var30 string + templ_7745c5c3_Var30, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/statuspages/" + e.ID).Resolve(ctx) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 133, Col: 138} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -620,136 +633,136 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { return templ_7745c5c3_Err } if len(e.Monitors) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var30 string - templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 135, Col: 81} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, m := range e.Monitors { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "
  • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var31 string - templ_7745c5c3_Var31, templ_7745c5c3_Err = templruntime.NewAttributeExpression(m.Name).Resolve(ctx) + templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 140, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 136, Col: 81} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "\"> ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "
      ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, m := range e.Monitors { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var33 string - templ_7745c5c3_Var33, templ_7745c5c3_Err = templruntime.NewAttributeExpression(m.ID).Resolve(ctx) + templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(m.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 142, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 142, Col: 23} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var33) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "\">
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "\" placeholder=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var38 string + templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "pages.label")).Resolve(ctx) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 147, Col: 94} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "\" class=\"w-1/2 border border-rule bg-transparent px-2 py-1 text-xs outline-none focus:border-ink\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -757,7 +770,7 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -765,33 +778,33 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "\" data-method=\"put\" data-next=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var40 string + templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/statuspages/" + e.ID).Resolve(ctx) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 157, Col: 115} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -807,149 +820,149 @@ func StatusPageEditor(p Page, me Me, e PageEditor) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if e.Domain != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if e.DomainVerified { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "

● ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var40 string - templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.domain_verified")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 164, Col: 82} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "

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

● ") 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, "pages.domain_cname")) + templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.domain_verified")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 165, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 165, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "

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

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var42 string - templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.domain_instructions")) + templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.domain_cname")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 167, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 166, Col: 78} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "

TXT
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var43 string - templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(e.RecordName) + templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.domain_instructions")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 170, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 168, Col: 66} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "

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

TXT
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var44 string - templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.value")) + templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(e.RecordName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 171, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 171, Col: 45} } _, 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, 73, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var45 string - templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(e.RecordValue) + templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.value")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 172, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 172, Col: 60} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "\" data-reload class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var49 string + templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.verify")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/statuspages.templ`, Line: 175, Col: 256} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } -- 2.54.1