package web import ( "strconv" "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" ) // PageRow is a status page in the list. type PageRow struct { ID string Title string Slug string Published bool URL string Domain string Suspended bool } // PagesView is the data of the status page list. type PagesView struct { Pages []PageRow CanWrite bool } templ StatusPagesPage(p Page, me Me, v PagesView) { @consoleShell(p, me) { @settingsHeading("pages.title", "pages.intro") if len(v.Pages) > 0 { } if v.CanWrite {
@sectionHeading("pages.create")
@formError() @valueField(i18n.T(ctx, "pages.page_title"), "title", "", "Acme status", true) @valueField(i18n.T(ctx, "pages.slug"), "slug", "", "acme", true) @submit(i18n.T(ctx, "pages.create"))
} } } // PageGroupRow is one nested group of a status page in tree order. type PageGroupRow struct { ID string Name string ParentID string Position int Depth int Label string } // PageMonitorOption is a monitor in the page editor. type PageMonitorOption struct { ID string Name string MonitorGroupPath string Included bool GroupID string Label string } // PageEditor is the data of the status page editor. type PageEditor struct { ID string Title string Slug string Description string Published bool ShowDetails bool Accent string LogoURL string CSS string URL string Domain string DomainVerified bool RecordName string RecordValue string Suspended bool SuspendedReason string Groups []PageGroupRow HasOrgGroups bool Monitors []PageMonitorOption } templ StatusPageEditor(p Page, me Me, e PageEditor) { @consoleShell(p, me) {

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

if e.Suspended { }

{ e.Title }

if e.Published { { i18n.T(ctx, "pages.open") } ↗ } { i18n.T(ctx, "pages.export") }
@sectionHeading("pages.settings")
@formError() @valueField(i18n.T(ctx, "pages.page_title"), "title", e.Title, "", true) @valueField(i18n.T(ctx, "pages.slug"), "slug", e.Slug, "", true)
{ i18n.T(ctx, "pages.description") } @MarkdownEditor("description", e.Description, 5, 10000, MarkdownInline)
@checkbox(i18n.T(ctx, "pages.published"), "published", e.Published) @checkbox(i18n.T(ctx, "pages.show_details"), "show_component_details", e.ShowDetails)

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

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

@valueField(i18n.T(ctx, "pages.accent"), "theme.accent", e.Accent, "#1f6feb", false) @valueField(i18n.T(ctx, "pages.logo"), "theme.logo_url", e.LogoURL, "https://example.com/logo.svg", false) @submit(i18n.T(ctx, "common.save"))
@sectionHeading("pages.groups") if e.HasOrgGroups { }

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

if len(e.Groups) > 0 {
    for _, g := range e.Groups {
  • { g.Name } { i18n.T(ctx, "common.edit") }
    @formError() @valueField(i18n.T(ctx, "sso.field.name"), "name", g.Name, "", true)
    @submit(i18n.T(ctx, "common.save"))
  • }
}
@formError()
@submit(i18n.T(ctx, "groups.create"))
@sectionHeading("pages.components")
@formError() if len(e.Monitors) == 0 {

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

}
    for _, m := range e.Monitors {
  • { m.Name } if m.MonitorGroupPath != "" { { m.MonitorGroupPath } }
  • }
@submit(i18n.T(ctx, "common.save"))
@sectionHeading("pages.domain")
@formError() @valueField(i18n.T(ctx, "pages.domain_name"), "domain", e.Domain, "status.example.com", false) @submit(i18n.T(ctx, "common.save"))
if e.Domain != "" {
if e.DomainVerified {

● { i18n.T(ctx, "pages.domain_verified") }

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

} else {

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

TXT
{ e.RecordName }
{ i18n.T(ctx, "pages.value") }
{ e.RecordValue }
}
}
} }