feat: per-organization limits set by platform admins
ci / image (pull_request) Successful in 4m25s
ci / build (pull_request) Successful in 8m15s
ci / test (pull_request) Successful in 8m51s
ci / lint (pull_request) Successful in 12m8s

Admins set default limits for monitors (all types), status pages and
regions per monitor, whether an organization's own checker regions count
towards the region limit, and how many organizations an account may own,
and override them per organization or account. Defaults are not copied:
changing one applies at once to everyone without an override. 0 means
unlimited; self-hosted defaults are unlimited, the cloud allows three
organizations per account.

Creations count under a per-organization advisory lock, so concurrent
requests cannot overshoot. A lowered limit keeps everything that exists:
monitors already beyond the region limit stay editable but may not grow.
Organizations see their usage in their settings and GET /org/limits;
the admin panel lists organizations with owner, usage and limits next
to their suspend and delete actions. Empty numeric form fields marked
data-nullable are sent as null.

Refs #111

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 21:06:45 +01:00
1 parent 90e74d091a
commit e4ce619fbe
26 files changed
+2386 -82

No files matched your search

+221
View File
@@ -0,0 +1,221 @@
package web
import (
"context"
"net/url"
"strconv"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
// LimitsView holds limits; 0 means unlimited.
type LimitsView struct {
Monitors int
StatusPages int
RegionsPerMonitor int
OwnRegionsCount bool
OrgsPerAccount int
}
// OrgsView lists organizations for platform admins.
type OrgsView struct {
Search string
Orgs []OrgRow
Limited bool
Defaults LimitsView
}
// OrgRow is an organization with its usage and limits. Overrides are form
// values: empty follows the default.
type OrgRow struct {
ID, Name, Slug, Created, Suspended string
Monitors, StatusPages int
Limits LimitsView
MonitorsOverride string
StatusPagesOverride string
RegionsOverride string
OwnRegionsOverride string
Owner *ModeratedTarget
OwnerOrgs int
OwnerOrgLimit string
}
func (v OrgsView) next() string {
if v.Search == "" {
return "/admin#orgs"
}
return "/admin?oq=" + url.QueryEscape(v.Search) + "#orgs"
}
// limitText shows a limit, or "unlimited".
func limitText(ctx context.Context, n int) string {
if n == 0 {
return i18n.T(ctx, "limits.unlimited")
}
return strconv.Itoa(n)
}
templ limitsSection(d LimitsView) {
<section id="limits" class="mb-12 max-w-3xl">
@sectionHeading("limits.title")
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "limits.intro") }</p>
<form data-api="/admin/limits" data-method="put" data-next="/admin#limits">
@formError()
<div class="grid gap-x-6 sm:grid-cols-2">
@numberField(i18n.T(ctx, "limits.monitors"), "monitors", d.Monitors, 0, 1000000, "")
@numberField(i18n.T(ctx, "limits.status_pages"), "status_pages", d.StatusPages, 0, 1000000, "")
@numberField(i18n.T(ctx, "limits.regions_per_monitor"), "regions_per_monitor", d.RegionsPerMonitor, 0, 1000, "")
@numberField(i18n.T(ctx, "limits.orgs_per_account"), "orgs_per_account", d.OrgsPerAccount, 0, 100000, "")
</div>
@checkbox(i18n.T(ctx, "limits.own_regions_count"), "own_regions_count", d.OwnRegionsCount)
<p class="mb-4 ml-6 text-xs text-muted">{ i18n.T(ctx, "limits.own_regions_count_hint") }</p>
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "common.save") }</button>
</form>
</section>
}
// overrideField is a limit an organization may override: empty follows
// the default, shown as placeholder.
templ overrideField(label, name, value string, def int, max int) {
<label class="mb-3 block">
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ label }</span>
<input
type="number"
name={ name }
data-number
data-nullable
min="0"
max={ strconv.Itoa(max) }
value={ value }
placeholder={ i18n.T(ctx, "limits.default", "Value", limitText(ctx, def)) }
class="w-full border border-rule bg-transparent px-2 py-1 font-mono text-sm outline-none focus:border-ink"
/>
</label>
}
templ orgsSection(v OrgsView) {
<section id="orgs" class="mb-12">
@sectionHeading("orgs.title")
<p class="mb-4 max-w-3xl text-sm text-muted">{ i18n.T(ctx, "orgs.intro") }</p>
<form method="get" action="/admin#orgs" class="mb-4 flex max-w-xl gap-2">
<input
type="search"
name="oq"
value={ v.Search }
placeholder={ i18n.T(ctx, "orgs.search") }
aria-label={ i18n.T(ctx, "orgs.search") }
class="w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"
/>
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "moderation.search_button") }</button>
</form>
if len(v.Orgs) == 0 {
<p class="text-sm text-muted">{ i18n.T(ctx, "orgs.none") }</p>
} else {
<div class="overflow-x-auto">
<table class="w-full min-w-[42rem] text-left text-sm">
<thead class="border-b border-rule text-xs uppercase tracking-wider text-muted">
<tr>
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.org") }</th>
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.owner") }</th>
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "limits.monitors") }</th>
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "limits.status_pages") }</th>
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.created") }</th>
</tr>
</thead>
<tbody class="divide-y divide-rule">
for _, o := range v.Orgs {
<tr class="align-top">
<td class="py-2.5 pr-4">
{ o.Name }
<span class="block font-mono text-xs text-muted">{ o.Slug }</span>
@moderationState(o.Suspended, false)
</td>
<td class="py-2.5 pr-4">
if o.Owner != nil {
<span class="break-all">{ o.Owner.Name }</span>
@moderationState(o.Owner.Suspended, false)
} else {
<span class="text-muted">–</span>
}
</td>
<td class="py-2.5 pr-4 font-mono text-xs">@usage(o.Monitors, o.Limits.Monitors)</td>
<td class="py-2.5 pr-4 font-mono text-xs">@usage(o.StatusPages, o.Limits.StatusPages)</td>
<td class="py-2.5 pr-4 font-mono text-xs text-muted">{ o.Created }</td>
</tr>
<tr>
<td colspan="5" class="pb-3">
<details class="text-sm">
<summary class="cursor-pointer text-muted hover:text-ink">{ i18n.T(ctx, "orgs.manage") }</summary>
<div class="mt-3 grid gap-6 md:grid-cols-3">
<form data-api={ "/admin/orgs/" + o.ID + "/limits" } data-method="put" data-next={ v.next() }>
<h4 class="mb-2 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "orgs.limits") }</h4>
@formError()
@overrideField(i18n.T(ctx, "limits.monitors"), "monitors", o.MonitorsOverride, v.Defaults.Monitors, 1000000)
@overrideField(i18n.T(ctx, "limits.status_pages"), "status_pages", o.StatusPagesOverride, v.Defaults.StatusPages, 1000000)
@overrideField(i18n.T(ctx, "limits.regions_per_monitor"), "regions_per_monitor", o.RegionsOverride, v.Defaults.RegionsPerMonitor, 1000)
<label class="mb-3 block">
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "limits.own_regions_count") }</span>
<select name="own_regions_count" class="w-full border border-rule bg-transparent px-2 py-1 text-sm">
<option value="" selected?={ o.OwnRegionsOverride == "" }>{ i18n.T(ctx, "limits.default", "Value", i18n.T(ctx, "limits.own_"+strconv.FormatBool(v.Defaults.OwnRegionsCount))) }</option>
<option value="true" selected?={ o.OwnRegionsOverride == "true" }>{ i18n.T(ctx, "limits.own_true") }</option>
<option value="false" selected?={ o.OwnRegionsOverride == "false" }>{ i18n.T(ctx, "limits.own_false") }</option>
</select>
</label>
<button type="submit" class="border border-ink px-2.5 py-1 hover:bg-ink hover:text-paper">{ i18n.T(ctx, "common.save") }</button>
</form>
@moderationActions("org", "/admin/orgs/"+o.ID, o.Suspended, o.Name, v.next())
if o.Owner != nil && o.Owner.Admin {
<p class="text-xs text-muted">{ i18n.T(ctx, "moderation.owner_is_admin") }</p>
} else if o.Owner != nil {
<div>
<form data-api={ "/admin/users/" + o.Owner.ID + "/limits" } data-method="put" data-next={ v.next() } class="mb-4">
<h4 class="mb-2 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "moderation.target_owner") }</h4>
@formError()
@overrideField(i18n.T(ctx, "orgs.owner_orgs", "Count", o.OwnerOrgs), "orgs", o.OwnerOrgLimit, v.Defaults.OrgsPerAccount, 100000)
<button type="submit" class="border border-ink px-2.5 py-1 hover:bg-ink hover:text-paper">{ i18n.T(ctx, "common.save") }</button>
</form>
@moderationActions("owner", "/admin/users/"+o.Owner.ID, o.Owner.Suspended, o.Owner.Name, v.next())
</div>
}
</div>
</details>
</td>
</tr>
}
</tbody>
</table>
</div>
if v.Limited {
<p class="mt-3 text-xs text-muted">{ i18n.T(ctx, "moderation.limited") }</p>
}
}
</section>
}
// usage shows "used / limit", marking a reached limit.
templ usage(used, max int) {
<span class={ templ.KV("text-down", max > 0 && used >= max) }>{ strconv.Itoa(used) } / { limitText(ctx, max) }</span>
}
// UsageView is an organization's usage of its limits.
type UsageView struct {
Limits LimitsView
Monitors, StatusPages int
}
templ usageSection(u UsageView) {
<section class="mb-12 max-w-xl">
@sectionHeading("limits.org_title")
<dl class="grid grid-cols-[1fr_auto] gap-x-6 gap-y-1.5 text-sm">
<dt>{ i18n.T(ctx, "limits.monitors") }</dt>
<dd class="font-mono text-xs">@usage(u.Monitors, u.Limits.Monitors)</dd>
<dt>{ i18n.T(ctx, "limits.status_pages") }</dt>
<dd class="font-mono text-xs">@usage(u.StatusPages, u.Limits.StatusPages)</dd>
<dt>{ i18n.T(ctx, "limits.regions_per_monitor") }</dt>
<dd class="font-mono text-xs">{ limitText(ctx, u.Limits.RegionsPerMonitor) }</dd>
</dl>
if u.Limits.RegionsPerMonitor > 0 && !u.Limits.OwnRegionsCount {
<p class="mt-2 text-xs text-muted">{ i18n.T(ctx, "limits.own_regions_free") }</p>
}
</section>
}
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -55,7 +55,9 @@
continue;
}
if (el.type === "checkbox") set(el.name, el.checked);
else if (el.dataset.number !== undefined) set(el.name, Number(el.value));
// [data-number][data-nullable] sends null when left empty.
else if (el.dataset.number !== undefined)
set(el.name, el.value === "" && el.dataset.nullable !== undefined ? null : Number(el.value));
else if (el.dataset.nullable !== undefined) set(el.name, el.value || null);
else if (el.dataset.headers !== undefined)
set(el.name, Object.fromEntries(
+2
View File
@@ -390,6 +390,7 @@ type OrgSettings struct {
// CheckTypes are the types the platform offers, enabled unless the
// organization switched them off.
CheckTypes []CheckTypeOption
Usage UsageView
}
templ OrgSettingsPage(p Page, me Me, v OrgSettings) {
@@ -420,6 +421,7 @@ templ OrgSettingsPage(p Page, me Me, v OrgSettings) {
@submit(i18n.T(ctx, "common.save"))
</form>
</section>
@usageSection(v.Usage)
@checkTypesSection(v.CheckTypes, "/org/check-types", "/settings/org", "org.check_types_intro")
@orgDataSection(me)
}
+22 -17
View File
@@ -1634,6 +1634,7 @@ type OrgSettings struct {
// CheckTypes are the types the platform offers, enabled unless the
// organization switched them off.
CheckTypes []CheckTypeOption
Usage UsageView
}
func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
@@ -1696,7 +1697,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var76 string
templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_totp_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 403, Col: 82}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 404, Col: 82}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
if templ_7745c5c3_Err != nil {
@@ -1717,7 +1718,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var77 string
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_sso_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 405, Col: 81}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 406, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
if templ_7745c5c3_Err != nil {
@@ -1730,7 +1731,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var78 string
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 407, Col: 121}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 408, Col: 121}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
if templ_7745c5c3_Err != nil {
@@ -1743,7 +1744,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var79 string
templ_7745c5c3_Var79, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maxDaysValue(v.TokenMaxDays)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 414, Col: 42}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 415, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var79)
if templ_7745c5c3_Err != nil {
@@ -1756,7 +1757,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "org.token_max_days_none")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 415, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 416, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var80)
if templ_7745c5c3_Err != nil {
@@ -1769,7 +1770,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var81 string
templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 419, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 420, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81))
if templ_7745c5c3_Err != nil {
@@ -1787,6 +1788,10 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = usageSection(v.Usage).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = checkTypesSection(v.CheckTypes, "/org/check-types", "/settings/org", "org.check_types_intro").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -1853,7 +1858,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var84 string
templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_invalid"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 442, Col: 63}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 444, Col: 63}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84))
if templ_7745c5c3_Err != nil {
@@ -1871,7 +1876,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var85 string
templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.summary", "Org", v.OrgName, "Role", v.RoleName))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 444, Col: 96}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 446, Col: 96}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85))
if templ_7745c5c3_Err != nil {
@@ -1884,7 +1889,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var86 string
templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(v.Email)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 445, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 447, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
if templ_7745c5c3_Err != nil {
@@ -1903,7 +1908,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var87 string
templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/accept").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 448, Col: 59}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 450, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87)
if templ_7745c5c3_Err != nil {
@@ -1933,7 +1938,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var88 string
templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_email_mismatch"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 453, Col: 82}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 455, Col: 82}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88))
if templ_7745c5c3_Err != nil {
@@ -1946,7 +1951,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var89 string
templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 454, Col: 110}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 456, Col: 110}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89))
if templ_7745c5c3_Err != nil {
@@ -1964,7 +1969,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var90 string
templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/login?next=/invite/" + v.Token)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 456, Col: 62}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 62}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90)
if templ_7745c5c3_Err != nil {
@@ -1977,7 +1982,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var91 string
templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.sign_in"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 456, Col: 153}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 153}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91))
if templ_7745c5c3_Err != nil {
@@ -1995,7 +2000,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var92 string
templ_7745c5c3_Var92, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/signup").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 59}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 460, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var92)
if templ_7745c5c3_Err != nil {
@@ -2069,7 +2074,7 @@ func tokenUsage() templ.Component {
var templ_7745c5c3_Var94 string
templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.usage"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 479, Col: 31}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 481, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94))
if templ_7745c5c3_Err != nil {
@@ -2082,7 +2087,7 @@ func tokenUsage() templ.Component {
var templ_7745c5c3_Var95 string
templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "apidocs.title"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 482, Col: 98}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 484, Col: 98}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95))
if templ_7745c5c3_Err != nil {
+3 -1
View File
@@ -163,7 +163,7 @@ templ RegionsPage(p Page, me Me, v RegionsView) {
}
}
templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView) {
templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView, orgs OrgsView) {
@consoleShell(p, me) {
@settingsHeading("admin.title", "admin.intro")
<p class="-mt-4 mb-8 flex gap-4 text-sm">
@@ -171,6 +171,8 @@ templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
</p>
@moderationSection(mod)
@orgsSection(orgs)
@limitsSection(orgs.Defaults)
@regionsBody(v)
@checkerNetworkSection(platformPrivate)
@checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro")
+51 -43
View File
@@ -772,7 +772,7 @@ func RegionsPage(p Page, me Me, v RegionsView) templ.Component {
})
}
func AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView) templ.Component {
func AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView, orgs OrgsView) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -839,6 +839,14 @@ func AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []C
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = orgsSection(orgs).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = limitsSection(orgs.Defaults).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = regionsBody(v).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -915,7 +923,7 @@ func checkerNetworkSection(allow bool) templ.Component {
var templ_7745c5c3_Var45 string
templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.platform_private_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 193, Col: 87}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 195, Col: 87}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
if templ_7745c5c3_Err != nil {
@@ -928,7 +936,7 @@ func checkerNetworkSection(allow bool) templ.Component {
var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 194, Col: 129}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 196, Col: 129}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
if templ_7745c5c3_Err != nil {
@@ -976,7 +984,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ
var templ_7745c5c3_Var48 string
templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, introID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 204, Col: 59}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 206, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
if templ_7745c5c3_Err != nil {
@@ -989,7 +997,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ
var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templruntime.NewAttributeExpression(api).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 205, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 207, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var49)
if templ_7745c5c3_Err != nil {
@@ -1002,7 +1010,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ
var templ_7745c5c3_Var50 string
templ_7745c5c3_Var50, templ_7745c5c3_Err = templruntime.NewAttributeExpression(next).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 205, Col: 59}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 207, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var50)
if templ_7745c5c3_Err != nil {
@@ -1028,7 +1036,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ
var templ_7745c5c3_Var51 string
templ_7745c5c3_Var51, templ_7745c5c3_Err = templruntime.NewAttributeExpression(t.Type).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 210, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 212, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var51)
if templ_7745c5c3_Err != nil {
@@ -1051,7 +1059,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ
var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.type_"+t.Type))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 211, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 213, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
if templ_7745c5c3_Err != nil {
@@ -1069,7 +1077,7 @@ func checkTypesSection(types []CheckTypeOption, api, next, introID string) templ
var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.save"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 215, Col: 129}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 217, Col: 129}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
if templ_7745c5c3_Err != nil {
@@ -1148,7 +1156,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var55 string
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.intro"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 256, Col: 80}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 258, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
if templ_7745c5c3_Err != nil {
@@ -1161,7 +1169,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Search).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 261, Col: 20}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 263, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var56)
if templ_7745c5c3_Err != nil {
@@ -1174,7 +1182,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "moderation.search")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 262, Col: 50}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 264, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var57)
if templ_7745c5c3_Err != nil {
@@ -1187,7 +1195,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "moderation.search")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 263, Col: 49}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 265, Col: 49}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var58)
if templ_7745c5c3_Err != nil {
@@ -1200,7 +1208,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.search_button"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 266, Col: 142}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 268, Col: 142}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
if templ_7745c5c3_Err != nil {
@@ -1218,7 +1226,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var60 string
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.none"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 269, Col: 65}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 271, Col: 65}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
if templ_7745c5c3_Err != nil {
@@ -1236,7 +1244,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var61 string
templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.page"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 275, Col: 73}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 277, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61))
if templ_7745c5c3_Err != nil {
@@ -1249,7 +1257,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var62 string
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.org"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 276, Col: 72}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 278, Col: 72}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
if templ_7745c5c3_Err != nil {
@@ -1262,7 +1270,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var63 string
templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 277, Col: 74}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 279, Col: 74}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
if templ_7745c5c3_Err != nil {
@@ -1275,7 +1283,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.created"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 278, Col: 76}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 280, Col: 76}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil {
@@ -1293,7 +1301,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var65 string
templ_7745c5c3_Var65, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(pg.URL)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 285, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 287, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var65)
if templ_7745c5c3_Err != nil {
@@ -1306,7 +1314,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 285, Col: 119}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 287, Col: 119}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
if templ_7745c5c3_Err != nil {
@@ -1319,7 +1327,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var67 string
templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Slug)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 286, Col: 67}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 288, Col: 67}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67))
if templ_7745c5c3_Err != nil {
@@ -1340,7 +1348,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var68 string
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Org.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 290, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 292, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
if templ_7745c5c3_Err != nil {
@@ -1353,7 +1361,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var69 string
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Org.Detail)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 291, Col: 73}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 293, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
if templ_7745c5c3_Err != nil {
@@ -1379,7 +1387,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var70 string
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Owner.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 296, Col: 49}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 298, Col: 49}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
if templ_7745c5c3_Err != nil {
@@ -1406,7 +1414,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var71 string
templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(pg.Created)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 302, Col: 73}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 304, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
if templ_7745c5c3_Err != nil {
@@ -1419,7 +1427,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var72 string
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.actions"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 307, Col: 103}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 309, Col: 103}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
if templ_7745c5c3_Err != nil {
@@ -1445,7 +1453,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var73 string
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.owner_is_admin"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 312, Col: 84}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 314, Col: 84}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
if templ_7745c5c3_Err != nil {
@@ -1478,7 +1486,7 @@ func moderationSection(v ModerationView) templ.Component {
var templ_7745c5c3_Var74 string
templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.limited"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 325, Col: 74}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 327, Col: 74}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74))
if templ_7745c5c3_Err != nil {
@@ -1523,7 +1531,7 @@ func moderationState(suspended string, draft bool) templ.Component {
var templ_7745c5c3_Var76 string
templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.suspended"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 334, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 336, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
if templ_7745c5c3_Err != nil {
@@ -1541,7 +1549,7 @@ func moderationState(suspended string, draft bool) templ.Component {
var templ_7745c5c3_Var77 string
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs("· " + suspended)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 336, Col: 60}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 338, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
if templ_7745c5c3_Err != nil {
@@ -1564,7 +1572,7 @@ func moderationState(suspended string, draft bool) templ.Component {
var templ_7745c5c3_Var78 string
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.draft"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 340, Col: 81}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 342, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
if templ_7745c5c3_Err != nil {
@@ -1605,7 +1613,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.target_"+kind))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 348, Col: 115}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 350, Col: 115}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var80))
if templ_7745c5c3_Err != nil {
@@ -1618,7 +1626,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var81 string
templ_7745c5c3_Var81, templ_7745c5c3_Err = templruntime.NewAttributeExpression(api + "/suspension").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 349, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 351, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var81)
if templ_7745c5c3_Err != nil {
@@ -1631,7 +1639,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var82 string
templ_7745c5c3_Var82, templ_7745c5c3_Err = templruntime.NewAttributeExpression(next).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 349, Col: 75}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 351, Col: 75}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var82)
if templ_7745c5c3_Err != nil {
@@ -1653,7 +1661,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var83 string
templ_7745c5c3_Var83, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.reinstate"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 353, Col: 119}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 355, Col: 119}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var83))
if templ_7745c5c3_Err != nil {
@@ -1671,7 +1679,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var84 string
templ_7745c5c3_Var84, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "moderation.reason")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 359, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 361, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var84)
if templ_7745c5c3_Err != nil {
@@ -1684,7 +1692,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var85 string
templ_7745c5c3_Var85, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "moderation.reason")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 360, Col: 50}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 362, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var85)
if templ_7745c5c3_Err != nil {
@@ -1697,7 +1705,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var86 string
templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.suspend"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 363, Col: 141}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 365, Col: 141}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
if templ_7745c5c3_Err != nil {
@@ -1715,7 +1723,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var87 string
templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression(api).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 368, Col: 20}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 370, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87)
if templ_7745c5c3_Err != nil {
@@ -1728,7 +1736,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var88 string
templ_7745c5c3_Var88, templ_7745c5c3_Err = templruntime.NewAttributeExpression(next).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 369, Col: 19}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 371, Col: 19}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var88)
if templ_7745c5c3_Err != nil {
@@ -1741,7 +1749,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var89 string
templ_7745c5c3_Var89, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "moderation.delete_confirm_"+kind, "Name", name)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 370, Col: 78}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 372, Col: 78}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var89)
if templ_7745c5c3_Err != nil {
@@ -1754,7 +1762,7 @@ func moderationActions(kind, api, suspended, name, next string) templ.Component
var templ_7745c5c3_Var90 string
templ_7745c5c3_Var90, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "moderation.delete_"+kind))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 372, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 374, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var90))
if templ_7745c5c3_Err != nil {
+9
View File
@@ -58,6 +58,11 @@ X-Empty:
</div>
<button type="submit">save</button>
</form>
<form data-api="/admin/orgs/o1/limits" data-method="put" id="limits">
<input name="monitors" data-number data-nullable value="">
<input name="status_pages" data-number data-nullable value="0">
<input name="regions_per_monitor" data-number value="">
</form>
<pre id="out"></pre>
<script>
const sent = [];
@@ -139,6 +144,10 @@ window.axios = { create: () => ({ interceptors: { request: { use() {} } }, reque
{ monitor_id: "m2", group_id: "g1", label: "" },
],
});
const limits = document.getElementById("limits");
limits.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }));
await new Promise((r) => setTimeout(r, 20));
check("empty nullable numbers are null, others numbers", sent.at(-1), { monitors: null, status_pages: 0, regions_per_monitor: 0 });
document.getElementById("out").textContent = out.join("\n");
})();
</script></body></html>