Acknowledge and hand over alerts, incident timelines, and built-in database backups

- Alerts can be acknowledged (note, assignee, duration); acknowledged alerts are left out of what
  needs attention (sidebar, dashboard strip, cards) but stay raised and counted by /metrics
- Incidents: each time an alert is raised and goes away is recorded (alert_acks, alert_incidents,
  incident_notes, migration 0032), with a timeline of acks, maintenance, changes, update runs,
  related alerts and notes; Incidents page and a digest section
- Backups of Homelab Manager's own database: daily checked VACUUM INTO copies, retention, download,
  check, upload, delete, and restore staged and applied at start-up before the database opens
  (pre-restore copy kept); alerts and /metrics for stale or failing backups
- Docs: README, BACKUP, DATABASE, NOTIFICATIONS, ROLES, API; tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 02:21:08 +02:00
1 parent 7a5b623444
commit 2744a84719
41 files changed
+6573 -26

No files matched your search

+51 -5
View File
@@ -14,6 +14,8 @@ import TableToolbar from "../components/TableToolbar";
import SilenceButton from "../components/SilenceButton";
import RunPlaybookButton from "../components/RunPlaybookButton";
import RunbookEntry from "../components/RunbookEntry";
import AckDrawer, { ackWords } from "../components/AckDrawer";
import { useAlertsReport } from "../hooks/useAlertsReport";
const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = {
critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 },
@@ -38,6 +40,8 @@ type Row = AlertItem & { rank: number };
export default function Alerts({ user }: { user: CurrentUser }) {
const canSilence = user.role === "admin" || user.role === "operator";
// The count beside Alerts in the menu is a shared one on its own timer; after an acknowledgement it should change at once.
const { reload: reloadBadge } = useAlertsReport();
const [report, setReport] = useState<AlertsReport | null>(null);
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(false);
@@ -45,6 +49,9 @@ export default function Alerts({ user }: { user: CurrentUser }) {
const [category, setCategory] = useState<"all" | AlertCategory>("all");
const [search, setSearch] = useState("");
const [showSilenced, setShowSilenced] = useState(true);
// Which alerts to show by whether somebody is on them, and the one whose acknowledgement is being edited.
const [attention, setAttention] = useState<"all" | "unacknowledged" | "acknowledged" | "mine">("all");
const [acking, setAcking] = useState<AlertItem | null>(null);
function load(refresh = false) {
setLoading(true);
@@ -67,9 +74,13 @@ export default function Alerts({ user }: { user: CurrentUser }) {
const q = search.trim().toLowerCase();
return report.alerts
.filter((a) => (severity === "all" || a.severity === severity) && (category === "all" || a.category === category) && (showSilenced || !a.silenced))
.filter((a) => {
const on = !!a.ack?.active;
return attention === "all" || (attention === "unacknowledged" ? !on : attention === "acknowledged" ? on : on && a.ack?.assignee?.id === user.id);
})
.filter((a) => !q || [a.message, a.source, CATEGORY_LABELS[a.category]].some((v) => v.toLowerCase().includes(q)))
.map((a) => ({ ...a, rank: SEVERITY[a.severity].rank }));
}, [report, severity, category, search, showSilenced]);
}, [report, severity, category, search, showSilenced, attention, user.id]);
// No initial sort: the server already puts active problems first, worst first.
const { sorted, sortKey, sortDir, requestSort } = useSortable(rows);
@@ -80,16 +91,17 @@ export default function Alerts({ user }: { user: CurrentUser }) {
function exportCsv() {
downloadCsv(
"alerts.csv",
["Severity", "Category", "Source", "Alert", "Silenced", "Ticket"],
(sorted ?? []).map((a) => [SEVERITY[a.severity].label, CATEGORY_LABELS[a.category], a.source, a.message, a.silenced ? "yes" : "no", a.ticket ? (a.ticket.number ?? "opened") : ""]),
["Severity", "Category", "Source", "Alert", "Silenced", "Ticket", "Acknowledged by", "Has it", "Note"],
(sorted ?? []).map((a) => [SEVERITY[a.severity].label, CATEGORY_LABELS[a.category], a.source, a.message, a.silenced ? "yes" : "no", a.ticket ? (a.ticket.number ?? "opened") : "", a.ack?.active ? a.ack.ackedBy : "", a.ack?.active ? (a.ack.assignee?.name ?? "") : "", a.ack?.active ? a.ack.note : ""]),
);
}
const counts = report?.counts;
const nothingFound = report !== null && report.alerts.length === 0;
const cards: { label: string; value: number | undefined; color: string }[] = [
{ label: "Critical", value: counts?.critical, color: "text-red" },
{ label: "Warnings", value: counts?.warning, color: "text-yellow" },
{ label: "Critical", value: counts?.attention?.critical ?? counts?.critical, color: "text-red" },
{ label: "Warnings", value: counts?.attention?.warning ?? counts?.warning, color: "text-yellow" },
...((counts?.acknowledged ?? 0) > 0 ? [{ label: "Acknowledged", value: counts?.acknowledged, color: "text-blue" }] : []),
{ label: "Info", value: counts?.info, color: "text-blue" },
{ label: "Silenced (maintenance)", value: counts?.silenced, color: "text-secondary" },
...((counts?.grouped ?? 0) > 0 ? [{ label: "Grouped under another", value: counts?.grouped, color: "text-secondary" }] : []),
@@ -200,6 +212,14 @@ export default function Alerts({ user }: { user: CurrentUser }) {
</option>
))}
</select>
{(counts?.acknowledged ?? 0) > 0 && (
<select className="form-select form-select-sm w-auto" aria-label="Whether somebody is on it" value={attention} onChange={(e) => setAttention(e.target.value as typeof attention)}>
<option value="all">Acknowledged or not</option>
<option value="unacknowledged">Nobody is on it</option>
<option value="acknowledged">Acknowledged</option>
<option value="mine">Handed to me</option>
</select>
)}
{(counts?.silenced ?? 0) + (counts?.grouped ?? 0) > 0 && (
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={showSilenced} onChange={(e) => setShowSilenced(e.target.checked)} />
@@ -245,6 +265,22 @@ export default function Alerts({ user }: { user: CurrentUser }) {
</span>
)
)}
{a.ack?.active && (
<div className="small mt-1">
<span className="badge bg-blue-lt text-blue me-1" title={`Acknowledged by ${a.ack.ackedBy}`}>
{ackWords(a.ack)}
</span>
{a.ack.note && <span className="text-secondary">{a.ack.note}</span>}
</div>
)}
{a.ack && !a.ack.active && (
<div className="small mt-1 text-secondary">Its acknowledgement ran out — nobody is on it now.</div>
)}
{a.incidentId != null && (
<div className="small">
<Link to={`/incidents/${a.incidentId}`}>Timeline</Link>
</div>
)}
{a.target && (
<div>
<RunbookEntry targetType={a.target.type} targetId={a.target.id} targetName={a.target.name} canEdit={canSilence} forCategory={a.category} />
@@ -273,6 +309,11 @@ export default function Alerts({ user }: { user: CurrentUser }) {
{canSilence && (
<td className="text-nowrap">
<div className="btn-list flex-nowrap">
{!a.silenced && (
<button type="button" className={`btn btn-sm ${a.ack?.active ? "btn-outline-primary" : "btn-outline-secondary"}`} onClick={() => setAcking(a)}>
{a.ack?.active ? "Acknowledged" : "Acknowledge…"}
</button>
)}
<SilenceButton alert={a} onDone={() => void load(true)} />
{a.target?.type === "server" && !a.silenced && <RunPlaybookButton serverName={a.target.name} />}
</div>
@@ -295,6 +336,11 @@ export default function Alerts({ user }: { user: CurrentUser }) {
)}
</>
)}
{acking && <AckDrawer alert={acking} me={user} onClose={() => setAcking(null)} onSaved={() => {
void load(true);
reloadBadge();
}} />}
</>
);
}
+253
View File
@@ -0,0 +1,253 @@
import { useCallback, useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { IconAlertTriangle, IconBell, IconCheck, IconClockPause, IconHandStop, IconLink, IconNote, IconPlayerPlay, IconSettings } from "@tabler/icons-react";
import { api, type CurrentUser, type IncidentDetail as Detail, type TimelineEvent, type TimelineKind } from "../api/client";
import { ackWords } from "../components/AckDrawer";
import RunbookEntry from "../components/RunbookEntry";
import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton";
import { ErrorNotice } from "../components/Notice";
import { confirmDialog } from "../utils/dialogs";
import { formatDateTime } from "../utils/date";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { CATEGORY_NAMES, durationWords, SEVERITY_BADGE } from "./Incidents";
const KIND_ICON: Record<TimelineKind, JSX.Element> = {
alert: <IconAlertTriangle size={16} />,
ack: <IconHandStop size={16} />,
maintenance: <IconClockPause size={16} />,
change: <IconSettings size={16} />,
health: <IconBell size={16} />,
run: <IconPlayerPlay size={16} />,
related: <IconLink size={16} />,
note: <IconNote size={16} />,
};
const TONE_COLOR: Record<TimelineEvent["tone"], string> = { good: "bg-green-lt text-green", bad: "bg-red-lt text-red", neutral: "bg-secondary-lt text-secondary", info: "bg-blue-lt text-blue" };
/** One incident, with everything the app knows about the time around it in the order it happened, and a place for notes. */
export default function IncidentDetail({ user }: { user: CurrentUser }) {
const { id: idParam } = useParams();
const id = Number(idParam);
const canWrite = user.role === "admin" || user.role === "operator";
const [detail, setDetail] = useState<Detail | null>(null);
const [error, setError] = useState<string | null>(null);
const [missing, setMissing] = useState(false);
const [note, setNote] = useState("");
const [busy, setBusy] = useState(false);
const load = useCallback(() => {
if (!Number.isInteger(id)) {
setMissing(true);
return Promise.resolve();
}
return api.incidents
.get(id)
.then((d) => {
setDetail(d);
setError(null);
})
.catch((err) => {
if (/\((404|400)\)/.test(String(err))) setMissing(true);
else setError(readableError(err));
});
}, [id]);
useEffect(() => {
void load();
}, [load]);
// While it is open the picture is still changing.
const open = detail?.incident.open ?? false;
useEffect(() => {
if (!open) return;
const timer = setInterval(() => void load(), 30_000);
return () => clearInterval(timer);
}, [open, load]);
async function addNote() {
setBusy(true);
try {
await api.incidents.addNote(id, note.trim());
setNote("");
await load();
} catch (err) {
toast.error(readableError(err));
} finally {
setBusy(false);
}
}
async function removeNote(noteId: number) {
if (!(await confirmDialog({ title: "Remove this note?", message: "It is taken out of the incident's history.", confirmLabel: "Remove", danger: true }))) return;
try {
await api.incidents.removeNote(id, noteId);
await load();
} catch (err) {
toast.error(readableError(err));
}
}
if (missing) {
return (
<div className="card">
<div className="card-body text-secondary">
There is no incident like that (it may be old enough to have been removed). <Link to="/incidents">All incidents</Link>.
</div>
</div>
);
}
if (!detail) {
return (
<>
<ErrorNotice error={error} />
<BlockSkeleton lines={6} />
</>
);
}
const { incident, ack, timeline } = detail;
const target = incident.target;
return (
<>
<div className="mb-2">
<Link to="/incidents" className="text-secondary">
← Incidents
</Link>
</div>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">{incident.message}</h2>
</div>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
{incident.open ? <span className="badge bg-red-lt text-red">open</span> : <span className="badge bg-green-lt text-green">resolved</span>}
<span className={`badge ${SEVERITY_BADGE[incident.peakSeverity] ?? ""}`}>{incident.peakSeverity}</span>
<span className="text-secondary">{CATEGORY_NAMES[incident.category] ?? incident.category}</span>
{incident.causedBy && <span className="badge bg-secondary-lt text-secondary">caused by {incident.causedBy}</span>}
{target && (
<span className="text-secondary">
· {target.type === "server" ? <Link to={`/servers/${target.id}`}>{target.name}</Link> : target.name}
</span>
)}
{target && <RunbookEntry targetType={target.type} targetId={target.id} targetName={target.name} canEdit={canWrite} forCategory={incident.category} />}
{incident.open && (
<Link to="/alerts" className="ms-auto">
Open in Alerts
</Link>
)}
</div>
<ErrorNotice error={error} />
<div className="row row-cards mb-3">
<div className="col-6 col-lg-3">
<div className="card card-sm">
<div className="card-body">
<div className="h3 mb-0" title={formatDateTime(new Date(incident.openedAt))}>
<TimeAgo value={incident.openedAt} />
</div>
<div className="text-secondary">Began</div>
</div>
</div>
</div>
<div className="col-6 col-lg-3">
<div className="card card-sm">
<div className="card-body">
<div className="h3 mb-0">{durationWords(incident.durationMs)}</div>
<div className="text-secondary">{incident.open ? "So far" : "Lasted"}</div>
</div>
</div>
</div>
<div className="col-6 col-lg-3">
<div className="card card-sm">
<div className="card-body">
<div className="h3 mb-0">{incident.resolvedAt ? <TimeAgo value={incident.resolvedAt} /> : "—"}</div>
<div className="text-secondary">Ended</div>
</div>
</div>
</div>
<div className="col-6 col-lg-3">
<div className="card card-sm">
<div className="card-body">
<div className="h3 mb-0">{incident.notes}</div>
<div className="text-secondary">{incident.notes === 1 ? "Note" : "Notes"}</div>
</div>
</div>
</div>
</div>
{ack && (
<div className={`alert ${ack.active ? "alert-info" : "alert-secondary"}`}>
<div>
<strong>{ack.active ? ackWords(ack) : "Its acknowledgement has run out"}</strong>
{ack.note && <div>{ack.note}</div>}
<div className="small">
Acknowledged by {ack.ackedBy} <TimeAgo value={ack.ackedAt} />.
</div>
</div>
</div>
)}
<div className="row g-3">
<div className="col-lg-8">
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">What happened</h3>
</div>
<div className="list-group list-group-flush">
{timeline.map((e, i) => (
<div className="list-group-item" key={`${e.at}-${i}`}>
<div className="d-flex gap-3">
<span className={`badge ${TONE_COLOR[e.tone]} flex-shrink-0 align-self-start`} style={{ width: 28, height: 28, display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
{KIND_ICON[e.kind] ?? <IconCheck size={16} />}
</span>
<div className="flex-fill">
<div className="d-flex flex-wrap gap-2 align-items-baseline">
<strong>{e.incidentId ? <Link to={`/incidents/${e.incidentId}`}>{e.title}</Link> : e.title}</strong>
<span className="text-secondary small" title={formatDateTime(new Date(e.at))}>
{formatDateTime(new Date(e.at))}
</span>
{e.actor && e.actor !== "system" && <span className="text-secondary small">· {e.actor}</span>}
</div>
{e.detail && <div className={e.kind === "note" ? "mt-1" : "text-secondary small"} style={e.kind === "note" ? { whiteSpace: "pre-wrap" } : undefined}>{e.detail}</div>}
{e.noteId !== undefined && (user.role === "admin" || e.actor === user.name) && (
<button type="button" className="btn btn-sm btn-ghost-secondary mt-1" onClick={() => void removeNote(e.noteId!)}>
Remove note
</button>
)}
</div>
</div>
</div>
))}
</div>
<div className="card-footer text-secondary small">
Put together from the alert itself, the audit log, the maintenance windows, update runs and other alerts about the same thing.
</div>
</div>
</div>
<div className="col-lg-4">
<div className="card">
<div className="card-header">
<h3 className="card-title">Notes</h3>
</div>
<div className="card-body">
{detail.notes.length === 0 && <div className="text-secondary mb-3">Nothing written yet. What was it? What fixed it? What would you do differently?</div>}
{canWrite ? (
<>
<textarea className="form-control mb-2" rows={4} maxLength={4000} placeholder="Add a note…" aria-label="Add a note" value={note} onChange={(e) => setNote(e.target.value)} />
<button type="button" className="btn btn-primary" disabled={busy || note.trim() === ""} onClick={() => void addNote()}>
{busy ? "Saving…" : "Add note"}
</button>
<div className="form-hint text-secondary small mt-2">It appears in the history on the left, with your name and the time.</div>
</>
) : (
detail.notes.length > 0 && <div className="text-secondary small">Operators can add notes.</div>
)}
</div>
</div>
</div>
</div>
</>
);
}
+193
View File
@@ -0,0 +1,193 @@
import { useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom";
import { api, type AlertCategory, type IncidentSummary } from "../api/client";
import { useSortable } from "../hooks/useSortable";
import { useTableSearch } from "../hooks/useTableSearch";
import { usePagination } from "../hooks/usePagination";
import SortableTh from "../components/SortableTh";
import Pagination from "../components/Pagination";
import TableToolbar from "../components/TableToolbar";
import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton";
import { ErrorNotice } from "../components/Notice";
import { downloadCsv } from "../utils/csv";
import { readableError } from "../utils/errors";
export const CATEGORY_NAMES: Record<AlertCategory, string> = {
offline: "Server down",
disk: "Disk & storage",
services: "Failing services",
backup: "Backups",
updates: "Updates",
expiry: "Expiry",
automation: "Automation",
integration: "Integration failing",
monitoring: "Monitoring",
tickets: "Tickets",
};
/** "35 min", "2.5 h", "3 days". */
export function durationWords(ms: number): string {
const minutes = Math.round(ms / 60_000);
if (minutes < 1) return "under a minute";
if (minutes < 90) return `${minutes} min`;
const hours = ms / 3600_000;
if (hours < 48) return `${Math.round(hours * 10) / 10} h`;
return `${Math.round(hours / 24)} days`;
}
export const SEVERITY_BADGE: Record<string, string> = { critical: "bg-red-lt text-red", warning: "bg-yellow-lt text-yellow", info: "bg-blue-lt text-blue" };
type Row = IncidentSummary & { where: string; openFirst: number };
/**
* Every time something was raised as an alert and later went away: when it began, how long it lasted, how bad it got. Open ones are on top.
* Open one for everything that happened around it.
*/
export default function Incidents() {
const [incidents, setIncidents] = useState<IncidentSummary[] | null>(null);
const [error, setError] = useState<string | null>(null);
const [status, setStatus] = useState<"all" | "open" | "resolved">("all");
useEffect(() => {
let alive = true;
const load = () =>
api.incidents
.list()
.then((res) => alive && setIncidents(res.incidents))
.catch((err) => alive && setError(readableError(err)));
void load();
const timer = setInterval(load, 30_000);
return () => {
alive = false;
clearInterval(timer);
};
}, []);
const rows: Row[] = useMemo(
() => (incidents ?? []).filter((i) => status === "all" || (status === "open" ? i.open : !i.open)).map((i) => ({ ...i, where: i.target?.name ?? i.source, openFirst: i.open ? 0 : 1 })),
[incidents, status],
);
const tableSearch = useTableSearch(rows);
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered, "openedAt", "desc", { url: true });
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
const open = (incidents ?? []).filter((i) => i.open).length;
const week = (incidents ?? []).filter((i) => Date.now() - Date.parse(i.openedAt) < 7 * 86_400_000).length;
const longest = (incidents ?? []).filter((i) => !i.open).sort((a, b) => b.durationMs - a.durationMs)[0];
function exportCsv() {
downloadCsv(
"incidents.csv",
["Began", "Ended", "Lasted (minutes)", "Worst", "Kind", "Where", "What", "Notes"],
(sorted ?? []).map((i) => [i.openedAt, i.resolvedAt ?? "", Math.round(i.durationMs / 60_000), i.peakSeverity, CATEGORY_NAMES[i.category] ?? i.category, i.where, i.message, i.notes]),
);
}
const cards: { label: string; value: string | number; note?: string; color: string }[] = [
{ label: "Open now", value: incidents ? open : "…", color: open > 0 ? "text-red" : "text-green" },
{ label: "Began in the last week", value: incidents ? week : "…", color: "" },
{ label: "Longest so far", value: longest ? durationWords(longest.durationMs) : incidents ? "—" : "…", note: longest?.message, color: "text-secondary" },
];
return (
<>
<div className="d-flex align-items-center mb-1">
<h2 className="page-title mb-0">Incidents</h2>
</div>
<p className="text-secondary">
Each time an alert was raised and later went away is one incident, kept with when it began and ended. Open one to see everything the app knows about that time — who acknowledged it, the maintenance windows, what was changed, the update runs and the notes people wrote.
They are recorded from the <Link to="/alerts">Alerts</Link> every few minutes, so one that comes and goes between two looks may not be here.
</p>
<ErrorNotice error={error} />
<div className="row row-cards mb-3">
{cards.map((c) => (
<div className="col-6 col-lg-4" key={c.label}>
<div className="card card-sm">
<div className="card-body">
<div className={`h2 mb-0 ${c.color}`}>{c.value}</div>
<div className="text-secondary">{c.label}</div>
{c.note && <div className="text-secondary small text-truncate">{c.note}</div>}
</div>
</div>
</div>
))}
</div>
<div className="card">
<TableToolbar
search={tableSearch.query}
onSearch={tableSearch.setQuery}
placeholder="Search incidents…"
filters={
<select className="form-select form-select-sm w-auto" aria-label="Show" value={status} onChange={(e) => setStatus(e.target.value as typeof status)}>
<option value="all">Open and resolved</option>
<option value="open">Open</option>
<option value="resolved">Resolved</option>
</select>
}
shown={sorted?.length}
total={rows.length}
onExport={exportCsv}
exportDisabled={!sorted || sorted.length === 0}
/>
<div className="table-responsive">
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<Row> label="Began" sortKeyName="openedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="State" sortKeyName="openFirst" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Lasted" sortKeyName="durationMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Worst" sortKeyName="peakSeverity" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Kind" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Where" sortKeyName="where" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="What" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
</tr>
</thead>
<tbody>
{incidents === null && !error && (
<tr>
<td colSpan={7}>
<BlockSkeleton lines={4} />
</td>
</tr>
)}
{(pageItems ?? []).map((i) => (
<tr key={i.id}>
<td className="text-nowrap">
<TimeAgo value={i.openedAt} />
</td>
<td>{i.open ? <span className="badge bg-red-lt text-red">open</span> : <span className="badge bg-green-lt text-green">resolved</span>}</td>
<td className="text-nowrap">{durationWords(i.durationMs)}</td>
<td>
<span className={`badge ${SEVERITY_BADGE[i.peakSeverity] ?? ""}`}>{i.peakSeverity}</span>
</td>
<td>{CATEGORY_NAMES[i.category] ?? i.category}</td>
<td>{i.target && i.target.type === "server" ? <Link to={`/servers/${i.target.id}`}>{i.where}</Link> : i.where}</td>
<td>
<Link to={`/incidents/${i.id}`}>{i.message}</Link>
{i.causedBy && <span className="badge bg-secondary-lt text-secondary ms-2">caused by {i.causedBy}</span>}
{i.notes > 0 && (
<span className="text-secondary small ms-2">
{i.notes} {i.notes === 1 ? "note" : "notes"}
</span>
)}
</td>
</tr>
))}
{incidents !== null && (sorted ?? []).length === 0 && (
<tr>
<td colSpan={7} className="text-secondary text-center">
{tableSearch.active || status !== "all" ? "Nothing matches that." : "No incidents yet. They are recorded from the Alerts, so the first one appears when something is raised."}
</td>
</tr>
)}
</tbody>
</table>
</div>
<Pagination page={page} pageCount={pageCount} totalCount={totalCount} onPageChange={setPage} />
</div>
</>
);
}
@@ -2,6 +2,7 @@ import { useRef, useState } from "react";
import { api, type EncryptedExportFile, type ImportResult } from "../../api/client";
import { confirmDialog } from "../../utils/dialogs";
import { ErrorNotice } from "../../components/Notice";
import DatabaseBackups from "../../components/DatabaseBackups";
function downloadJson(filename: string, data: unknown) {
const blob = new Blob([JSON.stringify(data)], { type: "application/json" });
@@ -89,6 +90,9 @@ export default function BackupSettings() {
<>
<h3 className="mb-3">Backup</h3>
<DatabaseBackups />
<h4 className="mb-3">Move your configuration</h4>
<div className="row row-cards">
<div className="col-md-6">
<div className="card h-100">