feat(console): add or remove all monitors of a status page, skip signup when signed in

The status page editor gets "Add all" and "Remove all" above its monitor
list. Opening the signup page while signed in leads to the monitor list,
as the login page already did.

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-25 23:19:27 +01:00
1 parent feaa1e930d
commit 4cde0f7e56
7 files changed
+463 -381

No files matched your search

+28
View File
@@ -55,3 +55,31 @@ func TestDashboardFiltersByStatus(t *testing.T) {
t.Error("an unknown status filter hides monitors")
}
}
func TestSignupSendsSignedInUsersToTheMonitors(t *testing.T) {
e := newEnv(t)
visitor := e.browser(t)
if st, path, _ := visitor.page("/signup"); st != http.StatusOK || path != "/signup" {
t.Fatalf("signup for a visitor = %d at %s", st, path)
}
owner := e.browser(t)
owner.signup("o@"+uniq("su")+".test", uniq("su-"))
if st, path, html := owner.page("/signup"); st != http.StatusOK || path != "/" || !strings.Contains(html, "Monitors") {
t.Errorf("signup when signed in ended at %s (%d), want the monitor list", path, st)
}
}
func TestPageEditorOffersAddAndRemoveAll(t *testing.T) {
e := newEnv(t)
_, region := e.platformChecker(t, uniq("eu-"))
owner := e.browser(t)
owner.signup("o@"+uniq("pa")+".test", uniq("pa-"))
owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "Shop", "type": "http", "target": "https://shop.test", "interval_seconds": 60, "regions": []string{region}})
_, p := owner.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": uniq("pa-"), "title": "Status"})
_, _, html := owner.page("/statuspages/" + p["id"].(string))
for _, want := range []string{`data-check-all="on"`, `data-check-all="off"`, "Add all", "Remove all"} {
if !strings.Contains(html, want) {
t.Errorf("the page editor lacks %q", want)
}
}
}
+5
View File
@@ -122,6 +122,11 @@ func (s *Server) signupOptions(ctx context.Context) (bool, []web.IDPButton, erro
}
func (s *Server) signupPage(c *gin.Context) {
// Signed in already: straight to the monitors.
if auth.Current(c) != nil {
c.Redirect(http.StatusSeeOther, "/")
return
}
email, providers, err := s.signupOptions(c.Request.Context())
if err != nil {
internalError(c, err)
+2
View File
@@ -1290,6 +1290,8 @@
"pages.intro": "Öffentliche Seiten mit dem Zustand ausgewählter Monitore. Jede Seite kann eine eigene Domain nutzen oder als einzelne HTML-Datei exportiert werden.",
"pages.label": "Öffentlicher Name",
"pages.logo": "Logo-URL (https)",
"pages.monitors_all": "Alle hinzufügen",
"pages.monitors_none": "Alle entfernen",
"pages.no_group": "Ohne Gruppe",
"pages.open": "Öffnen",
"pages.own_servers": "Die Statusseiten dieser Organisation liefern nur ihre eigenen Statusseiten-Server aus, nicht die der Plattform. Ruf sie über die Adresse deiner Server auf oder verbinde eine eigene Domain, die auf sie zeigt.",
+2
View File
@@ -1290,6 +1290,8 @@
"pages.intro": "Public pages showing the state of selected monitors. Each page can use its own domain or be exported as a single HTML file.",
"pages.label": "Public name",
"pages.logo": "Logo URL (https)",
"pages.monitors_all": "Add all",
"pages.monitors_none": "Remove all",
"pages.no_group": "No group",
"pages.open": "Open",
"pages.own_servers": "Your organization's own status page servers serve its pages; the platform's do not. Open them at the address of your servers or connect a custom domain pointing at them.",
+9
View File
@@ -186,6 +186,15 @@
navToggle.setAttribute("aria-expanded", String(open));
return;
}
// Ticks or clears every checkbox named by data-check-all in its form.
const checkAll = ev.target.closest("[data-check-all]");
if (checkAll) {
const on = checkAll.dataset.checkAll === "on";
checkAll.closest("form")?.querySelectorAll(checkAll.dataset.checkTarget).forEach((box) => {
box.checked = on;
});
return;
}
const locale = ev.target.closest("[data-locale]");
if (locale) {
await api.post("/locale", { locale: locale.dataset.locale }).catch(() => {});
+5
View File
@@ -272,6 +272,11 @@ templ StatusPageEditor(p Page, me Me, e PageEditor) {
@formError()
if len(e.Monitors) == 0 {
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "console.monitors.empty") }</p>
} else {
<p class="mb-2 flex gap-4 text-xs">
<button type="button" data-check-all="on" data-check-target="[data-field=include]" class="text-muted hover:text-ink">{ i18n.T(ctx, "pages.monitors_all") }</button>
<button type="button" data-check-all="off" data-check-target="[data-field=include]" class="text-muted hover:text-ink">{ i18n.T(ctx, "pages.monitors_none") }</button>
</p>
}
<ul class="mb-4 divide-y divide-rule border-y border-rule text-sm">
for _, m := range e.Monitors {
File diff suppressed because it is too large. Load diff