Show what Duplicati's warnings said, and let a job alert on them

The first twenty warning messages of each run are kept with the run and shown
on the job and in its history. A job can be set to raise a warning-level alert
when its last run finished with warnings (off by default; a muted job raises
nothing; maintenance on the machine's server silences it).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-09 23:20:57 +01:00
1 parent d78aba8bf9
commit 64961b1141
14 files changed
+9241 -24

No files matched your search

+33 -6
View File
@@ -43,6 +43,26 @@ function RunBadge({ result }: { result: string | null }) {
return <span className={`badge ${good ? "bg-green-lt text-green" : warn ? "bg-yellow-lt text-yellow" : "bg-red-lt text-red"}`}>{result}</span>;
}
/** What a run's warnings said, folded under "N warnings" so a long list does not crowd the table. */
function Warnings({ count, messages, label }: { count: number; messages: string[]; label?: string }) {
if (count === 0 && messages.length === 0) return null;
const text = label ?? `${count} warning${count === 1 ? "" : "s"}`;
if (messages.length === 0) return <div className="text-secondary small">{text}</div>;
return (
<details className="small">
<summary className="text-secondary">{text}</summary>
<ul className="mb-0 ps-3">
{messages.map((m, i) => (
<li key={i} className="text-break">
{m}
</li>
))}
</ul>
{count > messages.length && <div className="text-secondary">…and {count - messages.length} more that Duplicati did not include</div>}
</details>
);
}
/** The last runs of one backup, newest first. */
function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () => void }) {
const [runs, setRuns] = useState<DuplicatiRun[] | null>(null);
@@ -78,13 +98,12 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
</td>
<td>
<RunBadge result={r.result} />
{(r.errors > 0 || r.warnings > 0) && (
{r.errors > 0 && (
<div className="text-secondary small">
{r.errors > 0 ? `${r.errors} error${r.errors === 1 ? "" : "s"}` : ""}
{r.errors > 0 && r.warnings > 0 ? ", " : ""}
{r.warnings > 0 ? `${r.warnings} warning${r.warnings === 1 ? "" : "s"}` : ""}
{r.errors} error{r.errors === 1 ? "" : "s"}
</div>
)}
<Warnings count={r.warnings} messages={r.warningMessages} />
</td>
<td className="text-end">{took(r.durationSeconds)}</td>
<td className="text-end">{r.sizeBytes === null ? "—" : formatBytes(r.sizeBytes)}</td>
@@ -180,7 +199,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
}
}
async function patch(b: DuplicatiBackup, change: { expectedHours?: number; alert?: boolean }) {
async function patch(b: DuplicatiBackup, change: { expectedHours?: number; alert?: boolean; alertWarnings?: boolean }) {
try {
await api.duplicati.updateBackup(b.id, change);
load();
@@ -213,7 +232,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
</div>
<p className="text-secondary">
Whether the backups Duplicati makes are being made. Duplicati tells this app how each backup went (its own <em>send-http-url</em> option), so nothing here calls Duplicati and no password for it is kept. A backup that <strong>fails</strong>,
or has <strong>not succeeded for longer than it should</strong>, is an alert — see <Link to="/alerts">Alerts</Link>.
or has <strong>not succeeded for longer than it should</strong>, is an alert — see <Link to="/alerts">Alerts</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job&rsquo;s warnings to see what they said, and switch on <em>Alert on warnings</em> for the jobs where they matter.
</p>
<ErrorNotice error={error} />
{fresh && <Address path={fresh.path} name={fresh.name} onDone={() => setFresh(null)} />}
@@ -359,7 +378,10 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<td>
<span className={`badge ${STATE[b.state].cls}`}>{STATE[b.state].label}</span>
{b.problem && <div className="text-secondary small">{b.problem}</div>}
{b.state === "warning" && !b.problem && <Warnings count={b.warnings} messages={b.warningMessages} label={`${b.warnings} warning${b.warnings === 1 ? "" : "s"} in the last run`} />}
{b.problem && b.state === "warning" && <Warnings count={b.warnings} messages={b.warningMessages} label="All the warnings" />}
{!b.alert && <div className="text-secondary small">no alert</div>}
{b.alert && b.alertWarnings && <div className="text-secondary small">alerts on warnings</div>}
</td>
<td>
<div className="btn-list flex-nowrap">
@@ -371,6 +393,11 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alert: !b.alert })}>
{b.alert ? "Mute" : "Alert"}
</button>
{b.alert && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alertWarnings: !b.alertWarnings })} title="Whether a run that finishes with warnings raises an alert (it counts as a good backup either way)">
{b.alertWarnings ? "Stop warning alerts" : "Alert on warnings"}
</button>
)}
<button className="btn btn-sm btn-outline-danger" onClick={() => void forget(b)}>
Forget
</button>