Start maintenance on everything, all servers or all integrations at once

The Start maintenance list gets a "Many at once" group: Everything, All
servers, All integrations, All DNS providers (enabled ones only). Each target
still gets its own window, existing ones are extended, and the action is one
audit entry. "Everything" asks for confirmation first, and "End all" on the
Active list ends every running window together. The top banner and the wall
display summarise long lists instead of printing every name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-16 20:58:01 +02:00
1 parent 65263a64e3
commit bff0c2169e
7 files changed
+287 -4

No files matched your search

+60
View File
@@ -4,6 +4,7 @@ import {
type CurrentUser,
type IntegrationSummary,
type MaintenanceAlias,
type MaintenanceBulkScope,
type MaintenanceTargets,
type MaintenanceTargetType,
type MaintenanceWindow,
@@ -15,6 +16,7 @@ import { formatRemaining } from "../utils/duration";
import { readableError } from "../utils/errors";
import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast";
import { confirmDialog } from "../utils/dialogs";
const DURATIONS: { minutes: number; label: string }[] = [
{ minutes: 30, label: "30 minutes" },
@@ -89,8 +91,51 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
return () => clearInterval(tick);
}, []);
async function startBulk(scope: MaintenanceBulkScope) {
const words = DURATIONS.find((d) => d.minutes === minutes)?.label ?? `${minutes} minutes`;
// Everything is the one choice that can hide a real outage, so it asks first.
if (
scope === "everything" &&
!(await confirmDialog({
title: "Silence everything?",
message: `This silences every alert about every server, integration and DNS provider for ${words}. Anything still wrong when it ends alerts then.`,
confirmLabel: "Silence everything",
danger: true,
}))
)
return;
setError(null);
setBusy(true);
try {
const res = await api.maintenance.startBulk({ scope, minutes, reason: reason.trim() || undefined });
setTarget("");
setReason("");
toast.success(`Maintenance started on ${res.total} item${res.total === 1 ? "" : "s"} for ${words}. End them all from the Active list.`);
load();
announceChange();
} catch (err) {
setError(readableError(err));
} finally {
setBusy(false);
}
}
async function endAll() {
if (!(await confirmDialog({ title: "End all maintenance", message: `End all ${windows?.length ?? 0} windows now? Alerts about them become active again.`, confirmLabel: "End all", danger: true }))) return;
setError(null);
try {
const res = await api.maintenance.endAll();
toast.success(`Ended ${res.ended} maintenance window${res.ended === 1 ? "" : "s"}. Alerts are active again.`);
load();
announceChange();
} catch (err) {
setError(readableError(err));
}
}
async function start(e: React.FormEvent) {
e.preventDefault();
if (target.startsWith("all:")) return startBulk(target.slice(4) as MaintenanceBulkScope);
const [targetType, id] = target.split(":");
if (!targetType || !id) return;
setError(null);
@@ -211,6 +256,14 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<label className="form-label">What are you working on?</label>
<select className="form-select" required value={target} onChange={(e) => setTarget(e.target.value)}>
<option value="">Choose…</option>
{targets && targets.servers.length + targets.integrations.length + targets.dnsProviders.length > 1 && (
<optgroup label="Many at once">
<option value="all:everything">Everything — every server, integration and DNS provider</option>
{targets.servers.length > 1 && <option value="all:servers">All servers ({targets.servers.length})</option>}
{targets.integrations.length > 1 && <option value="all:integrations">All integrations (the enabled ones)</option>}
{targets.dnsProviders.length > 1 && <option value="all:dns_providers">All DNS providers (the enabled ones)</option>}
</optgroup>
)}
{targets && targets.servers.length > 0 && (
<optgroup label="Servers">
{targets.servers.map((s) => (
@@ -559,6 +612,13 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Active</h3>
{canEdit && (windows?.length ?? 0) > 1 && (
<div className="card-actions">
<button className="btn btn-sm btn-outline-secondary" onClick={() => void endAll()}>
End all ({windows?.length})
</button>
</div>
)}
</div>
<div className="table-responsive">
<table className="table table-vcenter card-table">
+2 -1
View File
@@ -186,11 +186,12 @@ export default function Wall() {
<>
<h2 className="wall-heading mt-4">In maintenance</h2>
<ul className="wall-list wall-list-small">
{windows.map((w) => (
{windows.slice(0, 8).map((w) => (
<li key={w.id}>
{w.targetName} <span className="wall-dim">· {formatRemaining(w.endsAt, now.getTime())} left</span>
</li>
))}
{windows.length > 8 && <li className="wall-more">and {windows.length - 8} more</li>}
</ul>
</>
)}