package web
import (
"net/url"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
// Region is a row in a region list.
type Region struct {
ID string
Key string
Name string
// Platform regions are shared by all organizations.
Platform bool
// Manageable regions can be deleted on the current page.
Manageable bool
Instances int64
}
// Agent is a checker or status page server.
type Agent struct {
ID string
Kind string
Name string
Region string
Prefix string
LastSeen string
// AllowPrivate is set for an organization's checkers: whether they
// may check private addresses.
AllowPrivate *bool
}
// RegionsView is the data of the org regions page and the admin panel.
type RegionsView struct {
Regions []Region
Agents []Agent
// APIBase is the prefix of the endpoints the forms post to, either
// /org or /admin.
APIBase string
// Next is the page to reload after a change.
Next string
// OwnRegions are the regions agents can be created in.
OwnRegions []Region
}
templ regionsBody(v RegionsView) {
for _, r := range v.Regions {
{ i18n.T(ctx, "sso.field.name") }
{ i18n.T(ctx, "regions.key") }
{ i18n.T(ctx, "regions.owner") }
{ i18n.T(ctx, "regions.instances") }
}
{ r.Name }
{ r.Key }
if r.Platform {
{ i18n.T(ctx, "regions.platform") }
} else {
{ i18n.T(ctx, "regions.own") }
}
0), templ.KV("text-unknown", r.Instances == 0) }>● { i18n.T(ctx, "regions.live", "Count", int(r.Instances)) }
if r.Manageable {
}
{ i18n.T(ctx, "audit.platform_title") } { i18n.T(ctx, "legal.platform_title") }
@moderationSection(mod) @orgsSection(orgs) @limitsSection(orgs.Defaults) @regionsBody(v) @checkerNetworkSection(platformPrivate) @checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro") @storageSection(storage) } } // CheckTypeOption is a check type in the admin panel. type CheckTypeOption struct { Type string Enabled bool } templ checkerNetworkSection(allow bool) {{ i18n.T(ctx, introID) }
{ i18n.T(ctx, "moderation.intro") }
if len(v.Pages) == 0 {{ i18n.T(ctx, "moderation.none") }
} else {| { i18n.T(ctx, "moderation.page") } | { i18n.T(ctx, "moderation.org") } | { i18n.T(ctx, "moderation.owner") } | { i18n.T(ctx, "moderation.created") } |
|---|---|---|---|
| { pg.Title } { pg.Slug } @moderationState(pg.Suspended, !pg.Published) | { pg.Org.Name } { pg.Org.Detail } @moderationState(pg.Org.Suspended, false) | if pg.Owner != nil { { pg.Owner.Name } @moderationState(pg.Owner.Suspended, false) } else { – } | { pg.Created } |
{ i18n.T(ctx, "moderation.actions") }
@moderationActions("page", "/admin/status-pages/"+pg.ID, pg.Suspended, pg.Title, v.next())
@moderationActions("org", "/admin/orgs/"+pg.Org.ID, pg.Org.Suspended, pg.Org.Name, v.next())
if pg.Owner != nil && pg.Owner.Admin {
{ i18n.T(ctx, "moderation.owner_is_admin") } } else if pg.Owner != nil { @moderationActions("owner", "/admin/users/"+pg.Owner.ID, pg.Owner.Suspended, pg.Owner.Name, v.next()) } |
|||
{ i18n.T(ctx, "moderation.limited") }
} }