Nextcloud cron and Nextcloud's own checks; bulk close and open again

Nextcloud: its own "Cron last run" setup check (GET /settings/setupcheck,
Nextcloud 28+, found by class name) raises an alert when background jobs have
stopped; other checks that report an error are one alert, warnings are shown
on the page. The core version Nextcloud says is available is shown too. Before
28, cron and the checks are unknown, never "fine".

Alerts page: bulk Close... (one reason, written on each incident, undoable) and
Open again. Bulk Wake now leaves closed alerts alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-25 22:12:10 +01:00
1 parent 5ae61a1ece
commit 65214f6f0f
25 files changed
+8108 -35

No files matched your search

+6
View File
@@ -1246,6 +1246,12 @@ export interface NextcloudInfo {
files: number | null;
active24h: number | null;
appUpdates: number | null;
/** The version Nextcloud says is available ("newer" when it does not say which); null when none is. */
coreUpdate: string | null;
/** Nextcloud's own "Cron last run" check; null when not known (no login, or before Nextcloud 28). */
cron: { state: "success" | "info" | "warning" | "error"; text: string | null } | null;
/** Its other checks that report an error or a warning; null when they could not be asked. */
setupIssues: { name: string; severity: "warning" | "error"; text: string | null }[] | null;
updatedAt: string;
} | null;
problems: { key: string; message: string; severity: "warning" | "critical" }[];
+34
View File
@@ -78,3 +78,37 @@ export default function CloseDrawer({ alert, onClose, onSaved }: { alert: AlertI
</DetailDrawer>
);
}
/** The same for several alerts at once: one reason for all, written on each one's incident. `onSubmit` does it (and says how it went); the tickets of these alerts are not closed from here. */
export function CloseBulkDrawer({ count, onSubmit, onClose }: { count: number; onSubmit: (note: string | null) => Promise<void>; onClose: () => void }) {
const [note, setNote] = useState("");
const [busy, setBusy] = useState(false);
return (
<DetailDrawer title={`Close ${count} alert${count === 1 ? "" : "s"}`} onClose={onClose}>
<div className="text-secondary mb-3">
Hide them, with no end. Each comes back only if it <strong>gets worse</strong> than it is now, or if its problem goes away for half an hour and then returns. Until then they are not counted and nothing is sent about them. The reason goes on each one&rsquo;s
incident. Nothing about the things themselves is promised — use <em>Silence</em> for planned work. Their osTicket tickets are not closed from here; close an alert on its own for that.
</div>
<label className="form-label" htmlFor="close-bulk-note">
Why? (optional)
</label>
<textarea id="close-bulk-note" className="form-control mb-3" rows={3} maxLength={500} value={note} onChange={(e) => setNote(e.target.value)} placeholder="All retired with the old host · accepted · fixed outside the app…" autoFocus />
<div className="d-flex gap-2">
<button
type="button"
className="btn btn-primary"
disabled={busy}
onClick={() => {
setBusy(true);
void onSubmit(note.trim() === "" ? null : note.trim()).finally(() => setBusy(false));
}}
>
{busy ? "Closing…" : `Close ${count === 1 ? "the alert" : `all ${count}`}`}
</button>
<button type="button" className="btn" disabled={busy} onClick={onClose}>
Cancel
</button>
</div>
</DetailDrawer>
);
}
+20 -2
View File
@@ -16,7 +16,7 @@ import SilenceButton from "../components/SilenceButton";
import RunPlaybookButton from "../components/RunPlaybookButton";
import RunbookEntry from "../components/RunbookEntry";
import AckDrawer, { ackWords } from "../components/AckDrawer";
import CloseDrawer from "../components/CloseDrawer";
import CloseDrawer, { CloseBulkDrawer } from "../components/CloseDrawer";
import SnoozeDrawer, { SnoozeBulkDrawer, snoozeWords } from "../components/SnoozeDrawer";
import { useAlertsReport } from "../hooks/useAlertsReport";
import { summariseAlerts } from "../utils/alertSummary";
@@ -101,7 +101,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
const [closing, setClosing] = useState<AlertItem | null>(null);
// Alerts ticked for a bulk action, and which bulk form is open.
const [picked, setPicked] = useState<Set<string>>(new Set());
const [bulkForm, setBulkForm] = useState<"ack" | "silence" | "snooze" | null>(null);
const [bulkForm, setBulkForm] = useState<"ack" | "silence" | "snooze" | "close" | null>(null);
// Held-back alerts are nested under the one that explains them (on by default; remembered), and each parent opens to show them.
const [grouped, setGrouped] = useState(() => {
try {
@@ -239,6 +239,17 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
setPicked(new Set());
}
}
async function bulkClose(note: string | null) {
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "close", alertIds: pickedIds, note }, done: (r) => `${plural(r.changed, "alert")} closed.`, reload: afterBulk });
if (ok) {
setBulkForm(null);
setPicked(new Set());
}
}
async function bulkReopen() {
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "reopen", alertIds: pickedIds }, done: (r) => `${plural(r.changed, "closed alert")} opened again.`, reload: afterBulk });
if (ok) setPicked(new Set());
}
async function bulkWake() {
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "unsnooze", alertIds: pickedIds }, done: (r) => `${plural(r.changed, "alert")} woken.`, reload: afterBulk });
if (ok) setPicked(new Set());
@@ -629,6 +640,12 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<button type="button" className="btn btn-sm" onClick={() => void bulkWake()}>
Wake
</button>
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("close")} title="Dealt with, or accepted: hide them until they get worse">
Close…
</button>
<button type="button" className="btn btn-sm" onClick={() => void bulkReopen()}>
Open again
</button>
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("silence")}>
Silence…
</button>
@@ -636,6 +653,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
</>
)}
{bulkForm === "ack" && <AckBulkDrawer count={pickedIds.length} onSubmit={bulkAck} onClose={() => setBulkForm(null)} />}
{bulkForm === "close" && <CloseBulkDrawer count={pickedIds.length} onSubmit={bulkClose} onClose={() => setBulkForm(null)} />}
{bulkForm === "snooze" && <SnoozeBulkDrawer count={pickedIds.length} onSubmit={bulkSnooze} onClose={() => setBulkForm(null)} />}
{bulkForm === "silence" && <SilenceBulkDrawer noun={pickedIds.length === 1 ? "alert" : "alerts"} count={pickedIds.length} canSilenceDependents={false} onSubmit={bulkSilence} onClose={() => setBulkForm(null)} />}
+24 -2
View File
@@ -43,8 +43,16 @@ function Card({ n }: { n: NextcloudInfo }) {
{s && (
<>
<div className="text-secondary small mb-3">
{[s.version ? `version ${s.version}` : null, s.maintenance ? "in maintenance mode" : null, s.needsUpgrade ? "needs its database upgrading" : null].filter(Boolean).join(" · ")}
{[s.version ? `version ${s.version}` : null, s.coreUpdate ? (s.coreUpdate === "newer" ? "a newer version is available" : `${s.coreUpdate} is available`) : null, s.maintenance ? "in maintenance mode" : null, s.needsUpgrade ? "needs its database upgrading" : null].filter(Boolean).join(" · ")}
</div>
{s.cron ? (
<div className="mb-3">
<span className={`badge me-2 ${s.cron.state === "error" ? "bg-red-lt text-red" : s.cron.state === "warning" ? "bg-yellow-lt text-yellow" : "bg-green-lt text-green"}`}>{s.cron.state === "error" ? "Background jobs stopped" : s.cron.state === "warning" ? "Background jobs: check" : "Background jobs running"}</span>
<span className="text-secondary small">{s.cron.text}</span>
</div>
) : (
s.detail && <div className="text-secondary small mb-3">Whether its background jobs run is not known — Nextcloud 28 or later says (through its own setup checks).</div>
)}
{s.detail ? (
<div className="row g-3">
<div className="col-6 col-lg-3">
@@ -86,6 +94,20 @@ function Card({ n }: { n: NextcloudInfo }) {
Only its status is read. Give the integration an administrator&rsquo;s name and an <strong>app password</strong> (Personal settings → Security → Devices &amp; sessions) and the room left for the data, the users and the app updates are read too.
</div>
)}
{s.setupIssues && s.setupIssues.length > 0 && (
<>
<h4 className="mt-3">Nextcloud&rsquo;s own checks</h4>
<ul className="mb-0">
{s.setupIssues.map((i) => (
<li key={i.name} className={i.severity === "error" ? "text-red" : ""}>
<strong>{i.name}</strong> <span className="text-secondary">({i.severity})</span>
{i.text && <div className="text-secondary small">{i.text}</div>}
</li>
))}
</ul>
<div className="text-secondary small mt-1">An error here is an alert; a warning is only shown, as in Nextcloud&rsquo;s own admin overview.</div>
</>
)}
</>
)}
</div>
@@ -114,7 +136,7 @@ export default function Nextcloud() {
<>
<h2 className="page-title">Nextcloud</h2>
<p className="text-secondary">
Whether people can sign in. It is read every few minutes (see <Link to="/integrations">Integrations</Link>). <strong>Maintenance mode left on</strong>, <strong>a database that wants upgrading</strong> and <strong>the data disk running low</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
Whether people can sign in. It is read every few minutes (see <Link to="/integrations">Integrations</Link>). <strong>Maintenance mode left on</strong>, <strong>a database that wants upgrading</strong>, <strong>background jobs that have stopped</strong> and <strong>the data disk running low</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
</p>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}