Swedish interface: labels and short texts across every page
About 1,600 more headings, buttons, table columns, status words, placeholders and short messages are translated. Tables of words built when the app loads are now read when they are drawn, so they follow the language, and a test fails if text is translated at load time. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25183c0320
commit
6e39430a1f
173 files changed
+3922
-2245
No files matched your search
@@ -13,7 +13,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ a }: { a: AdguardInstance }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -89,24 +89,24 @@ function Card({ a, canRead, onRead }: { a: AdguardInstance; canRead: boolean; on
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile
|
||||
label={t("DNS answers")}
|
||||
value={!s.running ? "Not running" : s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"}
|
||||
value={!s.running ? t("Not running") : s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : t("No")}
|
||||
sub={s.probe ? (s.probe.ok ? `a question about ${s.probe.name}, asked ${s.probe.host}:${s.dnsPort}` : `${s.probe.error ?? "no answer"} (${s.probe.host}:${s.dnsPort})`) : "no test yet"}
|
||||
tone={!s.running || (s.probe && !s.probe.ok) ? "bad" : undefined}
|
||||
/>
|
||||
<Tile label="Protection" value={s.protectionEnabled ? "On" : "Off"} sub={s.protectionEnabled ? null : s.protectionOffSince ? `since ${formatAgo(s.protectionOffSince)} — nothing is being blocked` : "nothing is being blocked"} tone={s.protectionEnabled ? undefined : "warn"} />
|
||||
<Tile label={t("Protection")} value={s.protectionEnabled ? t("On") : t("Off")} sub={s.protectionEnabled ? null : s.protectionOffSince ? `since ${formatAgo(s.protectionOffSince)} — nothing is being blocked` : "nothing is being blocked"} tone={s.protectionEnabled ? undefined : "warn"} />
|
||||
<Tile label={`Queries${st?.periodHours ? `, last ${st.periodHours >= 48 ? `${Math.round(st.periodHours / 24)} days` : `${st.periodHours} h`}` : ""}`} value={st ? st.queries.toLocaleString() : "—"} sub={st && st.avgMs !== null ? `${st.avgMs} ms on average` : st ? null : "could not be read"} />
|
||||
<Tile label="Blocked" value={st ? st.blocked.toLocaleString() : "—"} sub={st ? (st.blockedPercent === null ? null : `${st.blockedPercent}% of the queries`) : "could not be read"} />
|
||||
<Tile label={t("Blocked")} value={st ? st.blocked.toLocaleString() : "—"} sub={st ? (st.blockedPercent === null ? null : `${st.blockedPercent}% of the queries`) : "could not be read"} />
|
||||
</div>
|
||||
{st && (st.topBlocked.length > 0 || st.topClients.length > 0 || st.topQueried.length > 0) && (
|
||||
<div className="row g-3 mb-3">
|
||||
<Counted title="Blocked most" items={st.topBlocked} empty="Nothing blocked." />
|
||||
<Counted title="Asked about most" items={st.topQueried} empty="No queries." />
|
||||
<Counted title="Asking most" items={st.topClients} empty="No clients." />
|
||||
<Counted title={t("Blocked most")} items={st.topBlocked} empty="Nothing blocked." />
|
||||
<Counted title={t("Asked about most")} items={st.topQueried} empty="No queries." />
|
||||
<Counted title={t("Asking most")} items={st.topClients} empty="No clients." />
|
||||
</div>
|
||||
)}
|
||||
<h4>Filter lists</h4>
|
||||
<h4>{t("Filter lists")}</h4>
|
||||
{s.filters === null ? (
|
||||
<div className="text-secondary small">They could not be read.</div>
|
||||
<div className="text-secondary small">{t("They could not be read.")}</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="text-secondary small mb-2">
|
||||
@@ -171,7 +171,7 @@ export default function AdguardHome({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">AdGuard Home</h2>
|
||||
<PageIntro>
|
||||
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web interface can be up while DNS is not. Nothing is changed. <strong>DNS that stops answering</strong>, <strong>a DNS server that is not running</strong>,{" "}
|
||||
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web interface can be up while DNS is not. Nothing is changed. <strong>{t("DNS that stops answering")}</strong>, <strong>a DNS server that is not running</strong>,{" "}
|
||||
<strong>protection left off for an hour</strong> and <strong>filter lists that stopped updating</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -179,7 +179,7 @@ export default function AdguardHome({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No AdGuard Home connected" hint="Add one under Integrations with its address and, if it has a sign-in, a user name and password." />
|
||||
<EmptyState title={t("No AdGuard Home connected")} hint="Add one under Integrations with its address and, if it has a sign-in, a user name and password." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -163,7 +163,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
{canEdit && showForm && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{editing ? `Edit "${editing.label}"` : "Add an admin link"}</h3>
|
||||
<h3 className="card-title">{editing ? `Edit "${editing.label}"` : t("Add an admin link")}</h3>
|
||||
</div>
|
||||
<form onSubmit={submit}>
|
||||
<div className="card-body row g-3">
|
||||
@@ -177,7 +177,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
onChange={(e) => setForm({ ...form, serverId: e.target.value ? Number(e.target.value) : "" })}
|
||||
>
|
||||
<option value="" disabled>
|
||||
— choose a server —
|
||||
{t("— choose a server —")}
|
||||
</option>
|
||||
{(servers ?? []).map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
@@ -185,10 +185,10 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{editing && <div className="form-hint">Remove and re-add to move it to a different server.</div>}
|
||||
{editing && <div className="form-hint">{t("Remove and re-add to move it to a different server.")}</div>}
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Label</label>
|
||||
<label className="form-label">{t("Label")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -221,7 +221,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
>
|
||||
<option value="">
|
||||
{loadingPorts
|
||||
? "Loading this server's ports…"
|
||||
? t("Loading this server's ports…")
|
||||
: portOptions?.length
|
||||
? "— pick a port to fill in the URL above —"
|
||||
: "No known ports for this server yet"}
|
||||
@@ -243,7 +243,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={saving}>
|
||||
{editing ? "Save changes" : "Add link"}
|
||||
{editing ? t("Save changes") : t("Add link")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={cancelForm}>
|
||||
{t("Cancel")}
|
||||
@@ -257,7 +257,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search server, label, URL…"
|
||||
placeholder={t("Search server, label, URL…")}
|
||||
shown={filtered.length}
|
||||
total={links?.length}
|
||||
actions={
|
||||
@@ -275,7 +275,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<AdminLink> label={t("Server")} sortKeyName="serverName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AdminLink> label="Label" sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AdminLink> label={t("Label")} sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>URL</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
@@ -309,7 +309,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{links === null && <LoadingRow colSpan={canEdit ? 4 : 3} />}
|
||||
{links !== null && links.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 4 : 3} title="No admin links yet" hint="Shortcuts to the management pages of your equipment — a router, a NAS, a hypervisor — kept in one place." action={canEdit ? { label: "Add a link", onClick: startAdd } : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 4 : 3} title={t("No admin links yet")} hint="Shortcuts to the management pages of your equipment — a router, a NAS, a hypervisor — kept in one place." action={canEdit ? { label: t("Add a link"), onClick: startAdd } : undefined} />
|
||||
)}
|
||||
{links !== null && links.length > 0 && (sorted ?? []).length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 4 : 3} filtered={() => setSearch("")} />
|
||||
|
||||
@@ -12,10 +12,10 @@ import { removeWithUndo } from "../utils/undoable";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const METRICS: { value: AlertRuleMetric; label: string; unit: string; hint: string }[] = [
|
||||
{ value: "cpu", label: "CPU load", unit: "%", hint: "As each agent reports it (load average over cores)." },
|
||||
{ value: "mem", label: "Memory in use", unit: "%", hint: "The share of memory in use." },
|
||||
{ value: "disk", label: "Disk use", unit: "%", hint: "How full a disk is — every disk, or the one you name." },
|
||||
{ value: "disk_temp", label: "Disk temperature", unit: "°C", hint: "From the disk's own report (SMART); judged as of the last report." },
|
||||
{ value: "cpu", get label() { return t("CPU load"); }, unit: "%", hint: "As each agent reports it (load average over cores)." },
|
||||
{ value: "mem", get label() { return t("Memory in use"); }, unit: "%", get hint() { return t("The share of memory in use."); } },
|
||||
{ value: "disk", get label() { return t("Disk use"); }, unit: "%", get hint() { return t("How full a disk is — every disk, or the one you name."); } },
|
||||
{ value: "disk_temp", get label() { return t("Disk temperature"); }, unit: "°C", hint: "From the disk's own report (SMART); judged as of the last report." },
|
||||
];
|
||||
const metricOf = (m: AlertRuleMetric) => METRICS.find((x) => x.value === m)!;
|
||||
|
||||
@@ -105,7 +105,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
try {
|
||||
if (initial.id) await api.alertRules.update(initial.id, b);
|
||||
else await api.alertRules.create(b);
|
||||
toast.success(initial.id ? "Saved." : "Rule added.");
|
||||
toast.success(initial.id ? t("Saved.") : t("Rule added."));
|
||||
onSaved();
|
||||
onClose();
|
||||
} catch (err) {
|
||||
@@ -116,7 +116,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
}
|
||||
|
||||
return (
|
||||
<DetailDrawer title={initial.id ? "Change the rule" : "Add a rule"} subtitle={initial.id ? initial.name : "A limit of your own"} onClose={onClose}>
|
||||
<DetailDrawer title={initial.id ? t("Change the rule") : t("Add a rule")} subtitle={initial.id ? initial.name : "A limit of your own"} onClose={onClose}>
|
||||
<ErrorNotice error={error} />
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="rule-name">
|
||||
@@ -127,7 +127,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="rule-metric">
|
||||
Watch
|
||||
{t("Watch")}
|
||||
</label>
|
||||
<select id="rule-metric" className="form-select" value={metric} onChange={(e) => { setMetric(e.target.value as AlertRuleMetric); setTried(null); }}>
|
||||
{METRICS.map((x) => (
|
||||
@@ -149,7 +149,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="rule-operator">
|
||||
Alert when
|
||||
{t("Alert when")}
|
||||
</label>
|
||||
<select id="rule-operator" className="form-select" value={operator} onChange={(e) => setOperator(e.target.value as "above" | "below")}>
|
||||
<option value="above">above</option>
|
||||
@@ -181,7 +181,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="rule-severity">
|
||||
How serious
|
||||
{t("How serious")}
|
||||
</label>
|
||||
<select id="rule-severity" className="form-select" value={severity} onChange={(e) => setSeverity(e.target.value as "warning" | "critical")}>
|
||||
<option value="warning">{t("Warning")}</option>
|
||||
@@ -190,20 +190,20 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="rule-scope">
|
||||
For
|
||||
{t("For")}
|
||||
</label>
|
||||
<select id="rule-scope" className="form-select" value={scope} onChange={(e) => { setScope(e.target.value as typeof scope); setTried(null); }}>
|
||||
<option value="all">{t("Every server")}</option>
|
||||
<option value="server">One server</option>
|
||||
<option value="server">{t("One server")}</option>
|
||||
<option value="tag" disabled={tags.length === 0}>
|
||||
Servers with a tag
|
||||
{t("Servers with a tag")}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{scope === "server" && (
|
||||
<select className="form-select mb-3" aria-label="Which server" value={serverId} onChange={(e) => { setServerId(e.target.value); setTried(null); }}>
|
||||
<option value="">Choose a server…</option>
|
||||
<select className="form-select mb-3" aria-label={t("Which server")} value={serverId} onChange={(e) => { setServerId(e.target.value); setTried(null); }}>
|
||||
<option value="">{t("Choose a server…")}</option>
|
||||
{servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -212,8 +212,8 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
</select>
|
||||
)}
|
||||
{scope === "tag" && (
|
||||
<select className="form-select mb-3" aria-label="Which tag" value={tag} onChange={(e) => { setTag(e.target.value); setTried(null); }}>
|
||||
<option value="">Choose a tag…</option>
|
||||
<select className="form-select mb-3" aria-label={t("Which tag")} value={tag} onChange={(e) => { setTag(e.target.value); setTried(null); }}>
|
||||
<option value="">{t("Choose a tag…")}</option>
|
||||
{tags.map((t) => (
|
||||
<option key={t} value={t}>
|
||||
{t}
|
||||
@@ -238,10 +238,10 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
)}
|
||||
<div className="d-flex gap-2">
|
||||
<button type="button" className="btn btn-primary" disabled={busy || name.trim() === ""} onClick={() => void save()}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
{busy ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={busy} onClick={() => void tryIt()}>
|
||||
Try it now
|
||||
{t("Try it now")}
|
||||
</button>
|
||||
</div>
|
||||
</DetailDrawer>
|
||||
@@ -279,7 +279,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
const { id, ...rest } = asInput(r);
|
||||
await api.alertRules.update(id, { ...rest, enabled: !r.enabled });
|
||||
toast.success(r.enabled ? "Switched off." : "Switched on.");
|
||||
toast.success(r.enabled ? t("Switched off.") : t("Switched on."));
|
||||
await load();
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
@@ -299,27 +299,27 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h3 className="mb-0">Alert rules</h3>
|
||||
<h3 className="mb-0">{t("Alert rules")}</h3>
|
||||
{canEdit && (
|
||||
<div className="ms-auto">
|
||||
<button className="btn btn-primary" onClick={() => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" })}>
|
||||
Add a rule
|
||||
{t("Add a rule")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-secondary mb-3">
|
||||
Limits of your own, on top of the built-in checks: “CPU above 90% for 15 minutes”, “memory above 85%”, “a disk warmer than 55 °C”. What a rule finds is an ordinary alert on the{" "}
|
||||
<Link to="/alerts">Alerts page</Link> — raised and cleared with a message, held back by maintenance, routed by the notification rules. A server that is not reporting is not judged; its own offline alert says that.
|
||||
<Link to="/alerts">{t("Alerts page")}</Link> — raised and cleared with a message, held back by maintenance, routed by the notification rules. A server that is not reporting is not judged; its own offline alert says that.
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
{data === null && !error && <BlockSkeleton lines={3} />}
|
||||
{data && data.rules.length === 0 && (
|
||||
<div className="card">
|
||||
<EmptyState
|
||||
title="No rules of your own yet"
|
||||
hint={canEdit ? "Start from one of these, or add your own." : "An administrator can add them."}
|
||||
action={canEdit ? { label: "Add a rule", onClick: () => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" }) } : undefined}
|
||||
title={t("No rules of your own yet")}
|
||||
hint={canEdit ? t("Start from one of these, or add your own.") : t("An administrator can add them.")}
|
||||
action={canEdit ? { label: t("Add a rule"), onClick: () => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" }) } : undefined}
|
||||
/>
|
||||
{canEdit && (
|
||||
<div className="d-flex flex-wrap justify-content-center gap-2 pb-4">
|
||||
@@ -338,9 +338,9 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Rule</th>
|
||||
<th>{t("Rule")}</th>
|
||||
<th>{t("Severity")}</th>
|
||||
<th>Right now</th>
|
||||
<th>{t("Right now")}</th>
|
||||
{canEdit && (
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
@@ -357,13 +357,13 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
<div className="text-secondary small">{sentence(r)}</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label={t("Severity")}>
|
||||
<span className={`badge ${r.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{r.severity === "critical" ? "Critical" : "Warning"}</span>
|
||||
<span className={`badge ${r.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{r.severity === "critical" ? t("Critical") : t("Warning")}</span>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Right now">
|
||||
<td className="stack-label" data-label={t("Right now")}>
|
||||
{!r.enabled ? (
|
||||
<span className="text-secondary">—</span>
|
||||
) : r.firing.length === 0 ? (
|
||||
<span className="text-green">Not raised</span>
|
||||
<span className="text-green">{t("Not raised")}</span>
|
||||
) : (
|
||||
<div>
|
||||
{r.firing.slice(0, 4).map((f, i) => (
|
||||
@@ -387,10 +387,10 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
<td className="text-nowrap stack-wide">
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setEditing(asInput(r))}>
|
||||
Change
|
||||
{t("Change")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void toggle(r)}>
|
||||
{r.enabled ? "Switch off" : "Switch on"}
|
||||
{r.enabled ? t("Switch off") : t("Switch on")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(r)} aria-label={`Remove ${r.name}`}>
|
||||
{t("Remove")}
|
||||
|
||||
@@ -20,9 +20,9 @@ export default function AlertSettings({ user }: { user: CurrentUser }) {
|
||||
const asked = params.get("view");
|
||||
const view: View = asked === "levels" ? "levels" : isAdmin && asked === "tickets" ? "tickets" : "rules";
|
||||
const tabs = [
|
||||
{ to: "/alert-settings", label: "Alert rules", active: view === "rules" },
|
||||
{ to: "/alert-settings?view=levels", label: "Service levels", active: view === "levels" },
|
||||
...(isAdmin ? [{ to: "/alert-settings?view=tickets", label: "Alert tickets", active: view === "tickets" }] : []),
|
||||
{ to: "/alert-settings", label: t("Alert rules"), active: view === "rules" },
|
||||
{ to: "/alert-settings?view=levels", label: t("Service levels"), active: view === "levels" },
|
||||
...(isAdmin ? [{ to: "/alert-settings?view=tickets", label: t("Alert tickets"), active: view === "tickets" }] : []),
|
||||
];
|
||||
return (
|
||||
<>
|
||||
@@ -30,7 +30,7 @@ export default function AlertSettings({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-0">{t("Alert settings")}</h2>
|
||||
{isAdmin && (
|
||||
<Link to="/settings/notifications" className="ms-auto">
|
||||
Notification settings: channels, what is sent, quiet hours →
|
||||
{t("Notification settings: channels, what is sent, quiet hours →")}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+18
-18
@@ -34,9 +34,9 @@ import { doBulk, plural } from "../utils/bulk";
|
||||
import { t, tn } from "../i18n";
|
||||
|
||||
const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = {
|
||||
critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 },
|
||||
warning: { label: "Warning", badge: "bg-yellow-lt text-yellow", rank: 1 },
|
||||
info: { label: "Info", badge: "bg-blue-lt text-blue", rank: 2 },
|
||||
critical: { get label() { return t("Critical"); }, badge: "bg-red-lt text-red", rank: 0 },
|
||||
warning: { get label() { return t("Warning"); }, badge: "bg-yellow-lt text-yellow", rank: 1 },
|
||||
info: { get label() { return t("Info"); }, badge: "bg-blue-lt text-blue", rank: 2 },
|
||||
};
|
||||
|
||||
const CATEGORY_LABELS: Record<AlertCategory, string> = {
|
||||
@@ -59,9 +59,9 @@ const alertTabs = (view: "now" | "history" | "noise") => (
|
||||
<ViewTabs
|
||||
label={t("Alerts view")}
|
||||
tabs={[
|
||||
{ to: "/alerts", label: "Now", active: view === "now" },
|
||||
{ to: "/alerts?view=history", label: "History", active: view === "history" },
|
||||
{ to: "/alerts?view=noise", label: "Noise", active: view === "noise" },
|
||||
{ to: "/alerts", label: t("Now"), active: view === "now" },
|
||||
{ to: "/alerts?view=history", label: t("History"), active: view === "history" },
|
||||
{ to: "/alerts?view=noise", label: t("Noise"), active: view === "noise" },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -385,12 +385,12 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
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?.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: t("Critical"), value: counts?.attention?.critical ?? counts?.critical, color: "text-red" },
|
||||
{ label: t("Warnings"), value: counts?.attention?.warning ?? counts?.warning, color: "text-yellow" },
|
||||
...((counts?.acknowledged ?? 0) > 0 ? [{ label: t("Acknowledged"), value: counts?.acknowledged, color: "text-blue" }] : []),
|
||||
{ label: t("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" }] : []),
|
||||
...((counts?.grouped ?? 0) > 0 ? [{ label: t("Grouped under another"), value: counts?.grouped, color: "text-secondary" }] : []),
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -435,7 +435,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<div className="card-body py-3">
|
||||
<div className="h3 mb-1">
|
||||
{headline.standing - headline.acknowledged === 0
|
||||
? "Nothing needs attention"
|
||||
? t("Nothing needs attention")
|
||||
: `${headline.standing - headline.acknowledged} ${headline.standing - headline.acknowledged === 1 ? "problem needs" : "problems need"} attention`}
|
||||
{headline.acknowledged > 0 && <span className="text-secondary fw-normal fs-4"> · {headline.acknowledged} acknowledged</span>}
|
||||
</div>
|
||||
@@ -520,7 +520,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<option value="warning">{t("Warning")}</option>
|
||||
<option value="info">{t("Info")}</option>
|
||||
</select>
|
||||
<select className="form-select form-select-sm w-auto" value={groupBy} aria-label="Grouping" onChange={(e) => chooseGroupBy(e.target.value as GroupBy)}>
|
||||
<select className="form-select form-select-sm w-auto" value={groupBy} aria-label={t("Grouping")} onChange={(e) => chooseGroupBy(e.target.value as GroupBy)}>
|
||||
{(Object.keys(GROUP_BY_LABELS) as GroupBy[]).map((g) => (
|
||||
<option key={g} value={g}>
|
||||
{GROUP_BY_LABELS[g]}
|
||||
@@ -583,9 +583,9 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Row> label={t("Severity")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Kind" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Kind")} sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Source")} sortKeyName="source" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Alert" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Alert")} sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{canSilence && (
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
@@ -655,7 +655,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
)}
|
||||
{a.incidentId != null && (
|
||||
<div className="small">
|
||||
<Link to={incidentPath(a.incidentId)}>Timeline</Link>
|
||||
<Link to={incidentPath(a.incidentId)}>{t("Timeline")}</Link>
|
||||
</div>
|
||||
)}
|
||||
{(a.target || a.kind) && (
|
||||
@@ -688,8 +688,8 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
)}
|
||||
{a.ticket &&
|
||||
(() => {
|
||||
const label = a.ticket.number ? `Ticket #${a.ticket.number}${a.ticket.closedAt ? " (closed)" : ""}` : "Ticket opened";
|
||||
const title = a.ticket.closedAt ? "This ticket was closed in osTicket from here" : a.ticket.grouped ? "Part of one ticket that covers several problems that appeared together" : "A ticket was opened for this in osTicket";
|
||||
const label = a.ticket.number ? `Ticket #${a.ticket.number}${a.ticket.closedAt ? " (closed)" : ""}` : t("Ticket opened");
|
||||
const title = a.ticket.closedAt ? t("This ticket was closed in osTicket from here") : a.ticket.grouped ? t("Part of one ticket that covers several problems that appeared together") : "A ticket was opened for this in osTicket";
|
||||
return a.ticket.url ? (
|
||||
<a className="badge bg-blue-lt text-blue ms-2" href={a.ticket.url} target="_blank" rel="noopener noreferrer" title={title}>
|
||||
{label}
|
||||
|
||||
+17
-17
@@ -16,7 +16,7 @@ const EXPIRY = [
|
||||
{ value: "90", label: "90 days" },
|
||||
{ value: "30", label: "30 days" },
|
||||
{ value: "365", label: "1 year" },
|
||||
{ value: "", label: "No end — until I remove it" },
|
||||
{ value: "", get label() { return t("No end — until I remove it"); } },
|
||||
];
|
||||
|
||||
const READS = [
|
||||
@@ -72,7 +72,7 @@ export default function ApiTokens() {
|
||||
|
||||
async function remove(item_: ApiToken) {
|
||||
// Not undoable: the secret is not kept, so a token cannot be made again the same.
|
||||
if (!(await confirmDialog({ title: "Remove a token", message: `Remove "${item_.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove a token"), message: `Remove "${item_.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.apiTokens.remove(item_.id);
|
||||
toast.success(`Removed "${item_.label}".`);
|
||||
@@ -102,10 +102,10 @@ export default function ApiTokens() {
|
||||
<code className="text-break">{fresh.secret}</code>
|
||||
<CopyButton text={fresh.secret} />
|
||||
</div>
|
||||
<div className="small">Send it in a header, never in the address:</div>
|
||||
<div className="small">{t("Send it in a header, never in the address:")}</div>
|
||||
<pre className="mb-2 mt-1 small">{`curl -H "Authorization: Bearer ${fresh.secret}" ${origin}/api/v1/alerts`}</pre>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setFresh(null)}>
|
||||
I have copied it
|
||||
{t("I have copied it")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -113,18 +113,18 @@ export default function ApiTokens() {
|
||||
|
||||
<form className="card mb-3" onSubmit={make}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Make a token</h3>
|
||||
<h3 className="card-title">{t("Make a token")}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3 align-items-end">
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="tok-label">
|
||||
What it is for
|
||||
{t("What it is for")}
|
||||
</label>
|
||||
<input id="tok-label" className="form-control" maxLength={60} required placeholder="e.g. Home Assistant" value={label} onChange={(e) => setLabel(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="tok-exp">
|
||||
Works for
|
||||
{t("Works for")}
|
||||
</label>
|
||||
<select id="tok-exp" className="form-select" value={expiry} onChange={(e) => setExpiry(e.target.value)}>
|
||||
{EXPIRY.map((o) => (
|
||||
@@ -136,7 +136,7 @@ export default function ApiTokens() {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<button type="submit" className="btn btn-primary w-100" disabled={busy || label.trim() === "" || (tokens?.length ?? 0) >= max}>
|
||||
{busy ? "Making…" : "Make the token"}
|
||||
{busy ? "Making…" : t("Make the token")}
|
||||
</button>
|
||||
</div>
|
||||
{(tokens?.length ?? 0) >= max && <div className="col-12 text-secondary small">You have {max} tokens, the most there can be. Remove one you do not use.</div>}
|
||||
@@ -152,9 +152,9 @@ export default function ApiTokens() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Starts with</th>
|
||||
<th>Made</th>
|
||||
<th>Last used</th>
|
||||
<th>{t("Starts with")}</th>
|
||||
<th>{t("Made")}</th>
|
||||
<th>{t("Last used")}</th>
|
||||
<th>{t("Ends")}</th>
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
@@ -175,13 +175,13 @@ export default function ApiTokens() {
|
||||
<strong>{item_.label}</strong>
|
||||
{item_.expired && <span className="badge bg-red-lt text-red ms-2">expired</span>}
|
||||
</td>
|
||||
<td className="stack-label font-monospace" data-label="Starts with">
|
||||
<td className="stack-label font-monospace" data-label={t("Starts with")}>
|
||||
{item_.tokenPrefix}…
|
||||
</td>
|
||||
<td className="stack-label" data-label="Made">
|
||||
<td className="stack-label" data-label={t("Made")}>
|
||||
<TimeAgo value={item_.createdAt} fromDb />
|
||||
</td>
|
||||
<td className="stack-label" data-label="Last used">
|
||||
<td className="stack-label" data-label={t("Last used")}>
|
||||
{item_.lastUsedAt ? <TimeAgo value={item_.lastUsedAt} /> : <span className="text-secondary">never</span>}
|
||||
</td>
|
||||
<td className="stack-label" data-label={t("Ends")}>
|
||||
@@ -194,7 +194,7 @@ export default function ApiTokens() {
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{tokens !== null && tokens.length === 0 && <EmptyRow colSpan={6} title="No tokens yet" hint="Make one above, and copy it when it is shown: that is the only time it is." />}
|
||||
{tokens !== null && tokens.length === 0 && <EmptyRow colSpan={6} title={t("No tokens yet")} hint="Make one above, and copy it when it is shown: that is the only time it is." />}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -202,7 +202,7 @@ export default function ApiTokens() {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">What it can read</h3>
|
||||
<h3 className="card-title">{t("What it can read")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -215,7 +215,7 @@ export default function ApiTokens() {
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="text-secondary small">The full list, with an example of each answer, is in docs/API.md.</div>
|
||||
<div className="text-secondary small">{t("The full list, with an example of each answer, is in docs/API.md.")}</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
+18
-18
@@ -15,7 +15,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ a }: { a: AuthentikInfo }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -60,17 +60,17 @@ function Card({ a }: { a: AuthentikInfo }) {
|
||||
|
||||
<h4>Outposts</h4>
|
||||
{s.outposts.length === 0 ? (
|
||||
<div className="text-secondary mb-3">None.</div>
|
||||
<div className="text-secondary mb-3">{t("None.")}</div>
|
||||
) : (
|
||||
<div className="table-responsive mb-3">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Outpost</th>
|
||||
<th>Type</th>
|
||||
<th className="text-end">Serves</th>
|
||||
<th>{t("Type")}</th>
|
||||
<th className="text-end">{t("Serves")}</th>
|
||||
<th>{t("Reporting")}</th>
|
||||
<th>Last heard</th>
|
||||
<th>{t("Last heard")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -99,7 +99,7 @@ function Card({ a }: { a: AuthentikInfo }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h4>Certificates</h4>
|
||||
<h4>{t("Certificates")}</h4>
|
||||
{s.certificates.length === 0 ? (
|
||||
<div className="text-secondary mb-3">None that Authentik doesn’t renew itself.</div>
|
||||
) : (
|
||||
@@ -114,18 +114,18 @@ function Card({ a }: { a: AuthentikInfo }) {
|
||||
|
||||
<h4>API tokens and app passwords that expire</h4>
|
||||
{s.tokens.length === 0 ? (
|
||||
<div className="text-secondary mb-3">None.</div>
|
||||
<div className="text-secondary mb-3">{t("None.")}</div>
|
||||
) : (
|
||||
<ul className="mb-3">
|
||||
{s.tokens.map((t) => (
|
||||
<li key={t.identifier}>
|
||||
{t.identifier}
|
||||
{s.tokens.map((tok) => (
|
||||
<li key={tok.identifier}>
|
||||
{tok.identifier}
|
||||
<span className="text-secondary">
|
||||
{" "}
|
||||
({t.intent === "app_password" ? "app password" : "API token"}
|
||||
{t.user ? `, ${t.user}` : ""})
|
||||
({tok.intent === "app_password" ? "app password" : t("API token")}
|
||||
{tok.user ? `, ${tok.user}` : ""})
|
||||
</span>{" "}
|
||||
— <Left days={t.days} warn={7} critical={2} />
|
||||
— <Left days={tok.days} warn={7} critical={2} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -192,19 +192,19 @@ export default function Authentik({ user }: { user: CurrentUser }) {
|
||||
<ViewTabs
|
||||
label="Authentik view"
|
||||
tabs={[
|
||||
{ to: "/authentik", label: "Status", active: view === "status" },
|
||||
{ to: "/authentik?view=users", label: "Users and groups", active: view === "users" },
|
||||
{ to: "/authentik", label: t("Status"), active: view === "status" },
|
||||
{ to: "/authentik?view=users", label: t("Users and groups"), active: view === "users" },
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
{view === "status" ? (
|
||||
<PageIntro>
|
||||
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
|
||||
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
<strong>{t("API token")}</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
{isAdmin && (
|
||||
<>
|
||||
{" "}
|
||||
Making users and looking after users and groups is under <Link to="/authentik?view=users">Users and groups</Link>.
|
||||
Making users and looking after users and groups is under <Link to="/authentik?view=users">{t("Users and groups")}</Link>.
|
||||
</>
|
||||
)}
|
||||
</PageIntro>
|
||||
@@ -219,7 +219,7 @@ export default function Authentik({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Authentik connected" hint="Add one under Integrations with its address and an API token (Authentik → Directory → Tokens and App passwords → Create, intent API Token)." />
|
||||
<EmptyState title={t("No Authentik connected")} hint="Add one under Integrations with its address and an API token (Authentik → Directory → Tokens and App passwords → Create, intent API Token)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+47
-47
@@ -26,22 +26,22 @@ interface Row extends CoverageGuest {
|
||||
const RANK: Record<CoverageStatus, number> = { failed: 0, none: 1, stale: 2, unknown: 3, ok: 4 };
|
||||
|
||||
const STATUS: Record<CoverageStatus, { label: string; badge: string; hint: string }> = {
|
||||
ok: { label: "Recent backup", badge: "bg-green-lt text-green", hint: "Backed up within the limit, and nothing failed." },
|
||||
stale: { label: "Stale", badge: "bg-yellow-lt text-yellow", hint: "Its newest backup is older than the limit." },
|
||||
failed: { label: "Failed", badge: "bg-red-lt text-red", hint: "The latest backup didn't succeed, or the newest snapshot failed verification." },
|
||||
none: { label: "No backup", badge: "bg-red-lt text-red", hint: "No backup found, and no backup job covers it." },
|
||||
unknown: { label: "Unknown", badge: "bg-secondary-lt text-secondary", hint: "A backup job covers it, but nothing here says when it last ran — typical when backups go somewhere other than a Backup Server." },
|
||||
ok: { get label() { return t("Recent backup"); }, badge: "bg-green-lt text-green", get hint() { return t("Backed up within the limit, and nothing failed."); } },
|
||||
stale: { get label() { return t("Stale"); }, badge: "bg-yellow-lt text-yellow", get hint() { return t("Its newest backup is older than the limit."); } },
|
||||
failed: { get label() { return t("Failed"); }, badge: "bg-red-lt text-red", get hint() { return t("The latest backup didn't succeed, or the newest snapshot failed verification."); } },
|
||||
none: { get label() { return t("No backup"); }, badge: "bg-red-lt text-red", get hint() { return t("No backup found, and no backup job covers it."); } },
|
||||
unknown: { get label() { return t("Unknown"); }, badge: "bg-secondary-lt text-secondary", hint: "A backup job covers it, but nothing here says when it last ran — typical when backups go somewhere other than a Backup Server." },
|
||||
};
|
||||
|
||||
const STALE_CHOICES = [1, 2, 3, 7, 14];
|
||||
|
||||
const RESTORE: Record<RestoreStatus, { label: string; badge: string }> = {
|
||||
never: { label: "Never tested", badge: "bg-secondary-lt text-secondary" },
|
||||
ok: { label: "Restored fine", badge: "bg-green-lt text-green" },
|
||||
partial: { label: "Partly worked", badge: "bg-yellow-lt text-yellow" },
|
||||
failed: { label: "Restore failed", badge: "bg-red-lt text-red" },
|
||||
stale: { label: "Test is old", badge: "bg-yellow-lt text-yellow" },
|
||||
not_needed: { label: "No need to test", badge: "bg-secondary-lt text-secondary" },
|
||||
never: { get label() { return t("Never tested"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
ok: { get label() { return t("Restored fine"); }, badge: "bg-green-lt text-green" },
|
||||
partial: { get label() { return t("Partly worked"); }, badge: "bg-yellow-lt text-yellow" },
|
||||
failed: { get label() { return t("Restore failed"); }, badge: "bg-red-lt text-red" },
|
||||
stale: { get label() { return t("Test is old"); }, badge: "bg-yellow-lt text-yellow" },
|
||||
not_needed: { get label() { return t("No need to test"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
};
|
||||
const RESULT_WORDS: Record<RestoreResult, string> = { ok: "It restored and worked", partial: "It restored, but not everything worked", failed: "It failed", not_needed: "No need to test this one" };
|
||||
|
||||
@@ -159,25 +159,25 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
downloadCsv(
|
||||
"backup-coverage.csv",
|
||||
["Guest", "Type", "ID", "Node", "Cluster", "In a backup job", "Last backup", "Source", "Status", "Problem", "Restore test", "Tested on"],
|
||||
sorted.map((r) => [r.name, r.type === "qemu" ? "VM" : "Container", r.vmid, r.node, r.integrationName, r.inJob ? "yes" : "no", r.lastBackupAt ?? "", r.lastSource === "pbs" ? "Backup Server" : r.lastSource === "task" ? "Proxmox task" : "", STATUS[r.status].label, r.failure ?? "", r.restoreTest ? RESTORE[r.restoreTest.status].label : "", r.restoreTest?.testedAt ?? ""]),
|
||||
sorted.map((r) => [r.name, r.type === "qemu" ? "VM" : "Container", r.vmid, r.node, r.integrationName, r.inJob ? "yes" : "no", r.lastBackupAt ?? "", r.lastSource === "pbs" ? t("Backup Server") : r.lastSource === "task" ? t("Proxmox task") : "", STATUS[r.status].label, r.failure ?? "", r.restoreTest ? RESTORE[r.restoreTest.status].label : "", r.restoreTest?.testedAt ?? ""]),
|
||||
);
|
||||
}
|
||||
|
||||
const cards: { label: string; value: string | number; color: string; note?: string }[] = [
|
||||
{ label: "Guests", value: report ? (c?.total ?? 0) : "…", color: "" },
|
||||
{ label: "Recent backup", value: report ? (c?.ok ?? 0) : "…", color: "text-green" },
|
||||
{ label: "Failed", value: report ? (c?.failed ?? 0) : "…", color: (c?.failed ?? 0) > 0 ? "text-red" : "" },
|
||||
{ label: "No backup", value: report ? (c?.none ?? 0) : "…", color: (c?.none ?? 0) > 0 ? "text-red" : "" },
|
||||
{ label: "Stale", value: report ? (c?.stale ?? 0) : "…", color: (c?.stale ?? 0) > 0 ? "text-yellow" : "", note: `older than ${staleDays} ${staleDays === 1 ? "day" : "days"}` },
|
||||
{ label: "Unknown", value: report ? (c?.unknown ?? 0) : "…", color: "text-secondary", note: (c?.unknown ?? 0) > 0 ? "in a job, last run not visible" : undefined },
|
||||
{ label: t("Guests"), value: report ? (c?.total ?? 0) : "…", color: "" },
|
||||
{ label: t("Recent backup"), value: report ? (c?.ok ?? 0) : "…", color: "text-green" },
|
||||
{ label: t("Failed"), value: report ? (c?.failed ?? 0) : "…", color: (c?.failed ?? 0) > 0 ? "text-red" : "" },
|
||||
{ label: t("No backup"), value: report ? (c?.none ?? 0) : "…", color: (c?.none ?? 0) > 0 ? "text-red" : "" },
|
||||
{ label: t("Stale"), value: report ? (c?.stale ?? 0) : "…", color: (c?.stale ?? 0) > 0 ? "text-yellow" : "", note: `older than ${staleDays} ${staleDays === 1 ? "day" : "days"}` },
|
||||
{ label: t("Unknown"), value: report ? (c?.unknown ?? 0) : "…", color: "text-secondary", note: (c?.unknown ?? 0) > 0 ? "in a job, last run not visible" : undefined },
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
<h2 className="page-title mb-0">Backup coverage</h2>
|
||||
<h2 className="page-title mb-0">{t("Backup coverage")}</h2>
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={() => load(true)} disabled={checking}>
|
||||
{checking ? "Checking…" : "Check now"}
|
||||
{checking ? t("Checking…") : t("Check now")}
|
||||
</button>
|
||||
</div>
|
||||
{tabs}
|
||||
@@ -188,7 +188,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
{badSources.length > 0 && (
|
||||
<div className="alert alert-warning">
|
||||
Couldn't read everything — what is missing below isn't necessarily wrong:{" "}
|
||||
{badSources.map((s) => `${s.kind === "pbs" ? "Backup Server" : "Proxmox"} “${s.name}” (${s.error})`).join("; ")}.
|
||||
{badSources.map((s) => `${s.kind === "pbs" ? t("Backup Server") : "Proxmox"} “${s.name}” (${s.error})`).join("; ")}.
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -210,19 +210,19 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
<TableToolbar
|
||||
search={tableSearch.query}
|
||||
onSearch={tableSearch.setQuery}
|
||||
placeholder="Search guests…"
|
||||
placeholder={t("Search guests…")}
|
||||
filters={
|
||||
<>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Show guests that are" value={status} onChange={(e) => setParam("status", e.target.value)}>
|
||||
<option value="">All guests</option>
|
||||
<option value="attention">Needing attention</option>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Show guests that are")} value={status} onChange={(e) => setParam("status", e.target.value)}>
|
||||
<option value="">{t("All guests")}</option>
|
||||
<option value="attention">{t("Needing attention")}</option>
|
||||
{(Object.keys(RANK) as CoverageStatus[]).map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{STATUS[s].label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Stale after" value={staleDays} onChange={(e) => setParam("stale", e.target.value === "2" ? null : e.target.value)}>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Stale after")} value={staleDays} onChange={(e) => setParam("stale", e.target.value === "2" ? null : e.target.value)}>
|
||||
{STALE_CHOICES.map((d) => (
|
||||
<option key={d} value={d}>
|
||||
Stale after {d} {d === 1 ? "day" : "days"}
|
||||
@@ -240,11 +240,11 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Row> label="Guest" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="In a job" sortKeyName="inJob" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Last backup" sortKeyName="lastBackupAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Guest")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("In a job")} sortKeyName="inJob" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Last backup")} sortKeyName="lastBackupAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>Restore test</th>
|
||||
<th>{t("Restore test")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -274,7 +274,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
{r.lastBackupAt ? (
|
||||
<>
|
||||
<TimeAgo value={r.lastBackupAt} />
|
||||
<div className="text-secondary small">{r.lastSource === "pbs" ? "Backup Server" : "Proxmox task"}</div>
|
||||
<div className="text-secondary small">{r.lastSource === "pbs" ? t("Backup Server") : t("Proxmox task")}</div>
|
||||
</>
|
||||
) : (
|
||||
<span className="text-secondary">—</span>
|
||||
@@ -298,7 +298,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
{canRecord && r.restoreKey && (
|
||||
<div>
|
||||
<button type="button" className="btn btn-link btn-sm p-0" onClick={() => setDraft({ key: r.restoreKey!, label: r.name, testedAt: todayIso(), result: "ok", note: "" })}>
|
||||
Record a test
|
||||
{t("Record a test")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -306,7 +306,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</tr>
|
||||
))}
|
||||
{report !== null && sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={5} {...(rows.length === 0 ? { title: "No Proxmox guests to show", hint: "Connect a Proxmox integration and its virtual machines and containers appear here, with when each was last backed up.", action: { label: "Connect Proxmox", to: "/integrations" } } : { filtered: () => { tableSearch.setQuery(""); setParam("status", null); } })} />
|
||||
<EmptyRow colSpan={5} {...(rows.length === 0 ? { title: t("No Proxmox guests to show"), hint: t("Connect a Proxmox integration and its virtual machines and containers appear here, with when each was last backed up."), action: { label: t("Connect Proxmox"), to: "/integrations" } } : { filtered: () => { tableSearch.setQuery(""); setParam("status", null); } })} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -327,20 +327,20 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
{draft.key === null && (
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="rt-label">
|
||||
What was restored
|
||||
{t("What was restored")}
|
||||
</label>
|
||||
<input id="rt-label" className="form-control" required maxLength={120} placeholder="e.g. Photos share, Gitea database" value={draft.label} onChange={(e) => setDraft({ ...draft, label: e.target.value })} />
|
||||
</div>
|
||||
)}
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="rt-date">
|
||||
On
|
||||
{t("On")}
|
||||
</label>
|
||||
<input id="rt-date" type="date" className="form-control" required max={todayIso()} value={draft.testedAt} onChange={(e) => setDraft({ ...draft, testedAt: e.target.value })} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="rt-result">
|
||||
How it went
|
||||
{t("How it went")}
|
||||
</label>
|
||||
<select id="rt-result" className="form-select" value={draft.result} onChange={(e) => setDraft({ ...draft, result: e.target.value as RestoreResult })}>
|
||||
{(Object.keys(RESULT_WORDS) as RestoreResult[]).map((r) => (
|
||||
@@ -352,14 +352,14 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<label className="form-label" htmlFor="rt-note">
|
||||
Note (optional)
|
||||
{t("Note (optional)")}
|
||||
</label>
|
||||
<input id="rt-note" className="form-control" maxLength={500} placeholder="e.g. restored to a scratch VM, booted, the database was there" value={draft.note} onChange={(e) => setDraft({ ...draft, note: e.target.value })} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={saving || draft.label.trim() === ""}>
|
||||
{saving ? "Saving…" : "Record it"}
|
||||
{saving ? "Saving…" : t("Record it")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -370,11 +370,11 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
|
||||
<div className="card mt-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Restore tests</h3>
|
||||
<h3 className="card-title">{t("Restore tests")}</h3>
|
||||
{canRecord && !draft && (
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm" onClick={() => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" })}>
|
||||
Record a test of something else
|
||||
{t("Record a test of something else")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -385,7 +385,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</div>
|
||||
{custom.length > 0 && (
|
||||
<div className="card-body pb-0">
|
||||
<div className="text-secondary small mb-1">Other things being tracked</div>
|
||||
<div className="text-secondary small mb-1">{t("Other things being tracked")}</div>
|
||||
<div className="d-flex flex-wrap gap-2">
|
||||
{custom.map((c) => (
|
||||
<span key={c.key} className={`badge ${RESTORE[c.status].badge}`}>
|
||||
@@ -399,10 +399,10 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>What</th>
|
||||
<th>Result</th>
|
||||
<th>Note</th>
|
||||
<th>{t("Date")}</th>
|
||||
<th>{t("What")}</th>
|
||||
<th>{t("Result")}</th>
|
||||
<th>{t("Note")}</th>
|
||||
{isAdmin && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -416,7 +416,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
)}
|
||||
{tests?.map((item_) => (
|
||||
<tr key={item_.id}>
|
||||
<td className="stack-label" data-label="Date">{item_.testedAt}</td>
|
||||
<td className="stack-label" data-label={t("Date")}>{item_.testedAt}</td>
|
||||
<td>{item_.label}</td>
|
||||
<td>
|
||||
<span className={`badge ${RESTORE[item_.result].badge}`}>{RESTORE[item_.result].label}</span>
|
||||
@@ -435,7 +435,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</tr>
|
||||
))}
|
||||
{tests !== null && tests.length === 0 && (
|
||||
<EmptyRow colSpan={isAdmin ? 5 : 4} title="No restore recorded yet" hint="A backup nobody has restored is a hope, not a backup. Try restoring one — to a scratch machine is fine — and record how it went." action={canRecord ? { label: "Record a test", onClick: () => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" }) } : undefined} />
|
||||
<EmptyRow colSpan={isAdmin ? 5 : 4} title={t("No restore recorded yet")} hint="A backup nobody has restored is a hope, not a backup. Try restoring one — to a scratch machine is fine — and record how it went." action={canRecord ? { label: t("Record a test"), onClick: () => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" }) } : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { CurrentUser } from "../api/client";
|
||||
import ViewTabs from "../components/ViewTabs";
|
||||
import Backups from "./Backups";
|
||||
import PbsBackup from "./PbsBackup";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* The Proxmox backups, on one page with a tab for each view: **Backup coverage** (is every guest in a backup job, and when was it last backed up) and **Proxmox Backup Server** (its datastores,
|
||||
@@ -15,7 +16,7 @@ export default function BackupsHub({ user }: { user: CurrentUser }) {
|
||||
<ViewTabs
|
||||
label="Backup view"
|
||||
tabs={[
|
||||
{ to: "/backups", label: "Backup coverage", active: view === "coverage" },
|
||||
{ to: "/backups", label: t("Backup coverage"), active: view === "coverage" },
|
||||
{ to: "/backups?view=pbs", label: "Proxmox Backup Server", active: view === "pbs" },
|
||||
]}
|
||||
/>
|
||||
|
||||
+11
-11
@@ -16,9 +16,9 @@ const TONE_DOT: Record<ChangeEntry["tone"], string> = { good: "#2fb344", bad: "#
|
||||
const RANGES: { days: number; label: string }[] = [
|
||||
{ days: 1, label: "Last 24 hours" },
|
||||
{ days: 7, label: "Last 7 days" },
|
||||
{ days: 30, label: "Last 30 days" },
|
||||
{ days: 30, get label() { return t("Last 30 days"); } },
|
||||
{ days: 90, label: "Last 90 days" },
|
||||
{ days: 400, label: "Everything kept" },
|
||||
{ days: 400, get label() { return t("Everything kept"); } },
|
||||
];
|
||||
|
||||
const PAGE = 100;
|
||||
@@ -29,10 +29,10 @@ const PAGE = 100;
|
||||
*/
|
||||
const changeTabs = (view: "changes" | "audit") => (
|
||||
<ViewTabs
|
||||
label="Change log view"
|
||||
label={t("Change log view")}
|
||||
tabs={[
|
||||
{ to: "/changes", label: "Readable", active: view === "changes" },
|
||||
{ to: "/changes?view=audit", label: "Raw audit log", active: view === "audit" },
|
||||
{ to: "/changes", label: t("Readable"), active: view === "changes" },
|
||||
{ to: "/changes?view=audit", label: t("Raw audit log"), active: view === "audit" },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -158,8 +158,8 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-body d-flex flex-wrap gap-2 align-items-center">
|
||||
<input className="form-control w-auto flex-grow-1" style={{ maxWidth: "22rem" }} type="search" aria-label="Search the change log" placeholder="Search: a server, a person, a word…" value={text} onChange={(e) => setText(e.target.value)} />
|
||||
<select className="form-select w-auto" aria-label="Kind of change" value={kind} onChange={(e) => setParam("kind", e.target.value || null)}>
|
||||
<input className="form-control w-auto flex-grow-1" style={{ maxWidth: "22rem" }} type="search" aria-label={t("Search the change log")} placeholder={t("Search: a server, a person, a word…")} value={text} onChange={(e) => setText(e.target.value)} />
|
||||
<select className="form-select w-auto" aria-label={t("Kind of change")} value={kind} onChange={(e) => setParam("kind", e.target.value || null)}>
|
||||
<option value="">{t("All kinds")}</option>
|
||||
{kinds.map((k) => (
|
||||
<option key={k.id} value={k.id}>
|
||||
@@ -175,7 +175,7 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select className="form-select w-auto" aria-label="How far back" value={days} onChange={(e) => setParam("days", e.target.value === "7" ? null : e.target.value)}>
|
||||
<select className="form-select w-auto" aria-label={t("How far back")} value={days} onChange={(e) => setParam("days", e.target.value === "7" ? null : e.target.value)}>
|
||||
{RANGES.map((r) => (
|
||||
<option key={r.days} value={r.days}>
|
||||
{r.label}
|
||||
@@ -193,10 +193,10 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
filtered
|
||||
title={t("Nothing matches that")}
|
||||
hint={`Nothing in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()} fits what is searched for. Try a wider range, or fewer filters.`}
|
||||
action={{ label: "Clear the search and filters", onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }}
|
||||
action={{ label: t("Clear the search and filters"), onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }}
|
||||
/>
|
||||
) : (
|
||||
<EmptyState title="Nothing has changed" hint={`No change was recorded in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()}. Try a wider range.`} action={days < 400 ? { label: "Show everything kept", onClick: () => setParam("days", "400") } : undefined} />
|
||||
<EmptyState title={t("Nothing has changed")} hint={`No change was recorded in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()}. Try a wider range.`} action={days < 400 ? { label: t("Show everything kept"), onClick: () => setParam("days", "400") } : undefined} />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -237,7 +237,7 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
{more && (
|
||||
<div className="text-center mb-3">
|
||||
<button className="btn" onClick={() => void older()} disabled={loadingMore}>
|
||||
{loadingMore ? "Loading…" : "Show older"}
|
||||
{loadingMore ? t("Loading…") : t("Show older")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+15
-15
@@ -11,17 +11,17 @@ import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const KINDS: { id: AgendaKind; label: string }[] = [
|
||||
{ id: "secret", label: "Secrets" },
|
||||
{ id: "certificate", label: "Certificates" },
|
||||
{ id: "domain", label: "Domains" },
|
||||
{ id: "tailscale", label: "Tailscale keys" },
|
||||
{ id: "warranty", label: "Warranties" },
|
||||
{ id: "support", label: "End of support" },
|
||||
{ id: "maintenance", label: "Maintenance" },
|
||||
{ id: "restore", label: "Restore tests" },
|
||||
{ id: "updates", label: "Updates waiting" },
|
||||
{ id: "todo", label: "To do" },
|
||||
{ id: "renewal", label: "Renewals" },
|
||||
{ id: "secret", get label() { return t("Secrets"); } },
|
||||
{ id: "certificate", get label() { return t("Certificates"); } },
|
||||
{ id: "domain", get label() { return t("Domains"); } },
|
||||
{ id: "tailscale", get label() { return t("Tailscale keys"); } },
|
||||
{ id: "warranty", get label() { return t("Warranties"); } },
|
||||
{ id: "support", get label() { return t("End of support"); } },
|
||||
{ id: "maintenance", get label() { return t("Maintenance"); } },
|
||||
{ id: "restore", get label() { return t("Restore tests"); } },
|
||||
{ id: "updates", get label() { return t("Updates waiting"); } },
|
||||
{ id: "todo", get label() { return t("To do"); } },
|
||||
{ id: "renewal", get label() { return t("Renewals"); } },
|
||||
];
|
||||
const KIND_LABEL = Object.fromEntries(KINDS.map((k) => [k.id, k.label])) as Record<AgendaKind, string>;
|
||||
|
||||
@@ -29,7 +29,7 @@ const RANGES: { days: number; label: string }[] = [
|
||||
{ days: 30, label: "Next 30 days" },
|
||||
{ days: 90, label: "Next 3 months" },
|
||||
{ days: 180, label: "Next 6 months" },
|
||||
{ days: 400, label: "Next year" },
|
||||
{ days: 400, get label() { return t("Next year"); } },
|
||||
];
|
||||
|
||||
/** "today", "tomorrow", "in 5 days", "3 days ago". */
|
||||
@@ -176,9 +176,9 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
const needNow = inRange.filter((i) => i.daysLeft < 0 && i.kind !== "updates").length;
|
||||
const thisWeek = inRange.filter((i) => i.daysLeft >= 0 && i.daysLeft <= 7 && i.kind !== "updates").length;
|
||||
const cards = [
|
||||
{ label: "Past their date", value: agenda ? String(needNow) : "…", color: needNow > 0 ? "text-red" : "text-green" },
|
||||
{ label: t("Past their date"), value: agenda ? String(needNow) : "…", color: needNow > 0 ? "text-red" : "text-green" },
|
||||
{ label: "In the next 7 days", value: agenda ? String(thisWeek) : "…", color: thisWeek > 0 ? "text-yellow" : "" },
|
||||
{ label: "In the list", value: agenda ? String(shown.length) : "…", color: "" },
|
||||
{ label: t("In the list"), value: agenda ? String(shown.length) : "…", color: "" },
|
||||
];
|
||||
|
||||
function exportCsv() {
|
||||
@@ -278,7 +278,7 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
{agenda !== null && sections.length === 0 && (
|
||||
<div className="card">
|
||||
{filtered ? (
|
||||
<EmptyState filtered title={t("Nothing matches that")} hint={t("Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters.")} action={{ label: "Clear filters", onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
|
||||
<EmptyState filtered title={t("Nothing matches that")} hint={t("Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters.")} action={{ label: t("Clear filters"), onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
|
||||
) : (
|
||||
<EmptyState title={t("Nothing is coming up")} hint={`Nothing expires, ends or is planned in the next ${days} days. Dates come from Secrets, Domains, Inventory (warranty and end of support), Maintenance and the endpoint checks' certificates.`} />
|
||||
)}
|
||||
|
||||
@@ -12,11 +12,11 @@ import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const KINDS: { kind: ConsistencyKind; title: string; blurb: string }[] = [
|
||||
{ kind: "ip_conflict", title: "Address conflicts", blurb: "The same address reported by more than one server." },
|
||||
{ kind: "ip_conflict", get title() { return t("Address conflicts"); }, blurb: "The same address reported by more than one server." },
|
||||
{ kind: "dns_stale", title: "DNS out of date", blurb: "A DNS record named after a server that points at an address the server doesn't have." },
|
||||
{ kind: "ipam_stale", title: "IPAM out of date", blurb: "An IPAM entry labelled with a server's name at an address the server doesn't have." },
|
||||
{ kind: "not_in_ipam", title: "Not in IPAM", blurb: "Addresses in use — reported by a server or pointed at by DNS — that IPAM doesn't list." },
|
||||
{ kind: "no_dns", title: "No DNS record", blurb: "Server addresses on your LAN that no DNS record points at." },
|
||||
{ kind: "not_in_ipam", get title() { return t("Not in IPAM"); }, blurb: "Addresses in use — reported by a server or pointed at by DNS — that IPAM doesn't list." },
|
||||
{ kind: "no_dns", get title() { return t("No DNS record"); }, blurb: "Server addresses on your LAN that no DNS record points at." },
|
||||
];
|
||||
|
||||
const SEVERITY_BADGE: Record<ConsistencySeverity, string> = {
|
||||
@@ -78,10 +78,10 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
|
||||
async function ignore(f: ConsistencyFinding) {
|
||||
const reason = await promptDialog({
|
||||
title: "Ignore this finding",
|
||||
title: t("Ignore this finding"),
|
||||
message: "Why is this fine? (optional — shown in the Ignored list)",
|
||||
placeholder: "e.g. intentional, or a test machine",
|
||||
confirmLabel: "Ignore",
|
||||
confirmLabel: t("Ignore"),
|
||||
});
|
||||
if (reason === null) return; // cancelled
|
||||
setBusyKey(f.key);
|
||||
@@ -124,11 +124,11 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
if (!report || !f.ip) return;
|
||||
const suggestion = f.ip.includes(":") ? `${f.ip}/64` : `${f.ip.split(".").slice(0, 3).join(".")}.0/24`;
|
||||
const range = await promptDialog({
|
||||
title: "Exclude a range",
|
||||
message: "Leave this range out of the report entirely — every address in it, from servers, IPAM and DNS alike.",
|
||||
title: t("Exclude a range"),
|
||||
message: t("Leave this range out of the report entirely — every address in it, from servers, IPAM and DNS alike."),
|
||||
label: "Range (a network like 192.168.16.0/20, or a single address)",
|
||||
defaultValue: suggestion,
|
||||
confirmLabel: "Exclude",
|
||||
confirmLabel: t("Exclude"),
|
||||
required: true,
|
||||
});
|
||||
if (range === null || !range.trim()) return;
|
||||
@@ -165,7 +165,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={() => void load()} disabled={loading}>
|
||||
{loading ? "Checking…" : "Refresh"}
|
||||
{loading ? "Checking…" : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -202,7 +202,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
{report && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-body">
|
||||
<div className="fw-bold">Excluded ranges</div>
|
||||
<div className="fw-bold">{t("Excluded ranges")}</div>
|
||||
<div className="text-secondary small mb-2">
|
||||
Addresses in these ranges are left out of the report completely — servers, IPAM and DNS alike. Meant for networks that
|
||||
aren't part of your LAN, like Docker's, which repeat the same subnet on many hosts.
|
||||
@@ -214,7 +214,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
</div>
|
||||
<div className="d-flex flex-wrap gap-1 mb-2">
|
||||
{report.excludedRanges.length === 0 && <span className="text-secondary small">Nothing excluded.</span>}
|
||||
{report.excludedRanges.length === 0 && <span className="text-secondary small">{t("Nothing excluded.")}</span>}
|
||||
{report.excludedRanges.map((r) => (
|
||||
<span key={r} className="badge bg-secondary-lt text-secondary d-inline-flex align-items-center">
|
||||
<code className="bg-transparent p-0">{r}</code>
|
||||
@@ -240,7 +240,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
onChange={(e) => setNewRange(e.target.value)}
|
||||
/>
|
||||
<button type="submit" className="btn btn-sm btn-primary" disabled={savingRanges || !newRange.trim()}>
|
||||
Exclude
|
||||
{t("Exclude")}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
@@ -311,16 +311,16 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
<div className="btn-list flex-nowrap">
|
||||
{f.kind === "not_in_ipam" && f.ip && (
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => void addToIpam(f)} disabled={busyKey === f.key}>
|
||||
Add to IPAM
|
||||
{t("Add to IPAM")}
|
||||
</button>
|
||||
)}
|
||||
{f.ip && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void excludeAround(f)} disabled={savingRanges} title="Leave a whole range out of the report">
|
||||
Exclude range
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void excludeAround(f)} disabled={savingRanges} title={t("Leave a whole range out of the report")}>
|
||||
{t("Exclude range")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void ignore(f)} disabled={busyKey === f.key}>
|
||||
Ignore
|
||||
{t("Ignore")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -341,7 +341,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
})
|
||||
}
|
||||
>
|
||||
{expanded.has(kind) ? "Show fewer" : `Show all ${items.length}`}
|
||||
{expanded.has(kind) ? t("Show fewer") : `Show all ${items.length}`}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -355,7 +355,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
<h3 className="card-title">Ignored ({report.ignored.length})</h3>
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-link btn-sm p-0" onClick={() => setShowIgnored((s) => !s)}>
|
||||
{showIgnored ? "Hide" : "Show"}
|
||||
{showIgnored ? t("Hide") : t("Show")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -374,7 +374,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void restore(i.id)}>
|
||||
Stop ignoring
|
||||
{t("Stop ignoring")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+30
-30
@@ -40,10 +40,10 @@ function ElectricityCard({ e }: { e: Electricity }) {
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Electricity</h3>
|
||||
<h3 className="card-title">{t("Electricity")}</h3>
|
||||
<div className="card-actions">
|
||||
<Link to="/inventory" className="btn btn-sm">
|
||||
Open the Inventory
|
||||
{t("Open the Inventory")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,22 +53,22 @@ function ElectricityCard({ e }: { e: Electricity }) {
|
||||
) : (
|
||||
<div className="row g-3 mb-3">
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">Typical draw</div>
|
||||
<div className="text-secondary small">{t("Typical draw")}</div>
|
||||
<div className="h2 mb-0">{e.watts.toLocaleString()} W</div>
|
||||
<div className="text-secondary small">{e.kwhPerMonth?.toLocaleString(undefined, { maximumFractionDigits: 0 })} kWh a month</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">Per month</div>
|
||||
<div className="text-secondary small">{t("Per month")}</div>
|
||||
<div className="h2 mb-0">{e.monthly !== null ? moneyIn(e.monthly, e.currencyLabel, e.currency) : "—"}</div>
|
||||
<div className="text-secondary small">{e.pricePerKwh !== null ? `at ${e.pricePerKwh} per kWh` : "no price set"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">Per year</div>
|
||||
<div className="text-secondary small">{t("Per year")}</div>
|
||||
<div className="h2 mb-0">{e.yearly !== null ? moneyIn(e.yearly, e.currencyLabel, e.currency) : "—"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">In the totals</div>
|
||||
<div className="h2 mb-0">{e.includedInTotals ? "Yes" : "No"}</div>
|
||||
<div className="text-secondary small">{t("In the totals")}</div>
|
||||
<div className="h2 mb-0">{e.includedInTotals ? t("Yes") : t("No")}</div>
|
||||
<div className="text-secondary small">{e.includedInTotals ? "under Electricity" : "see below"}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -79,10 +79,10 @@ function ElectricityCard({ e }: { e: Electricity }) {
|
||||
<table className="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hardware</th>
|
||||
<th className="text-end">Draw</th>
|
||||
<th className="text-end">Per month</th>
|
||||
<th style={{ minWidth: 140 }}>Share</th>
|
||||
<th>{t("Hardware")}</th>
|
||||
<th className="text-end">{t("Draw")}</th>
|
||||
<th className="text-end">{t("Per month")}</th>
|
||||
<th style={{ minWidth: 140 }}>{t("Share")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -131,15 +131,15 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
|
||||
}}
|
||||
>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">What</label>
|
||||
<label className="form-label">{t("What")}</label>
|
||||
<input className="form-control" required maxLength={100} placeholder="e.g. tooweb.se domain, VPN, Plex pass" value={v.name} onChange={(e) => setV({ ...v, name: e.target.value })} autoFocus />
|
||||
</div>
|
||||
<div className="col-6 col-md-2">
|
||||
<label className="form-label">Amount</label>
|
||||
<label className="form-label">{t("Amount")}</label>
|
||||
<input className="form-control" required inputMode="decimal" placeholder="9.99" value={amount} onChange={(e) => setAmount(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-6 col-md-1">
|
||||
<label className="form-label">Currency</label>
|
||||
<label className="form-label">{t("Currency")}</label>
|
||||
<input className="form-control text-uppercase" required maxLength={3} list="cost-currencies" value={v.currency} onChange={(e) => setV({ ...v, currency: e.target.value })} />
|
||||
<datalist id="cost-currencies">
|
||||
{currencies.map((c) => (
|
||||
@@ -148,14 +148,14 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
|
||||
</datalist>
|
||||
</div>
|
||||
<div className="col-6 col-md-2">
|
||||
<label className="form-label">Paid</label>
|
||||
<label className="form-label">{t("Paid")}</label>
|
||||
<select className="form-select" value={v.period} onChange={(e) => setV({ ...v, period: e.target.value as CostInput["period"] })}>
|
||||
<option value="month">every month</option>
|
||||
<option value="year">every year</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-6 col-md-2">
|
||||
<label className="form-label">Kind</label>
|
||||
<label className="form-label">{t("Kind")}</label>
|
||||
<input className="form-control" maxLength={40} list="cost-categories" value={v.category} onChange={(e) => setV({ ...v, category: e.target.value })} />
|
||||
<datalist id="cost-categories">
|
||||
{categories.map((c) => (
|
||||
@@ -164,16 +164,16 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
|
||||
</datalist>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">A day it is billed (optional)</label>
|
||||
<label className="form-label">{t("A day it is billed (optional)")}</label>
|
||||
<input type="date" className="form-control" value={v.renewsOn ?? ""} onChange={(e) => setV({ ...v, renewsOn: e.target.value === "" ? null : e.target.value })} />
|
||||
</div>
|
||||
<div className="col-md-8">
|
||||
<label className="form-label">Note (optional)</label>
|
||||
<label className="form-label">{t("Note (optional)")}</label>
|
||||
<input className="form-control" maxLength={300} placeholder="where it is paid, what it covers, when to cancel…" value={v.note ?? ""} onChange={(e) => setV({ ...v, note: e.target.value })} />
|
||||
</div>
|
||||
<div className="col-md-4 d-flex gap-2">
|
||||
<button className="btn btn-primary" disabled={!valid || saving}>
|
||||
{saving ? "Saving…" : "Save"}
|
||||
{saving ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={saving} onClick={onCancel}>
|
||||
{t("Cancel")}
|
||||
@@ -210,7 +210,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
if (form?.id != null) await api.costs.update(form.id, value);
|
||||
else await api.costs.create(value);
|
||||
toast.success(form?.id != null ? "Saved." : "Added.");
|
||||
toast.success(form?.id != null ? t("Saved.") : t("Added."));
|
||||
setForm(null);
|
||||
load();
|
||||
} catch (err) {
|
||||
@@ -221,7 +221,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function remove(i: CostItem) {
|
||||
if (!(await confirmDialog({ title: "Remove from costs", message: `Remove "${i.name}"?`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove from costs"), message: `Remove "${i.name}"?`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.costs.remove(i.id);
|
||||
toast.success("Removed.");
|
||||
@@ -243,7 +243,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
{isAdmin && !form && (
|
||||
<button className="btn btn-primary ms-auto flex-shrink-0" onClick={() => setForm({ id: null, value: blank(defaultCurrency) })}>
|
||||
Add something you pay for
|
||||
{t("Add something you pay for")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -284,7 +284,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
{form && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{form.id != null ? "Change it" : "Add something you pay for"}</h3>
|
||||
<h3 className="card-title">{form.id != null ? t("Change it") : t("Add something you pay for")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<ItemForm initial={form.value} categories={report?.categories ?? []} currencies={currencies} saving={saving} onSave={(v) => void save(v)} onCancel={() => setForm(null)} />
|
||||
@@ -296,7 +296,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
{empty && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="Nothing added yet" hint={isAdmin ? "Add the domains, VPN, licences and subscriptions you pay for; a Hetzner project's estimate is added by itself." : "An administrator adds what is paid for."} />
|
||||
<EmptyState title={t("Nothing added yet")} hint={isAdmin ? "Add the domains, VPN, licences and subscriptions you pay for; a Hetzner project's estimate is added by itself." : "An administrator adds what is paid for."} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -307,11 +307,11 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>What</th>
|
||||
<th>Kind</th>
|
||||
<th>Paid</th>
|
||||
<th>Per month</th>
|
||||
<th>Billed next</th>
|
||||
<th>{t("What")}</th>
|
||||
<th>{t("Kind")}</th>
|
||||
<th>{t("Paid")}</th>
|
||||
<th>{t("Per month")}</th>
|
||||
<th>{t("Billed next")}</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -322,7 +322,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
<strong>{a.name}</strong> <span className="badge bg-blue-lt text-blue">read from {a.source}</span>
|
||||
<div className="text-secondary small text-break">{a.detail}{a.stale ? " — not read lately, so this may be out of date" : ""}</div>
|
||||
</td>
|
||||
<td className="text-secondary">{a.category ?? "Hosting"}</td>
|
||||
<td className="text-secondary">{a.category ?? t("Hosting")}</td>
|
||||
<td className="text-secondary">estimate</td>
|
||||
<td>{money(a.monthly, a.currency)}</td>
|
||||
<td className="text-secondary">—</td>
|
||||
|
||||
+38
-38
@@ -293,13 +293,13 @@ function TechnitiumBody({ enabled, instance, loading }: { enabled: boolean; inst
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label={t("DNS answers")} value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
|
||||
<MiniStat label={t("DNS answers")} value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : t("No")} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label={t("Queries, 24 h")} value={st ? st.queries.toLocaleString() : "—"} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Blocked" value={st?.blockedPercent != null ? `${st.blockedPercent}%` : "—"} accent={!s.blockingEnabled && s.settings.blockLists.count > 0 ? "#f59e0b" : undefined} />
|
||||
<MiniStat label={t("Blocked")} value={st?.blockedPercent != null ? `${st.blockedPercent}%` : "—"} accent={!s.blockingEnabled && s.settings.blockLists.count > 0 ? "#f59e0b" : undefined} />
|
||||
</div>
|
||||
</div>
|
||||
{how.length > 0 && <BreakdownBar data={how} colors={TECHNITIUM_HOW_COLORS} compact />}
|
||||
@@ -788,11 +788,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
// What has nothing set up yet. These get one list at the bottom instead of a grey "Not configured" card each.
|
||||
const notSetUp: { label: string; to: string; what: string }[] = [];
|
||||
if (dnsStats?.totalProviders === 0) notSetUp.push({ label: "DNS", to: "/dns", what: t("connect a DNS provider to see zones and records") });
|
||||
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: "Secrets", to: "/secrets", what: t("track when a token, certificate or password expires") });
|
||||
if (serverSummary?.total === 0) notSetUp.push({ label: "Servers", to: "/servers", what: "add a server and install its agent" });
|
||||
if (heartbeatList !== null && heartbeatList.length === 0) notSetUp.push({ label: "Heartbeats", to: "/heartbeats", what: "have a backup or cron job report in, so you hear when it doesn't run" });
|
||||
if (endpointChecks !== null && endpointChecks.length === 0) notSetUp.push({ label: "Endpoints", to: "/endpoints", what: "ask a web address, a port or a certificate whether it is fine" });
|
||||
if (domainList !== null && domains.length === 0) notSetUp.push({ label: "Domains", to: "/dns?view=domains", what: "appear after a DNS zone is added and the daily check has run" });
|
||||
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: t("Secrets"), to: "/secrets", what: t("track when a token, certificate or password expires") });
|
||||
if (serverSummary?.total === 0) notSetUp.push({ label: t("Servers"), to: "/servers", what: "add a server and install its agent" });
|
||||
if (heartbeatList !== null && heartbeatList.length === 0) notSetUp.push({ label: t("Heartbeats"), to: "/heartbeats", what: "have a backup or cron job report in, so you hear when it doesn't run" });
|
||||
if (endpointChecks !== null && endpointChecks.length === 0) notSetUp.push({ label: t("Endpoints"), to: "/endpoints", what: "ask a web address, a port or a certificate whether it is fine" });
|
||||
if (domainList !== null && domains.length === 0) notSetUp.push({ label: t("Domains"), to: "/dns?view=domains", what: "appear after a DNS zone is added and the daily check has run" });
|
||||
if (integrations !== null) {
|
||||
for (const { type, label } of WIDGETS) {
|
||||
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: t("connect it under Integrations") });
|
||||
@@ -905,7 +905,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<MiniStat label={t("Records")} value={dnsStats.totalRecords} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Providers" value={`${dnsStats.enabledProviders}/${dnsStats.totalProviders}`} />
|
||||
<MiniStat label={t("Providers")} value={`${dnsStats.enabledProviders}/${dnsStats.totalProviders}`} />
|
||||
</div>
|
||||
</div>
|
||||
{dnsStats.perProvider.some((p) => p.error) && (
|
||||
@@ -948,13 +948,13 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Monitored" value={totalSecrets} />
|
||||
<MiniStat label={t("Monitored")} value={totalSecrets} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Expiring" value={expiringSecrets} accent={expiringSecrets > 0 ? "#f59e0b" : undefined} />
|
||||
<MiniStat label={t("Expiring")} value={expiringSecrets} accent={expiringSecrets > 0 ? "#f59e0b" : undefined} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Expired" value={expiredSecrets} accent={expiredSecrets > 0 ? "#ef4444" : undefined} />
|
||||
<MiniStat label={t("Expired")} value={expiredSecrets} accent={expiredSecrets > 0 ? "#ef4444" : undefined} />
|
||||
</div>
|
||||
</div>
|
||||
<BreakdownBar data={secretsByType} colors={SECRET_TYPE_COLORS} compact />
|
||||
@@ -1012,7 +1012,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
data={[
|
||||
{ label: t("Online"), count: serverSummary.online },
|
||||
{ label: t("Offline"), count: serverSummary.offline.length },
|
||||
{ label: "No data", count: serverSummary.noData },
|
||||
{ label: t("No data"), count: serverSummary.noData },
|
||||
].filter((d) => d.count > 0)}
|
||||
colors={SERVER_STATE_COLORS}
|
||||
compact
|
||||
@@ -1090,21 +1090,21 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Tracked" value={<Link to="/dns?view=domains" className="text-reset text-decoration-none">{domains.length}</Link>} />
|
||||
<MiniStat label={t("Tracked")} value={<Link to="/dns?view=domains" className="text-reset text-decoration-none">{domains.length}</Link>} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Expiring" value={expiringDomains.length} accent={expiringDomains.length > 0 ? "#f59e0b" : undefined} />
|
||||
<MiniStat label={t("Expiring")} value={expiringDomains.length} accent={expiringDomains.length > 0 ? "#f59e0b" : undefined} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Expired" value={expiredDomains.length} accent={expiredDomains.length > 0 ? "#ef4444" : undefined} />
|
||||
<MiniStat label={t("Expired")} value={expiredDomains.length} accent={expiredDomains.length > 0 ? "#ef4444" : undefined} />
|
||||
</div>
|
||||
</div>
|
||||
<BreakdownBar
|
||||
data={[
|
||||
{ label: "OK", count: okDomains },
|
||||
{ label: "Expiring", count: expiringDomains.length },
|
||||
{ label: "Expired", count: expiredDomains.length },
|
||||
{ label: "No date", count: undatedDomains },
|
||||
{ label: t("Expiring"), count: expiringDomains.length },
|
||||
{ label: t("Expired"), count: expiredDomains.length },
|
||||
{ label: t("No date"), count: undatedDomains },
|
||||
].filter((d) => d.count > 0)}
|
||||
colors={DOMAIN_STATE_COLORS}
|
||||
compact
|
||||
@@ -1172,13 +1172,13 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Checks" value={endpointChecks.filter((c) => c.enabled).length} />
|
||||
<MiniStat label={t("Checks")} value={endpointChecks.filter((c) => c.enabled).length} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Up" value={endpointChecks.filter((c) => c.enabled && c.lastOk === true).length} />
|
||||
<MiniStat label={t("Up")} value={endpointChecks.filter((c) => c.enabled && c.lastOk === true).length} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Down" value={endpointsDown.length} accent={endpointsDown.length > 0 ? "#ef4444" : undefined} />
|
||||
<MiniStat label={t("Down")} value={endpointsDown.length} accent={endpointsDown.length > 0 ? "#ef4444" : undefined} />
|
||||
</div>
|
||||
</div>
|
||||
{endpointsDown.slice(0, 3).map((c) => (
|
||||
@@ -1246,7 +1246,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Jobs" value={heartbeatList.filter((h) => h.enabled).length} />
|
||||
<MiniStat label={t("Jobs")} value={heartbeatList.filter((h) => h.enabled).length} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label={t("On time")} value={heartbeatList.filter((h) => h.state === "up" || h.state === "running").length} />
|
||||
@@ -1270,7 +1270,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
|
||||
{TYPE_GROUPS.filter((group) => integrations?.some((i) => group.types.includes(i.type))).map((group) => (
|
||||
<Fragment key={group.id}>
|
||||
<SectionHeader title={group.label} hint={GROUP_HINTS[group.id]} />
|
||||
<SectionHeader title={t(group.label)} hint={t(GROUP_HINTS[group.id])} />
|
||||
<div className="row row-cards">
|
||||
{WIDGETS.filter(({ type }) => group.types.includes(type)).map(({ type, label }) => {
|
||||
const integration = integrations?.find((i) => i.type === type && i.enabled);
|
||||
@@ -1301,7 +1301,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
hide={integrations === null || !integrations.some((i) => i.type === type)}
|
||||
badge={
|
||||
isLive ? (
|
||||
<span className="badge bg-green-lt text-green">Connected</span>
|
||||
<span className="badge bg-green-lt text-green">{t("Connected")}</span>
|
||||
) : integration ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">{t("Connecting…")}</span>
|
||||
) : (
|
||||
@@ -1317,7 +1317,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Unauthorized"
|
||||
label={t("Unauthorized")}
|
||||
value={tailscaleSummary!.unauthorized}
|
||||
accent={tailscaleSummary!.unauthorized > 0 ? "#f59e0b" : undefined}
|
||||
/>
|
||||
@@ -1342,10 +1342,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Repositories" value={giteaSummary!.repoCount} />
|
||||
<MiniStat label={t("Repositories")} value={giteaSummary!.repoCount} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Private" value={giteaSummary!.privateCount} />
|
||||
<MiniStat label={t("Private")} value={giteaSummary!.privateCount} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
@@ -1366,7 +1366,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<MiniStat label={t("Running / Total")} value={`${dockhandSummary!.running}/${dockhandSummary!.total}`} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Hosts" value={dockhandSummary!.hostCount} />
|
||||
<MiniStat label={t("Hosts")} value={dockhandSummary!.hostCount} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
@@ -1423,11 +1423,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Volumes" value={synologySummary!.volumeCount} />
|
||||
<MiniStat label={t("Volumes")} value={synologySummary!.volumeCount} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Unhealthy"
|
||||
label={t("Unhealthy")}
|
||||
value={synologySummary!.volumesNotNormal + synologySummary!.disksNotNormal}
|
||||
accent={synologySummary!.volumesNotNormal + synologySummary!.disksNotNormal > 0 ? "#ef4444" : undefined}
|
||||
/>
|
||||
@@ -1456,10 +1456,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Monitors" value={uptimeKumaSummary!.total} />
|
||||
<MiniStat label={t("Monitors")} value={uptimeKumaSummary!.total} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Down" value={uptimeKumaSummary!.down} accent={uptimeKumaSummary!.down > 0 ? "#ef4444" : undefined} />
|
||||
<MiniStat label={t("Down")} value={uptimeKumaSummary!.down} accent={uptimeKumaSummary!.down > 0 ? "#ef4444" : undefined} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label={t("Matched to a server")} value={`${uptimeKumaSummary!.matched}/${uptimeKumaSummary!.total}`} />
|
||||
@@ -1472,18 +1472,18 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
) : isLivePbs ? (
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Datastores" value={pbsSummary!.datastoreCount} />
|
||||
<MiniStat label={t("Datastores")} value={pbsSummary!.datastoreCount} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Failed"
|
||||
label={t("Failed")}
|
||||
value={pbsSummary!.failedSnapshotCount}
|
||||
accent={pbsSummary!.failedSnapshotCount > 0 ? "#ef4444" : undefined}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Unverified"
|
||||
label={t("Unverified")}
|
||||
value={pbsSummary!.unverifiedSnapshotCount}
|
||||
accent={pbsSummary!.unverifiedSnapshotCount > 0 ? "#f59e0b" : undefined}
|
||||
/>
|
||||
@@ -1496,7 +1496,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Overdue"
|
||||
label={t("Overdue")}
|
||||
value={osTicketSummary!.overdue}
|
||||
accent={osTicketSummary!.overdue > 0 ? "#ef4444" : undefined}
|
||||
/>
|
||||
@@ -1537,7 +1537,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
) : alerts ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>
|
||||
) : i.health?.status === "ok" ? (
|
||||
<span className="badge bg-green-lt text-green">Working</span>
|
||||
<span className="badge bg-green-lt text-green">{t("Working")}</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not checked yet")}</span>
|
||||
);
|
||||
@@ -1549,7 +1549,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
: alerts
|
||||
? `${alerts.count} open ${alerts.count === 1 ? "alert" : "alerts"}.`
|
||||
: i.enabled
|
||||
? "Nothing open."
|
||||
? t("Nothing open.")
|
||||
: "Switched off under Integrations."}
|
||||
</div>
|
||||
{i.enabled && (
|
||||
|
||||
+30
-30
@@ -42,10 +42,10 @@ const emptyRecordForm: DnsRecordInput = { type: "A", name: "", content: "", ttl:
|
||||
|
||||
const dnsTabs = (view: "records" | "domains") => (
|
||||
<ViewTabs
|
||||
label="DNS view"
|
||||
label={t("DNS view")}
|
||||
tabs={[
|
||||
{ to: "/dns", label: "Zones and records", active: view === "records" },
|
||||
{ to: "/dns?view=domains", label: "Domain names", active: view === "domains" },
|
||||
{ to: "/dns", label: t("Zones and records"), active: view === "records" },
|
||||
{ to: "/dns?view=domains", label: t("Domain names"), active: view === "domains" },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -233,7 +233,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
|
||||
async function removeRecord(r: DnsRecord) {
|
||||
if (!selectedProviderId || !selectedZone) return;
|
||||
if (!(await confirmDialog({ title: "Delete DNS record", message: `Delete ${r.type} record "${r.name}"?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete DNS record"), message: `Delete ${r.type} record "${r.name}"?`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
setError(null);
|
||||
try {
|
||||
await api.dns.records.remove(selectedProviderId, selectedZone.id, r.id);
|
||||
@@ -259,10 +259,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
const zone = selectedZone;
|
||||
const cached = zone.recordCount > 0 ? ` (${zone.recordCount} record${zone.recordCount === 1 ? " is" : "s are"} cached here)` : "";
|
||||
const typed = await promptDialog({
|
||||
title: "Delete zone",
|
||||
title: t("Delete zone"),
|
||||
message: `This deletes the zone "${zone.name}" on ${selectedProvider.name}, and every record in it${cached}, for good. It cannot be undone, and what uses this server stops finding the names in it. Type the name of the zone to confirm.`,
|
||||
label: "Zone name",
|
||||
confirmLabel: "Delete",
|
||||
label: t("Zone name"),
|
||||
confirmLabel: t("Delete"),
|
||||
required: true,
|
||||
});
|
||||
if (typed === null) return;
|
||||
@@ -280,7 +280,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
}
|
||||
|
||||
async function removeProvider(p: DnsProviderSummary) {
|
||||
if (!(await confirmDialog({ title: "Delete DNS provider", message: `Delete provider "${p.name}"? This removes its cached zones and records too.`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete DNS provider"), message: `Delete provider "${p.name}"? This removes its cached zones and records too.`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
try {
|
||||
await api.dns.providers.remove(p.id);
|
||||
if (selectedProviderId === p.id) setSelectedProviderId(null);
|
||||
@@ -312,7 +312,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
downloadCsv(
|
||||
"dns-providers.csv",
|
||||
["Name", "Provider", "Status"],
|
||||
sortedProviders.map((p) => [p.name, PROVIDER_LABELS[p.providerType], p.enabled ? "Enabled" : "Disabled"]),
|
||||
sortedProviders.map((p) => [p.name, PROVIDER_LABELS[p.providerType], p.enabled ? t("Enabled") : t("Disabled")]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
className="btn btn-outline-secondary ms-auto"
|
||||
onClick={() => setManagingProviders((v) => !v)}
|
||||
>
|
||||
{managingProviders ? "Back to browsing" : "Manage providers"}
|
||||
{managingProviders ? t("Back to browsing") : t("Manage providers")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -380,7 +380,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onSort={requestProviderSort}
|
||||
/>
|
||||
<SortableTh<DnsProviderSummary>
|
||||
label="Provider"
|
||||
label={t("Provider")}
|
||||
sortKeyName="providerType"
|
||||
activeKey={providerSortKey}
|
||||
direction={providerSortDir}
|
||||
@@ -408,7 +408,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
className={`badge ${p.enabled ? "bg-green-lt text-green" : "bg-secondary-lt text-secondary"} border-0`}
|
||||
onClick={() => toggleProviderEnabled(p)}
|
||||
>
|
||||
{p.enabled ? "Enabled" : "Disabled"}
|
||||
{p.enabled ? t("Enabled") : t("Disabled")}
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
@@ -420,7 +420,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
))}
|
||||
{providers === null && <LoadingRow colSpan={4} />}
|
||||
{sortedProviders?.length === 0 && (
|
||||
<EmptyRow colSpan={4} title="No DNS providers yet" hint="Connect Cloudflare, Loopia, Pi-hole, Azure DNS, cPanel or Technitium to see its zones and records here, and to have names matched to your servers." />
|
||||
<EmptyRow colSpan={4} title={t("No DNS providers yet")} hint="Connect Cloudflare, Loopia, Pi-hole, Azure DNS, cPanel or Technitium to see its zones and records here, and to have names matched to your servers." />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -464,11 +464,11 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<div className="col-md-5">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Zones</h3>
|
||||
<h3 className="card-title">{t("Zones")}</h3>
|
||||
<div className="card-actions">
|
||||
{isAdmin && selectedProvider?.canCreateZones && selectedProvider.enabled && (
|
||||
<button className="btn btn-sm btn-primary me-2" onClick={() => setCreatingZone((v) => !v)} aria-expanded={creatingZone}>
|
||||
New zone
|
||||
{t("New zone")}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
@@ -508,7 +508,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onSort={requestZoneSort}
|
||||
/>
|
||||
<SortableTh<DnsZone>
|
||||
label="Synced"
|
||||
label={t("Synced")}
|
||||
sortKeyName="syncedAt"
|
||||
activeKey={zoneSortKey}
|
||||
direction={zoneSortDir}
|
||||
@@ -536,7 +536,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
</tr>
|
||||
))}
|
||||
{sortedZones && sortedZones.length === 0 && (
|
||||
<EmptyRow colSpan={3} title="No zones found" hint="The provider answered with none. Check that its credentials can see the zones, or sync it again." />
|
||||
<EmptyRow colSpan={3} title={t("No zones found")} hint="The provider answered with none. Check that its credentials can see the zones, or sync it again." />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -560,22 +560,22 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
</button>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-outline-secondary me-2" onClick={syncZone} disabled={syncing}>
|
||||
{syncing ? "Syncing…" : "Sync now"}
|
||||
{syncing ? t("Syncing…") : t("Sync now")}
|
||||
</button>
|
||||
)}
|
||||
{canEdit && !recordForm && (
|
||||
<button className="btn btn-sm btn-primary" onClick={startAddRecord}>
|
||||
Add record
|
||||
{t("Add record")}
|
||||
</button>
|
||||
)}
|
||||
{isAdmin && selectedProvider?.canEditZones && selectedProvider.enabled && (
|
||||
<button className="btn btn-sm btn-outline-secondary ms-2" onClick={() => setEditingZone((v) => !v)} aria-expanded={editingZone}>
|
||||
Edit zone
|
||||
{t("Edit zone")}
|
||||
</button>
|
||||
)}
|
||||
{isAdmin && selectedProvider?.canDeleteZones && selectedProvider.enabled && (
|
||||
<button className="btn btn-sm btn-outline-danger ms-2" onClick={() => void deleteZone()}>
|
||||
Delete zone
|
||||
{t("Delete zone")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -589,7 +589,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<form onSubmit={submitRecord}>
|
||||
<div className="card-body row g-2">
|
||||
<div className="col-2">
|
||||
<label className="form-label">Type</label>
|
||||
<label className="form-label">{t("Type")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -613,7 +613,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-3">
|
||||
<label className="form-label">Content</label>
|
||||
<label className="form-label">{t("Content")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -631,7 +631,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-2">
|
||||
<label className="form-label">Priority</label>
|
||||
<label className="form-label">{t("Priority")}</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
@@ -650,14 +650,14 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
checked={Boolean(recordForm.proxied)}
|
||||
onChange={(e) => setRecordForm({ ...recordForm, proxied: e.target.checked })}
|
||||
/>
|
||||
<span className="form-check-label">Proxied through Cloudflare</span>
|
||||
<span className="form-check-label">{t("Proxied through Cloudflare")}</span>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={savingRecord}>
|
||||
{editingRecordId ? "Save changes" : "Add record"}
|
||||
{editingRecordId ? t("Save changes") : t("Add record")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setRecordForm(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -670,10 +670,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<DnsRecord> label="Type" sortKeyName="type" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
<SortableTh<DnsRecord> label={t("Type")} sortKeyName="type" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
<SortableTh<DnsRecord> label={t("Name")} sortKeyName="name" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
<SortableTh<DnsRecord>
|
||||
label="Content"
|
||||
label={t("Content")}
|
||||
sortKeyName="content"
|
||||
activeKey={recordSortKey}
|
||||
direction={recordSortDir}
|
||||
@@ -707,7 +707,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
</tr>
|
||||
))}
|
||||
{sortedRecords?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 5 : 4} title="No records cached" hint={syncedAt === null ? "Sync this zone to fetch its records from the provider." : "This zone has no records."} action={canEdit ? { label: "Add a record", onClick: startAddRecord } : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 5 : 4} title={t("No records cached")} hint={syncedAt === null ? t("Sync this zone to fetch its records from the provider.") : t("This zone has no records.")} action={canEdit ? { label: t("Add a record"), onClick: startAddRecord } : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -716,7 +716,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
</div>
|
||||
) : (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">Select a zone to view its records.</div>
|
||||
<div className="card-body text-secondary">{t("Select a zone to view its records.")}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+17
-17
@@ -29,14 +29,14 @@ function updateBadge(c: DockhandContainer) {
|
||||
if (!c.updateAvailable) return <span className="badge bg-green-lt text-green">{t("Up to date")}</span>;
|
||||
return (
|
||||
<span className="badge bg-yellow-lt text-yellow" title={c.newerVersion ?? undefined}>
|
||||
Update available
|
||||
{t("Update available")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** What is wrong with a container, in a badge: the same finding the health pass raises an alert for. */
|
||||
function problemBadge(c: DockhandContainer) {
|
||||
if (c.leftAlone) return <span className="badge bg-secondary-lt text-secondary" title="No alert is raised for it">left alone</span>;
|
||||
if (c.leftAlone) return <span className="badge bg-secondary-lt text-secondary" title={t("No alert is raised for it")}>left alone</span>;
|
||||
if (!c.problem) return null;
|
||||
return (
|
||||
<span className={`badge ${c.problem.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`} title={`An alert is raised: ${c.name} ${c.problem.text}`}>
|
||||
@@ -48,14 +48,14 @@ function problemBadge(c: DockhandContainer) {
|
||||
function containerStateBadge(state: string) {
|
||||
switch (state) {
|
||||
case "running":
|
||||
return <span className="badge bg-green-lt text-green">Running</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("Running")}</span>;
|
||||
case "exited":
|
||||
case "dead":
|
||||
return <span className="badge bg-red-lt text-red">{state === "dead" ? "Dead" : "Exited"}</span>;
|
||||
return <span className="badge bg-red-lt text-red">{state === "dead" ? t("Dead") : t("Exited")}</span>;
|
||||
case "paused":
|
||||
return <span className="badge bg-yellow-lt text-yellow">Paused</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{t("Paused")}</span>;
|
||||
case "restarting":
|
||||
return <span className="badge bg-blue-lt text-blue">Restarting</span>;
|
||||
return <span className="badge bg-blue-lt text-blue">{t("Restarting")}</span>;
|
||||
default:
|
||||
return <span className="badge bg-secondary-lt text-secondary">{state}</span>;
|
||||
}
|
||||
@@ -159,12 +159,12 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
|
||||
async function containerAction(c: DockhandContainer, action: "start" | "stop" | "restart") {
|
||||
if (!selectedId) return;
|
||||
if (action === "stop" && !(await confirmDialog({ title: "Stop container", message: `Stop container "${c.name}"?`, confirmLabel: "Stop", danger: true }))) return;
|
||||
if (action === "stop" && !(await confirmDialog({ title: t("Stop container"), message: `Stop container "${c.name}"?`, confirmLabel: t("Stop"), danger: true }))) return;
|
||||
setActingOnContainer(c.id);
|
||||
setError(null);
|
||||
try {
|
||||
await api.integrations.dockhand[action](selectedId, c.environmentId, c.id);
|
||||
toast.success(`${action === "start" ? "Started" : action === "stop" ? "Stopped" : "Restarted"} ${c.name}.`);
|
||||
toast.success(`${action === "start" ? t("Started") : action === "stop" ? "Stopped" : t("Restarted")} ${c.name}.`);
|
||||
loadContainers(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -182,7 +182,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Dockhand integration configured yet.{" "}
|
||||
<Link to="/integrations">Add one under Integrations</Link>.
|
||||
<Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -246,7 +246,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
value={hostFilter}
|
||||
onChange={(e) => setHostFilter(e.target.value)}
|
||||
>
|
||||
<option value="">All hosts</option>
|
||||
<option value="">{t("All hosts")}</option>
|
||||
{hosts.map((host) => (
|
||||
<option key={host} value={host}>
|
||||
{host}
|
||||
@@ -259,7 +259,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={checkForUpdates} disabled={checkingUpdates}>
|
||||
{checkingUpdates ? "Checking…" : "Check for updates"}
|
||||
{checkingUpdates ? t("Checking…") : t("Check for updates")}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
@@ -267,7 +267,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadContainers(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -277,7 +277,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
<tr>
|
||||
<SortableTh<DockhandContainer> label={t("Container")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer>
|
||||
label="Host"
|
||||
label={t("Host")}
|
||||
sortKeyName="environmentName"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -286,7 +286,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
<SortableTh<DockhandContainer> label={t("Image")} sortKeyName="image" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer> label={t("Status")} sortKeyName="state" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer>
|
||||
label="Update"
|
||||
label={t("Update")}
|
||||
sortKeyName="updateAvailable"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -338,8 +338,8 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
)}
|
||||
{user.role === "admin" && (c.problem || c.leftAlone) && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void leaveAlone(c)} title={c.leftAlone ? "Raise alerts about it again" : "Stop raising alerts about this container"}>
|
||||
{c.leftAlone ? "Watch again" : "Leave alone"}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void leaveAlone(c)} title={c.leftAlone ? t("Raise alerts about it again") : t("Stop raising alerts about this container")}>
|
||||
{c.leftAlone ? t("Watch again") : t("Leave alone")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -348,7 +348,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{data && sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} {...(hostFilter ? { filtered: () => setHostFilter("") } : { title: "No containers found", hint: "Dockhand answered with no containers in any environment. Check the integration and its environments.", action: { label: "Check the integration", to: "/integrations" } })} />
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} {...(hostFilter ? { filtered: () => setHostFilter("") } : { title: t("No containers found"), hint: t("Dockhand answered with no containers in any environment. Check the integration and its environments."), action: { label: t("Check the integration"), to: "/integrations" } })} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -17,11 +17,11 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
|
||||
<div className="d-flex flex-wrap align-items-center gap-2">
|
||||
<strong>{env.environmentName}</strong>
|
||||
{env.critical === null ? (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not read</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not read")}</span>
|
||||
) : env.critical > 0 ? (
|
||||
<span className="badge bg-red-lt text-red">{env.critical} critical</span>
|
||||
) : (
|
||||
<span className="badge bg-green-lt text-green">No critical</span>
|
||||
<span className="badge bg-green-lt text-green">{t("No critical")}</span>
|
||||
)}
|
||||
<span className="text-secondary small">
|
||||
{count(env.high)} high · {count(env.medium)} medium · {count(env.low)} low
|
||||
@@ -41,7 +41,7 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
|
||||
{env.findings.length > 0 && (
|
||||
<>
|
||||
<button className="btn btn-link btn-sm p-0 mt-1" onClick={() => setOpen((o) => !o)}>
|
||||
{open ? "Hide the critical findings" : `Show the critical findings${env.critical !== null && env.critical > env.findings.length ? ` (first ${env.findings.length} of ${env.critical})` : ""}`}
|
||||
{open ? t("Hide the critical findings") : `Show the critical findings${env.critical !== null && env.critical > env.findings.length ? ` (first ${env.findings.length} of ${env.critical})` : ""}`}
|
||||
</button>
|
||||
{open && (
|
||||
<div className="table-responsive mt-2">
|
||||
@@ -49,11 +49,11 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
|
||||
<thead>
|
||||
<tr>
|
||||
<th>CVE</th>
|
||||
<th>Package</th>
|
||||
<th>Installed</th>
|
||||
<th>Fixed in</th>
|
||||
<th>{t("Package")}</th>
|
||||
<th>{t("Installed")}</th>
|
||||
<th>{t("Fixed in")}</th>
|
||||
<th>{t("Image")}</th>
|
||||
<th>Used by</th>
|
||||
<th>{t("Used by")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -112,7 +112,7 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{error && <div className="text-yellow">{error}</div>}
|
||||
{!data && !error && <div className="text-secondary">Reading…</div>}
|
||||
{!data && !error && <div className="text-secondary">{t("Reading…")}</div>}
|
||||
{data && (
|
||||
<>
|
||||
<p className="text-secondary small">
|
||||
@@ -122,7 +122,7 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
|
||||
<strong>{t("Critical")}</strong> findings are an alert — see <Link to="/alerts">{t("Alerts")}</Link>;{" "}
|
||||
{data.highThreshold > 0 ? (
|
||||
<>
|
||||
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">Settings → Notifications</Link>); medium and low are only shown here.
|
||||
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">{t("Settings → Notifications")}</Link>); medium and low are only shown here.
|
||||
</>
|
||||
) : (
|
||||
<>high, medium and low are only shown here (high ones can be alerted from a number you choose under Settings → Notifications).</>
|
||||
@@ -130,13 +130,13 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
The alert for critical findings is switched off (<Link to="/settings/notifications">Settings → Notifications</Link>).
|
||||
The alert for critical findings is switched off (<Link to="/settings/notifications">{t("Settings → Notifications")}</Link>).
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
{data.status && !data.status.ok && <div className="text-yellow mb-2">The last attempt to read them failed: {data.status.error ?? "no answer"}.</div>}
|
||||
{data.environments.length === 0 && !data.status && <div className="text-secondary">Not read yet — it is read a few minutes after Dockhand is added, then every quarter of an hour.</div>}
|
||||
{data.environments.length === 0 && data.status?.ok && <div className="text-secondary">Dockhand lists no Docker hosts.</div>}
|
||||
{data.environments.length === 0 && data.status?.ok && <div className="text-secondary">{t("Dockhand lists no Docker hosts.")}</div>}
|
||||
{data.environments.map((e) => (
|
||||
<Host key={e.environmentId} env={e} imageAgeDays={data.imageAgeDays} />
|
||||
))}
|
||||
|
||||
+18
-18
@@ -40,7 +40,7 @@ function durationText(seconds: number): string {
|
||||
}
|
||||
|
||||
function Badge({ c }: { c: DownloadClient }) {
|
||||
if (!c.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!c.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!c.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!c.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (c.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -70,11 +70,11 @@ function ItemsTable({ items, stuck }: { items: DownloadItem[]; stuck: Set<string
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>State</th>
|
||||
<th>Progress</th>
|
||||
<th>Speed</th>
|
||||
<th>Left</th>
|
||||
<th>Category</th>
|
||||
<th>{t("State")}</th>
|
||||
<th>{t("Progress")}</th>
|
||||
<th>{t("Speed")}</th>
|
||||
<th>{t("Left")}</th>
|
||||
<th>{t("Category")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -156,16 +156,16 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
|
||||
{s && (
|
||||
<>
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile label="Downloading" value={speedText(s.speedDown)} sub={s.speedUp !== null ? `uploading ${speedText(s.speedUp)}` : null} />
|
||||
<Tile label={t("Downloading")} value={speedText(s.speedDown)} sub={s.speedUp !== null ? `uploading ${speedText(s.speedUp)}` : null} />
|
||||
<Tile
|
||||
label={c.kind === "sabnzbd" ? "Queue" : "Not finished"}
|
||||
label={c.kind === "sabnzbd" ? t("Queue") : t("Not finished")}
|
||||
value={String(pending)}
|
||||
sub={[`${s.counts.downloading} downloading`, `${s.counts.queued + s.counts.waiting} waiting`, s.counts.stalled > 0 ? `${s.counts.stalled} stalled` : null, s.counts.error > 0 ? `${s.counts.error} in error` : null, c.kind === "qbittorrent" ? `${s.counts.seeding} seeding` : null].filter(Boolean).join(", ")}
|
||||
/>
|
||||
{c.kind === "qbittorrent" ? (
|
||||
<Tile label="Stuck" value={String(stuck.size)} sub={stuck.size > 0 ? "in error, or nothing moving for a day" : "nothing stuck"} warn={stuck.size > 0} />
|
||||
<Tile label={t("Stuck")} value={String(stuck.size)} sub={stuck.size > 0 ? "in error, or nothing moving for a day" : "nothing stuck"} warn={stuck.size > 0} />
|
||||
) : (
|
||||
<Tile label="Failed in the last day" value={s.failed === null ? "—" : String(failedRecent.size)} sub={s.failed === null ? "could not be read" : null} warn={failedRecent.size > 0} />
|
||||
<Tile label={t("Failed in the last day")} value={s.failed === null ? "—" : String(failedRecent.size)} sub={s.failed === null ? "could not be read" : null} warn={failedRecent.size > 0} />
|
||||
)}
|
||||
{c.kind === "qbittorrent" ? (
|
||||
<Tile
|
||||
@@ -175,13 +175,13 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
|
||||
warn={s.connection === "disconnected"}
|
||||
/>
|
||||
) : (
|
||||
<Tile label="Queue is" value={s.paused ? "Paused" : "Running"} sub={s.paused && s.since.pausedSince ? `for ${durationText((Date.now() - Date.parse(s.since.pausedSince)) / 1000)}` : null} warn={s.paused && pending > 0} />
|
||||
<Tile label={t("Queue is")} value={s.paused ? "Paused" : t("Running")} sub={s.paused && s.since.pausedSince ? `for ${durationText((Date.now() - Date.parse(s.since.pausedSince)) / 1000)}` : null} warn={s.paused && pending > 0} />
|
||||
)}
|
||||
{fullest && <Tile label="Free space" value={formatBytes(fullest.free)} sub={fullest.total ? `of ${formatBytes(fullest.total)} (${fullest.label.toLowerCase()})` : fullest.label.toLowerCase()} warn={fullest.total ? fullest.free / fullest.total < 0.1 : fullest.free < 20 * 1024 ** 3} />}
|
||||
{fullest && <Tile label={t("Free space")} value={formatBytes(fullest.free)} sub={fullest.total ? `of ${formatBytes(fullest.total)} (${fullest.label.toLowerCase()})` : fullest.label.toLowerCase()} warn={fullest.total ? fullest.free / fullest.total < 0.1 : fullest.free < 20 * 1024 ** 3} />}
|
||||
</div>
|
||||
{s.disks && s.disks.some((d) => d.total) && (
|
||||
<div className="mb-3">
|
||||
<h4>Disks</h4>
|
||||
<h4>{t("Disks")}</h4>
|
||||
{s.disks
|
||||
.filter((d) => d.total)
|
||||
.map((d) => {
|
||||
@@ -201,15 +201,15 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
|
||||
)}
|
||||
{s.items.length > 0 && (
|
||||
<>
|
||||
<h4>{c.kind === "sabnzbd" ? "Queue" : "Not finished"}</h4>
|
||||
<h4>{c.kind === "sabnzbd" ? t("Queue") : t("Not finished")}</h4>
|
||||
<ItemsTable items={s.items} stuck={stuck} />
|
||||
{s.counts.seeding + s.counts.completed > 0 && <div className="text-secondary small">{s.counts.seeding + s.counts.completed} more are finished and idle (seeding or stopped), and not listed.</div>}
|
||||
</>
|
||||
)}
|
||||
{s.items.length === 0 && <div className="text-secondary">{s.total === 0 ? "Nothing in the queue." : `${s.total} item${s.total === 1 ? "" : "s"}, all finished and idle.`}</div>}
|
||||
{s.items.length === 0 && <div className="text-secondary">{s.total === 0 ? t("Nothing in the queue.") : `${s.total} item${s.total === 1 ? "" : "s"}, all finished and idle.`}</div>}
|
||||
{failed.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Failed in the last day</h4>
|
||||
<h4 className="mt-3">{t("Failed in the last day")}</h4>
|
||||
<ul className="mb-0">
|
||||
{failed.map((f) => (
|
||||
<li key={f.id} className="text-break">
|
||||
@@ -264,7 +264,7 @@ export default function Downloads({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">{t("Download clients")}</h2>
|
||||
<PageIntro>
|
||||
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is added, paused or removed. <strong>Downloads that are stuck</strong>, <strong>no connection</strong>, <strong>a queue left paused or getting nothing</strong> and{" "}
|
||||
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is added, paused or removed. <strong>{t("Downloads that are stuck")}</strong>, <strong>no connection</strong>, <strong>a queue left paused or getting nothing</strong> and{" "}
|
||||
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>. What Sonarr, Radarr and the others think of their downloads is on <Link to="/media">{t("Media managers")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -272,7 +272,7 @@ export default function Downloads({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No download client connected" hint="Add qBittorrent (its Web UI address, and the user name and password of the Web UI) or SABnzbd (its address and API key) under Integrations." />
|
||||
<EmptyState title={t("No download client connected")} hint="Add qBittorrent (its Web UI address, and the user name and password of the Web UI) or SABnzbd (its address and API key) under Integrations." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+33
-33
@@ -15,10 +15,10 @@ import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const STATE: Record<DuplicatiBackup["state"], { label: string; cls: string }> = {
|
||||
ok: { label: "In order", cls: "bg-green-lt text-green" },
|
||||
warning: { label: "Warnings", cls: "bg-yellow-lt text-yellow" },
|
||||
failed: { label: "Failed", cls: "bg-red-lt text-red" },
|
||||
stale: { label: "Overdue", cls: "bg-red-lt text-red" },
|
||||
ok: { get label() { return t("In order"); }, cls: "bg-green-lt text-green" },
|
||||
warning: { get label() { return t("Warnings"); }, cls: "bg-yellow-lt text-yellow" },
|
||||
failed: { get label() { return t("Failed"); }, cls: "bg-red-lt text-red" },
|
||||
stale: { get label() { return t("Overdue"); }, cls: "bg-red-lt text-red" },
|
||||
};
|
||||
|
||||
/** What needs a look comes first. */
|
||||
@@ -79,18 +79,18 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
|
||||
<DetailDrawer title={backup.name} subtitle={`${backup.sourceName} — the last backups`} onClose={onClose}>
|
||||
<ErrorNotice error={error} />
|
||||
{runs === null && !error && <BlockSkeleton lines={4} />}
|
||||
{runs?.length === 0 && <EmptyState title="No runs yet" />}
|
||||
{runs?.length === 0 && <EmptyState title={t("No runs yet")} />}
|
||||
{runs && runs.length > 0 && (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("When")}</th>
|
||||
<th>Result</th>
|
||||
<th className="text-end">Took</th>
|
||||
<th className="text-end">Size</th>
|
||||
<th>{t("Result")}</th>
|
||||
<th className="text-end">{t("Took")}</th>
|
||||
<th className="text-end">{t("Size")}</th>
|
||||
<th className="text-end" title={t("How much the backups take up where they are kept")}>{t("Stored")}</th>
|
||||
<th className="text-end">Changed</th>
|
||||
<th className="text-end">{t("Changed")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -149,7 +149,7 @@ function Activity({ s }: { s: DuplicatiSource }) {
|
||||
)}
|
||||
{a.sample && (
|
||||
<details>
|
||||
<summary className="text-secondary">What was sent</summary>
|
||||
<summary className="text-secondary">{t("What was sent")}</summary>
|
||||
<pre className="mb-0 small text-break" style={{ whiteSpace: "pre-wrap", maxHeight: 200, overflow: "auto" }}>
|
||||
{a.sample}
|
||||
</pre>
|
||||
@@ -188,10 +188,10 @@ function Address({ path, name, onDone }: { path: string; name: string; onDone: (
|
||||
<div className="fw-bold mb-1">Point Duplicati on {name} at this app</div>
|
||||
<div className="text-secondary mb-2">Copy it now — the address can’t be shown again. If it is lost, remove the machine and add it again.</div>
|
||||
<ol className="mb-2">
|
||||
<li>In Duplicati, open <strong>Settings → Default options</strong> (so every job on that machine reports) and add these three <strong>advanced options</strong>:</li>
|
||||
<li>In Duplicati, open <strong>{t("Settings → Default options")}</strong> (so every job on that machine reports) and add these three <strong>advanced options</strong>:</li>
|
||||
</ol>
|
||||
<div className="input-group mb-2">
|
||||
<textarea className="form-control" rows={3} readOnly value={options} aria-label="The three Duplicati options" onFocus={(e) => e.currentTarget.select()} style={{ fontFamily: "monospace", fontSize: "0.8125rem" }} />
|
||||
<textarea className="form-control" rows={3} readOnly value={options} aria-label={t("The three Duplicati options")} onFocus={(e) => e.currentTarget.select()} style={{ fontFamily: "monospace", fontSize: "0.8125rem" }} />
|
||||
<CopyButton text={options} />
|
||||
</div>
|
||||
<div className="text-secondary small mb-2">
|
||||
@@ -251,7 +251,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function removeSource(id: number, label: string) {
|
||||
if (!(await confirmDialog({ title: "Remove a machine", message: `Remove "${label}" with its backups and their history? Its address stops working.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove a machine"), message: `Remove "${label}" with its backups and their history? Its address stops working.`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.duplicati.removeSource(id);
|
||||
load();
|
||||
@@ -270,7 +270,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function forget(b: DuplicatiBackup) {
|
||||
if (!(await confirmDialog({ title: "Forget a backup", message: `Forget "${b.name}" on ${b.sourceName} and its history? If Duplicati reports it again, it is learned again.`, confirmLabel: "Forget", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Forget a backup"), message: `Forget "${b.name}" on ${b.sourceName} and its history? If Duplicati reports it again, it is learned again.`, confirmLabel: t("Forget"), danger: true }))) return;
|
||||
try {
|
||||
await api.duplicati.forgetBackup(b.id);
|
||||
load();
|
||||
@@ -287,13 +287,13 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-0">Duplicati</h2>
|
||||
{isAdmin && !adding && (
|
||||
<button className="btn btn-primary ms-auto" onClick={() => setAdding(true)}>
|
||||
Add a machine
|
||||
{t("Add a machine")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<PageIntro>
|
||||
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">{t("Alerts")}</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job’s warnings to see what they said, and switch on <em>Alert on warnings</em> for the jobs where they matter.
|
||||
or has <strong>not succeeded for longer than it should</strong>, is an alert — see <Link to="/alerts">{t("Alerts")}</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job’s warnings to see what they said, and switch on <em>{t("Alert on warnings")}</em> for the jobs where they matter.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{fresh && <Address path={fresh.path} name={fresh.name} onDone={() => setFresh(null)} />}
|
||||
@@ -301,7 +301,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
{adding && data && (
|
||||
<form className="card mb-3" onSubmit={addSource}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Add a machine running Duplicati</h3>
|
||||
<h3 className="card-title">{t("Add a machine running Duplicati")}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-5">
|
||||
@@ -312,10 +312,10 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-7">
|
||||
<label className="form-label" htmlFor="dup-server">
|
||||
It runs on the server
|
||||
{t("It runs on the server")}
|
||||
</label>
|
||||
<select id="dup-server" className="form-select" value={serverId} onChange={(e) => setServerId(e.target.value)}>
|
||||
<option value="">— none in particular —</option>
|
||||
<option value="">{t("— none in particular —")}</option>
|
||||
{data.servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -327,7 +327,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button className="btn btn-primary" disabled={busy || name.trim() === ""}>
|
||||
{busy ? "Adding…" : "Add and show its address"}
|
||||
{busy ? "Adding…" : t("Add and show its address")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setAdding(false)}>
|
||||
{t("Cancel")}
|
||||
@@ -341,9 +341,9 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState
|
||||
title="No machine reports yet"
|
||||
title={t("No machine reports yet")}
|
||||
hint="Add each machine that runs Duplicati: you get an address to give Duplicati once, and every backup it makes then shows up here with how it went."
|
||||
action={isAdmin ? { label: "Add a machine", onClick: () => setAdding(true) } : undefined}
|
||||
action={isAdmin ? { label: t("Add a machine"), onClick: () => setAdding(true) } : undefined}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -395,14 +395,14 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Backup</th>
|
||||
<th>Last good backup</th>
|
||||
<th className="text-end">Took</th>
|
||||
<th className="text-end">Size</th>
|
||||
<th>{t("Backup")}</th>
|
||||
<th>{t("Last good backup")}</th>
|
||||
<th className="text-end">{t("Took")}</th>
|
||||
<th className="text-end">{t("Size")}</th>
|
||||
<th className="text-end" title={t("How much the backups take up where they are kept, and how that is growing")}>{t("Stored")}</th>
|
||||
<th className="text-end">Changed</th>
|
||||
<th>Expected every</th>
|
||||
<th>State</th>
|
||||
<th className="text-end">{t("Changed")}</th>
|
||||
<th>{t("Expected every")}</th>
|
||||
<th>{t("State")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -443,7 +443,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<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.problem && b.state === "warning" && <Warnings count={b.warnings} messages={b.warningMessages} label={t("All the warnings")} />}
|
||||
{b.warningStreak >= data.streakRuns && <div className="text-yellow small">{t("Warnings {n} runs in a row", { n: b.warningStreak })}</div>}
|
||||
{!b.alert && <div className="text-secondary small">no alert</div>}
|
||||
{b.alert && b.alertWarnings && <div className="text-secondary small">alerts on warnings</div>}
|
||||
@@ -456,7 +456,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
{canEdit && (
|
||||
<>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alert: !b.alert })}>
|
||||
{b.alert ? "Mute" : "Alert"}
|
||||
{b.alert ? t("Mute") : t("Alert")}
|
||||
</button>
|
||||
{b.alert && !b.alertWarnings && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { warnStreakAlert: !b.warnStreakAlert })} title={t("Whether {n} runs in a row with warnings raise an alert (on unless you switch it off; a job that always has a few warnings can be left alone)", { n: data.streakRuns })}>
|
||||
@@ -465,11 +465,11 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
{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"}
|
||||
{b.alertWarnings ? t("Stop warning alerts") : t("Alert on warnings")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void forget(b)}>
|
||||
Forget
|
||||
{t("Forget")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
+43
-43
@@ -31,11 +31,11 @@ const KIND_HINTS: Record<EndpointKind, string> = {
|
||||
|
||||
type State = "waiting" | "up" | "failing" | "down" | "off";
|
||||
const STATE_BADGE: Record<State, { label: string; badge: string }> = {
|
||||
waiting: { label: "Not asked yet", badge: "bg-secondary-lt text-secondary" },
|
||||
up: { label: "Up", badge: "bg-green-lt text-green" },
|
||||
failing: { label: "Failing", badge: "bg-yellow-lt text-yellow" },
|
||||
down: { label: "Down", badge: "bg-red-lt text-red" },
|
||||
off: { label: "Switched off", badge: "bg-secondary-lt text-secondary" },
|
||||
waiting: { get label() { return t("Not asked yet"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
up: { get label() { return t("Up"); }, badge: "bg-green-lt text-green" },
|
||||
failing: { get label() { return t("Failing"); }, badge: "bg-yellow-lt text-yellow" },
|
||||
down: { get label() { return t("Down"); }, badge: "bg-red-lt text-red" },
|
||||
off: { get label() { return t("Switched off"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
};
|
||||
const RANK: Record<State, number> = { down: 0, failing: 1, waiting: 2, up: 3, off: 4 };
|
||||
|
||||
@@ -201,7 +201,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
if (draft.id === null) await api.endpoints.create(toInput(draft));
|
||||
else await api.endpoints.update(draft.id, toInput(draft));
|
||||
toast.success(draft.id === null ? `Added ${draft.name}.` : "Saved.");
|
||||
toast.success(draft.id === null ? `Added ${draft.name}.` : t("Saved."));
|
||||
setDraft(null);
|
||||
load();
|
||||
} catch (err) {
|
||||
@@ -212,7 +212,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function remove(c: EndpointCheck) {
|
||||
if (!(await confirmDialog({ title: "Remove a check", message: `Remove "${c.name}" and its history?`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove a check"), message: `Remove "${c.name}" and its history?`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.endpoints.remove(c.id);
|
||||
load();
|
||||
@@ -245,9 +245,9 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
|
||||
const set = <K extends keyof Draft>(key: K, value: Draft[K]) => setDraft((d) => (d ? { ...d, [key]: value } : d));
|
||||
const cards = [
|
||||
{ label: "Checks", value: checks ? String(rows.length) : "…", color: "" },
|
||||
{ label: "Not answering", value: checks ? String(down) : "…", color: down > 0 ? "text-red" : "text-green" },
|
||||
{ label: "Certificates to renew", value: checks ? String(certs) : "…", color: certs > 0 ? "text-yellow" : "" },
|
||||
{ label: t("Checks"), value: checks ? String(rows.length) : "…", color: "" },
|
||||
{ label: t("Not answering"), value: checks ? String(down) : "…", color: down > 0 ? "text-red" : "text-green" },
|
||||
{ label: t("Certificates to renew"), value: checks ? String(certs) : "…", color: certs > 0 ? "text-yellow" : "" },
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -256,7 +256,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-0">{t("Endpoints")}</h2>
|
||||
{isAdmin && !draft && (
|
||||
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
|
||||
Add a check
|
||||
{t("Add a check")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -284,7 +284,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
{draft && (
|
||||
<form className="card mb-3" onSubmit={save}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{draft.id === null ? "Add a check" : `Edit ${draft.name || "the check"}`}</h3>
|
||||
<h3 className="card-title">{draft.id === null ? t("Add a check") : `Edit ${draft.name || "the check"}`}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-4">
|
||||
@@ -295,7 +295,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="ep-kind">
|
||||
What to ask
|
||||
{t("What to ask")}
|
||||
</label>
|
||||
<select id="ep-kind" className="form-select" value={draft.kind} onChange={(e) => set("kind", e.target.value as EndpointKind)}>
|
||||
{(Object.keys(KIND_LABELS) as EndpointKind[]).map((k) => (
|
||||
@@ -308,10 +308,10 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="ep-server">
|
||||
It is about the server
|
||||
{t("It is about the server")}
|
||||
</label>
|
||||
<select id="ep-server" className="form-select" value={draft.serverId} onChange={(e) => set("serverId", e.target.value)}>
|
||||
<option value="">— none in particular —</option>
|
||||
<option value="">{t("— none in particular —")}</option>
|
||||
{servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -322,7 +322,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className={draft.kind === "http" ? "col-md-8" : "col-md-5"}>
|
||||
<label className="form-label" htmlFor="ep-target">
|
||||
{draft.kind === "http" ? "Address" : "Host name or address"}
|
||||
{draft.kind === "http" ? t("Address") : t("Host name or address")}
|
||||
</label>
|
||||
<input
|
||||
id="ep-target"
|
||||
@@ -337,7 +337,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
{draft.kind !== "http" && (
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="ep-port">
|
||||
Port
|
||||
{t("Port")}
|
||||
</label>
|
||||
<input id="ep-port" type="number" min={1} max={65535} className="form-control" required value={draft.port} placeholder={draft.kind === "tls" ? "443" : ""} onChange={(e) => set("port", e.target.value)} />
|
||||
</div>
|
||||
@@ -346,13 +346,13 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="ep-status">
|
||||
Good answers
|
||||
{t("Good answers")}
|
||||
</label>
|
||||
<input id="ep-status" className="form-control" placeholder="200-399" value={draft.expectStatus} onChange={(e) => set("expectStatus", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="ep-keyword">
|
||||
Page contains
|
||||
{t("Page contains")}
|
||||
</label>
|
||||
<input id="ep-keyword" className="form-control" maxLength={200} value={draft.keyword} onChange={(e) => set("keyword", e.target.value)} />
|
||||
</div>
|
||||
@@ -361,7 +361,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
{draft.kind === "http" && (
|
||||
<div className="col-12">
|
||||
<div className="border rounded p-3">
|
||||
<div className="fw-bold mb-1">Judge a value in the answer (optional)</div>
|
||||
<div className="fw-bold mb-1">{t("Judge a value in the answer (optional)")}</div>
|
||||
<div className="text-secondary small mb-2">
|
||||
For an answer in JSON: say where the value is and what it should be. For example <code>power.now</code> is below 5000, <code>state</code> is equal to playing, or, for a Prometheus query, <code>data.result[0].value[1]</code> is above 0.
|
||||
Use <code>[0]</code> for the first place in a list.
|
||||
@@ -369,13 +369,13 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
<div className="row g-2">
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="ep-vpath">
|
||||
Where in the answer
|
||||
{t("Where in the answer")}
|
||||
</label>
|
||||
<input id="ep-vpath" className="form-control" maxLength={200} placeholder="power.now" value={draft.valuePath} onChange={(e) => set("valuePath", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="ep-vop">
|
||||
It should be
|
||||
{t("It should be")}
|
||||
</label>
|
||||
<select id="ep-vop" className="form-select" value={draft.valueOp} disabled={draft.valuePath.trim() === ""} onChange={(e) => set("valueOp", e.target.value as EndpointValueOp)}>
|
||||
{(Object.keys(OP_LABELS) as EndpointValueOp[]).map((op) => (
|
||||
@@ -395,7 +395,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="ep-vunit">
|
||||
Unit
|
||||
{t("Unit")}
|
||||
</label>
|
||||
<input id="ep-vunit" className="form-control" maxLength={12} disabled={draft.valuePath.trim() === ""} placeholder="W" value={draft.valueUnit} onChange={(e) => set("valueUnit", e.target.value)} />
|
||||
</div>
|
||||
@@ -403,13 +403,13 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
<div className="row g-2 mt-1">
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="ep-hname">
|
||||
Send a header (optional)
|
||||
{t("Send a header (optional)")}
|
||||
</label>
|
||||
<input id="ep-hname" className="form-control" maxLength={100} placeholder="Authorization" value={draft.headerName} onChange={(e) => set("headerName", e.target.value)} />
|
||||
<input id="ep-hname" className="form-control" maxLength={100} placeholder={t("Authorization")} value={draft.headerName} onChange={(e) => set("headerName", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-8">
|
||||
<label className="form-label" htmlFor="ep-hvalue">
|
||||
Its value
|
||||
{t("Its value")}
|
||||
</label>
|
||||
<input
|
||||
id="ep-hvalue"
|
||||
@@ -418,7 +418,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
className="form-control"
|
||||
maxLength={2000}
|
||||
disabled={draft.headerName.trim() === ""}
|
||||
placeholder={draft.hadHeader ? "Saved — leave blank to keep it" : "Bearer …"}
|
||||
placeholder={draft.hadHeader ? t("Saved — leave blank to keep it") : "Bearer …"}
|
||||
value={draft.headerValue}
|
||||
onChange={(e) => set("headerValue", e.target.value)}
|
||||
/>
|
||||
@@ -430,7 +430,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="ep-interval">
|
||||
Every
|
||||
{t("Every")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="ep-interval" type="number" min={1} max={1440} className="form-control" value={draft.intervalMinutes} onChange={(e) => set("intervalMinutes", e.target.value)} />
|
||||
@@ -439,7 +439,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="ep-timeout">
|
||||
Give up after
|
||||
{t("Give up after")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="ep-timeout" type="number" min={1} max={60} className="form-control" value={draft.timeoutSeconds} onChange={(e) => set("timeoutSeconds", e.target.value)} />
|
||||
@@ -448,7 +448,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="ep-fails">
|
||||
Alert after
|
||||
{t("Alert after")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="ep-fails" type="number" min={1} max={20} className="form-control" value={draft.failuresBeforeAlert} onChange={(e) => set("failuresBeforeAlert", e.target.value)} />
|
||||
@@ -457,7 +457,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="ep-warn">
|
||||
Warn about the certificate
|
||||
{t("Warn about the certificate")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="ep-warn" type="number" min={1} max={90} className="form-control" value={draft.warnDays} onChange={(e) => set("warnDays", e.target.value)} />
|
||||
@@ -478,7 +478,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === "" || draft.target.trim() === ""}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
{busy ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -488,16 +488,16 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder="Search checks…" shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
|
||||
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder={t("Search checks…")} shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Row> label="Check" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Check")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Answer" sortKeyName="lastResponseMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Uptime" sortKeyName="uptime24h" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Certificate" sortKeyName="certDays" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Answer")} sortKeyName="lastResponseMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Uptime")} sortKeyName="uptime24h" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Certificate")} sortKeyName="certDays" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Checked")} sortKeyName="lastCheckedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{(canCheck || isAdmin) && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
@@ -534,7 +534,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Answer">
|
||||
<td className="stack-label" data-label={t("Answer")}>
|
||||
{c.lastValue !== null && (
|
||||
<div className="fw-bold" title={limitWords(c)}>
|
||||
{c.lastValue}
|
||||
@@ -556,7 +556,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Uptime">
|
||||
<td className="stack-label" data-label={t("Uptime")}>
|
||||
{c.stats?.uptime24h == null ? (
|
||||
<span className="text-secondary">—</span>
|
||||
) : (
|
||||
@@ -569,10 +569,10 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
<Ticks recent={c.stats?.recent ?? []} />
|
||||
</div>
|
||||
<button type="button" className="btn btn-link btn-sm p-0" onClick={() => setHistoryFor({ id: c.id, name: c.name })}>
|
||||
History…
|
||||
{t("History…")}
|
||||
</button>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Certificate">
|
||||
<td className="stack-label" data-label={t("Certificate")}>
|
||||
{c.certDays === null ? (
|
||||
<span className="text-secondary">—</span>
|
||||
) : c.certDays < 0 ? (
|
||||
@@ -595,7 +595,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
<div className="btn-list flex-nowrap">
|
||||
{canCheck && (
|
||||
<button className="btn btn-sm btn-outline-primary" disabled={asking === c.id} onClick={() => void askNow(c)}>
|
||||
{asking === c.id ? "Asking…" : "Check now"}
|
||||
{asking === c.id ? t("Asking…") : t("Check now")}
|
||||
</button>
|
||||
)}
|
||||
{isAdmin && (
|
||||
@@ -614,7 +614,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{checks !== null && sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={7} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: "Nothing is being checked yet", hint: "Ask a web address, a port or a certificate every few minutes, and hear about it when it stops answering or a certificate is about to run out.", action: isAdmin ? { label: "Add a check", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
|
||||
<EmptyRow colSpan={7} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: t("Nothing is being checked yet"), hint: t("Ask a web address, a port or a certificate every few minutes, and hear about it when it stops answering or a certificate is about to run out."), action: isAdmin ? { label: t("Add a check"), onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -20,7 +20,7 @@ type Server = FragnetServerInfo;
|
||||
const MB = 1024 ** 2;
|
||||
|
||||
function Badge({ a }: { a: FragnetAccount }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -29,15 +29,15 @@ function Badge({ a }: { a: FragnetAccount }) {
|
||||
}
|
||||
|
||||
function StateBadge({ s }: { s: Server }) {
|
||||
if (s.suspended) return <span className="badge bg-red-lt text-red">Suspended</span>;
|
||||
if (s.installing) return <span className="badge bg-blue-lt text-blue">Installing</span>;
|
||||
if (s.panelStatus === "restoring_backup") return <span className="badge bg-blue-lt text-blue">Restoring a backup</span>;
|
||||
if (s.panelStatus === "install_failed" || s.panelStatus === "reinstall_failed") return <span className="badge bg-red-lt text-red">Install failed</span>;
|
||||
if (s.state === "running") return <span className="badge bg-green-lt text-green">Running</span>;
|
||||
if (s.state === "offline") return <span className="badge bg-secondary-lt text-secondary">Stopped</span>;
|
||||
if (s.state === "starting") return <span className="badge bg-blue-lt text-blue">Starting</span>;
|
||||
if (s.state === "stopping") return <span className="badge bg-yellow-lt text-yellow">Stopping</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">Unknown</span>;
|
||||
if (s.suspended) return <span className="badge bg-red-lt text-red">{t("Suspended")}</span>;
|
||||
if (s.installing) return <span className="badge bg-blue-lt text-blue">{t("Installing")}</span>;
|
||||
if (s.panelStatus === "restoring_backup") return <span className="badge bg-blue-lt text-blue">{t("Restoring a backup")}</span>;
|
||||
if (s.panelStatus === "install_failed" || s.panelStatus === "reinstall_failed") return <span className="badge bg-red-lt text-red">{t("Install failed")}</span>;
|
||||
if (s.state === "running") return <span className="badge bg-green-lt text-green">{t("Running")}</span>;
|
||||
if (s.state === "offline") return <span className="badge bg-secondary-lt text-secondary">{t("Stopped")}</span>;
|
||||
if (s.state === "starting") return <span className="badge bg-blue-lt text-blue">{t("Starting")}</span>;
|
||||
if (s.state === "stopping") return <span className="badge bg-yellow-lt text-yellow">{t("Stopping")}</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{t("Unknown")}</span>;
|
||||
}
|
||||
|
||||
/** What is used of a limit, as a bar that turns yellow at the integration's limit for "nearly full" and red near the top. A limit of 0 (or none) is no limit: only the use is written. */
|
||||
@@ -65,7 +65,7 @@ function CopyAddress({ a }: { a: Server["allocations"][number] }) {
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-link p-0 text-reset text-decoration-none"
|
||||
title="Copy the address"
|
||||
title={t("Copy the address")}
|
||||
onClick={() => {
|
||||
void navigator.clipboard?.writeText(text).then(
|
||||
() => toast.success(`Copied ${text}`),
|
||||
@@ -92,7 +92,7 @@ function PowerHistory({ power }: { power: Server["power"] }) {
|
||||
const headline = stats ? onHeadline(stats) : null;
|
||||
return (
|
||||
<div className="col-12">
|
||||
<h5>Power history</h5>
|
||||
<h5>{t("Power history")}</h5>
|
||||
{!stats && <div className="text-secondary small">Nothing yet — this app keeps it from the first time it reads a server, so it fills in as the days go by.</div>}
|
||||
{stats && (
|
||||
<div className="row g-3">
|
||||
@@ -118,7 +118,7 @@ function PowerHistory({ power }: { power: Server["power"] }) {
|
||||
<div className="position-relative rounded overflow-hidden bg-secondary-lt" style={{ height: 16 }} role="img" aria-label="The last seven days: green where the server was on, grey where it was off">
|
||||
{timeline.segments.map((seg, i) => {
|
||||
const [left, width] = barPosition(timeline, seg);
|
||||
return <div key={i} className={seg.on ? "bg-green" : "bg-secondary"} style={{ position: "absolute", top: 0, bottom: 0, left: `${left}%`, width: `${width}%`, opacity: seg.on ? 1 : 0.35 }} title={`${seg.on ? "On" : "Off"} from ${formatDateTime(new Date(seg.from))} to ${formatDateTime(new Date(seg.to))}`} />;
|
||||
return <div key={i} className={seg.on ? "bg-green" : "bg-secondary"} style={{ position: "absolute", top: 0, bottom: 0, left: `${left}%`, width: `${width}%`, opacity: seg.on ? 1 : 0.35 }} title={`${seg.on ? t("On") : t("Off")} from ${formatDateTime(new Date(seg.from))} to ${formatDateTime(new Date(seg.to))}`} />;
|
||||
})}
|
||||
</div>
|
||||
<div className="d-flex justify-content-between small text-secondary mt-1">
|
||||
@@ -130,8 +130,8 @@ function PowerHistory({ power }: { power: Server["power"] }) {
|
||||
<div className="small text-secondary mt-1">Seen by reading the account every five minutes, so each time is to the nearest five. Known since {formatDateTime(new Date(stats.trackedSince))}.</div>
|
||||
</div>
|
||||
<div className="col-lg-4">
|
||||
<div className="small text-secondary mb-1">Latest</div>
|
||||
{power && power.recent.length === 0 && <div className="small text-secondary">Nothing has changed since it was first read.</div>}
|
||||
<div className="small text-secondary mb-1">{t("Latest")}</div>
|
||||
{power && power.recent.length === 0 && <div className="small text-secondary">{t("Nothing has changed since it was first read.")}</div>}
|
||||
<ul className="list-unstyled small mb-0">
|
||||
{power?.recent.slice(0, 8).map((e, i) => (
|
||||
<li key={i}>
|
||||
@@ -160,8 +160,8 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
|
||||
return (
|
||||
<div className="row g-3">
|
||||
<div className="col-lg-4">
|
||||
<h5>Addresses</h5>
|
||||
{s.allocations.length === 0 && <div className="text-secondary small">The panel did not list any.</div>}
|
||||
<h5>{t("Addresses")}</h5>
|
||||
{s.allocations.length === 0 && <div className="text-secondary small">{t("The panel did not list any.")}</div>}
|
||||
<ul className="list-unstyled mb-2">
|
||||
{s.allocations.map((a) => (
|
||||
<li key={`${a.ip}:${a.port}`}>
|
||||
@@ -185,18 +185,18 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
|
||||
<div>
|
||||
Room for {s.backupLimit ?? "?"} backups, {s.databaseLimit ?? "?"} databases{s.databases !== null ? ` (${s.databases} made)` : ""}
|
||||
</div>
|
||||
{!s.owner && <div>Shared with this account — not owned by it.</div>}
|
||||
{!s.owner && <div>{t("Shared with this account — not owned by it.")}</div>}
|
||||
<div>
|
||||
Known here since <TimeAgo value={s.firstSeenAt} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-2 btn-list">
|
||||
<a className="btn btn-sm" href={`${panelUrl.replace(/\/+$/, "")}/server/${s.id}`} target="_blank" rel="noopener noreferrer">
|
||||
Open in the game panel
|
||||
{t("Open in the game panel")}
|
||||
</a>
|
||||
{canAct && !s.suspended && !s.installing && (
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => onSignal(s, "kill")}>
|
||||
Kill…
|
||||
{t("Kill…")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -205,13 +205,13 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
|
||||
<div className="d-flex align-items-center gap-2 mb-2">
|
||||
<h5 className="mb-0">Backups{s.backupLimit ? ` (${backups.filter((b) => b.completedAt !== null).length} of ${s.backupLimit})` : ""}</h5>
|
||||
{canAct && s.backupLimit ? (
|
||||
<button className="btn btn-sm ms-auto" disabled={busy || making} onClick={() => onBackup(s)} title={making ? "One is already being made" : "Ask the panel to make a backup now"}>
|
||||
{making ? "Being made…" : "Back up now"}
|
||||
<button className="btn btn-sm ms-auto" disabled={busy || making} onClick={() => onBackup(s)} title={making ? t("One is already being made") : t("Ask the panel to make a backup now")}>
|
||||
{making ? t("Being made…") : t("Back up now")}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
{s.backups === null && <div className="text-secondary small">They could not be listed (the key may not be allowed to).</div>}
|
||||
{s.backups !== null && backups.length === 0 && <div className="text-secondary small">{s.backupLimit ? "None has been made." : "This plan has none."}</div>}
|
||||
{s.backups === null && <div className="text-secondary small">{t("They could not be listed (the key may not be allowed to).")}</div>}
|
||||
{s.backups !== null && backups.length === 0 && <div className="text-secondary small">{s.backupLimit ? t("None has been made.") : t("This plan has none.")}</div>}
|
||||
<ul className="list-unstyled mb-0">
|
||||
{backups.slice(0, 8).map((b) => (
|
||||
<li key={b.uuid}>
|
||||
@@ -227,8 +227,8 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
|
||||
{backups.length > 8 && <div className="text-secondary small">and {backups.length - 8} older</div>}
|
||||
</div>
|
||||
<div className="col-lg-4">
|
||||
<h5>Schedules</h5>
|
||||
{s.schedules === null && <div className="text-secondary small">They could not be listed.</div>}
|
||||
<h5>{t("Schedules")}</h5>
|
||||
{s.schedules === null && <div className="text-secondary small">{t("They could not be listed.")}</div>}
|
||||
{s.schedules !== null && s.schedules.length === 0 && <div className="text-secondary small">None. A restart or a backup on a schedule is set in the game panel.</div>}
|
||||
<ul className="list-unstyled mb-0">
|
||||
{s.schedules?.map((x) => (
|
||||
@@ -295,8 +295,8 @@ function ServerRow({ a, s, readAt, canAct, open, onToggle, onSignal, onBackup, b
|
||||
{s.allocations.length > 1 && <div className="small text-secondary">+{s.allocations.length - 1} more</div>}
|
||||
</td>
|
||||
<td>
|
||||
<UseBar label="Memory" used={s.state === "running" || s.state === "starting" ? (s.usage?.memoryBytes ?? null) : null} limitMb={s.memoryLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.memory} />
|
||||
<UseBar label="Disk" used={s.usage?.diskBytes ?? null} limitMb={s.diskLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.disk} />
|
||||
<UseBar label={t("Memory")} used={s.state === "running" || s.state === "starting" ? (s.usage?.memoryBytes ?? null) : null} limitMb={s.memoryLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.memory} />
|
||||
<UseBar label={t("Disk")} used={s.usage?.diskBytes ?? null} limitMb={s.diskLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.disk} />
|
||||
</td>
|
||||
<td className="text-secondary">
|
||||
{backup === null ? (
|
||||
@@ -330,8 +330,8 @@ function ServerRow({ a, s, readAt, canAct, open, onToggle, onSignal, onBackup, b
|
||||
</>
|
||||
)}
|
||||
{s.backupLimit ? (
|
||||
<button className="btn btn-sm" disabled={busy || backupInProgress(s)} onClick={() => onBackup(s)} title={backupInProgress(s) ? "One is already being made" : "Ask the panel to make a backup now"}>
|
||||
{backupInProgress(s) ? "Backing up…" : "Back up"}
|
||||
<button className="btn btn-sm" disabled={busy || backupInProgress(s)} onClick={() => onBackup(s)} title={backupInProgress(s) ? t("One is already being made") : t("Ask the panel to make a backup now")}>
|
||||
{backupInProgress(s) ? t("Backing up…") : t("Back up")}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
@@ -398,7 +398,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
|
||||
const ok = await confirmDialog({
|
||||
title: `Back up ${server.name}`,
|
||||
message: `Ask the game panel to make a backup of ${server.name} now? It is made in the background while the game keeps running, and a large one can take a few minutes.${server.backupLimit ? ` It counts towards the ${server.backupLimit} the plan allows${used !== null ? ` (${used} made)` : ""} — if the plan is full the panel will refuse, and one has to be deleted in the panel first.` : ""}`,
|
||||
confirmLabel: "Back up now",
|
||||
confirmLabel: t("Back up now"),
|
||||
});
|
||||
if (!ok) return;
|
||||
setBusy(true);
|
||||
@@ -460,7 +460,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Games</div>
|
||||
<div className="text-secondary small">{t("Games")}</div>
|
||||
<div className="h2 mb-0">{new Set(s.servers.map((x) => x.game ?? x.dockerImage ?? "?")).size}</div>
|
||||
<div className="text-secondary small text-truncate">{[...new Set(s.servers.map((x) => x.game).filter(Boolean))].join(", ") || "not said by the panel"}</div>
|
||||
</div>
|
||||
@@ -478,7 +478,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Addresses</div>
|
||||
<div className="text-secondary small">{t("Addresses")}</div>
|
||||
<div className="h2 mb-0">{s.servers.reduce((n, x) => n + x.allocations.length, 0)}</div>
|
||||
<div className="text-secondary small">on {new Set(s.servers.flatMap((x) => x.allocations.map((y) => y.ip))).size} IP address(es)</div>
|
||||
</div>
|
||||
@@ -490,10 +490,10 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Server")}</th>
|
||||
<th>State</th>
|
||||
<th>Address</th>
|
||||
<th>Use</th>
|
||||
<th>Newest backup</th>
|
||||
<th>{t("State")}</th>
|
||||
<th>{t("Address")}</th>
|
||||
<th>{t("Use")}</th>
|
||||
<th>{t("Newest backup")}</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -504,7 +504,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
|
||||
{s.servers.length === 0 && (
|
||||
<tr>
|
||||
<td colSpan={6} className="text-secondary">
|
||||
The account has no game servers.
|
||||
{t("The account has no game servers.")}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
@@ -541,7 +541,7 @@ export default function GameServers({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">{t("Game servers")}</h2>
|
||||
<PageIntro>
|
||||
What Fragnet’s game panel says about your servers, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>A backup that is late</strong> and <strong>a disk or memory nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>; a server that is stopped is not, since a game server is often stopped on purpose.
|
||||
What Fragnet’s game panel says about your servers, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>{t("A backup that is late")}</strong> and <strong>a disk or memory nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>; a server that is stopped is not, since a game server is often stopped on purpose.
|
||||
{canAct ? " Start, stop and restart are sent to the panel when you press them; nothing else is ever changed." : " Operators can start, stop and restart them from here."} What they cost is added by hand under <Link to="/costs">{t("Costs")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -549,7 +549,7 @@ export default function GameServers({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Fragnet account connected" hint="Add one under Integrations with an API key from the game panel (panel.fragnet.net → your profile → API Credentials; it starts with ptlc_)." />
|
||||
<EmptyState title={t("No Fragnet account connected")} hint="Add one under Integrations with an API key from the game panel (panel.fragnet.net → your profile → API Credentials; it starts with ptlc_)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+22
-22
@@ -104,21 +104,21 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
{user.role === "admin" && (
|
||||
<>
|
||||
{" "}
|
||||
<Link to="/settings/names">Edit the lists</Link>.
|
||||
<Link to="/settings/names">{t("Edit the lists")}</Link>.
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
<ErrorNotice error={themesError} className="py-2" />
|
||||
<label className="form-label">Theme</label>
|
||||
<label className="form-label">{t("Theme")}</label>
|
||||
<select className="form-select mb-1" value={theme} onChange={(e) => setTheme(e.target.value)} disabled={!themes}>
|
||||
<option value={MIXED}>Mixed — all lists</option>
|
||||
<option value={MIXED}>{t("Mixed — all lists")}</option>
|
||||
{(themes ?? []).map((t) => (
|
||||
<option key={t.id} value={t.id}>
|
||||
{t.label} ({t.names.length})
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="form-hint mb-3">{themes ? `${pool.length} name${pool.length === 1 ? "" : "s"} to pick from.` : "Loading the lists…"}</div>
|
||||
<div className="form-hint mb-3">{themes ? `${pool.length} name${pool.length === 1 ? "" : "s"} to pick from.` : t("Loading the lists…")}</div>
|
||||
{serverNames.length > 1 ? (
|
||||
<ul className="list-group">
|
||||
{serverNames.map((n) => (
|
||||
@@ -130,22 +130,22 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
</ul>
|
||||
) : (
|
||||
<div className="input-group">
|
||||
<input type="text" className="form-control" readOnly value={serverNames[0] ?? ""} placeholder="Click Generate…" aria-label="Generated server name" />
|
||||
<input type="text" className="form-control" readOnly value={serverNames[0] ?? ""} placeholder="Click Generate…" aria-label={t("Generated server name")} />
|
||||
{serverNames[0] && <CopyButton text={serverNames[0]} />}
|
||||
</div>
|
||||
)}
|
||||
{serverNames.length > 1 && (
|
||||
<div className="mt-2">
|
||||
<CopyButton text={serverNames.join("\n")} label="Copy all" />
|
||||
<CopyButton text={serverNames.join("\n")} label={t("Copy all")} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="card-footer d-flex flex-wrap align-items-center gap-2">
|
||||
<button className="btn btn-primary" onClick={rollServerName} disabled={pool.length === 0}>
|
||||
Generate
|
||||
{t("Generate")}
|
||||
</button>
|
||||
<label className="d-flex align-items-center gap-2 mb-0 ms-auto">
|
||||
<span className="text-secondary">How many</span>
|
||||
<span className="text-secondary">{t("How many")}</span>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
@@ -163,22 +163,22 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
<div className="col-md-6 col-lg-4">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Username</h3>
|
||||
<h3 className="card-title">{t("Username")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">An adjective + animal, optionally with a number — easy to say, hard to collide.</p>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-7">
|
||||
<label className="form-label">Separator</label>
|
||||
<label className="form-label">{t("Separator")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
value={usernameOptions.separator}
|
||||
onChange={(e) => setUsernameOptions((o) => ({ ...o, separator: e.target.value as UsernameOptions["separator"] }))}
|
||||
>
|
||||
<option value="-">Hyphen (clever-otter)</option>
|
||||
<option value="_">Underscore (clever_otter)</option>
|
||||
<option value=".">Dot (clever.otter)</option>
|
||||
<option value="">None (cleverotter)</option>
|
||||
<option value="-">{t("Hyphen (clever-otter)")}</option>
|
||||
<option value="_">{t("Underscore (clever_otter)")}</option>
|
||||
<option value=".">{t("Dot (clever.otter)")}</option>
|
||||
<option value="">{t("None (cleverotter)")}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-5 d-flex align-items-end">
|
||||
@@ -189,18 +189,18 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
checked={usernameOptions.includeNumber}
|
||||
onChange={(e) => setUsernameOptions((o) => ({ ...o, includeNumber: e.target.checked }))}
|
||||
/>
|
||||
<span className="form-check-label">Add number</span>
|
||||
<span className="form-check-label">{t("Add number")}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-group">
|
||||
<input type="text" className="form-control" readOnly value={username} placeholder="Click Generate…" aria-label="Generated username" />
|
||||
<input type="text" className="form-control" readOnly value={username} placeholder="Click Generate…" aria-label={t("Generated username")} />
|
||||
{username && <CopyButton text={username} />}
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-primary" onClick={rollUsername}>
|
||||
Generate
|
||||
{t("Generate")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -209,7 +209,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
<div className="col-md-6 col-lg-4">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Password</h3>
|
||||
<h3 className="card-title">{t("Password")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<label className="form-label">Length: {passwordOptions.length}</label>
|
||||
@@ -252,20 +252,20 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
<span className="form-check-label">Exclude ambiguous characters (0/O, 1/l/I…)</span>
|
||||
</label>
|
||||
{noCharsetSelected && <div className="alert alert-danger py-2">Pick at least one character type.</div>}
|
||||
{noCharsetSelected && <div className="alert alert-danger py-2">{t("Pick at least one character type.")}</div>}
|
||||
<div className="input-group mb-2">
|
||||
<input
|
||||
type={showPassword ? "text" : "password"}
|
||||
className="form-control font-monospace"
|
||||
readOnly
|
||||
value={password}
|
||||
aria-label="Generated password"
|
||||
aria-label={t("Generated password")}
|
||||
placeholder="Click Generate…"
|
||||
/>
|
||||
{password && (
|
||||
<>
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={() => setShowPassword((v) => !v)}>
|
||||
{showPassword ? "Hide" : "Show"}
|
||||
{showPassword ? t("Hide") : t("Show")}
|
||||
</button>
|
||||
<CopyButton text={password} />
|
||||
</>
|
||||
@@ -279,7 +279,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-primary" onClick={rollPassword} disabled={noCharsetSelected}>
|
||||
Generate
|
||||
{t("Generate")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+16
-16
@@ -19,24 +19,24 @@ import { t } from "../i18n";
|
||||
|
||||
function runStatusBadge(repo: GiteaRepo) {
|
||||
const run = repo.latestRun;
|
||||
if (!run) return <span className="badge bg-secondary-lt text-secondary">No runs</span>;
|
||||
if (!run) return <span className="badge bg-secondary-lt text-secondary">{t("No runs")}</span>;
|
||||
const state = run.conclusion || run.status;
|
||||
switch (state) {
|
||||
case "success":
|
||||
return <span className="badge bg-green-lt text-green">Success</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("Success")}</span>;
|
||||
case "failure":
|
||||
return <span className="badge bg-red-lt text-red">Failed</span>;
|
||||
return <span className="badge bg-red-lt text-red">{t("Failed")}</span>;
|
||||
case "cancelled":
|
||||
return <span className="badge bg-secondary-lt text-secondary">Cancelled</span>;
|
||||
return <span className="badge bg-secondary-lt text-secondary">{t("Cancelled")}</span>;
|
||||
case "skipped":
|
||||
return <span className="badge bg-secondary-lt text-secondary">Skipped</span>;
|
||||
return <span className="badge bg-secondary-lt text-secondary">{t("Skipped")}</span>;
|
||||
case "waiting":
|
||||
case "queued":
|
||||
case "pending":
|
||||
return <span className="badge bg-yellow-lt text-yellow">Queued</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{t("Queued")}</span>;
|
||||
case "running":
|
||||
case "in_progress":
|
||||
return <span className="badge bg-blue-lt text-blue">Running</span>;
|
||||
return <span className="badge bg-blue-lt text-blue">{t("Running")}</span>;
|
||||
default:
|
||||
return <span className="badge bg-secondary-lt text-secondary">{state}</span>;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Gitea integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
|
||||
No Gitea integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -161,7 +161,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
) : (
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Repositories</h3>
|
||||
<h3 className="card-title">{t("Repositories")}</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
@@ -172,7 +172,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadRepos(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -180,10 +180,10 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<GiteaRepo> label="Repository" sortKeyName="fullName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<GiteaRepo> label="Last updated" sortKeyName="updatedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>Last run</th>
|
||||
<th>Branch</th>
|
||||
<SortableTh<GiteaRepo> label={t("Repository")} sortKeyName="fullName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<GiteaRepo> label={t("Last updated")} sortKeyName="updatedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>{t("Last run")}</th>
|
||||
<th>{t("Branch")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
@@ -195,7 +195,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
<a href={r.htmlUrl} target="_blank" rel="noopener noreferrer">
|
||||
{r.fullName}
|
||||
</a>
|
||||
{r.private && <span className="badge bg-secondary-lt ms-2">Private</span>}
|
||||
{r.private && <span className="badge bg-secondary-lt ms-2">{t("Private")}</span>}
|
||||
</td>
|
||||
<td>
|
||||
{r.updatedAt ? (
|
||||
@@ -236,7 +236,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} title="No repositories to show" hint="A token only sees the repositories it has been given access to. Check its permissions in Gitea." action={{ label: "Check the integration", to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} title={t("No repositories to show")} hint="A token only sees the repositories it has been given access to. Check its permissions in Gitea." action={{ label: t("Check the integration"), to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+12
-12
@@ -12,7 +12,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ g }: { g: GrafanaInstance }) {
|
||||
if (!g.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!g.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!g.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!g.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (g.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -67,22 +67,22 @@ function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; on
|
||||
{s && (
|
||||
<>
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile label="Alert rules" value={rules ? String(rules.total) : "—"} sub={rules ? "in Grafana-managed alerting" : "could not be read"} />
|
||||
<Tile label="Firing" value={rules ? String(firing.length) : "—"} sub={rules ? (pending.length > 0 ? `and ${pending.length} pending` : "none pending") : null} warn={firing.length > 0} />
|
||||
<Tile label="Cannot be evaluated" value={rules ? String(broken.length) : "—"} sub="rules in an error state" warn={broken.length > 0} />
|
||||
<Tile label="Data sources" value={ds ? String(ds.length) : "—"} sub={ds ? (failing.length > 0 ? `${failing.length} failing its check` : "none failing") : "could not be listed"} warn={failing.length > 0} />
|
||||
<Tile label={t("Alert rules")} value={rules ? String(rules.total) : "—"} sub={rules ? "in Grafana-managed alerting" : "could not be read"} />
|
||||
<Tile label={t("Firing")} value={rules ? String(firing.length) : "—"} sub={rules ? (pending.length > 0 ? `and ${pending.length} pending` : "none pending") : null} warn={firing.length > 0} />
|
||||
<Tile label={t("Cannot be evaluated")} value={rules ? String(broken.length) : "—"} sub="rules in an error state" warn={broken.length > 0} />
|
||||
<Tile label={t("Data sources")} value={ds ? String(ds.length) : "—"} sub={ds ? (failing.length > 0 ? `${failing.length} failing its check` : "none failing") : "could not be listed"} warn={failing.length > 0} />
|
||||
</div>
|
||||
{rules && rules.items.length > 0 && (
|
||||
<>
|
||||
<h4>Rules that are not quiet</h4>
|
||||
<h4>{t("Rules that are not quiet")}</h4>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Rule</th>
|
||||
<th>State</th>
|
||||
<th>{t("Rule")}</th>
|
||||
<th>{t("State")}</th>
|
||||
<th>{t("Where")}</th>
|
||||
<th>Since</th>
|
||||
<th>{t("Since")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -111,7 +111,7 @@ function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; on
|
||||
{rules && rules.items.length === 0 && <div className="text-secondary small mb-3">All {rules.total} rules are quiet.</div>}
|
||||
{ds && ds.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Data sources</h4>
|
||||
<h4 className="mt-3">{t("Data sources")}</h4>
|
||||
<ul className="mb-0">
|
||||
{ds.map((d) => (
|
||||
<li key={d.uid}>
|
||||
@@ -154,7 +154,7 @@ export default function Grafana({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">Grafana</h2>
|
||||
<PageIntro>
|
||||
Read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is silenced, paused or changed. <strong>A rule that is firing</strong>, <strong>a rule Grafana cannot evaluate</strong> and <strong>a data source that fails its check</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
Read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is silenced, paused or changed. <strong>{t("A rule that is firing")}</strong>, <strong>a rule Grafana cannot evaluate</strong> and <strong>a data source that fails its check</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
Grafana can notify about its own alerts too; with both you hear twice.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -162,7 +162,7 @@ export default function Grafana({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Grafana connected" hint="Add one under Integrations with its address and a service account token (Administration → Users and access → Service accounts; the Viewer role is enough)." />
|
||||
<EmptyState title={t("No Grafana connected")} hint="Add one under Integrations with its address and a service account token (Administration → Users and access → Service accounts; the Viewer role is enough)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -21,12 +21,12 @@ import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const STATE_BADGE: Record<HeartbeatState, { label: string; badge: string }> = {
|
||||
waiting: { label: "Waiting for the first call", badge: "bg-secondary-lt text-secondary" },
|
||||
up: { label: "On time", badge: "bg-green-lt text-green" },
|
||||
running: { label: "Running", badge: "bg-blue-lt text-blue" },
|
||||
late: { label: "Late", badge: "bg-yellow-lt text-yellow" },
|
||||
failed: { label: "Said it failed", badge: "bg-red-lt text-red" },
|
||||
off: { label: "Switched off", badge: "bg-secondary-lt text-secondary" },
|
||||
waiting: { get label() { return t("Waiting for the first call"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
up: { get label() { return t("On time"); }, badge: "bg-green-lt text-green" },
|
||||
running: { get label() { return t("Running"); }, badge: "bg-blue-lt text-blue" },
|
||||
late: { get label() { return t("Late"); }, badge: "bg-yellow-lt text-yellow" },
|
||||
failed: { get label() { return t("Said it failed"); }, badge: "bg-red-lt text-red" },
|
||||
off: { get label() { return t("Switched off"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
};
|
||||
const RANK: Record<HeartbeatState, number> = { failed: 0, late: 1, waiting: 2, running: 3, up: 4, off: 5 };
|
||||
|
||||
@@ -101,7 +101,7 @@ function HowToCall({ url, onClose, name }: { url: string; onClose: () => void; n
|
||||
Have the job call this address when it finishes. Anyone with it can say “I’m alive” for the job — and nothing else — so keep it between the job and you. If it gets out, give the heartbeat a new address.
|
||||
</p>
|
||||
<div className="input-group mb-3">
|
||||
<input className="form-control" readOnly value={url} aria-label="The address to call" onFocus={(e) => e.currentTarget.select()} />
|
||||
<input className="form-control" readOnly value={url} aria-label={t("The address to call")} onFocus={(e) => e.currentTarget.select()} />
|
||||
<CopyButton text={url} />
|
||||
</div>
|
||||
<div className="mb-1 fw-bold">In cron, after the job:</div>
|
||||
@@ -194,7 +194,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function remove(h: Heartbeat) {
|
||||
if (!(await confirmDialog({ title: "Remove a heartbeat", message: `Remove "${h.name}" and its history? The job's calls to its address will get "not found".`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove a heartbeat"), message: `Remove "${h.name}" and its history? The job's calls to its address will get "not found".`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.heartbeats.remove(h.id);
|
||||
load();
|
||||
@@ -204,7 +204,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function newAddress(h: Heartbeat) {
|
||||
if (!(await confirmDialog({ title: "Give it a new address", message: `The old address for "${h.name}" stops working at once, and the job has to be changed to call the new one. Do this if the old one got out.`, confirmLabel: "Make a new address", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Give it a new address"), message: `The old address for "${h.name}" stops working at once, and the job has to be changed to call the new one. Do this if the old one got out.`, confirmLabel: t("Make a new address"), danger: true }))) return;
|
||||
try {
|
||||
const { path } = await api.heartbeats.newAddress(h.id);
|
||||
setShowing({ name: h.name, path });
|
||||
@@ -224,9 +224,9 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
|
||||
const set = <K extends keyof Draft>(key: K, value: Draft[K]) => setDraft((d) => (d ? { ...d, [key]: value } : d));
|
||||
const cards = [
|
||||
{ label: "Heartbeats", value: items ? String(rows.length) : "…", color: "" },
|
||||
{ label: "Late or failed", value: items ? String(wrong) : "…", color: wrong > 0 ? "text-red" : "text-green" },
|
||||
{ label: "Waiting for a first call", value: items ? String(waiting) : "…", color: waiting > 0 ? "text-yellow" : "" },
|
||||
{ label: t("Heartbeats"), value: items ? String(rows.length) : "…", color: "" },
|
||||
{ label: t("Late or failed"), value: items ? String(wrong) : "…", color: wrong > 0 ? "text-red" : "text-green" },
|
||||
{ label: t("Waiting for a first call"), value: items ? String(waiting) : "…", color: waiting > 0 ? "text-yellow" : "" },
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -235,7 +235,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-0">{t("Heartbeats")}</h2>
|
||||
{isAdmin && !draft && (
|
||||
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
|
||||
Add a heartbeat
|
||||
{t("Add a heartbeat")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -263,7 +263,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
{draft && (
|
||||
<form className="card mb-3" onSubmit={save}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{draft.id === null ? "Add a heartbeat" : `Edit ${draft.name || "the heartbeat"}`}</h3>
|
||||
<h3 className="card-title">{draft.id === null ? t("Add a heartbeat") : `Edit ${draft.name || "the heartbeat"}`}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-4">
|
||||
@@ -274,11 +274,11 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="hb-every">
|
||||
It should report every
|
||||
{t("It should report every")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="hb-every" type="number" min={1} step="any" className="form-control" required value={draft.every} onChange={(e) => set("every", e.target.value)} />
|
||||
<select className="form-select" aria-label="Unit" value={draft.unit} onChange={(e) => set("unit", e.target.value as Unit)} style={{ maxWidth: "7rem" }}>
|
||||
<select className="form-select" aria-label={t("Unit")} value={draft.unit} onChange={(e) => set("unit", e.target.value as Unit)} style={{ maxWidth: "7rem" }}>
|
||||
<option value="minutes">minutes</option>
|
||||
<option value="hours">hours</option>
|
||||
<option value="days">days</option>
|
||||
@@ -297,10 +297,10 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="hb-server">
|
||||
It runs on the server
|
||||
{t("It runs on the server")}
|
||||
</label>
|
||||
<select id="hb-server" className="form-select" value={draft.serverId} onChange={(e) => set("serverId", e.target.value)}>
|
||||
<option value="">— none in particular —</option>
|
||||
<option value="">{t("— none in particular —")}</option>
|
||||
{servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -324,7 +324,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === "" || !(Number(draft.every) > 0)}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
{busy ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -334,15 +334,15 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder="Search heartbeats…" shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
|
||||
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder={t("Search heartbeats…")} shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Row> label="Job" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Job")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Last call" sortKeyName="lastPingAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Due by" sortKeyName="dueBy" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Last call")} sortKeyName="lastPingAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Due by")} sortKeyName="dueBy" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>{t("Recent runs")}</th>
|
||||
{isAdmin && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
@@ -370,7 +370,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
<span className={`badge ${STATE_BADGE[h.state].badge}`}>{STATE_BADGE[h.state].label}</span>
|
||||
{h.state === "failed" && h.lastMessage && <div className="text-secondary small text-break">{h.lastMessage}</div>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Last call">
|
||||
<td className="stack-label" data-label={t("Last call")}>
|
||||
{h.lastPingAt ? (
|
||||
<>
|
||||
<TimeAgo value={h.lastPingAt} />
|
||||
@@ -381,7 +381,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
<span className="text-secondary">never</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Due by">
|
||||
<td className="stack-label" data-label={t("Due by")}>
|
||||
{h.enabled ? (
|
||||
<span className={h.state === "late" ? "text-yellow" : "text-secondary"}>{formatDateTime(new Date(h.dueBy))}</span>
|
||||
) : (
|
||||
@@ -396,14 +396,14 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
<div className="btn-list flex-nowrap">
|
||||
{h.path && (
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => setShowing({ name: h.name, path: h.path! })}>
|
||||
Address
|
||||
{t("Address")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(toDraft(h))}>
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void newAddress(h)}>
|
||||
New address
|
||||
{t("New address")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(h)}>
|
||||
{t("Remove")}
|
||||
@@ -414,7 +414,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{items !== null && sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={6} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: "No job is reporting in yet", hint: "Add a heartbeat for a backup, a sync or any job that should run on its own; it calls an address when it finishes, and you hear about it when it doesn't.", action: isAdmin ? { label: "Add a heartbeat", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
|
||||
<EmptyRow colSpan={6} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: t("No job is reporting in yet"), hint: "Add a heartbeat for a backup, a sync or any job that should run on its own; it calls an address when it finishes, and you hear about it when it doesn't.", action: isAdmin ? { label: t("Add a heartbeat"), onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+25
-25
@@ -13,7 +13,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ p }: { p: HetznerProject }) {
|
||||
if (!p.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!p.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!p.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!p.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -22,8 +22,8 @@ function Badge({ p }: { p: HetznerProject }) {
|
||||
}
|
||||
|
||||
export function StatusBadge({ status }: { status: string }) {
|
||||
if (status === "running") return <span className="badge bg-green-lt text-green">Running</span>;
|
||||
if (status === "off") return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (status === "running") return <span className="badge bg-green-lt text-green">{t("Running")}</span>;
|
||||
if (status === "off") return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{status}</span>;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Estimated per month</div>
|
||||
<div className="text-secondary small">{t("Estimated per month")}</div>
|
||||
<div className="h2 mb-0">{cost ? money(cost.total, cost.currency) : "—"}</div>
|
||||
<div className="text-secondary small">{cost ? "at list prices, with VAT" : "the price list could not be read"}</div>
|
||||
</div>
|
||||
@@ -156,7 +156,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Volumes</div>
|
||||
<div className="text-secondary small">{t("Volumes")}</div>
|
||||
<div className="h2 mb-0">{s.volumes === null ? "—" : s.volumes.length}</div>
|
||||
<div className="text-secondary small">{s.volumes === null ? "could not be read" : `${gb} GB${s.volumes.some((v) => v.serverId === null) ? `, ${s.volumes.filter((v) => v.serverId === null).length} not attached` : ""}`}</div>
|
||||
</div>
|
||||
@@ -165,7 +165,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Snapshots and backups</div>
|
||||
<div className="text-secondary small">{t("Snapshots and backups")}</div>
|
||||
<div className="h2 mb-0">{s.images === null ? "—" : `${snapshots.length} + ${backups.length}`}</div>
|
||||
<div className="text-secondary small">{s.images === null ? "could not be read" : "snapshots + backups"}</div>
|
||||
</div>
|
||||
@@ -184,12 +184,12 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
<tr>
|
||||
<th>{t("Server")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
<th>Type</th>
|
||||
<th>Location</th>
|
||||
<th>Address</th>
|
||||
<th>Traffic this month</th>
|
||||
<th>{t("Type")}</th>
|
||||
<th>{t("Location")}</th>
|
||||
<th>{t("Address")}</th>
|
||||
<th>{t("Traffic this month")}</th>
|
||||
<th>{t("Backups")}</th>
|
||||
<th>Price/mo</th>
|
||||
<th>{t("Price/mo")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -199,7 +199,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
{s.servers.length === 0 && (
|
||||
<tr>
|
||||
<td colSpan={8} className="text-secondary">
|
||||
The project has no servers.
|
||||
{t("The project has no servers.")}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
@@ -208,17 +208,17 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
</div>
|
||||
{s.loadBalancers && s.loadBalancers.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Load balancers</h4>
|
||||
<h4 className="mt-3">{t("Load balancers")}</h4>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Type</th>
|
||||
<th>Address</th>
|
||||
<th>Targets</th>
|
||||
<th>Traffic this month</th>
|
||||
<th>Price/mo</th>
|
||||
<th>{t("Type")}</th>
|
||||
<th>{t("Address")}</th>
|
||||
<th>{t("Targets")}</th>
|
||||
<th>{t("Traffic this month")}</th>
|
||||
<th>{t("Price/mo")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -237,7 +237,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
<td className="text-secondary text-break">{l.ipv4 ?? "—"}</td>
|
||||
<td>
|
||||
{l.targets.length === 0 ? (
|
||||
<span className="text-secondary">none</span>
|
||||
<span className="text-secondary">{t("none")}</span>
|
||||
) : bad.length === 0 ? (
|
||||
<span className="badge bg-green-lt text-green">{l.targets.every((t) => t.health === "healthy") ? `${l.targets.length} healthy` : `${l.targets.length} · not judged yet`}</span>
|
||||
) : (
|
||||
@@ -259,7 +259,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
)}
|
||||
{s.floatingIps && s.floatingIps.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Floating IPs</h4>
|
||||
<h4 className="mt-3">{t("Floating IPs")}</h4>
|
||||
<ul className="mb-0">
|
||||
{s.floatingIps.map((f) => (
|
||||
<li key={f.id}>
|
||||
@@ -273,7 +273,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
)}
|
||||
{s.certificates && s.certificates.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Certificates</h4>
|
||||
<h4 className="mt-3">{t("Certificates")}</h4>
|
||||
<ul className="mb-0">
|
||||
{s.certificates.map((c) => {
|
||||
const left = c.notValidAfter === null ? null : (Date.parse(c.notValidAfter) - Date.now()) / 86_400_000;
|
||||
@@ -298,7 +298,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
)}
|
||||
{s.volumes && s.volumes.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Volumes</h4>
|
||||
<h4 className="mt-3">{t("Volumes")}</h4>
|
||||
<ul className="mb-0">
|
||||
{s.volumes.map((v) => (
|
||||
<li key={v.id}>
|
||||
@@ -310,7 +310,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
)}
|
||||
{snapshots.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Snapshots</h4>
|
||||
<h4 className="mt-3">{t("Snapshots")}</h4>
|
||||
<ul className="mb-0">
|
||||
{snapshots.map((i) => (
|
||||
<li key={i.id}>
|
||||
@@ -323,7 +323,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="text-secondary small mt-1">Snapshots are billed per GB and month until they are deleted.</div>
|
||||
<div className="text-secondary small mt-1">{t("Snapshots are billed per GB and month until they are deleted.")}</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
@@ -365,7 +365,7 @@ export default function Hetzner({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Hetzner project connected" hint="Add one under Integrations with a project's API token (Hetzner Console → the project → Security → API tokens; Read is enough)." />
|
||||
<EmptyState title={t("No Hetzner project connected")} hint="Add one under Integrations with a project's API token (Hetzner Console → the project → Security → API tokens; Read is enough)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -11,7 +11,7 @@ import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ a }: { a: RobotAccount }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -79,10 +79,10 @@ function Card({ a, canRead, onRead }: { a: RobotAccount; canRead: boolean; onRea
|
||||
{s && (
|
||||
<>
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile label="Dedicated servers" value={String(s.servers.length)} sub={s.servers.length === 0 ? "none on this account" : null} />
|
||||
<Tile label="Rescue system on" value={String(rescue)} sub={rescue > 0 ? "the next boot is into it" : "none"} warn={rescue > 0} />
|
||||
<Tile label="Cancelled" value={String(cancelled)} sub={cancelled > 0 ? "servers and storage boxes shutting down" : "nothing shutting down"} warn={cancelled > 0} />
|
||||
<Tile label="Storage boxes" value={s.storageBoxes === null ? "—" : String(s.storageBoxes.length)} sub={s.storageBoxes === null ? "could not be read" : s.storageBoxes.some((b) => b.locked) ? "one is locked" : null} warn={!!s.storageBoxes?.some((b) => b.locked)} />
|
||||
<Tile label={t("Dedicated servers")} value={String(s.servers.length)} sub={s.servers.length === 0 ? "none on this account" : null} />
|
||||
<Tile label={t("Rescue system on")} value={String(rescue)} sub={rescue > 0 ? "the next boot is into it" : "none"} warn={rescue > 0} />
|
||||
<Tile label={t("Cancelled")} value={String(cancelled)} sub={cancelled > 0 ? "servers and storage boxes shutting down" : "nothing shutting down"} warn={cancelled > 0} />
|
||||
<Tile label={t("Storage boxes")} value={s.storageBoxes === null ? "—" : String(s.storageBoxes.length)} sub={s.storageBoxes === null ? "could not be read" : s.storageBoxes.some((b) => b.locked) ? "one is locked" : null} warn={!!s.storageBoxes?.some((b) => b.locked)} />
|
||||
</div>
|
||||
{s.skippedDetail > 0 && <div className="text-secondary small mb-2">{s.skippedDetail} server{s.skippedDetail === 1 ? "" : "s"} beyond the first 25 were not asked about their rescue system (Hetzner allows 200 requests an hour).</div>}
|
||||
{s.servers.length > 0 && (
|
||||
@@ -91,12 +91,12 @@ function Card({ a, canRead, onRead }: { a: RobotAccount; canRead: boolean; onRea
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Server")}</th>
|
||||
<th>Product</th>
|
||||
<th>Address</th>
|
||||
<th>Traffic</th>
|
||||
<th>{t("Product")}</th>
|
||||
<th>{t("Address")}</th>
|
||||
<th>{t("Traffic")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
<th>Rescue</th>
|
||||
<th>Paid</th>
|
||||
<th>{t("Rescue")}</th>
|
||||
<th>{t("Paid")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -147,17 +147,17 @@ function Card({ a, canRead, onRead }: { a: RobotAccount; canRead: boolean; onRea
|
||||
)}
|
||||
{s.storageBoxes && s.storageBoxes.length > 0 && (
|
||||
<>
|
||||
<h4>Storage boxes</h4>
|
||||
<h4>{t("Storage boxes")}</h4>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Storage box</th>
|
||||
<th>Product</th>
|
||||
<th>Location</th>
|
||||
<th>{t("Storage box")}</th>
|
||||
<th>{t("Product")}</th>
|
||||
<th>{t("Location")}</th>
|
||||
<th>{t("Linked to")}</th>
|
||||
<th>State</th>
|
||||
<th>Paid</th>
|
||||
<th>{t("State")}</th>
|
||||
<th>{t("Paid")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -218,7 +218,7 @@ export default function HetznerRobot({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Hetzner Robot account connected" hint="Add one under Integrations with a webservice user (Robot → Settings → Webservice and app settings) and its password." />
|
||||
<EmptyState title={t("No Hetzner Robot account connected")} hint="Add one under Integrations with a webservice user (Robot → Settings → Webservice and app settings) and its password." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -24,7 +24,7 @@ function StateCell({ w, problem }: { w: HaWatchedEntity; problem: boolean }) {
|
||||
if (e.unavailableSince !== null || e.state === "missing") {
|
||||
return (
|
||||
<span className="badge bg-yellow-lt text-yellow" title={`Since ${e.unavailableSince ?? "?"}`}>
|
||||
{e.state === "missing" ? "Not in Home Assistant" : e.state}
|
||||
{e.state === "missing" ? t("Not in Home Assistant") : e.state}
|
||||
{e.unavailableSince ? <> · <TimeAgo value={e.unavailableSince} /></> : null}
|
||||
</span>
|
||||
);
|
||||
@@ -74,7 +74,7 @@ function HistoryDrawer({ integrationId, w, onClose }: { integrationId: number; w
|
||||
<ErrorNotice error={error} />
|
||||
{!points && !error && <BlockSkeleton lines={5} />}
|
||||
{points && <TimeChart series={series} unit="value" from={to - shown * 86_400_000} to={to} label={`${shownName(w)} over time`} format={(v) => numberWords(v, unit)} empty="Nothing kept for this in this stretch yet — a reading is added every few minutes." />}
|
||||
<div className="text-secondary small mt-2">Readings are kept for 35 days.</div>
|
||||
<div className="text-secondary small mt-2">{t("Readings are kept for 35 days.")}</div>
|
||||
</DetailDrawer>
|
||||
);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ function EditDrawer({ integrationId, w, onClose, onSaved }: { integrationId: num
|
||||
<ErrorNotice error={error} />
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="ha-name">
|
||||
Name shown here
|
||||
{t("Name shown here")}
|
||||
</label>
|
||||
<input id="ha-name" className="form-control" value={name} maxLength={80} placeholder={w.entity?.friendlyName ?? w.entityId} onChange={(e) => setName(e.target.value)} />
|
||||
</div>
|
||||
@@ -133,7 +133,7 @@ function EditDrawer({ integrationId, w, onClose, onSaved }: { integrationId: num
|
||||
<div className="text-secondary mb-3">This one isn’t a number, so there are no limits to set. It is an alert when it has been unavailable for 15 minutes.</div>
|
||||
)}
|
||||
<button className="btn btn-primary" onClick={() => void save()} disabled={busy}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
{busy ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
</DetailDrawer>
|
||||
);
|
||||
@@ -178,9 +178,9 @@ function PickDrawer({ integration, onClose, onChanged }: { integration: Integrat
|
||||
}
|
||||
|
||||
return (
|
||||
<DetailDrawer title="Watch something" subtitle={integration.name} onClose={onClose}>
|
||||
<DetailDrawer title={t("Watch something")} subtitle={integration.name} onClose={onClose}>
|
||||
<div className="text-secondary mb-2">Search by name or id, like “battery” or “freezer”. Limits are set afterwards, from the list.</div>
|
||||
<input className="form-control mb-3" type="search" value={q} onChange={(e) => setQ(e.target.value)} placeholder="Search Home Assistant…" aria-label="Search entities" autoFocus />
|
||||
<input className="form-control mb-3" type="search" value={q} onChange={(e) => setQ(e.target.value)} placeholder={t("Search Home Assistant…")} aria-label={t("Search entities")} autoFocus />
|
||||
<ErrorNotice error={error} />
|
||||
{!found && !error && <BlockSkeleton lines={4} />}
|
||||
{found && (
|
||||
@@ -196,16 +196,16 @@ function PickDrawer({ integration, onClose, onChanged }: { integration: Integrat
|
||||
</div>
|
||||
</div>
|
||||
{e.watched ? (
|
||||
<span className="badge bg-green-lt text-green">Watching</span>
|
||||
<span className="badge bg-green-lt text-green">{t("Watching")}</span>
|
||||
) : (
|
||||
<button className="btn btn-sm btn-outline-primary" disabled={busy === e.entityId} onClick={() => void watch(e)}>
|
||||
Watch
|
||||
{t("Watch")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{found.entities.length === 0 && <div className="text-secondary">Nothing matches.</div>}
|
||||
{found.entities.length === 0 && <div className="text-secondary">{t("Nothing matches.")}</div>}
|
||||
<div className="text-secondary small mt-2">
|
||||
{found.entities.length >= 60 ? "The first 60 of " : ""}
|
||||
{found.total} in Home Assistant.
|
||||
@@ -281,7 +281,7 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
|
||||
{canAct && live.length > 0 && (
|
||||
<div className="ms-auto btn-list">
|
||||
<button className="btn btn-outline-secondary" onClick={() => void readNow()} disabled={reading}>
|
||||
{reading ? "Reading…" : "Read now"}
|
||||
{reading ? "Reading…" : t("Read now")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -295,9 +295,9 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
|
||||
{data && live.length === 0 && (
|
||||
<div className="card">
|
||||
<EmptyState
|
||||
title="No Home Assistant connected"
|
||||
title={t("No Home Assistant connected")}
|
||||
hint="Add a Home Assistant integration with a long-lived access token (made at the bottom of your profile page in Home Assistant), then choose what to watch."
|
||||
action={user.role === "admin" ? { label: "Add Home Assistant", to: "/integrations" } : undefined}
|
||||
action={user.role === "admin" ? { label: t("Add Home Assistant"), to: "/integrations" } : undefined}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -326,22 +326,22 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
|
||||
{canAct && i.enabled && (
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-primary btn-sm" onClick={() => setPicking(i)}>
|
||||
Watch something
|
||||
{t("Watch something")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{i.watched.length === 0 ? (
|
||||
<EmptyState title="Nothing is being watched yet" hint="Pick the entities that matter — a battery level, a temperature, a switch — and set the limits that should raise an alert." action={canAct && i.enabled ? { label: "Watch something", onClick: () => setPicking(i) } : undefined} />
|
||||
<EmptyState title={t("Nothing is being watched yet")} hint="Pick the entities that matter — a battery level, a temperature, a switch — and set the limits that should raise an alert." action={canAct && i.enabled ? { label: t("Watch something"), onClick: () => setPicking(i) } : undefined} />
|
||||
) : (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Now</th>
|
||||
<th>Alert when</th>
|
||||
<th>Last changed</th>
|
||||
<th>{t("Now")}</th>
|
||||
<th>{t("Alert when")}</th>
|
||||
<th>{t("Last changed")}</th>
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
</th>
|
||||
@@ -356,13 +356,13 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
|
||||
<strong>{shownName(w)}</strong>
|
||||
<div className="text-secondary small font-monospace">{w.entityId}</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Now">
|
||||
<td className="stack-label" data-label={t("Now")}>
|
||||
<StateCell w={w} problem={problem} />
|
||||
</td>
|
||||
<td className="stack-label" data-label="Alert when">
|
||||
<td className="stack-label" data-label={t("Alert when")}>
|
||||
{limitsWords(w) || <span className="text-secondary">unavailable for 15 min</span>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Last changed">
|
||||
<td className="stack-label" data-label={t("Last changed")}>
|
||||
{w.entity?.lastChanged ? <TimeAgo value={w.entity.lastChanged} /> : <span className="text-secondary">—</span>}
|
||||
</td>
|
||||
<td className="text-nowrap stack-wide">
|
||||
@@ -375,7 +375,7 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
|
||||
{canAct && (
|
||||
<>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setEditing({ id: i.id, w })}>
|
||||
Limits
|
||||
{t("Limits")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void stop(i.id, w)} aria-label={`Stop watching ${shownName(w)}`}>
|
||||
{t("Stop")}
|
||||
|
||||
@@ -12,7 +12,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ i }: { i: ImmichInfo }) {
|
||||
if (!i.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!i.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!i.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!i.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (i.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -54,7 +54,7 @@ function Card({ i }: { i: ImmichInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Photos</div>
|
||||
<div className="text-secondary small">{t("Photos")}</div>
|
||||
<div className="h2 mb-0">{n(s.photos)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,7 +62,7 @@ function Card({ i }: { i: ImmichInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Videos</div>
|
||||
<div className="text-secondary small">{t("Videos")}</div>
|
||||
<div className="h2 mb-0">{n(s.videos)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@ function Card({ i }: { i: ImmichInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Library</div>
|
||||
<div className="text-secondary small">{t("Library")}</div>
|
||||
<div className="h2 mb-0">{s.usageBytes === null ? "—" : formatBytes(s.usageBytes)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@ function Card({ i }: { i: ImmichInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Disk under it</div>
|
||||
<div className="text-secondary small">{t("Disk under it")}</div>
|
||||
<div className="h2 mb-0">{percent === null ? "—" : `${Math.round(percent)} %`}</div>
|
||||
{s.disk && (
|
||||
<>
|
||||
@@ -103,10 +103,10 @@ function Card({ i }: { i: ImmichInfo }) {
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Queue</th>
|
||||
<th>{t("Queue")}</th>
|
||||
<th className="text-end">{t("Active")}</th>
|
||||
<th className="text-end">Waiting</th>
|
||||
<th className="text-end">Failed</th>
|
||||
<th className="text-end">{t("Waiting")}</th>
|
||||
<th className="text-end">{t("Failed")}</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -161,7 +161,7 @@ export default function Immich() {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Immich connected" hint="Add one under Integrations with its address and an API key (Account Settings → API Keys; read permissions are enough)." />
|
||||
<EmptyState title={t("No Immich connected")} hint="Add one under Integrations with its address and an API key (Account Settings → API Keys; read permissions are enough)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -86,7 +86,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
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;
|
||||
if (!(await confirmDialog({ title: t("Remove this note?"), message: t("It is taken out of the incident's history."), confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.incidents.removeNote(id, noteId);
|
||||
await load();
|
||||
@@ -99,7 +99,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
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="/alerts?view=history">All incidents</Link>.
|
||||
There is no incident like that (it may be old enough to have been removed). <Link to="/alerts?view=history">{t("All incidents")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -139,7 +139,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
{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
|
||||
{t("Open in Alerts")}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
@@ -152,7 +152,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
<div className="h3 mb-0" title={formatDateTime(new Date(incident.openedAt))}>
|
||||
<TimeAgo value={incident.openedAt} />
|
||||
</div>
|
||||
<div className="text-secondary">Began</div>
|
||||
<div className="text-secondary">{t("Began")}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -160,7 +160,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
<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 className="text-secondary">{incident.open ? t("So far") : t("Lasted")}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -168,7 +168,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
<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 className="text-secondary">{t("Ended")}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,7 +176,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
<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 className="text-secondary">{incident.notes === 1 ? t("Note") : t("Notes")}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,7 +185,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
{ack && (
|
||||
<div className={`alert ${ack.active ? "alert-info" : "alert-secondary"}`}>
|
||||
<div>
|
||||
<strong>{ack.active ? ackWords(ack) : "Its acknowledgement has run out"}</strong>
|
||||
<strong>{ack.active ? ackWords(ack) : t("Its acknowledgement has run out")}</strong>
|
||||
{ack.note && <div>{ack.note}</div>}
|
||||
<div className="small">
|
||||
Acknowledged by {ack.ackedBy} <TimeAgo value={ack.ackedAt} />.
|
||||
@@ -199,7 +199,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
<WhatChangedBefore incidentId={incident.id} openedAt={incident.openedAt} />
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">What happened</h3>
|
||||
<h3 className="card-title">{t("What happened")}</h3>
|
||||
</div>
|
||||
<div className="list-group list-group-flush">
|
||||
{timeline.map((e, i) => (
|
||||
@@ -219,7 +219,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
{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
|
||||
{t("Remove note")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -242,14 +242,14 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
|
||||
{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)} />
|
||||
<textarea className="form-control mb-2" rows={4} maxLength={4000} placeholder={t("Add a note…")} aria-label={t("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"}
|
||||
{busy ? t("Saving…") : t("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>
|
||||
<div className="form-hint text-secondary small mt-2">{t("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>
|
||||
detail.notes.length > 0 && <div className="text-secondary small">{t("Operators can add notes.")}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,8 +63,8 @@ const integrationTabs = (view: "list" | "calls") => (
|
||||
<ViewTabs
|
||||
label={t("Integrations view")}
|
||||
tabs={[
|
||||
{ to: "/integrations", label: "Integrations", active: view === "list" },
|
||||
{ to: "/integrations?view=calls", label: "Call log", active: view === "calls" },
|
||||
{ to: "/integrations", label: t("Integrations"), active: view === "list" },
|
||||
{ to: "/integrations?view=calls", label: t("Call log"), active: view === "calls" },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -144,7 +144,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
}
|
||||
|
||||
async function removeIntegration(i: IntegrationSummary) {
|
||||
if (!(await confirmDialog({ title: t("Delete integration"), message: `Delete integration "${i.name}"?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete integration"), message: `Delete integration "${i.name}"?`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
try {
|
||||
await api.integrations.remove(i.id);
|
||||
toast.success(`Deleted ${i.name}.`);
|
||||
@@ -195,7 +195,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
// The cards in groups, as the sidebar groups their pages (a kind nobody has placed goes under "Other").
|
||||
const groupedIntegrations = (() => {
|
||||
const groups = new Map<string, { id: string; label: string; items: IntegrationSummary[] }>();
|
||||
for (const g of [...TYPE_GROUPS.map(({ id, label }) => ({ id, label })), { id: "other", label: "Other" }]) groups.set(g.id, { ...g, items: [] });
|
||||
for (const g of [...TYPE_GROUPS.map(({ id, label }) => ({ id, label })), { id: "other", label: t("Other") }]) groups.set(g.id, { ...g, items: [] });
|
||||
for (const i of sortedIntegrations ?? []) groups.get(groupOfType(i.type).id)!.items.push(i);
|
||||
return [...groups.values()].filter((g) => g.items.length > 0);
|
||||
})();
|
||||
@@ -205,7 +205,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
downloadCsv(
|
||||
"integrations.csv",
|
||||
["Name", "Type", "Status"],
|
||||
sortedIntegrations.map((i) => [i.name, TYPE_LABELS[i.type], i.enabled ? "Enabled" : "Disabled"]),
|
||||
sortedIntegrations.map((i) => [i.name, TYPE_LABELS[i.type], i.enabled ? t("Enabled") : t("Disabled")]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
>
|
||||
<option value="">{t("Any status")}</option>
|
||||
<option value="failing">{t("Failing")}</option>
|
||||
<option value="working">Working</option>
|
||||
<option value="working">{t("Working")}</option>
|
||||
<option value="disabled">{t("Disabled")}</option>
|
||||
</select>
|
||||
}
|
||||
@@ -348,9 +348,9 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<IntegrationRow> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label="Kind" sortKeyName="kind" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label="Group" sortKeyName="group" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label="Address" sortKeyName="host" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label={t("Kind")} sortKeyName="kind" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label={t("Group")} sortKeyName="group" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label={t("Address")} sortKeyName="host" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IntegrationRow> label={t("Status")} sortKeyName="statusRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th scope="col">{t("Last week")}</th>
|
||||
<th scope="col">{t("Last 30 days")}</th>
|
||||
|
||||
+45
-45
@@ -163,7 +163,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
if (draft.id === null) await api.inventory.create(toInput(draft));
|
||||
else await api.inventory.update(draft.id, toInput(draft));
|
||||
toast.success(draft.id === null ? `Added ${draft.name}.` : "Saved.");
|
||||
toast.success(draft.id === null ? `Added ${draft.name}.` : t("Saved."));
|
||||
setDraft(null);
|
||||
load();
|
||||
} catch (err) {
|
||||
@@ -193,7 +193,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function remove(a: Asset) {
|
||||
if (!(await confirmDialog({ title: "Remove from the inventory", message: `Remove "${a.name}"?`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove from the inventory"), message: `Remove "${a.name}"?`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.inventory.remove(a.id);
|
||||
load();
|
||||
@@ -205,7 +205,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
async function refreshFromAgent(a: Asset) {
|
||||
const d = a.agent?.differs ?? {};
|
||||
const lines = (Object.keys(d) as (keyof typeof d)[]).map((k) => `${k}: "${a[k] ?? ""}" becomes "${d[k]}"`);
|
||||
if (!(await confirmDialog({ title: "Take over what the agent says", message: `${a.name}: ${lines.join("; ")}.`, confirmLabel: "Replace" }))) return;
|
||||
if (!(await confirmDialog({ title: t("Take over what the agent says"), message: `${a.name}: ${lines.join("; ")}.`, confirmLabel: t("Replace") }))) return;
|
||||
try {
|
||||
await api.inventory.refreshFromAgent(a.id);
|
||||
toast.success("Updated from the agent.");
|
||||
@@ -253,11 +253,11 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
const set = <K extends keyof Draft>(key: K, value: Draft[K]) => setDraft((d) => (d ? { ...d, [key]: value } : d));
|
||||
|
||||
const cards: { label: string; value: string; note?: string; color: string }[] = [
|
||||
{ label: "Hardware", value: assets ? String(all.length) : "…", note: spent > 0 ? `${money(spent, config.currency)} paid` : undefined, color: "" },
|
||||
{ label: "Under warranty", value: assets ? String(covered + expiring) : "…", note: expiring > 0 ? `${expiring} ending within 90 days` : expired > 0 ? `${expired} ended` : undefined, color: expiring > 0 ? "text-yellow" : "text-green" },
|
||||
{ label: "Power draw", value: assets ? `${watts} W` : "…", note: watts > 0 ? `${yearlyKwh(watts).toLocaleString("sv-SE")} kWh a year` : undefined, color: "" },
|
||||
{ label: t("Hardware"), value: assets ? String(all.length) : "…", note: spent > 0 ? `${money(spent, config.currency)} paid` : undefined, color: "" },
|
||||
{ label: t("Under warranty"), value: assets ? String(covered + expiring) : "…", note: expiring > 0 ? `${expiring} ending within 90 days` : expired > 0 ? `${expired} ended` : undefined, color: expiring > 0 ? "text-yellow" : "text-green" },
|
||||
{ label: t("Power draw"), value: assets ? `${watts} W` : "…", note: watts > 0 ? `${yearlyKwh(watts).toLocaleString("sv-SE")} kWh a year` : undefined, color: "" },
|
||||
{
|
||||
label: "Running cost",
|
||||
label: t("Running cost"),
|
||||
value: cost !== null ? `${money(cost, config.currency)} / year` : "—",
|
||||
note: cost === null ? (config.pricePerKwh === null ? "set a price of power below" : "add power draws to see it") : undefined,
|
||||
color: "",
|
||||
@@ -270,17 +270,17 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-0">{t("Inventory")}</h2>
|
||||
<div className="ms-auto d-flex gap-2">
|
||||
<Link to="/inventory/racks" className="btn">
|
||||
Racks
|
||||
{t("Racks")}
|
||||
</Link>
|
||||
<Link to="/inventory/lifecycle" className="btn">
|
||||
Lifecycle
|
||||
{t("Lifecycle")}
|
||||
</Link>
|
||||
<Link to="/inventory/labels" className="btn">
|
||||
Print labels
|
||||
{t("Print labels")}
|
||||
</Link>
|
||||
{canEdit && !draft && (
|
||||
<button className="btn btn-primary" onClick={() => setDraft({ ...EMPTY })}>
|
||||
Add hardware
|
||||
{t("Add hardware")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -321,7 +321,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{focused.server && (
|
||||
<div className="col-md-6 d-flex">
|
||||
<dt className="col-5 text-secondary fw-normal">Is the server</dt>
|
||||
<dt className="col-5 text-secondary fw-normal">{t("Is the server")}</dt>
|
||||
<dd className="col-7">
|
||||
<Link to={`/servers/${focused.server.id}`}>{focused.server.name}</Link>
|
||||
</dd>
|
||||
@@ -331,7 +331,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{focusId !== null && assets !== null && !focused && <div className="alert alert-warning">That piece of hardware isn't in the inventory any more.</div>}
|
||||
{focusId !== null && assets !== null && !focused && <div className="alert alert-warning">{t("That piece of hardware isn't in the inventory any more.")}</div>}
|
||||
|
||||
<div className="row row-cards mb-3">
|
||||
{cards.map((c) => (
|
||||
@@ -350,7 +350,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
{draft && (
|
||||
<form id="inventory-form" className="card mb-3" onSubmit={save}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{draft.id === null ? "Add hardware" : `Edit ${draft.name || "hardware"}`}</h3>
|
||||
<h3 className="card-title">{draft.id === null ? t("Add hardware") : `Edit ${draft.name || "hardware"}`}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-5">
|
||||
@@ -361,7 +361,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="inv-kind">
|
||||
Kind
|
||||
{t("Kind")}
|
||||
</label>
|
||||
<select id="inv-kind" className="form-select" value={draft.kind} onChange={(e) => set("kind", e.target.value as AssetKind)}>
|
||||
{KINDS.map((k) => (
|
||||
@@ -373,10 +373,10 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="inv-server">
|
||||
Is the server
|
||||
{t("Is the server")}
|
||||
</label>
|
||||
<select id="inv-server" className="form-select" value={draft.serverId} onChange={(e) => set("serverId", e.target.value)}>
|
||||
<option value="">— not a server here —</option>
|
||||
<option value="">{t("— not a server here —")}</option>
|
||||
{servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -387,7 +387,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
<div className="form-hint small mt-1">
|
||||
Looks like <strong>{suggestion.name}</strong>.{" "}
|
||||
<button type="button" className="btn btn-link btn-sm p-0 align-baseline" onClick={() => set("serverId", String(suggestion.id))}>
|
||||
Link it
|
||||
{t("Link it")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -395,25 +395,25 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="inv-maker">
|
||||
Manufacturer
|
||||
{t("Manufacturer")}
|
||||
</label>
|
||||
<input id="inv-maker" className="form-control" maxLength={100} value={draft.manufacturer} onChange={(e) => set("manufacturer", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="inv-model">
|
||||
Model
|
||||
{t("Model")}
|
||||
</label>
|
||||
<input id="inv-model" className="form-control" maxLength={100} value={draft.model} onChange={(e) => set("model", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="inv-serial">
|
||||
Serial number
|
||||
{t("Serial number")}
|
||||
</label>
|
||||
<input id="inv-serial" className="form-control" maxLength={100} value={draft.serial} onChange={(e) => set("serial", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="inv-bought">
|
||||
Bought
|
||||
{t("Bought")}
|
||||
</label>
|
||||
<input id="inv-bought" type="date" className="form-control" value={draft.purchaseDate} onChange={(e) => set("purchaseDate", e.target.value)} />
|
||||
</div>
|
||||
@@ -425,13 +425,13 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="inv-warranty">
|
||||
Warranty until
|
||||
{t("Warranty until")}
|
||||
</label>
|
||||
<input id="inv-warranty" type="date" className="form-control" value={draft.warrantyUntil} onChange={(e) => set("warrantyUntil", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="inv-eos">
|
||||
End of support
|
||||
{t("End of support")}
|
||||
</label>
|
||||
<input id="inv-eos" type="date" className="form-control" value={draft.endOfSupport} onChange={(e) => set("endOfSupport", e.target.value)} />
|
||||
<div className="form-hint text-secondary small mt-1">When the maker stops patching it, or you plan to retire it.</div>
|
||||
@@ -445,7 +445,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="inv-power">
|
||||
Typical power draw
|
||||
{t("Typical power draw")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="inv-power" type="number" min={0} max={100000} step={1} className="form-control" value={draft.powerWatts} onChange={(e) => set("powerWatts", e.target.value)} />
|
||||
@@ -454,13 +454,13 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="inv-location">
|
||||
Where it is
|
||||
{t("Where it is")}
|
||||
</label>
|
||||
<input id="inv-location" className="form-control" maxLength={120} placeholder="e.g. Rack in the cellar" value={draft.location} onChange={(e) => set("location", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="inv-unit">
|
||||
Rack unit
|
||||
{t("Rack unit")}
|
||||
</label>
|
||||
<input id="inv-unit" className="form-control" maxLength={30} placeholder="U12" value={draft.rackUnit} onChange={(e) => set("rackUnit", e.target.value)} />
|
||||
</div>
|
||||
@@ -473,7 +473,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === ""}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
{busy ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -486,7 +486,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
<TableToolbar
|
||||
search={tableSearch.query}
|
||||
onSearch={tableSearch.setQuery}
|
||||
placeholder="Search hardware…"
|
||||
placeholder={t("Search hardware…")}
|
||||
filters={
|
||||
<>
|
||||
{canEdit && shownIds.length > 0 && (
|
||||
@@ -511,7 +511,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
<select
|
||||
className="form-select form-select-sm w-auto"
|
||||
aria-label="Show hardware of kind"
|
||||
aria-label={t("Show hardware of kind")}
|
||||
value={kind}
|
||||
onChange={(e) =>
|
||||
setParams(
|
||||
@@ -525,7 +525,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Every kind</option>
|
||||
<option value="">{t("Every kind")}</option>
|
||||
{KINDS.map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{KIND_LABELS[k]}
|
||||
@@ -544,11 +544,11 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Asset> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label="Kind" sortKeyName="kind" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label={t("Kind")} sortKeyName="kind" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label={t("Where")} sortKeyName="location" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label="Bought" sortKeyName="purchaseDate" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label="Warranty" sortKeyName="warrantyUntil" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label="Power" sortKeyName="powerWatts" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label={t("Bought")} sortKeyName="purchaseDate" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label={t("Warranty")} sortKeyName="warrantyUntil" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Asset> label={t("Power")} sortKeyName="powerWatts" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -575,7 +575,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
<div className="small text-secondary">
|
||||
The agent says {Object.entries(a.agent.differs).map(([k, v]) => `${k === "manufacturer" ? "maker" : k === "serial" ? "serial number" : k} ${v}`).join(", ")}.{" "}
|
||||
<button type="button" className="btn btn-link btn-sm p-0 align-baseline" onClick={() => void refreshFromAgent(a)}>
|
||||
Refresh from agent
|
||||
{t("Refresh from agent")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -585,15 +585,15 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
{a.location ?? "—"}
|
||||
{a.rackUnit && <span className="text-secondary"> · {a.rackUnit}</span>}
|
||||
</td>
|
||||
<td className="text-secondary stack-label" data-label="Bought">
|
||||
<td className="text-secondary stack-label" data-label={t("Bought")}>
|
||||
{a.purchaseDate ?? "—"}
|
||||
{a.purchasePrice !== null && <div className="small">{money(a.purchasePrice, config.currency)}</div>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Warranty">
|
||||
<td className="stack-label" data-label={t("Warranty")}>
|
||||
<WarrantyBadge until={a.warrantyUntil} />
|
||||
{a.endOfSupport && <SupportLine until={a.endOfSupport} />}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Power">{a.powerWatts === null ? <span className="text-secondary">—</span> : `${a.powerWatts} W`}</td>
|
||||
<td className="stack-label" data-label={t("Power")}>{a.powerWatts === null ? <span className="text-secondary">—</span> : `${a.powerWatts} W`}</td>
|
||||
{canEdit && (
|
||||
<td className="stack-wide">
|
||||
<div className="btn-list flex-nowrap">
|
||||
@@ -609,7 +609,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{assets !== null && sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 7 : 6} {...(tableSearch.active || kind ? { filtered: () => { tableSearch.setQuery(""); setParams((p) => { const n = new URLSearchParams(p); n.delete("kind"); return n; }, { replace: true }); } } : { title: "Nothing in the inventory yet", hint: "Keep track of the hardware behind it all: what it is, when it was bought, how long it is covered, where it sits and what it draws.", action: canEdit ? { label: "Add the first piece of hardware", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
|
||||
<EmptyRow colSpan={canEdit ? 7 : 6} {...(tableSearch.active || kind ? { filtered: () => { tableSearch.setQuery(""); setParams((p) => { const n = new URLSearchParams(p); n.delete("kind"); return n; }, { replace: true }); } } : { title: t("Nothing in the inventory yet"), hint: "Keep track of the hardware behind it all: what it is, when it was bought, how long it is covered, where it sits and what it draws.", action: canEdit ? { label: t("Add the first piece of hardware"), onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -622,10 +622,10 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
<div className="has-bulk-bar" />
|
||||
<BulkBar count={pickedIds.length} noun={pickedIds.length === 1 ? "piece" : "pieces"} onClear={() => setPicked(new Set())}>
|
||||
<button type="button" className="btn btn-sm btn-primary" onClick={() => setBulkOpen(true)}>
|
||||
Change where / dates…
|
||||
{t("Change where / dates…")}
|
||||
</button>
|
||||
<Link to={`/inventory/labels?only=${pickedIds.join(",")}`} className="btn btn-sm">
|
||||
Print labels
|
||||
{t("Print labels")}
|
||||
</Link>
|
||||
</BulkBar>
|
||||
</>
|
||||
@@ -635,18 +635,18 @@ export default function Inventory({ user }: { user: CurrentUser }) {
|
||||
{isAdmin && (
|
||||
<form className="card" onSubmit={saveConfig}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Price of power</h3>
|
||||
<h3 className="card-title">{t("Price of power")}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3 align-items-end">
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="inv-kwh">
|
||||
Price per kWh
|
||||
{t("Price per kWh")}
|
||||
</label>
|
||||
<input id="inv-kwh" type="number" min={0} step="any" className="form-control" value={priceText} onChange={(e) => setPriceText(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label" htmlFor="inv-cur">
|
||||
Currency
|
||||
{t("Currency")}
|
||||
</label>
|
||||
<input id="inv-cur" className="form-control" maxLength={8} placeholder="SEK" value={currencyText} onChange={(e) => setCurrencyText(e.target.value)} />
|
||||
</div>
|
||||
|
||||
@@ -60,10 +60,10 @@ export default function InventoryLabels() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-3 no-print">
|
||||
<h2 className="page-title mb-0">Labels</h2>
|
||||
<h2 className="page-title mb-0">{t("Labels")}</h2>
|
||||
<div className="ms-auto d-flex gap-2">
|
||||
<Link to="/inventory" className="btn">
|
||||
Back to the inventory
|
||||
{t("Back to the inventory")}
|
||||
</Link>
|
||||
<button className="btn btn-primary" disabled={picked.length === 0} onClick={() => window.print()}>
|
||||
Print {picked.length} label{picked.length === 1 ? "" : "s"}
|
||||
@@ -79,7 +79,7 @@ export default function InventoryLabels() {
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<label className="form-label" htmlFor="label-size">
|
||||
Size
|
||||
{t("Size")}
|
||||
</label>
|
||||
<select id="label-size" className="form-select mb-3" value={size} onChange={(e) => setSize(e.target.value as SizeKey)}>
|
||||
{(Object.keys(SIZES) as SizeKey[]).map((k) => (
|
||||
@@ -99,19 +99,19 @@ export default function InventoryLabels() {
|
||||
<div className="col-lg-8">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Which hardware</h3>
|
||||
<h3 className="card-title">{t("Which hardware")}</h3>
|
||||
<div className="card-actions btn-list">
|
||||
<button className="btn btn-sm" onClick={() => setChosen(new Set((assets ?? []).map((a) => a.id)))}>
|
||||
{t("All")}
|
||||
</button>
|
||||
<button className="btn btn-sm" onClick={() => setChosen(new Set())}>
|
||||
None
|
||||
{t("None")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body" style={{ maxHeight: "16rem", overflowY: "auto" }}>
|
||||
{assets === null && !error && <BlockSkeleton lines={3} />}
|
||||
{assets?.length === 0 && <div className="text-secondary">Nothing in the inventory yet.</div>}
|
||||
{assets?.length === 0 && <div className="text-secondary">{t("Nothing in the inventory yet.")}</div>}
|
||||
<div className="row">
|
||||
{assets?.map((a) => (
|
||||
<div className="col-md-6" key={a.id}>
|
||||
@@ -129,7 +129,7 @@ export default function InventoryLabels() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="label-sheet" aria-label="Labels to print">
|
||||
<div className="label-sheet" aria-label={t("Labels to print")}>
|
||||
{picked.map((a) => (
|
||||
<div key={a.id} className={`asset-label ${showBorder ? "asset-label-border" : ""}`} style={{ width: `${dims.w}mm`, height: `${dims.h}mm` }}>
|
||||
<div className="asset-label-qr" style={{ width: `${dims.qr}mm`, height: `${dims.qr}mm` }}>
|
||||
|
||||
@@ -21,10 +21,10 @@ function Items({ items, currency, showYear }: { items: LifecycleItem[]; currency
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hardware</th>
|
||||
<th>{showYear ? "Date" : "Ages out"}</th>
|
||||
<th>Because</th>
|
||||
<th className="text-end">Replacement</th>
|
||||
<th>{t("Hardware")}</th>
|
||||
<th>{showYear ? "Date" : t("Ages out")}</th>
|
||||
<th>{t("Because")}</th>
|
||||
<th className="text-end">{t("Replacement")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -38,7 +38,7 @@ function Items({ items, currency, showYear }: { items: LifecycleItem[]; currency
|
||||
<span className="text-secondary small"> · {i.daysLeft < 0 ? `${-i.daysLeft} d ago` : i.daysLeft === 0 ? "today" : `in ${i.daysLeft} d`}</span>
|
||||
</td>
|
||||
<td className="text-secondary">{i.basis === "support" ? "end of support" : "warranty ends (no end of support set)"}</td>
|
||||
<td className="text-end stack-label" data-label="Replacement">
|
||||
<td className="text-end stack-label" data-label={t("Replacement")}>
|
||||
{i.cost === null ? (
|
||||
<span className="text-secondary">—</span>
|
||||
) : (
|
||||
@@ -93,9 +93,9 @@ export default function InventoryLifecycle() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">Lifecycle</h2>
|
||||
<h2 className="page-title mb-0">{t("Lifecycle")}</h2>
|
||||
<div className="ms-auto d-flex gap-2">
|
||||
<select className="form-select w-auto" aria-label="How many years to show" value={years} onChange={(e) => setYears(Number(e.target.value))}>
|
||||
<select className="form-select w-auto" aria-label={t("How many years to show")} value={years} onChange={(e) => setYears(Number(e.target.value))}>
|
||||
{YEARS.map((y) => (
|
||||
<option key={y} value={y}>
|
||||
Next {y} years
|
||||
@@ -106,7 +106,7 @@ export default function InventoryLifecycle() {
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
<Link to="/inventory" className="btn">
|
||||
Back to the inventory
|
||||
{t("Back to the inventory")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
@@ -120,9 +120,9 @@ export default function InventoryLifecycle() {
|
||||
{report && dated === 0 && (
|
||||
<div className="card">
|
||||
<EmptyState
|
||||
title="Nothing has a date yet"
|
||||
title={t("Nothing has a date yet")}
|
||||
hint="Edit a piece of hardware and give it an end of support (or a warranty end), and what ages out is listed here by year, with what replacing it will cost."
|
||||
action={{ label: "Go to the inventory", to: "/inventory" }}
|
||||
action={{ label: t("Go to the inventory"), to: "/inventory" }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { BlockSkeleton } from "../components/Skeleton";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { KIND_LABELS } from "../utils/inventory";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
type Rack = Awaited<ReturnType<typeof api.inventory.racks>>["racks"][number];
|
||||
|
||||
@@ -70,13 +71,13 @@ export default function InventoryRacks() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">Racks</h2>
|
||||
<h2 className="page-title mb-0">{t("Racks")}</h2>
|
||||
<div className="ms-auto btn-list no-print">
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={() => window.print()} disabled={!racks || racks.length === 0}>
|
||||
Print
|
||||
{t("Print")}
|
||||
</button>
|
||||
<Link to="/inventory" className="btn btn-outline-secondary">
|
||||
Hardware
|
||||
{t("Hardware")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,7 +88,7 @@ export default function InventoryRacks() {
|
||||
{racks === null && !error && <BlockSkeleton lines={4} />}
|
||||
{racks !== null && racks.length === 0 && (
|
||||
<div className="card">
|
||||
<EmptyState title="No racks to draw yet" hint={<>On the <Link to="/inventory">Hardware</Link> page, give a piece a location (the rack’s name) and a rack unit such as U12, and it appears here.</>} />
|
||||
<EmptyState title={t("No racks to draw yet")} hint={<>On the <Link to="/inventory">{t("Hardware")}</Link> page, give a piece a location (the rack’s name) and a rack unit such as U12, and it appears here.</>} />
|
||||
</div>
|
||||
)}
|
||||
<div className="row row-cards">
|
||||
|
||||
+32
-32
@@ -82,11 +82,11 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
async function excludeAround(entry: IpamEntry) {
|
||||
const suggestion = isIpv6(entry.ipAddress) ? `${entry.ipAddress}/64` : `${entry.ipAddress.split(".").slice(0, 3).join(".")}.0/24`;
|
||||
const range = await promptDialog({
|
||||
title: "Exclude a range",
|
||||
message: "Hide this range from IP Addresses and the Consistency report — every address in it, not just this one.",
|
||||
title: t("Exclude a range"),
|
||||
message: t("Hide this range from IP Addresses and the Consistency report — every address in it, not just this one."),
|
||||
label: "Range (a network like 172.17.0.0/16, or a single address)",
|
||||
defaultValue: suggestion,
|
||||
confirmLabel: "Exclude",
|
||||
confirmLabel: t("Exclude"),
|
||||
required: true,
|
||||
});
|
||||
if (range === null || !range.trim()) return;
|
||||
@@ -155,7 +155,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
async function remove(entry: IpamEntry) {
|
||||
setError(null);
|
||||
if (entry.source) {
|
||||
if (!(await confirmDialog({ title: "Delete IP address", message: `Delete IP address "${entry.ipAddress}"? A sync can bring it back.`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete IP address"), message: `Delete IP address "${entry.ipAddress}"? A sync can bring it back.`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
try {
|
||||
await api.ipam.remove(entry.id);
|
||||
load();
|
||||
@@ -178,7 +178,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
if (ids.length === 0) return;
|
||||
const picked = (entries ?? []).filter((e) => ids.includes(e.id));
|
||||
const plain = picked.length === ids.length && picked.every((e) => !e.source);
|
||||
if (!plain && !(await confirmDialog({ title: "Delete IP addresses", message: `Delete ${ids.length} IP address${ids.length !== 1 ? "es" : ""}? Those a sync made can be brought back by it.`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!plain && !(await confirmDialog({ title: t("Delete IP addresses"), message: `Delete ${ids.length} IP address${ids.length !== 1 ? "es" : ""}? Those a sync made can be brought back by it.`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
setError(null);
|
||||
setBulkDeleting(true);
|
||||
try {
|
||||
@@ -190,7 +190,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
load();
|
||||
if (plain && gone.length > 0) {
|
||||
toast.success(`Deleted ${gone.length} IP address${gone.length !== 1 ? "es" : ""}.`, {
|
||||
label: "Undo",
|
||||
label: t("Undo"),
|
||||
onClick: async () => {
|
||||
const back = await Promise.allSettled(gone.map((e) => api.ipam.create(asInput(e))));
|
||||
const lost = back.filter((r) => r.status === "rejected").length;
|
||||
@@ -272,7 +272,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
</span>
|
||||
</label>
|
||||
<button type="button" className="btn btn-link btn-sm p-0 ms-2" onClick={() => setShowRanges((s) => !s)}>
|
||||
{showRanges ? "Hide" : "Manage"} excluded ranges
|
||||
{showRanges ? "Hide" : t("Manage")} excluded ranges
|
||||
</button>
|
||||
</div>
|
||||
{showRanges && (
|
||||
@@ -283,7 +283,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
subnet on many hosts.
|
||||
</div>
|
||||
<div className="d-flex flex-wrap gap-1 mb-2">
|
||||
{excludedRanges.length === 0 && <span className="text-secondary small">Nothing excluded.</span>}
|
||||
{excludedRanges.length === 0 && <span className="text-secondary small">{t("Nothing excluded.")}</span>}
|
||||
{excludedRanges.map((r) => (
|
||||
<span key={r} className="badge bg-secondary-lt text-secondary d-inline-flex align-items-center">
|
||||
<code className="bg-transparent p-0">{r}</code>
|
||||
@@ -309,7 +309,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
onChange={(e) => setNewRange(e.target.value)}
|
||||
/>
|
||||
<button type="submit" className="btn btn-sm btn-primary" disabled={savingRanges || !newRange.trim()}>
|
||||
Exclude
|
||||
{t("Exclude")}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
@@ -321,12 +321,12 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
{canEdit && showForm && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{editing ? `Edit ${editing.ipAddress}` : "Add an IP address"}</h3>
|
||||
<h3 className="card-title">{editing ? `Edit ${editing.ipAddress}` : t("Add an IP address")}</h3>
|
||||
</div>
|
||||
<form onSubmit={submit}>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">IP address</label>
|
||||
<label className="form-label">{t("IP address")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -335,10 +335,10 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
value={form.ipAddress}
|
||||
onChange={(e) => setForm({ ...form, ipAddress: e.target.value })}
|
||||
/>
|
||||
{!editing && <div className="form-hint">Cannot be changed after creation.</div>}
|
||||
{!editing && <div className="form-hint">{t("Cannot be changed after creation.")}</div>}
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Label</label>
|
||||
<label className="form-label">{t("Label")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="Web Server 1"
|
||||
@@ -347,7 +347,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Vendor / provider</label>
|
||||
<label className="form-label">{t("Vendor / provider")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="Hetzner"
|
||||
@@ -356,7 +356,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Location</label>
|
||||
<label className="form-label">{t("Location")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="Frankfurt"
|
||||
@@ -375,7 +375,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={saving}>
|
||||
{editing ? "Save changes" : "Add IP address"}
|
||||
{editing ? t("Save changes") : t("Add IP address")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={cancelForm}>
|
||||
{t("Cancel")}
|
||||
@@ -389,29 +389,29 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search IP, label, vendor, location…"
|
||||
placeholder={t("Search IP, label, vendor, location…")}
|
||||
shown={filtered.length}
|
||||
total={entries?.length}
|
||||
actions={
|
||||
<>
|
||||
{canEdit && !showForm && (
|
||||
<button className="btn btn-sm btn-primary" onClick={startAdd}>
|
||||
Add IP address
|
||||
{t("Add IP address")}
|
||||
</button>
|
||||
)}
|
||||
{canEdit && (
|
||||
<>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("tailscale")} disabled={!!syncing}>
|
||||
{syncing === "tailscale" ? "Syncing…" : "Sync from Tailscale"}
|
||||
{syncing === "tailscale" ? t("Syncing…") : t("Sync from Tailscale")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("proxmox")} disabled={!!syncing}>
|
||||
{syncing === "proxmox" ? "Syncing…" : "Sync from Proxmox"}
|
||||
{syncing === "proxmox" ? t("Syncing…") : t("Sync from Proxmox")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("phpipam")} disabled={!!syncing}>
|
||||
{syncing === "phpipam" ? "Syncing…" : "Sync from phpIPAM"}
|
||||
{syncing === "phpipam" ? t("Syncing…") : t("Sync from phpIPAM")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("unifi")} disabled={!!syncing}>
|
||||
{syncing === "unifi" ? "Syncing…" : "Sync from UniFi"}
|
||||
{syncing === "unifi" ? t("Syncing…") : t("Sync from UniFi")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
@@ -423,10 +423,10 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
<div className="card-header bg-blue-lt d-flex align-items-center gap-2">
|
||||
<span>{selection.count} selected</span>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={bulkDelete} disabled={bulkDeleting}>
|
||||
{bulkDeleting ? "Deleting…" : "Delete selected"}
|
||||
{bulkDeleting ? t("Deleting…") : t("Delete selected")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-link" onClick={selection.clear}>
|
||||
Clear selection
|
||||
{t("Clear selection")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -444,11 +444,11 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</th>
|
||||
)}
|
||||
<SortableTh<IpamEntry> label="IP address" sortKeyName="ipAddress" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IpamEntry> label="Label" sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IpamEntry> label="Vendor" sortKeyName="vendor" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IpamEntry> label="Location" sortKeyName="location" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>DNS records</th>
|
||||
<SortableTh<IpamEntry> label={t("IP address")} sortKeyName="ipAddress" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IpamEntry> label={t("Label")} sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IpamEntry> label={t("Vendor")} sortKeyName="vendor" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<IpamEntry> label={t("Location")} sortKeyName="location" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>{t("DNS records")}</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -488,8 +488,8 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
{t("Edit")}
|
||||
</button>
|
||||
{!entry.excluded && (
|
||||
<button className="btn btn-sm" onClick={() => excludeAround(entry)} title="Hide this and every address in the same range">
|
||||
Exclude…
|
||||
<button className="btn btn-sm" onClick={() => excludeAround(entry)} title={t("Hide this and every address in the same range")}>
|
||||
{t("Exclude…")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(entry)}>
|
||||
@@ -502,7 +502,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{entries === null && <LoadingRow colSpan={canEdit ? 7 : 5} />}
|
||||
{entries !== null && (sorted ?? []).length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 7 : 5} {...(entries && entries.length > 0 ? { filtered: () => { setSearch(""); setHideExcluded(false); }, hint: "Every tracked address is excluded or filtered out. Show the excluded ones, or clear the search, to see them." } : { title: "No IP addresses tracked yet", hint: "Track the addresses you hand out, so you can see what is taken, what is free and what clashes.", action: canEdit ? { label: "Add an address", onClick: startAdd } : undefined })} />
|
||||
<EmptyRow colSpan={canEdit ? 7 : 5} {...(entries && entries.length > 0 ? { filtered: () => { setSearch(""); setHideExcluded(false); }, hint: t("Every tracked address is excluded or filtered out. Show the excluded ones, or clear the search, to see them.") } : { title: t("No IP addresses tracked yet"), hint: t("Track the addresses you hand out, so you can see what is taken, what is free and what clashes."), action: canEdit ? { label: t("Add an address"), onClick: startAdd } : undefined })} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+12
-12
@@ -14,12 +14,12 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ j }: { j: JellyfinInfo }) {
|
||||
if (!j.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!j.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!j.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!j.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (j.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
if (j.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
return <span className="badge bg-green-lt text-green">Up</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("Up")}</span>;
|
||||
}
|
||||
|
||||
const count = (n: number | null, one: string, many: string) => (n === null ? null : `${n.toLocaleString()} ${n === 1 ? one : many}`);
|
||||
@@ -56,7 +56,7 @@ function History({ id, name }: { id: number; name: string }) {
|
||||
return (
|
||||
<div>
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<h4 className="mb-0">Who was watching</h4>
|
||||
<h4 className="mb-0">{t("Who was watching")}</h4>
|
||||
<div className="ms-auto">
|
||||
<RangeSelect value={shown} onChange={setDays} only={[1, 7, 30]} />
|
||||
</div>
|
||||
@@ -105,18 +105,18 @@ function Card({ j }: { j: JellyfinInfo }) {
|
||||
{[s.serverName && s.serverName !== j.name ? s.serverName : null, s.version ? `version ${s.version}` : null, s.os, s.updateAvailable ? "an update is available" : null].filter(Boolean).join(" · ")}
|
||||
{libraries.length > 0 && <div>{libraries.join(" · ")}</div>}
|
||||
</div>
|
||||
<h4>Streaming now</h4>
|
||||
<h4>{t("Streaming now")}</h4>
|
||||
{s.streams.length === 0 ? (
|
||||
<div className="text-secondary mb-3">Nobody.</div>
|
||||
<div className="text-secondary mb-3">{t("Nobody.")}</div>
|
||||
) : (
|
||||
<div className="table-responsive mb-3">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Who</th>
|
||||
<th>Watching</th>
|
||||
<th>On</th>
|
||||
<th>How</th>
|
||||
<th>{t("Who")}</th>
|
||||
<th>{t("Watching")}</th>
|
||||
<th>{t("On")}</th>
|
||||
<th>{t("How")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -128,7 +128,7 @@ function Card({ j }: { j: JellyfinInfo }) {
|
||||
{x.paused && <span className="text-secondary"> (paused)</span>}
|
||||
</td>
|
||||
<td className="text-secondary">{[x.client, x.device].filter(Boolean).join(" · ") || "—"}</td>
|
||||
<td>{x.transcoding ? <span className="badge bg-orange-lt text-orange">Transcoded</span> : <span className="badge bg-green-lt text-green">Direct</span>}</td>
|
||||
<td>{x.transcoding ? <span className="badge bg-orange-lt text-orange">{t("Transcoded")}</span> : <span className="badge bg-green-lt text-green">{t("Direct")}</span>}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@@ -137,7 +137,7 @@ function Card({ j }: { j: JellyfinInfo }) {
|
||||
)}
|
||||
{failed.length > 0 && (
|
||||
<>
|
||||
<h4>Scheduled tasks that failed</h4>
|
||||
<h4>{t("Scheduled tasks that failed")}</h4>
|
||||
<ul className="mb-3">
|
||||
{failed.map((t) => (
|
||||
<li key={t.name}>
|
||||
@@ -193,7 +193,7 @@ export default function Jellyfin() {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Jellyfin connected" hint="Add one under Integrations with its address and an API key (Jellyfin → Dashboard → API Keys)." />
|
||||
<EmptyState title={t("No Jellyfin connected")} hint="Add one under Integrations with its address and an API key (Jellyfin → Dashboard → API Keys)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -108,7 +108,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
!(await confirmDialog({
|
||||
title: t("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",
|
||||
confirmLabel: t("Silence everything"),
|
||||
danger: true,
|
||||
}))
|
||||
)
|
||||
@@ -130,7 +130,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function endAll() {
|
||||
if (!(await confirmDialog({ title: t("End all maintenance"), message: `End all ${windows?.length ?? 0} windows now? Alerts about them become active again.`, confirmLabel: "End all", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("End all maintenance"), message: `End all ${windows?.length ?? 0} windows now? Alerts about them become active again.`, confirmLabel: t("End all"), danger: true }))) return;
|
||||
setError(null);
|
||||
try {
|
||||
const res = await api.maintenance.endAll();
|
||||
@@ -160,7 +160,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
setTarget("");
|
||||
setReason("");
|
||||
const also = res.alsoSilenced?.length ?? 0;
|
||||
toast.success(also > 0 ? `Maintenance started, and on ${also} thing${also === 1 ? "" : "s"} that depend on it. Alerts for them are silenced until it ends.` : "Maintenance started. Alerts for it are silenced until it ends.");
|
||||
toast.success(also > 0 ? `Maintenance started, and on ${also} thing${also === 1 ? "" : "s"} that depend on it. Alerts for them are silenced until it ends.` : t("Maintenance started. Alerts for it are silenced until it ends."));
|
||||
load();
|
||||
announceChange();
|
||||
} catch (err) {
|
||||
@@ -202,7 +202,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
setError(null);
|
||||
try {
|
||||
await api.maintenance.end(w.id);
|
||||
toast.success(w.startedAt > new Date().toISOString() ? "Scheduled window cancelled." : "Maintenance ended. Alerts for it are active again.");
|
||||
toast.success(w.startedAt > new Date().toISOString() ? t("Scheduled window cancelled.") : t("Maintenance ended. Alerts for it are active again."));
|
||||
load();
|
||||
announceChange();
|
||||
} catch (err) {
|
||||
@@ -315,7 +315,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">For</label>
|
||||
<label className="form-label">{t("For")}</label>
|
||||
<select className="form-select" value={minutes} onChange={(e) => setMinutes(Number(e.target.value))}>
|
||||
{DURATIONS.map((d) => (
|
||||
<option key={d.minutes} value={d.minutes}>
|
||||
@@ -397,7 +397,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">For</label>
|
||||
<label className="form-label">{t("For")}</label>
|
||||
<select className="form-select" value={kumaMinutes} onChange={(e) => setKumaMinutes(Number(e.target.value))}>
|
||||
{DURATIONS.map((d) => (
|
||||
<option key={d.minutes} value={d.minutes}>
|
||||
@@ -416,7 +416,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
<div className="card-body pt-0">
|
||||
<div className={`alert ${syncResult.started + syncResult.updated + syncResult.removed > 0 ? "alert-success" : "alert-info"} mb-0`}>
|
||||
{syncResult.maintenances.length === 0
|
||||
? "Uptime Kuma has no maintenance windows."
|
||||
? t("Uptime Kuma has no maintenance windows.")
|
||||
: `Read ${syncResult.maintenances.length} maintenance window${syncResult.maintenances.length === 1 ? "" : "s"} from Uptime Kuma: ${syncResult.started} added, ${syncResult.updated} changed, ${syncResult.removed} removed here.`}
|
||||
<ul className="mb-0 mt-2">
|
||||
{syncResult.maintenances.map((m) => (
|
||||
@@ -435,7 +435,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
<div className="text-secondary small">
|
||||
Covers {m.monitorCount} monitor{m.monitorCount === 1 ? "" : "s"} in Uptime Kuma ·{" "}
|
||||
{m.slots.length === 0
|
||||
? "Uptime Kuma gave no time slot"
|
||||
? t("Uptime Kuma gave no time slot")
|
||||
: m.slots.map((s) => `${formatDateTime(new Date(s.start))} – ${formatDateTime(new Date(s.end))}`).join("; ")}
|
||||
</div>
|
||||
</li>
|
||||
@@ -454,7 +454,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
{kumaResult.monitorsInMaintenance === 0 ? (
|
||||
<div className="alert alert-info mb-0">
|
||||
{kumaResult.monitorsChecked === 0
|
||||
? "Uptime Kuma answered, but reported no monitors at all."
|
||||
? t("Uptime Kuma answered, but reported no monitors at all.")
|
||||
: `Read ${kumaResult.monitorsChecked} monitor${kumaResult.monitorsChecked === 1 ? "" : "s"} from Uptime Kuma; none is in maintenance right now.`}{" "}
|
||||
Only a maintenance window that is active at this moment can be imported — one scheduled for later
|
||||
shows up here once it starts.
|
||||
@@ -576,7 +576,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<th>{t("Address")}</th>
|
||||
<th>{t("Belongs to")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
@@ -605,7 +605,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
{upcoming.length > 0 && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Scheduled</h3>
|
||||
<h3 className="card-title">{t("Scheduled")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="maintenance-scheduled" />
|
||||
</div>
|
||||
@@ -616,7 +616,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
<tr>
|
||||
<th>{t("Target")}</th>
|
||||
<th>{t("Reason")}</th>
|
||||
<th>Starts</th>
|
||||
<th>{t("Starts")}</th>
|
||||
<th>{t("Ends")}</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
|
||||
@@ -80,8 +80,8 @@ function layout(data: MapData): { placed: Map<string, Placed>; width: number; he
|
||||
const height = all.length ? Math.max(...all.map((p) => p.y)) + NODE_H : 0;
|
||||
const width = Math.max(...all.map((p) => p.x), 0) + NODE_W;
|
||||
const columns = [
|
||||
...(hasHosts ? [{ x: colX[0], title: byKind(["host"]).length > 0 && byKind(["device"]).length > 0 ? "Proxmox hosts & network devices" : byKind(["device"]).length > 0 ? "Network devices" : "Proxmox hosts" }] : []),
|
||||
...(servers.length > 0 ? [{ x: colX[1], title: "Servers" }] : []),
|
||||
...(hasHosts ? [{ x: colX[0], title: byKind(["host"]).length > 0 && byKind(["device"]).length > 0 ? "Proxmox hosts & network devices" : byKind(["device"]).length > 0 ? t("Network devices") : t("Proxmox hosts") }] : []),
|
||||
...(servers.length > 0 ? [{ x: colX[1], title: t("Servers") }] : []),
|
||||
...(hasRight ? [{ x: colX[2], title: "DNS names & monitors" }] : []),
|
||||
];
|
||||
return { placed, width, height, columns };
|
||||
@@ -106,12 +106,12 @@ export default function MapPage({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">{t("Map")}</h2>
|
||||
<div className="btn-group ms-auto" role="group" aria-label="What to draw">
|
||||
<div className="btn-group ms-auto" role="group" aria-label={t("What to draw")}>
|
||||
<button type="button" className={`btn btn-sm ${view === "connections" ? "active" : ""}`} aria-pressed={view === "connections"} onClick={() => choose("connections")}>
|
||||
Connections
|
||||
{t("Connections")}
|
||||
</button>
|
||||
<button type="button" className={`btn btn-sm ${view === "dependencies" ? "active" : ""}`} aria-pressed={view === "dependencies"} onClick={() => choose("dependencies")}>
|
||||
Dependencies
|
||||
{t("Dependencies")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,7 +123,7 @@ export default function MapPage({ user }: { user: CurrentUser }) {
|
||||
A server that runs on another, a service that needs the server it is installed on. Pick a box to see what would go down with it before you reboot it.
|
||||
</PageIntro>
|
||||
<DependencyMap />
|
||||
<h3 className="mt-4 mb-2">Say what needs what</h3>
|
||||
<h3 className="mt-4 mb-2">{t("Say what needs what")}</h3>
|
||||
<DependencyEditor user={user} />
|
||||
</>
|
||||
)}
|
||||
@@ -168,7 +168,7 @@ function ConnectionsMap() {
|
||||
</div>
|
||||
))}
|
||||
{!data && !error && <PageSkeleton />}
|
||||
{data && drawing && data.nodes.length === 0 && <div className="card"><div className="card-body text-secondary">Nothing to draw yet — add a server first.</div></div>}
|
||||
{data && drawing && data.nodes.length === 0 && <div className="card"><div className="card-body text-secondary">{t("Nothing to draw yet — add a server first.")}</div></div>}
|
||||
{data && drawing && data.nodes.length > 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body map-scroll">
|
||||
|
||||
+15
-15
@@ -16,7 +16,7 @@ const KIND_NAMES: Record<ArrApp["kind"], string> = { sonarr: "Sonarr", radarr: "
|
||||
const QUEUE_SHOWN = 25;
|
||||
|
||||
function Badge({ a }: { a: ArrApp }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -72,18 +72,18 @@ function Card({ a, canRead, onRead }: { a: ArrApp; canRead: boolean; onRead: ()
|
||||
<div className="row g-3 mb-3">
|
||||
{a.kind !== "prowlarr" && (
|
||||
<>
|
||||
<Tile label="Download queue" value={queue ? String(queue.total) : "—"} sub={queue ? (stuck.size > 0 ? `${stuck.size} stuck` : "nothing stuck") : "could not be read"} warn={stuck.size > 0} />
|
||||
<Tile label="Wanted, no file yet" value={s.missing === null ? "—" : String(s.missing)} sub="monitored items" />
|
||||
<Tile label={t("Download queue")} value={queue ? String(queue.total) : "—"} sub={queue ? (stuck.size > 0 ? `${stuck.size} stuck` : "nothing stuck") : "could not be read"} warn={stuck.size > 0} />
|
||||
<Tile label={t("Wanted, no file yet")} value={s.missing === null ? "—" : String(s.missing)} sub="monitored items" />
|
||||
</>
|
||||
)}
|
||||
{a.kind === "prowlarr" && (
|
||||
<>
|
||||
<Tile label="Indexers" value={s.indexers ? String(s.indexers.length) : "—"} sub={s.indexers ? `${s.indexers.filter((i) => i.enabled).length} switched on` : "could not be read"} />
|
||||
<Tile label={t("Indexers")} value={s.indexers ? String(s.indexers.length) : "—"} sub={s.indexers ? `${s.indexers.filter((i) => i.enabled).length} switched on` : "could not be read"} />
|
||||
<Tile label={t("Failing")} value={s.indexers ? String(s.indexers.filter((i) => i.disabledTill && Date.parse(i.disabledTill) > Date.now()).length) : "—"} sub="switched off after failures" warn={!!s.indexers?.some((i) => i.disabledTill && Date.parse(i.disabledTill) > Date.now())} />
|
||||
</>
|
||||
)}
|
||||
<Tile label="Its own findings" value={String(findings.length)} sub={notices.length > 0 ? `and ${notices.length} notice${notices.length === 1 ? "" : "s"}` : "warnings and errors"} warn={findings.length > 0} />
|
||||
<Tile label="Disks" value={s.disks ? String(s.disks.length) : "—"} sub={s.disks ? (s.disks.length > 0 ? `${formatBytes(Math.min(...s.disks.map((d) => d.free)))} free on the fullest` : "none reported") : "could not be read"} />
|
||||
<Tile label={t("Its own findings")} value={String(findings.length)} sub={notices.length > 0 ? `and ${notices.length} notice${notices.length === 1 ? "" : "s"}` : "warnings and errors"} warn={findings.length > 0} />
|
||||
<Tile label={t("Disks")} value={s.disks ? String(s.disks.length) : "—"} sub={s.disks ? (s.disks.length > 0 ? `${formatBytes(Math.min(...s.disks.map((d) => d.free)))} free on the fullest` : "none reported") : "could not be read"} />
|
||||
</div>
|
||||
{(findings.length > 0 || notices.length > 0) && (
|
||||
<>
|
||||
@@ -99,7 +99,7 @@ function Card({ a, canRead, onRead }: { a: ArrApp; canRead: boolean; onRead: ()
|
||||
)}
|
||||
{s.disks && s.disks.length > 0 && (
|
||||
<div className="mb-3">
|
||||
<h4>Disks</h4>
|
||||
<h4>{t("Disks")}</h4>
|
||||
{s.disks.map((d) => {
|
||||
const free = d.total > 0 ? d.free / d.total : 1;
|
||||
return (
|
||||
@@ -117,16 +117,16 @@ function Card({ a, canRead, onRead }: { a: ArrApp; canRead: boolean; onRead: ()
|
||||
)}
|
||||
{queue && queue.total > 0 && (
|
||||
<>
|
||||
<h4>Download queue</h4>
|
||||
<h4>{t("Download queue")}</h4>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Title")}</th>
|
||||
<th>State</th>
|
||||
<th>Progress</th>
|
||||
<th>In the queue</th>
|
||||
<th>Client</th>
|
||||
<th>{t("State")}</th>
|
||||
<th>{t("Progress")}</th>
|
||||
<th>{t("In the queue")}</th>
|
||||
<th>{t("Client")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -179,7 +179,7 @@ function Card({ a, canRead, onRead }: { a: ArrApp; canRead: boolean; onRead: ()
|
||||
)}
|
||||
{s.indexers && s.indexers.length > 0 && (
|
||||
<>
|
||||
<h4 className="mt-3">Indexers</h4>
|
||||
<h4 className="mt-3">{t("Indexers")}</h4>
|
||||
<ul className="mb-0">
|
||||
{s.indexers.map((i) => {
|
||||
const off = i.disabledTill !== null && Date.parse(i.disabledTill) > Date.now();
|
||||
@@ -223,7 +223,7 @@ export default function Media({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">{t("Media managers")}</h2>
|
||||
<PageIntro>
|
||||
Sonarr, Radarr, Prowlarr, Lidarr and Readarr, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is searched, grabbed or changed. <strong>What an application says is wrong with itself</strong>, <strong>downloads stuck for two hours</strong> and{" "}
|
||||
Sonarr, Radarr, Prowlarr, Lidarr and Readarr, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is searched, grabbed or changed. <strong>{t("What an application says is wrong with itself")}</strong>, <strong>downloads stuck for two hours</strong> and{" "}
|
||||
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -231,7 +231,7 @@ export default function Media({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No media manager connected" hint="Add one under Integrations with its address and API key (Settings → General → Security → API Key in the application)." />
|
||||
<EmptyState title={t("No media manager connected")} hint="Add one under Integrations with its address and API key (Settings → General → Security → API Key in the application)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -22,10 +22,10 @@ function span(minutes: number): string {
|
||||
}
|
||||
|
||||
const RESULT_WORDS: Record<string, { label: string; badge: string }> = {
|
||||
ok: { label: "Passed", badge: "bg-green-lt text-green" },
|
||||
partial: { label: "Partly worked", badge: "bg-yellow-lt text-yellow" },
|
||||
failed: { label: "Failed", badge: "bg-red-lt text-red" },
|
||||
not_needed: { label: "Not needed", badge: "bg-secondary-lt text-secondary" },
|
||||
ok: { get label() { return t("Passed"); }, badge: "bg-green-lt text-green" },
|
||||
partial: { get label() { return t("Partly worked"); }, badge: "bg-yellow-lt text-yellow" },
|
||||
failed: { get label() { return t("Failed"); }, badge: "bg-red-lt text-red" },
|
||||
not_needed: { get label() { return t("Not needed"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
};
|
||||
|
||||
const average = (rows: { percent: number | null }[]) => {
|
||||
@@ -42,12 +42,12 @@ function ServiceLevelsSection({ rows, partial }: { rows: ServiceLevelResult[]; p
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Service levels</h3>
|
||||
<h3 className="card-title">{t("Service levels")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p>
|
||||
<strong>{metCount}</strong> of {rows.length} {rows.length === 1 ? "target was" : "targets were"} met{partial ? " so far" : ""}. Each is judged on the downtime it allowed over the whole stretch (the error budget).{" "}
|
||||
<Link to="/alert-settings?view=levels">Set targets</Link>
|
||||
<Link to="/alert-settings?view=levels">{t("Set targets")}</Link>
|
||||
</p>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter table-sm">
|
||||
@@ -55,9 +55,9 @@ function ServiceLevelsSection({ rows, partial }: { rows: ServiceLevelResult[]; p
|
||||
<tr>
|
||||
<th>{t("Target")}</th>
|
||||
<th className="text-end">{t("Target")}</th>
|
||||
<th className="text-end">Achieved</th>
|
||||
<th className="text-end">Down for</th>
|
||||
<th className="text-end">Allowed</th>
|
||||
<th className="text-end">{t("Achieved")}</th>
|
||||
<th className="text-end">{t("Down for")}</th>
|
||||
<th className="text-end">{t("Allowed")}</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -91,8 +91,8 @@ function Availability({ title, rows, hint }: { title: string; rows: Availability
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th className="text-end">Up</th>
|
||||
<th className="text-end">Down for</th>
|
||||
<th className="text-end">{t("Up")}</th>
|
||||
<th className="text-end">{t("Down for")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -149,7 +149,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
|
||||
const r = data?.report;
|
||||
const kind = r?.period ?? (month ? (/Q/.test(month) ? "quarter" : /^\d{4}$/.test(month) ? "year" : "month") : "month");
|
||||
const noun = kind === "year" ? "Annual" : kind === "quarter" ? "Quarterly" : "Monthly";
|
||||
const noun = kind === "year" ? t("Annual") : kind === "quarter" ? t("Quarterly") : t("Monthly");
|
||||
const stretch = kind === "year" ? "year" : kind === "quarter" ? "quarter" : "month";
|
||||
const options = data ? (kind === "year" ? data.years : kind === "quarter" ? data.quarters : data.months) : [];
|
||||
/** The newest finished one of a kind, which is what is shown when nothing is asked for. */
|
||||
@@ -158,11 +158,11 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
const endpointAvg = r ? average(r.endpoints) : null;
|
||||
const cards = r
|
||||
? [
|
||||
{ label: "Servers up, on average", value: serverAvg === null ? "—" : `${serverAvg}%`, color: percentBadge(serverAvg) },
|
||||
{ label: "Endpoints answering", value: endpointAvg === null ? "—" : `${endpointAvg}%`, color: percentBadge(endpointAvg) },
|
||||
{ label: "Incidents began", value: String(r.incidents.began), color: r.incidents.began > 0 ? "text-yellow" : "text-green" },
|
||||
{ label: "Update runs", value: String(r.updates.runs), color: r.updates.failed > 0 ? "text-yellow" : "" },
|
||||
{ label: "Renewed", value: String(r.renewals.length), color: "" },
|
||||
{ label: t("Servers up, on average"), value: serverAvg === null ? "—" : `${serverAvg}%`, color: percentBadge(serverAvg) },
|
||||
{ label: t("Endpoints answering"), value: endpointAvg === null ? "—" : `${endpointAvg}%`, color: percentBadge(endpointAvg) },
|
||||
{ label: t("Incidents began"), value: String(r.incidents.began), color: r.incidents.began > 0 ? "text-yellow" : "text-green" },
|
||||
{ label: t("Update runs"), value: String(r.updates.runs), color: r.updates.failed > 0 ? "text-yellow" : "" },
|
||||
{ label: t("Renewed"), value: String(r.renewals.length), color: "" },
|
||||
]
|
||||
: [];
|
||||
|
||||
@@ -172,7 +172,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-0">{noun} report</h2>
|
||||
<div className="ms-auto d-flex flex-wrap gap-2 no-print">
|
||||
{data && (
|
||||
<div className="btn-group" role="group" aria-label="What the report covers">
|
||||
<div className="btn-group" role="group" aria-label={t("What the report covers")}>
|
||||
{([["month", "Month", data.months], ["quarter", "Quarter", data.quarters], ["year", "Year", data.years]] as const).map(([k, label, list]) => (
|
||||
<button key={k} type="button" className={`btn ${kind === k ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={kind === k} onClick={() => setParams(k === "month" ? {} : { month: lastWhole(list) ?? "" }, { replace: true })}>
|
||||
{label}
|
||||
@@ -181,7 +181,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
{data && (
|
||||
<select className="form-select w-auto" aria-label={noun === "Monthly" ? "Month" : noun === "Quarterly" ? "Quarter" : "Year"} value={r?.month ?? ""} onChange={(e) => setParams(e.target.value === lastWhole(options) && kind === "month" ? {} : { month: e.target.value }, { replace: true })}>
|
||||
<select className="form-select w-auto" aria-label={noun === "Monthly" ? "Month" : noun === "Quarterly" ? t("Quarter") : t("Year")} value={r?.month ?? ""} onChange={(e) => setParams(e.target.value === lastWhole(options) && kind === "month" ? {} : { month: e.target.value }, { replace: true })}>
|
||||
{options.map((m) => (
|
||||
<option key={m.id} value={m.id}>
|
||||
{m.label}
|
||||
@@ -191,7 +191,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
</select>
|
||||
)}
|
||||
<button className="btn btn-outline-secondary" onClick={() => void copyText()} disabled={!r}>
|
||||
Copy as text
|
||||
{t("Copy as text")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary d-inline-flex align-items-center gap-1" onClick={() => window.print()} disabled={!r}>
|
||||
<IconPrinter size={16} aria-hidden="true" /> Print
|
||||
@@ -203,7 +203,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
{user.role === "admin" ? (
|
||||
<>
|
||||
{" "}
|
||||
It can be sent on a day of the month, and a quarter's and year's report after the month that ends it: <Link to="/settings/notifications">Settings → Notifications</Link>.
|
||||
It can be sent on a day of the month, and a quarter's and year's report after the month that ends it: <Link to="/settings/notifications">{t("Settings → Notifications")}</Link>.
|
||||
</>
|
||||
) : null}
|
||||
</PageIntro>
|
||||
@@ -233,7 +233,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Availability</h3>
|
||||
<h3 className="card-title">{t("Availability")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{r.servers.length === 0 && r.endpoints.length === 0 && r.integrations.length === 0 ? (
|
||||
@@ -249,10 +249,10 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Check</th>
|
||||
<th className="text-end">Answered</th>
|
||||
<th className="text-end">Average answer</th>
|
||||
<th className="text-end">Times asked</th>
|
||||
<th>{t("Check")}</th>
|
||||
<th className="text-end">{t("Answered")}</th>
|
||||
<th className="text-end">{t("Average answer")}</th>
|
||||
<th className="text-end">{t("Times asked")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -269,7 +269,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<Availability title={t("Integrations")} rows={r.integrations} hint="How often the calls to each kind of integration worked." />
|
||||
<Availability title={t("Integrations")} rows={r.integrations} hint={t("How often the calls to each kind of integration worked.")} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
@@ -279,11 +279,11 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Incidents</h3>
|
||||
<h3 className="card-title">{t("Incidents")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{r.incidents.began === 0 && r.incidents.resolved === 0 && r.incidents.stillOpen === 0 ? (
|
||||
<div className="text-secondary">No incident began or ended this month.</div>
|
||||
<div className="text-secondary">{t("No incident began or ended this month.")}</div>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
@@ -303,11 +303,11 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Began</th>
|
||||
<th>{t("Began")}</th>
|
||||
<th>{t("Where")}</th>
|
||||
<th>What</th>
|
||||
<th>Worst</th>
|
||||
<th className="text-end">Lasted</th>
|
||||
<th>{t("What")}</th>
|
||||
<th>{t("Worst")}</th>
|
||||
<th className="text-end">{t("Lasted")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -342,7 +342,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{r.updates.runs === 0 && r.updates.planRuns.runs === 0 ? (
|
||||
<div className="text-secondary">No update run was made from here this month.</div>
|
||||
<div className="text-secondary">{t("No update run was made from here this month.")}</div>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
@@ -362,9 +362,9 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Server")}</th>
|
||||
<th className="text-end">Runs</th>
|
||||
<th className="text-end">Failed</th>
|
||||
<th className="text-end">Installed</th>
|
||||
<th className="text-end">{t("Runs")}</th>
|
||||
<th className="text-end">{t("Failed")}</th>
|
||||
<th className="text-end">{t("Installed")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -387,20 +387,20 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Backups and restore tests</h3>
|
||||
<h3 className="card-title">{t("Backups and restore tests")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{r.restoreTests.length === 0 ? (
|
||||
<p className="text-secondary">No restore test was recorded this month.</p>
|
||||
<p className="text-secondary">{t("No restore test was recorded this month.")}</p>
|
||||
) : (
|
||||
<div className="table-responsive mb-2">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tested</th>
|
||||
<th>What</th>
|
||||
<th>Result</th>
|
||||
<th>Note</th>
|
||||
<th>{t("Tested")}</th>
|
||||
<th>{t("What")}</th>
|
||||
<th>{t("Result")}</th>
|
||||
<th>{t("Note")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -426,7 +426,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
; {r.backups.failed} failed, {r.backups.stale} stale, {r.backups.none} without any{r.backups.unknown > 0 ? `, ${r.backups.unknown} unknown` : ""}
|
||||
</>
|
||||
)}
|
||||
. See <Link to="/backups">Backup coverage</Link>.
|
||||
. See <Link to="/backups">{t("Backup coverage")}</Link>.
|
||||
</p>
|
||||
) : (
|
||||
<p className="text-secondary mb-0">The backups have not been read since this app started, so their state is not shown here. Open Backup coverage to read them.</p>
|
||||
@@ -436,20 +436,20 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Renewed</h3>
|
||||
<h3 className="card-title">{t("Renewed")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{r.renewals.length === 0 ? (
|
||||
<div className="text-secondary">No certificate or domain was seen to be renewed this month.</div>
|
||||
<div className="text-secondary">{t("No certificate or domain was seen to be renewed this month.")}</div>
|
||||
) : (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Seen</th>
|
||||
<th>What</th>
|
||||
<th>Was good until</th>
|
||||
<th>Is good until</th>
|
||||
<th>{t("Seen")}</th>
|
||||
<th>{t("What")}</th>
|
||||
<th>{t("Was good until")}</th>
|
||||
<th>{t("Is good until")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -457,7 +457,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
<tr key={`${x.subject}-${i}`}>
|
||||
<td className="text-nowrap">{formatDate(new Date(x.at))}</td>
|
||||
<td>
|
||||
{x.kind === "domain" ? "Domain" : "Certificate"} {x.subject}
|
||||
{x.kind === "domain" ? t("Domain") : t("Certificate")} {x.subject}
|
||||
</td>
|
||||
<td className="text-secondary">{x.fromDate}</td>
|
||||
<td>{x.toDate}</td>
|
||||
|
||||
+10
-10
@@ -56,7 +56,7 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
await api.maintenance.end(w.id);
|
||||
toast.success(`Maintenance on ${w.targetName} ended.`, {
|
||||
label: "Undo",
|
||||
label: t("Undo"),
|
||||
onClick: async () => {
|
||||
try {
|
||||
await api.maintenance.start({ targetType: w.targetType as never, targetId: w.targetId, minutes: minutesFor(w, 0), reason: w.reason ?? undefined });
|
||||
@@ -78,14 +78,14 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
|
||||
|
||||
const nothing = work !== null && work.alerts.length === 0 && work.windows.length === 0 && work.updateRuns.length === 0 && work.todos.length === 0;
|
||||
|
||||
async function finish(t: MyWork["todos"][number]) {
|
||||
async function finish(todo: MyWork["todos"][number]) {
|
||||
try {
|
||||
await api.todos.update(t.id, { done: true });
|
||||
toast.success(`Done: ${t.title}`, {
|
||||
label: "Undo",
|
||||
await api.todos.update(todo.id, { done: true });
|
||||
toast.success(`Done: ${todo.title}`, {
|
||||
label: t("Undo"),
|
||||
onClick: async () => {
|
||||
try {
|
||||
await api.todos.update(t.id, { done: false });
|
||||
await api.todos.update(todo.id, { done: false });
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
} finally {
|
||||
@@ -134,11 +134,11 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
|
||||
<td className="stack-wide">
|
||||
{a.link ? <Link to={a.link}>{a.message}</Link> : a.message}
|
||||
<div className="small text-secondary">
|
||||
{a.role === "handed" ? (a.ackedBy === (user.name ?? user.email ?? user.sub) ? "You took it" : `Handed to you by ${a.ackedBy}`) : "You acknowledged it"}
|
||||
{a.role === "handed" ? (a.ackedBy === (user.name ?? user.email ?? user.sub) ? t("You took it") : `Handed to you by ${a.ackedBy}`) : t("You acknowledged it")}
|
||||
{a.note ? ` — ${a.note}` : ""}
|
||||
</div>
|
||||
</td>
|
||||
<td className="stack-label text-nowrap" data-label="Lasts">
|
||||
<td className="stack-label text-nowrap" data-label={t("Lasts")}>
|
||||
{a.until ? (
|
||||
<span className={a.endsSoon ? "text-yellow" : "text-secondary"} title={t("When the acknowledgement runs out and the alert counts as nobody's again")}>
|
||||
{a.endsSoon ? "Runs out " : "Until "}
|
||||
@@ -259,9 +259,9 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
|
||||
<Link to={`/servers/${r.serverId}`}>{r.serverName}</Link> <span className="text-secondary small">{r.templateName}</span>
|
||||
{r.message && !r.running && <div className="small text-secondary">{r.message}</div>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="State">
|
||||
<td className="stack-label" data-label={t("State")}>
|
||||
{r.running ? (
|
||||
<span className="badge bg-blue-lt text-blue">Running</span>
|
||||
<span className="badge bg-blue-lt text-blue">{t("Running")}</span>
|
||||
) : r.status === "done" ? (
|
||||
<span className="badge bg-green-lt text-green">{t("Done")}</span>
|
||||
) : (
|
||||
|
||||
@@ -11,7 +11,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ n }: { n: N8nInfo }) {
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!n.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!n.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (n.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
@@ -24,7 +24,7 @@ function LastRun({ status, at }: { status: string | null; at: string | null }) {
|
||||
if (!status || !at) return <span className="text-secondary">no run seen</span>;
|
||||
return (
|
||||
<>
|
||||
<span className={`badge ${failed(status) ? "bg-red-lt text-red" : status === "success" ? "bg-green-lt text-green" : "bg-secondary-lt text-secondary"}`}>{failed(status) ? (status === "crashed" ? "Crashed" : "Failed") : status === "success" ? "Succeeded" : status}</span>{" "}
|
||||
<span className={`badge ${failed(status) ? "bg-red-lt text-red" : status === "success" ? "bg-green-lt text-green" : "bg-secondary-lt text-secondary"}`}>{failed(status) ? (status === "crashed" ? t("Crashed") : t("Failed")) : status === "success" ? t("Succeeded") : status}</span>{" "}
|
||||
<span className="text-secondary">
|
||||
<TimeAgo value={at} />
|
||||
</span>
|
||||
@@ -59,16 +59,16 @@ function Card({ n }: { n: N8nInfo }) {
|
||||
{s.workflows.length} workflow{s.workflows.length === 1 ? "" : "s"}, {s.workflows.filter((w) => w.active).length} switched on — judged from the newest 250 runs
|
||||
</div>
|
||||
{workflows.length === 0 ? (
|
||||
<div className="text-secondary">No workflows.</div>
|
||||
<div className="text-secondary">{t("No workflows.")}</div>
|
||||
) : (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Workflow</th>
|
||||
<th>On</th>
|
||||
<th>Last run</th>
|
||||
<th className="text-end">Failed in the last day</th>
|
||||
<th>{t("Workflow")}</th>
|
||||
<th>{t("On")}</th>
|
||||
<th>{t("Last run")}</th>
|
||||
<th className="text-end">{t("Failed in the last day")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -120,7 +120,7 @@ export default function N8n() {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No n8n connected" hint="Add one under Integrations with its address and an API key (Settings → n8n API)." />
|
||||
<EmptyState title={t("No n8n connected")} hint="Add one under Integrations with its address and an API key (Settings → n8n API)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -11,7 +11,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ n }: { n: NetBoxInfo }) {
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!n.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!n.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (n.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
@@ -56,13 +56,13 @@ function Card({ n }: { n: NetBoxInfo }) {
|
||||
<>
|
||||
<div className="text-secondary small mb-3">{s.version ? `version ${s.version}` : ""}</div>
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile label="Workers running" value={count(s.workersRunning)} bad={s.workersRunning === 0} />
|
||||
<Tile label="Devices" value={count(s.devices)} />
|
||||
<Tile label="Virtual machines" value={count(s.virtualMachines)} />
|
||||
<Tile label={t("Workers running")} value={count(s.workersRunning)} bad={s.workersRunning === 0} />
|
||||
<Tile label={t("Devices")} value={count(s.devices)} />
|
||||
<Tile label={t("Virtual machines")} value={count(s.virtualMachines)} />
|
||||
<Tile label={t("IP addresses")} value={count(s.ipAddresses)} />
|
||||
</div>
|
||||
|
||||
<h4>Servers with no address in NetBox</h4>
|
||||
<h4>{t("Servers with no address in NetBox")}</h4>
|
||||
{s.missing === null ? (
|
||||
<div className="text-secondary">NetBox’s addresses could not be listed, so nothing can be said about what is missing.</div>
|
||||
) : s.missing.length === 0 ? (
|
||||
@@ -110,14 +110,14 @@ export default function NetBox() {
|
||||
<>
|
||||
<h2 className="page-title">NetBox</h2>
|
||||
<PageIntro>
|
||||
Whether NetBox is working, and whether it is complete. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>No background worker running</strong> is an alert — see <Link to="/alerts">{t("Alerts")}</Link>; the servers missing from NetBox are only listed.
|
||||
Whether NetBox is working, and whether it is complete. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>{t("No background worker running")}</strong> is an alert — see <Link to="/alerts">{t("Alerts")}</Link>; the servers missing from NetBox are only listed.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No NetBox connected" hint="Add one under Integrations with its address and an API token (your profile → API Tokens; read-only is enough)." />
|
||||
<EmptyState title={t("No NetBox connected")} hint="Add one under Integrations with its address and an API token (your profile → API Tokens; read-only is enough)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -48,16 +48,16 @@ function StateBadge({ d }: { d: NetworkDevice }) {
|
||||
return <span className="badge bg-green-lt text-green">{t("Online")}</span>;
|
||||
case "offline":
|
||||
return (
|
||||
<span className="badge bg-red-lt text-red" title="The controller has not seen it online">
|
||||
<span className="badge bg-red-lt text-red" title={t("The controller has not seen it online")}>
|
||||
Offline{d.offlineSince ? <> · <TimeAgo value={d.offlineSince} /></> : null}
|
||||
</span>
|
||||
);
|
||||
case "updating":
|
||||
return <span className="badge bg-yellow-lt text-yellow">Updating</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{t("Updating")}</span>;
|
||||
case "pending":
|
||||
return <span className="badge bg-blue-lt text-blue">Being adopted</span>;
|
||||
return <span className="badge bg-blue-lt text-blue">{t("Being adopted")}</span>;
|
||||
default:
|
||||
return <span className="badge bg-secondary-lt text-secondary">Unknown</span>;
|
||||
return <span className="badge bg-secondary-lt text-secondary">{t("Unknown")}</span>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,10 +125,10 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
const controllers = data?.integrations.filter((i) => i.enabled) ?? [];
|
||||
const tabs = (
|
||||
<ViewTabs
|
||||
label="Network devices view"
|
||||
label={t("Network devices view")}
|
||||
tabs={[
|
||||
{ to: "/network/devices", label: "Devices", active: view === "devices" },
|
||||
{ to: "/network/devices?view=diagram", label: "Diagram", active: view === "diagram" },
|
||||
{ to: "/network/devices", label: t("Devices"), active: view === "devices" },
|
||||
{ to: "/network/devices?view=diagram", label: t("Diagram"), active: view === "diagram" },
|
||||
{ to: "/network/devices?view=wifi", label: "Networks & Wi-Fi", active: view === "wifi" },
|
||||
]}
|
||||
/>
|
||||
@@ -151,7 +151,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
{canAct && controllers.length > 0 && (
|
||||
<div className="ms-auto btn-list">
|
||||
<button className="btn btn-outline-secondary" onClick={() => void readNow()} disabled={reading}>
|
||||
{reading ? "Reading…" : "Read now"}
|
||||
{reading ? "Reading…" : t("Read now")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -168,9 +168,9 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
{noController && (
|
||||
<div className="card">
|
||||
<EmptyState
|
||||
title="No UniFi controller connected"
|
||||
title={t("No UniFi controller connected")}
|
||||
hint="Add a UniFi integration — an API key from the controller's Integrations settings, or a read-only local account — and its switches, access points and gateways appear here."
|
||||
action={user.role === "admin" ? { label: "Add a UniFi controller", to: "/integrations" } : undefined}
|
||||
action={user.role === "admin" ? { label: t("Add a UniFi controller"), to: "/integrations" } : undefined}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -206,10 +206,10 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row row-cards mb-3">
|
||||
{[
|
||||
{ label: "Devices", value: devices.length, color: "" },
|
||||
{ label: "Offline", value: offline, color: offline > 0 ? "text-red" : "text-green" },
|
||||
{ label: "Firmware updates", value: updates, color: updates > 0 ? "text-yellow" : "" },
|
||||
{ label: "Controllers", value: controllers.length, color: "" },
|
||||
{ label: t("Devices"), value: devices.length, color: "" },
|
||||
{ label: t("Offline"), value: offline, color: offline > 0 ? "text-red" : "text-green" },
|
||||
{ label: t("Firmware updates"), value: updates, color: updates > 0 ? "text-yellow" : "" },
|
||||
{ label: t("Controllers"), value: controllers.length, color: "" },
|
||||
].map((c) => (
|
||||
<div className="col-6 col-lg-3" key={c.label}>
|
||||
<div className="card card-sm">
|
||||
@@ -226,20 +226,20 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
<TableToolbar
|
||||
search={tableSearch.query}
|
||||
onSearch={tableSearch.setQuery}
|
||||
placeholder="Search devices…"
|
||||
placeholder={t("Search devices…")}
|
||||
filters={
|
||||
<>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Kind of device" value={kind} onChange={(e) => setKind(e.target.value as typeof kind)}>
|
||||
<option value="all">Every kind</option>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Kind of device")} value={kind} onChange={(e) => setKind(e.target.value as typeof kind)}>
|
||||
<option value="all">{t("Every kind")}</option>
|
||||
{(Object.keys(KIND_LABELS) as NetworkDeviceKind[]).map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{KIND_LABELS[k]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Which devices" value={status} onChange={(e) => setStatus(e.target.value as typeof status)}>
|
||||
<option value="all">All devices</option>
|
||||
<option value="problem">Offline or with an update waiting</option>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Which devices")} value={status} onChange={(e) => setStatus(e.target.value as typeof status)}>
|
||||
<option value="all">{t("All devices")}</option>
|
||||
<option value="problem">{t("Offline or with an update waiting")}</option>
|
||||
</select>
|
||||
</>
|
||||
}
|
||||
@@ -254,11 +254,11 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
<tr>
|
||||
<SortableTh<Row> label={t("Status")} sortKeyName="stateRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="IP address" sortKeyName="ip" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Uptime" sortKeyName="uptimeSeconds" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Firmware" sortKeyName="firmware" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Connected through" sortKeyName="uplinkName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Needed by" sortKeyName="dependents" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("IP address")} sortKeyName="ip" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Uptime")} sortKeyName="uptimeSeconds" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Firmware")} sortKeyName="firmware" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Connected through")} sortKeyName="uplinkName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Needed by")} sortKeyName="dependents" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{canAct && (
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
@@ -272,7 +272,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
<td>
|
||||
<StateBadge d={d} />
|
||||
{d.inMaintenance && (
|
||||
<span className="badge bg-secondary-lt text-secondary ms-1" title="Under a maintenance window — its alerts are held back">
|
||||
<span className="badge bg-secondary-lt text-secondary ms-1" title={t("Under a maintenance window — its alerts are held back")}>
|
||||
maintenance
|
||||
</span>
|
||||
)}
|
||||
@@ -299,7 +299,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td className="stack-label" data-label="IP address">
|
||||
<td className="stack-label" data-label={t("IP address")}>
|
||||
{d.ip ? (
|
||||
<span className="d-inline-flex align-items-center gap-2">
|
||||
<span className="font-monospace">{d.ip}</span>
|
||||
@@ -309,19 +309,19 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
<span className="text-secondary">—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="stack-label text-nowrap" data-label="Uptime">
|
||||
<td className="stack-label text-nowrap" data-label={t("Uptime")}>
|
||||
{d.state === "online" ? uptimeWords(d.uptimeSeconds) : <span className="text-secondary">—</span>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Firmware">
|
||||
<td className="stack-label" data-label={t("Firmware")}>
|
||||
{d.firmware ?? <span className="text-secondary">—</span>}
|
||||
{d.firmwareUpdatable && <span className="badge bg-yellow-lt text-yellow ms-1">update available</span>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Connected through">
|
||||
<td className="stack-label" data-label={t("Connected through")}>
|
||||
{d.uplink ? d.uplink.name : <span className="text-secondary">{d.kind === "gateway" ? "(the internet)" : "—"}</span>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Needed by">
|
||||
<td className="stack-label" data-label={t("Needed by")}>
|
||||
{d.dependents > 0 ? (
|
||||
<Link to="/map?view=dependencies" title="Open the dependency map">
|
||||
<Link to="/map?view=dependencies" title={t("Open the dependency map")}>
|
||||
{d.dependents} {d.dependents === 1 ? "thing" : "things"}
|
||||
</Link>
|
||||
) : (
|
||||
@@ -346,7 +346,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
colSpan={canAct ? 8 : 7}
|
||||
{...(tableSearch.active || kind !== "all" || status !== "all"
|
||||
? { filtered: () => { tableSearch.setQuery(""); setKind("all"); setStatus("all"); } }
|
||||
: { title: "No devices yet", hint: "The controller has not reported any, or has not been read yet. Press Read now." })}
|
||||
: { title: t("No devices yet"), hint: t("The controller has not reported any, or has not been read yet. Press Read now.") })}
|
||||
/>
|
||||
)}
|
||||
</tbody>
|
||||
@@ -361,7 +361,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="mb-2 no-print">
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => window.print()}>
|
||||
Print
|
||||
{t("Print")}
|
||||
</button>
|
||||
</div>
|
||||
<NetworkDiagram devices={devices} />
|
||||
@@ -380,7 +380,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
function enabledBadge(on: boolean) {
|
||||
return on ? <span className="badge bg-green-lt text-green">On</span> : <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
return on ? <span className="badge bg-green-lt text-green">{t("On")}</span> : <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
}
|
||||
|
||||
function NetworksAndWifi({ data }: { data: NetworkOverview }) {
|
||||
@@ -390,7 +390,7 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
|
||||
<>
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Networks</h3>
|
||||
<h3 className="card-title">{t("Networks")}</h3>
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
@@ -398,9 +398,9 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>VLAN</th>
|
||||
<th>Address range</th>
|
||||
<th>Purpose</th>
|
||||
<th>State</th>
|
||||
<th>{t("Address range")}</th>
|
||||
<th>{t("Purpose")}</th>
|
||||
<th>{t("State")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -411,12 +411,12 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
|
||||
{where(n) && <div className="text-secondary small">{where(n)}</div>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="VLAN">{n.vlanId ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label font-monospace" data-label="Address range">{n.subnet ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label="Purpose">{n.purpose ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label="State">{enabledBadge(n.enabled)}</td>
|
||||
<td className="stack-label font-monospace" data-label={t("Address range")}>{n.subnet ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label={t("Purpose")}>{n.purpose ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label={t("State")}>{enabledBadge(n.enabled)}</td>
|
||||
</tr>
|
||||
))}
|
||||
{data.networks.length === 0 && <EmptyRow colSpan={5} title="No networks read" hint="The controller reported none, or the account or key may not be allowed to read them." />}
|
||||
{data.networks.length === 0 && <EmptyRow colSpan={5} title={t("No networks read")} hint="The controller reported none, or the account or key may not be allowed to read them." />}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -424,17 +424,17 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Wi-Fi names</h3>
|
||||
<h3 className="card-title">{t("Wi-Fi names")}</h3>
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name (SSID)</th>
|
||||
<th>{t("Name (SSID)")}</th>
|
||||
<th>{t("Security")}</th>
|
||||
<th>{t("Network")}</th>
|
||||
<th>VLAN</th>
|
||||
<th>State</th>
|
||||
<th>{t("State")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -447,14 +447,14 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
|
||||
<td className="stack-label" data-label={t("Security")}>{s.security ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label={t("Network")}>{s.networkName ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label="VLAN">{s.vlanId ?? <span className="text-secondary">—</span>}</td>
|
||||
<td className="stack-label" data-label="State">{enabledBadge(s.enabled)}</td>
|
||||
<td className="stack-label" data-label={t("State")}>{enabledBadge(s.enabled)}</td>
|
||||
</tr>
|
||||
))}
|
||||
{data.ssids.length === 0 && <EmptyRow colSpan={5} title="No Wi-Fi names read" hint="The controller reported none, or the account or key may not be allowed to read them." />}
|
||||
{data.ssids.length === 0 && <EmptyRow colSpan={5} title={t("No Wi-Fi names read")} hint="The controller reported none, or the account or key may not be allowed to read them." />}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="card-footer text-secondary small">Passphrases are never read from the controller.</div>
|
||||
<div className="card-footer text-secondary small">{t("Passphrases are never read from the controller.")}</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ n }: { n: NextcloudInfo }) {
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!n.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!n.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!n.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (n.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -50,7 +50,7 @@ function Card({ n }: { n: NextcloudInfo }) {
|
||||
</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={`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" ? t("Background jobs stopped") : s.cron.state === "warning" ? "Background jobs: check" : "Background jobs running"}</span>
|
||||
<span className="text-secondary small">{s.cron.text}</span>
|
||||
</div>
|
||||
) : (
|
||||
@@ -61,7 +61,7 @@ function Card({ n }: { n: NextcloudInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Free for data</div>
|
||||
<div className="text-secondary small">{t("Free for data")}</div>
|
||||
<div className="h2 mb-0">{s.freeBytes === null ? "—" : formatBytes(s.freeBytes)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@ function Card({ n }: { n: NextcloudInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Files</div>
|
||||
<div className="text-secondary small">{t("Files")}</div>
|
||||
<div className="h2 mb-0">{count(s.files)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -140,14 +140,14 @@ export default function Nextcloud() {
|
||||
<>
|
||||
<h2 className="page-title">Nextcloud</h2>
|
||||
<PageIntro>
|
||||
Whether people can sign in. It is read every few minutes (see <Link to="/integrations">{t("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">{t("Alerts")}</Link>.
|
||||
Whether people can sign in. It is read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>{t("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">{t("Alerts")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Nextcloud connected" hint="Add one under Integrations with its address; an administrator's name and an app password add the disk, the users and the app updates." />
|
||||
<EmptyState title={t("No Nextcloud connected")} hint="Add one under Integrations with its address; an administrator's name and an app password add the disk, the users and the app updates." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -77,15 +77,15 @@ export default function NotificationHistory() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-1">
|
||||
<h2 className="page-title mb-0">Notification history</h2>
|
||||
<h2 className="page-title mb-0">{t("Notification history")}</h2>
|
||||
</div>
|
||||
<PageIntro>
|
||||
What was sent, to which channel, and whether it got through — or why it was not sent. Kept 30 days. The channels are set up under <Link to="/settings/notifications">Settings → Notifications</Link>.
|
||||
What was sent, to which channel, and whether it got through — or why it was not sent. Kept 30 days. The channels are set up under <Link to="/settings/notifications">{t("Settings → Notifications")}</Link>.
|
||||
</PageIntro>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-sm-4 col-md-3">
|
||||
<select className="form-select" aria-label={t("Show")} value={status} onChange={(e) => setParam("status", e.target.value || null)}>
|
||||
<option value="">Everything</option>
|
||||
<option value="">{t("Everything")}</option>
|
||||
{STATUS_ORDER.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
{STATUS_LABEL[s]}
|
||||
@@ -94,7 +94,7 @@ export default function NotificationHistory() {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-sm-8 col-md-5">
|
||||
<input className="form-control" type="search" aria-label="Search the history" placeholder="Search the title or the message" value={text} onChange={(e) => setText(e.target.value)} />
|
||||
<input className="form-control" type="search" aria-label={t("Search the history")} placeholder={t("Search the title or the message")} value={text} onChange={(e) => setText(e.target.value)} />
|
||||
</div>
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -102,7 +102,7 @@ export default function NotificationHistory() {
|
||||
{entries && entries.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title={status || q ? "Nothing matches" : "Nothing has been sent yet"} hint={status || q ? "Try another filter." : "Every notification is listed here from now on, with how each channel took it."} />
|
||||
<EmptyState title={status || q ? t("Nothing matches") : t("Nothing has been sent yet")} hint={status || q ? t("Try another filter.") : t("Every notification is listed here from now on, with how each channel took it.")} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -119,8 +119,8 @@ export default function NotificationHistory() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("When")}</th>
|
||||
<th>Notification</th>
|
||||
<th>How it went</th>
|
||||
<th>{t("Notification")}</th>
|
||||
<th>{t("How it went")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -138,7 +138,7 @@ export default function NotificationHistory() {
|
||||
<div className="fw-bold text-break">{e.title}</div>
|
||||
{e.resentOf !== null && <div className="text-secondary small">sent again from an earlier one</div>}
|
||||
<details className="small">
|
||||
<summary className="text-secondary">Show what it said</summary>
|
||||
<summary className="text-secondary">{t("Show what it said")}</summary>
|
||||
<pre className="mb-0 text-break" style={{ whiteSpace: "pre-wrap", maxHeight: 220, overflow: "auto" }}>
|
||||
{e.message}
|
||||
</pre>
|
||||
@@ -161,8 +161,8 @@ export default function NotificationHistory() {
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
<button className="btn btn-sm" disabled={resending === e.id} onClick={() => void resend(e)} title="Send it once more to every channel that is on">
|
||||
{resending === e.id ? "Sending…" : e.status === "held" ? "Send now" : "Send again"}
|
||||
<button className="btn btn-sm" disabled={resending === e.id} onClick={() => void resend(e)} title={t("Send it once more to every channel that is on")}>
|
||||
{resending === e.id ? t("Sending…") : e.status === "held" ? t("Send now") : t("Send again")}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+17
-17
@@ -77,7 +77,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
item_.statusName,
|
||||
item_.priorityName ?? "",
|
||||
item_.departmentName ?? "",
|
||||
item_.staffName ?? item_.teamName ?? "Unassigned",
|
||||
item_.staffName ?? item_.teamName ?? t("Unassigned"),
|
||||
item_.requesterName ?? item_.requesterEmail ?? "",
|
||||
item_.isOverdue ? "yes" : "no",
|
||||
item_.isAnswered ? "no" : "yes",
|
||||
@@ -96,7 +96,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No osTicket integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
|
||||
No osTicket integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -132,7 +132,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-6 col-md-4">
|
||||
<div className="card card-sm">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary">Open tickets</div>
|
||||
<div className="text-secondary">{t("Open tickets")}</div>
|
||||
<div className="h2 mb-0">{data?.summary.total ?? "—"}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -140,7 +140,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-6 col-md-4">
|
||||
<div className="card card-sm">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary">Overdue</div>
|
||||
<div className="text-secondary">{t("Overdue")}</div>
|
||||
<div className={`h2 mb-0 ${data && data.summary.overdue > 0 ? "text-red" : ""}`}>
|
||||
{data?.summary.overdue ?? "—"}
|
||||
</div>
|
||||
@@ -150,7 +150,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-6 col-md-4">
|
||||
<div className="card card-sm">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary">Awaiting our reply</div>
|
||||
<div className="text-secondary">{t("Awaiting our reply")}</div>
|
||||
<div className={`h2 mb-0 ${data && data.summary.awaitingReply > 0 ? "text-yellow" : ""}`}>
|
||||
{data?.summary.awaitingReply ?? "—"}
|
||||
</div>
|
||||
@@ -162,7 +162,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Open tickets</h3>
|
||||
<h3 className="card-title">{t("Open tickets")}</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button
|
||||
@@ -177,7 +177,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadTickets(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -186,24 +186,24 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<OsTicketTicket> label="#" sortKeyName="number" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<OsTicketTicket> label="Subject" sortKeyName="subject" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<OsTicketTicket> label={t("Subject")} sortKeyName="subject" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<OsTicketTicket>
|
||||
label="Priority"
|
||||
label={t("Priority")}
|
||||
sortKeyName="priorityName"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<OsTicketTicket>
|
||||
label="Department"
|
||||
label={t("Department")}
|
||||
sortKeyName="departmentName"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<OsTicketTicket> label="Assigned to" sortKeyName="staffName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<OsTicketTicket> label={t("Assigned to")} sortKeyName="staffName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<OsTicketTicket>
|
||||
label="Requester"
|
||||
label={t("Requester")}
|
||||
sortKeyName="requesterName"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -211,14 +211,14 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
/>
|
||||
<SortableTh<OsTicketTicket> label={t("Created")} sortKeyName="createdAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<OsTicketTicket>
|
||||
label="Last activity"
|
||||
label={t("Last activity")}
|
||||
sortKeyName="lastActivityAt"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<OsTicketTicket>
|
||||
label="Flags"
|
||||
label={t("Flags")}
|
||||
sortKeyName="isOverdue"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -236,7 +236,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
</td>
|
||||
<td>{priorityBadge(item_)}</td>
|
||||
<td className="text-secondary">{item_.departmentName ?? "—"}</td>
|
||||
<td className="text-secondary">{item_.staffName ?? item_.teamName ?? "Unassigned"}</td>
|
||||
<td className="text-secondary">{item_.staffName ?? item_.teamName ?? t("Unassigned")}</td>
|
||||
<td className="text-secondary">{item_.requesterName ?? item_.requesterEmail ?? "—"}</td>
|
||||
<td className="text-secondary" title={formatDateTime(new Date(item_.createdAt))}>
|
||||
{formatAgo(item_.createdAt)}
|
||||
@@ -249,13 +249,13 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
{item_.isOverdue && <span className="badge bg-red-lt text-red me-1">Overdue</span>}
|
||||
{item_.isOverdue && <span className="badge bg-red-lt text-red me-1">{t("Overdue")}</span>}
|
||||
{!item_.isAnswered && <span className="badge bg-yellow-lt text-yellow">{t("Awaiting reply")}</span>}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{sortedTickets?.length === 0 && (
|
||||
<EmptyRow colSpan={9} title="No open tickets" hint="Nothing is waiting in osTicket right now." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={9} title={t("No open tickets")} hint={t("Nothing is waiting in osTicket right now.")} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+10
-10
@@ -14,7 +14,7 @@ import { t } from "../i18n";
|
||||
const NAMES: Record<string, string> = { database: "Database", redis: "Redis", celery: "Document worker", index: "Search index", classifier: "Classifier", sanity_check: "Sanity check" };
|
||||
|
||||
function Badge({ p }: { p: PaperlessInfo }) {
|
||||
if (!p.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!p.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!p.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!p.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -53,7 +53,7 @@ function Card({ p }: { p: PaperlessInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Documents</div>
|
||||
<div className="text-secondary small">{t("Documents")}</div>
|
||||
<div className="h2 mb-0">{n(s.documents)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,7 +61,7 @@ function Card({ p }: { p: PaperlessInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">In the inbox</div>
|
||||
<div className="text-secondary small">{t("In the inbox")}</div>
|
||||
<div className="h2 mb-0">{n(s.inbox)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,7 +69,7 @@ function Card({ p }: { p: PaperlessInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Failed to import</div>
|
||||
<div className="text-secondary small">{t("Failed to import")}</div>
|
||||
<div className={`h2 mb-0 ${s.failed && s.failed.length > 0 ? "text-red" : ""}`}>{s.failed === null ? "—" : s.failed.length}</div>
|
||||
<div className="text-secondary small">in the last week</div>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@ function Card({ p }: { p: PaperlessInfo }) {
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="card card-sm h-100">
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small">Disk</div>
|
||||
<div className="text-secondary small">{t("Disk")}</div>
|
||||
<div className="h2 mb-0">{percent === null ? "—" : `${percent} %`}</div>
|
||||
{s.storage && (
|
||||
<div className="text-secondary small">
|
||||
@@ -90,14 +90,14 @@ function Card({ p }: { p: PaperlessInfo }) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>System status</h4>
|
||||
<h4>{t("System status")}</h4>
|
||||
{!s.components ? (
|
||||
<div className="text-secondary mb-3">Paperless did not give its system status — that needs the token of a superuser.</div>
|
||||
) : (
|
||||
<ul className="list-unstyled mb-3">
|
||||
{s.components.map((c) => (
|
||||
<li key={c.name}>
|
||||
<span className={`badge me-2 ${c.status === "OK" ? "bg-green-lt text-green" : c.status === "ERROR" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{c.status === "OK" ? "OK" : c.status === "ERROR" ? "Error" : "Warning"}</span>
|
||||
<span className={`badge me-2 ${c.status === "OK" ? "bg-green-lt text-green" : c.status === "ERROR" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{c.status === "OK" ? "OK" : c.status === "ERROR" ? t("Error") : t("Warning")}</span>
|
||||
{NAMES[c.name] ?? c.name}
|
||||
{c.error && <div className="text-secondary small ms-1">{c.error}</div>}
|
||||
</li>
|
||||
@@ -107,7 +107,7 @@ function Card({ p }: { p: PaperlessInfo }) {
|
||||
|
||||
{s.failed && s.failed.length > 0 && (
|
||||
<>
|
||||
<h4>Documents that failed to import</h4>
|
||||
<h4>{t("Documents that failed to import")}</h4>
|
||||
<ul className="mb-0">
|
||||
{s.failed.slice(0, 10).map((f, i) => (
|
||||
<li key={`${f.file}-${i}`}>
|
||||
@@ -154,7 +154,7 @@ export default function Paperless() {
|
||||
<>
|
||||
<h2 className="page-title">Paperless-ngx</h2>
|
||||
<PageIntro>
|
||||
Whether documents are being taken in. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>A component in error</strong> (above all the worker that consumes documents), <strong>documents that failed to import</strong> and a{" "}
|
||||
Whether documents are being taken in. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>{t("A component in error")}</strong> (above all the worker that consumes documents), <strong>documents that failed to import</strong> and a{" "}
|
||||
<strong>disk that is filling up</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -162,7 +162,7 @@ export default function Paperless() {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Paperless-ngx connected" hint="Add one under Integrations with its address and an API token (a superuser's, to see the system status)." />
|
||||
<EmptyState title={t("No Paperless-ngx connected")} hint="Add one under Integrations with its address and an API token (a superuser's, to see the system status)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+20
-20
@@ -48,10 +48,10 @@ function formatUptime(seconds: number | null): string {
|
||||
}
|
||||
|
||||
function verificationBadge(d: PbsDatastore) {
|
||||
if (d.error) return <span className="badge bg-red-lt text-red">Unreadable</span>;
|
||||
if (d.error) return <span className="badge bg-red-lt text-red">{t("Unreadable")}</span>;
|
||||
if (d.failedCount > 0) return <span className="badge bg-red-lt text-red">{d.failedCount} failed</span>;
|
||||
if (d.unverifiedCount > 0) return <span className="badge bg-yellow-lt text-yellow">{d.unverifiedCount} unverified</span>;
|
||||
return <span className="badge bg-green-lt text-green">All verified</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("All verified")}</span>;
|
||||
}
|
||||
|
||||
export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /** The tabs of the page this is one view of (see BackupsHub), shown under the title. */ tabs?: ReactNode }) {
|
||||
@@ -139,7 +139,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Proxmox Backup Server integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
|
||||
No Proxmox Backup Server integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -173,14 +173,14 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Node</h3>
|
||||
<h3 className="card-title">{t("Node")}</h3>
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
onClick={() => selected && loadStatus(selected.id)}
|
||||
disabled={loadingStatus}
|
||||
>
|
||||
{loadingStatus ? "Refreshing…" : "Refresh"}
|
||||
{loadingStatus ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -190,11 +190,11 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
) : (
|
||||
<div className="row g-3">
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Uptime</div>
|
||||
<div className="text-secondary">{t("Uptime")}</div>
|
||||
<div>{formatUptime(status?.uptime ?? null)}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">CPU</div>
|
||||
<div className="text-secondary">{t("CPU")}</div>
|
||||
<div>
|
||||
{status?.cpuUsagePercent !== null && status?.cpuUsagePercent !== undefined
|
||||
? `${status.cpuUsagePercent.toFixed(0)}%`
|
||||
@@ -203,13 +203,13 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Memory</div>
|
||||
<div className="text-secondary">{t("Memory")}</div>
|
||||
<div>
|
||||
{formatBytes(status?.memUsedBytes ?? null)} / {formatBytes(status?.memTotalBytes ?? null)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Root filesystem</div>
|
||||
<div className="text-secondary">{t("Root filesystem")}</div>
|
||||
<div>
|
||||
{formatBytes(status?.rootfsUsedBytes ?? null)} / {formatBytes(status?.rootfsTotalBytes ?? null)}
|
||||
</div>
|
||||
@@ -222,7 +222,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Datastores</h3>
|
||||
<h3 className="card-title">{t("Datastores")}</h3>
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
@@ -236,7 +236,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
onClick={() => selected && loadDatastores(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -244,24 +244,24 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<PbsDatastore> label="Datastore" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<PbsDatastore> label="Used" sortKeyName="usedBytes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<PbsDatastore> label={t("Datastore")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<PbsDatastore> label={t("Used")} sortKeyName="usedBytes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<PbsDatastore>
|
||||
label="Snapshots"
|
||||
label={t("Snapshots")}
|
||||
sortKeyName="snapshotCount"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<PbsDatastore>
|
||||
label="Latest snapshot"
|
||||
label={t("Latest snapshot")}
|
||||
sortKeyName="latestSnapshotAt"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<PbsDatastore>
|
||||
label="Verification"
|
||||
label={t("Verification")}
|
||||
sortKeyName="failedCount"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -285,7 +285,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
</tr>
|
||||
))}
|
||||
{sortedDatastores?.length === 0 && (
|
||||
<EmptyRow colSpan={5} title="No datastores found" hint="The Backup Server answered but listed none. Check that the API token has access to a datastore." action={{ label: "Check the integration", to: "/integrations" }} />
|
||||
<EmptyRow colSpan={5} title={t("No datastores found")} hint="The Backup Server answered but listed none. Check that the API token has access to a datastore." action={{ label: t("Check the integration"), to: "/integrations" }} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -296,7 +296,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Recent verification failures</h3>
|
||||
<h3 className="card-title">{t("Recent verification failures")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="pbs-verification-failures" />
|
||||
</div>
|
||||
@@ -305,8 +305,8 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datastore</th>
|
||||
<th>Backup</th>
|
||||
<th>{t("Datastore")}</th>
|
||||
<th>{t("Backup")}</th>
|
||||
<th>{t("When")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
+37
-37
@@ -111,7 +111,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
for (const p of list) {
|
||||
try {
|
||||
await api.servers.ports.save(p.serverId, { port: p.port, protocol: p.protocol, label: "Expected", comment: "" });
|
||||
await api.servers.ports.save(p.serverId, { port: p.port, protocol: p.protocol, label: t("Expected"), comment: "" });
|
||||
} catch (err) {
|
||||
setAgentError(`${p.serverName} ${p.protocol}/${p.port}: ${readableError(err)}`);
|
||||
break;
|
||||
@@ -126,9 +126,9 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
async function markAllExpected() {
|
||||
const names = [...new Set(newPorts.map((p) => p.serverName))];
|
||||
const ok = await confirmDialog({
|
||||
title: "Mark every new port as expected",
|
||||
title: t("Mark every new port as expected"),
|
||||
message: `${newPorts.length} port${newPorts.length !== 1 ? "s" : ""} on ${names.length} server${names.length !== 1 ? "s" : ""} (${names.join(", ")}) will be noted as expected, and their alerts end. Only do this if you have looked at what is listening on each.`,
|
||||
confirmLabel: "Mark as expected",
|
||||
confirmLabel: t("Mark as expected"),
|
||||
});
|
||||
if (ok) await markExpected(newPorts);
|
||||
}
|
||||
@@ -233,10 +233,10 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
<h2 className="page-title mb-3">{t("Ports")}</h2>
|
||||
|
||||
<ViewTabs
|
||||
label="Ports view"
|
||||
label={t("Ports view")}
|
||||
tabs={[
|
||||
{ to: "/ports", label: "Ports", active: view === "ports" },
|
||||
{ to: "/ports?view=presets", label: "Presets", active: view === "presets" },
|
||||
{ to: "/ports", label: t("Ports"), active: view === "ports" },
|
||||
{ to: "/ports?view=presets", label: t("Presets"), active: view === "presets" },
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -248,7 +248,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Ports reported by agents</h3>
|
||||
<h3 className="card-title">{t("Ports reported by agents")}</h3>
|
||||
<div className="card-actions">
|
||||
<span className="text-secondary me-3">
|
||||
{reportingServers} of {totalServers} server{totalServers !== 1 ? "s" : ""} reporting
|
||||
@@ -269,15 +269,15 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
{newPorts.length} new port{newPorts.length !== 1 ? "s" : ""}
|
||||
</strong>{" "}
|
||||
on {newServers} server{newServers !== 1 ? "s" : ""} began listening after that server's first report, and nobody has said {newPorts.length !== 1 ? "they are" : "it is"} expected. Each is a warning on the{" "}
|
||||
<Link to="/alerts">Alerts page</Link> until it is marked as expected or stops listening.
|
||||
<Link to="/alerts">{t("Alerts page")}</Link> until it is marked as expected or stops listening.
|
||||
</div>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setOnlyNew(!showOnlyNew)} aria-pressed={showOnlyNew}>
|
||||
{showOnlyNew ? "Show all ports" : "Show only new"}
|
||||
{showOnlyNew ? t("Show all ports") : t("Show only new")}
|
||||
</button>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-primary" onClick={() => void markAllExpected()} disabled={marking.size > 0}>
|
||||
Mark all as expected
|
||||
{t("Mark all as expected")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -288,12 +288,12 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<AgentPortRow> label={t("Server")} sortKeyName="serverName" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
<SortableTh<AgentPortRow> label="Protocol" sortKeyName="protocol" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
<SortableTh<AgentPortRow> label="Port" sortKeyName="port" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
<th>Service</th>
|
||||
<th>Address</th>
|
||||
<th>Process</th>
|
||||
<SortableTh<AgentPortRow> label="Last report" sortKeyName="lastSeenAt" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
<SortableTh<AgentPortRow> label={t("Protocol")} sortKeyName="protocol" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
<SortableTh<AgentPortRow> label={t("Port")} sortKeyName="port" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
<th>{t("Service")}</th>
|
||||
<th>{t("Address")}</th>
|
||||
<th>{t("Process")}</th>
|
||||
<SortableTh<AgentPortRow> label={t("Last report")} sortKeyName="lastSeenAt" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
|
||||
{canEdit && newPorts.length > 0 && <th />}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -336,7 +336,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{agentPorts === null && <LoadingRow colSpan={8} />}
|
||||
{agentPorts !== null && agentPorts.length === 0 && (
|
||||
<EmptyRow colSpan={8} title="No listening ports reported yet" hint="Each server's agent lists what is listening with its next report. Install or update the agent to see ports here." action={{ label: "Go to Servers", to: "/servers" }} />
|
||||
<EmptyRow colSpan={8} title={t("No listening ports reported yet")} hint="Each server's agent lists what is listening with its next report. Install or update the agent to see ports here." action={{ label: t("Go to Servers"), to: "/servers" }} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -349,22 +349,22 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
{canEdit && showForm && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{editing ? `Edit "${editing.label}"` : "Add a manual port opening"}</h3>
|
||||
<h3 className="card-title">{editing ? `Edit "${editing.label}"` : t("Add a manual port opening")}</h3>
|
||||
</div>
|
||||
<form onSubmit={submit}>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Label</label>
|
||||
<label className="form-label">{t("Label")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
placeholder="Plex remote access"
|
||||
placeholder={t("Plex remote access")}
|
||||
value={form.label}
|
||||
onChange={(e) => setForm({ ...form, label: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">External port</label>
|
||||
<label className="form-label">{t("External port")}</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
@@ -376,7 +376,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Protocol</label>
|
||||
<label className="form-label">{t("Protocol")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
value={form.protocol}
|
||||
@@ -387,7 +387,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Internal port</label>
|
||||
<label className="form-label">{t("Internal port")}</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
@@ -399,13 +399,13 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Server (optional)</label>
|
||||
<label className="form-label">{t("Server (optional)")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
value={form.serverId ?? ""}
|
||||
onChange={(e) => setForm({ ...form, serverId: e.target.value ? Number(e.target.value) : null })}
|
||||
>
|
||||
<option value="">— none —</option>
|
||||
<option value="">{t("— none —")}</option>
|
||||
{(servers ?? []).map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -414,10 +414,10 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Destination</label>
|
||||
<label className="form-label">{t("Destination")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="IP/host, if not a tracked server"
|
||||
placeholder={t("IP/host, if not a tracked server")}
|
||||
value={form.destination ?? ""}
|
||||
onChange={(e) => setForm({ ...form, destination: e.target.value })}
|
||||
/>
|
||||
@@ -426,13 +426,13 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
<label className="form-label">{t("Source")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="Home router, OPNsense, Cloudflare Tunnel…"
|
||||
placeholder={t("Home router, OPNsense, Cloudflare Tunnel…")}
|
||||
value={form.source ?? ""}
|
||||
onChange={(e) => setForm({ ...form, source: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Comment</label>
|
||||
<label className="form-label">{t("Comment")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
value={form.comment ?? ""}
|
||||
@@ -442,7 +442,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={saving}>
|
||||
{editing ? "Save changes" : "Add port opening"}
|
||||
{editing ? t("Save changes") : t("Add port opening")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={cancelForm}>
|
||||
{t("Cancel")}
|
||||
@@ -454,7 +454,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Manual port openings</h3>
|
||||
<h3 className="card-title">{t("Manual port openings")}</h3>
|
||||
<p className="text-secondary mb-0 me-auto">
|
||||
Router port forwards, edge firewall rules, cloud security groups — anything opened further out on the
|
||||
network that this app can't see on its own.
|
||||
@@ -462,7 +462,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
<div className="card-actions">
|
||||
{canEdit && !showForm && (
|
||||
<button className="btn btn-primary btn-sm" onClick={startAdd}>
|
||||
Add port opening
|
||||
{t("Add port opening")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportForwardsCsv} disabled={!sortedForwards?.length}>
|
||||
@@ -475,17 +475,17 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<PortForward> label="Label" sortKeyName="label" activeKey={forwardSortKey} direction={forwardSortDir} onSort={requestForwardSort} />
|
||||
<SortableTh<PortForward> label={t("Label")} sortKeyName="label" activeKey={forwardSortKey} direction={forwardSortDir} onSort={requestForwardSort} />
|
||||
<SortableTh<PortForward>
|
||||
label="External port"
|
||||
label={t("External port")}
|
||||
sortKeyName="externalPort"
|
||||
activeKey={forwardSortKey}
|
||||
direction={forwardSortDir}
|
||||
onSort={requestForwardSort}
|
||||
/>
|
||||
<th>Destination</th>
|
||||
<th>{t("Destination")}</th>
|
||||
<SortableTh<PortForward> label={t("Source")} sortKeyName="source" activeKey={forwardSortKey} direction={forwardSortDir} onSort={requestForwardSort} />
|
||||
<th>Comment</th>
|
||||
<th>{t("Comment")}</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -522,7 +522,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{forwards === null && <LoadingRow colSpan={canEdit ? 6 : 5} />}
|
||||
{forwards !== null && forwards.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} title="No port openings recorded" hint="Write down what is forwarded through the router or opened by hand, so it isn't forgotten." action={canEdit ? { label: "Record one", onClick: startAdd } : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} title={t("No port openings recorded")} hint="Write down what is forwarded through the router or opened by hand, so it isn't forgotten." action={canEdit ? { label: t("Record one"), onClick: startAdd } : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+42
-42
@@ -55,7 +55,7 @@ export default function Privacy() {
|
||||
<div className="card mb-3">
|
||||
<div className="card-body">
|
||||
Homelab Manager runs on your own server, and what it stores stays there unless it's listed under{" "}
|
||||
<a href="#where-it-goes">Where data goes</a>. It has no analytics or telemetry, loads no third-party scripts, fonts or
|
||||
<a href="#where-it-goes">{t("Where data goes")}</a>. It has no analytics or telemetry, loads no third-party scripts, fonts or
|
||||
trackers, and sets no tracking or advertising cookies. This page describes what it actually does and shows live values
|
||||
for this installation.
|
||||
</div>
|
||||
@@ -65,10 +65,10 @@ export default function Privacy() {
|
||||
{data && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">About you</h3>
|
||||
<h3 className="card-title">{t("About you")}</h3>
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => void download()} disabled={exporting}>
|
||||
{exporting ? "Preparing…" : "Download my data"}
|
||||
{exporting ? t("Preparing…") : t("Download my data")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,19 +76,19 @@ export default function Privacy() {
|
||||
<dl className="row mb-0">
|
||||
<dt className="col-sm-3">{t("Name")}</dt>
|
||||
<dd className="col-sm-9">{data.me.user.name ?? "—"}</dd>
|
||||
<dt className="col-sm-3">Email</dt>
|
||||
<dt className="col-sm-3">{t("Email")}</dt>
|
||||
<dd className="col-sm-9">{data.me.user.email ?? "—"}</dd>
|
||||
<dt className="col-sm-3">Role</dt>
|
||||
<dt className="col-sm-3">{t("Role")}</dt>
|
||||
<dd className="col-sm-9">{data.me.user.role}</dd>
|
||||
<dt className="col-sm-3">Sign-in ID</dt>
|
||||
<dt className="col-sm-3">{t("Sign-in ID")}</dt>
|
||||
<dd className="col-sm-9 text-break">
|
||||
<code>{data.me.user.subject}</code>
|
||||
</dd>
|
||||
<dt className="col-sm-3">First signed in</dt>
|
||||
<dt className="col-sm-3">{t("First signed in")}</dt>
|
||||
<dd className="col-sm-9">{formatDateTime(parseTime(data.me.user.createdAt))}</dd>
|
||||
<dt className="col-sm-3">Last signed in</dt>
|
||||
<dt className="col-sm-3">{t("Last signed in")}</dt>
|
||||
<dd className="col-sm-9">{data.me.user.lastLoginAt ? formatDateTime(parseTime(data.me.user.lastLoginAt)) : "—"}</dd>
|
||||
<dt className="col-sm-3">Recorded actions</dt>
|
||||
<dt className="col-sm-3">{t("Recorded actions")}</dt>
|
||||
<dd className="col-sm-9">
|
||||
{data.me.auditEntries} change{data.me.auditEntries === 1 ? "" : "s"} you made are in the audit log under your name
|
||||
</dd>
|
||||
@@ -98,14 +98,14 @@ export default function Privacy() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body border-top">
|
||||
<div className="fw-bold mb-2">Your active sign-ins</div>
|
||||
<div className="fw-bold mb-2">{t("Your active sign-ins")}</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>Browser</th>
|
||||
<th>Last active</th>
|
||||
<th>{t("From")}</th>
|
||||
<th>{t("Browser")}</th>
|
||||
<th>{t("Last active")}</th>
|
||||
<th>{t("Ends")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -123,7 +123,7 @@ export default function Privacy() {
|
||||
{data.me.sessions.length === 0 && (
|
||||
<tr>
|
||||
<td colSpan={4} className="text-secondary">
|
||||
No active sign-ins found.
|
||||
{t("No active sign-ins found.")}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
@@ -139,25 +139,25 @@ export default function Privacy() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">What is stored</h3>
|
||||
<h3 className="card-title">{t("What is stored")}</h3>
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>What</th>
|
||||
<th>Contains</th>
|
||||
<th>Kept</th>
|
||||
<th>{t("What")}</th>
|
||||
<th>{t("Contains")}</th>
|
||||
<th>{t("Kept")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Accounts</td>
|
||||
<td>{t("Accounts")}</td>
|
||||
<td>Sign-in ID, email and name (from Authentik), role, first and last sign-in.</td>
|
||||
<td>Until an administrator removes the account from the database — the app can change roles but has no delete-account function.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sign-in sessions</td>
|
||||
<td>{t("Sign-in sessions")}</td>
|
||||
<td>
|
||||
Your sign-in ID, email and name, the ID token Authentik issued (needed to sign you out there), and the IP address and
|
||||
browser name from the sign-in.
|
||||
@@ -165,7 +165,7 @@ export default function Privacy() {
|
||||
<td>7 days after sign-in, or until you sign out or an administrator ends the session.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Audit log</td>
|
||||
<td>{t("Audit log")}</td>
|
||||
<td>
|
||||
Who changed what: your name (or email) as it was at the time, the action, what it was done to, and details of the change.
|
||||
Also each time you sign in or out — with the IP address you came from — and when your account was first created.
|
||||
@@ -178,14 +178,14 @@ export default function Privacy() {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Diagnostic log</td>
|
||||
<td>{t("Diagnostic log")}</td>
|
||||
<td>Each call to a DNS provider or integration: which service, what operation, success or failure, how long it took, any error text. It isn't about people.</td>
|
||||
<td>
|
||||
{retention?.enabled ? `Deleted after ${retention.retentionDays} days.` : "Indefinitely — automatic deletion is off."}
|
||||
{retention?.enabled ? `Deleted after ${retention.retentionDays} days.` : t("Indefinitely — automatic deletion is off.")}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Server reports</td>
|
||||
<td>{t("Server reports")}</td>
|
||||
<td>
|
||||
From each agent: hostname, IP addresses, CPU, memory and disk usage, listening ports with the program using them,
|
||||
and cron/systemd tasks <em>including their commands</em> — which can contain sensitive text.
|
||||
@@ -193,12 +193,12 @@ export default function Privacy() {
|
||||
<td>The latest report; removed with the server.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Secrets tracker</td>
|
||||
<td>{t("Secrets tracker")}</td>
|
||||
<td>Names, types, descriptions, expiry dates, notes, and a host to check for certificates. Never the secret values themselves.</td>
|
||||
<td>Until deleted.</td>
|
||||
<td>{t("Until deleted.")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Integration, DNS and notification credentials</td>
|
||||
<td>{t("Integration, DNS and notification credentials")}</td>
|
||||
<td>
|
||||
API tokens and passwords — including the Gotify/ntfy/Telegram tokens, the Pushover keys, SMTP password and webhook secret — encrypted (AES-256-GCM) with a key held in
|
||||
the server's environment, not in the database. (If that key isn't set, notification credentials are kept unencrypted and the server says so at startup.)
|
||||
@@ -208,7 +208,7 @@ export default function Privacy() {
|
||||
<tr>
|
||||
<td>{t("Inventory")}</td>
|
||||
<td>IP addresses, cached DNS records, domain registrations, port notes, tags and maintenance windows.</td>
|
||||
<td>Until deleted.</td>
|
||||
<td>{t("Until deleted.")}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -217,7 +217,7 @@ export default function Privacy() {
|
||||
|
||||
<div className="card mb-3" id="where-it-goes">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Where data goes</h3>
|
||||
<h3 className="card-title">{t("Where data goes")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<ul className="mb-0">
|
||||
@@ -225,7 +225,7 @@ export default function Privacy() {
|
||||
<strong>Authentik</strong> — you sign in there. The app receives your name, email and sign-in ID; it never sees your password.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Your integrations</strong>
|
||||
<strong>{t("Your integrations")}</strong>
|
||||
{outbound && outbound.integrationTypes.length > 0 ? ` (${outbound.integrationTypes.join(", ")})` : ""} — API calls to systems
|
||||
you configured, to read status and, when someone with permission asks, to act (start a VM, run a template…).
|
||||
</li>
|
||||
@@ -254,15 +254,15 @@ export default function Privacy() {
|
||||
)}
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Domain registries</strong> — the {outbound?.domainsTracked ?? 0} domain name{outbound?.domainsTracked === 1 ? "" : "s"} tracked
|
||||
<strong>{t("Domain registries")}</strong> — the {outbound?.domainsTracked ?? 0} domain name{outbound?.domainsTracked === 1 ? "" : "s"} tracked
|
||||
on the Domains page are sent to IANA and each registry's RDAP or WHOIS server to read the expiry date. Nothing but the names.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Certificate checks</strong> — for {outbound?.tlsCertificateChecks ?? 0} secret{outbound?.tlsCertificateChecks === 1 ? "" : "s"} with
|
||||
<strong>{t("Certificate checks")}</strong> — for {outbound?.tlsCertificateChecks ?? 0} secret{outbound?.tlsCertificateChecks === 1 ? "" : "s"} with
|
||||
a host to check, the app connects to that host to read its certificate — never to this server itself, a loopback or link-local address, or a cloud metadata address.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Profile pictures</strong> —{" "}
|
||||
<strong>{t("Profile pictures")}</strong> —{" "}
|
||||
{outbound && (outbound.profilePictures.gravatar || outbound.profilePictures.identityProvider) ? (
|
||||
<>
|
||||
this server fetches pictures
|
||||
@@ -281,12 +281,12 @@ export default function Privacy() {
|
||||
or your servers.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Servers and agents</strong> — {outbound?.serversWithAgent ?? 0} of {outbound?.servers ?? 0} servers have reported in. Agents push
|
||||
<strong>{t("Servers and agents")}</strong> — {outbound?.serversWithAgent ?? 0} of {outbound?.servers ?? 0} servers have reported in. Agents push
|
||||
their reports to the app; the app doesn't connect out to them, apart from port scans, which run only when an operator starts one
|
||||
and only against private addresses.
|
||||
</li>
|
||||
<li>
|
||||
<strong>Nothing else.</strong> No telemetry, no update checks, no crash reports, no third-party analytics.
|
||||
<strong>{t("Nothing else.")}</strong> No telemetry, no update checks, no crash reports, no third-party analytics.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -296,7 +296,7 @@ export default function Privacy() {
|
||||
<div className="col-lg-6">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">In your browser</h3>
|
||||
<h3 className="card-title">{t("In your browser")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<ul className="mb-0">
|
||||
@@ -315,7 +315,7 @@ export default function Privacy() {
|
||||
<div className="col-lg-6">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Who can see what</h3>
|
||||
<h3 className="card-title">{t("Who can see what")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<ul className="mb-0">
|
||||
@@ -330,23 +330,23 @@ export default function Privacy() {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Removing or limiting data</h3>
|
||||
<h3 className="card-title">{t("Removing or limiting data")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<ul className="mb-0">
|
||||
<li className="mb-2">
|
||||
<strong>{t("Sign out")}</strong> to end your session now. Administrators can also end anyone's on the <Link to="/users?view=sessions">Users → Signed in now</Link> page.
|
||||
<strong>{t("Sign out")}</strong> to end your session now. Administrators can also end anyone's on the <Link to="/users?view=sessions">{t("Users → Signed in now")}</Link> page.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Audit and diagnostic logs</strong> can be deleted automatically after a set number of days under Settings → Data → Logs
|
||||
<strong>{t("Audit and diagnostic logs")}</strong> can be deleted automatically after a set number of days under Settings → Data → Logs
|
||||
{retention ? ` — currently ${retention.enabled ? `on, ${retention.retentionDays} days` : "off"}` : ""}.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>Your account</strong> can only be removed by an administrator deleting it from the database; the app doesn't do that
|
||||
<strong>{t("Your account")}</strong> can only be removed by an administrator deleting it from the database; the app doesn't do that
|
||||
itself. Old audit entries keep your name until the log is purged.
|
||||
</li>
|
||||
<li>
|
||||
<strong>A copy of your data</strong> is the “Download my data” button above.
|
||||
<strong>{t("A copy of your data")}</strong> is the “Download my data” button above.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ import { t } from "../i18n";
|
||||
const BY_DESIGN = /^(watchdog|deadmansswitch|deadmanssnitch|infoinhibitor)$/i;
|
||||
|
||||
function Badge({ p }: { p: PrometheusInfo }) {
|
||||
if (!p.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!p.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!p.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!p.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -53,19 +53,19 @@ function Card({ p }: { p: PrometheusInfo }) {
|
||||
{[s.version ? `version ${s.version}` : null, targets === null ? "targets could not be read" : `${targets} target${targets === 1 ? "" : "s"}, ${down} down`, s.alerts === null ? "alerts could not be read" : `${firing.length} alert${firing.length === 1 ? "" : "s"} firing`].filter(Boolean).join(" · ")}
|
||||
</div>
|
||||
|
||||
<h4>Targets by job</h4>
|
||||
<h4>{t("Targets by job")}</h4>
|
||||
{!s.jobs ? (
|
||||
<div className="text-secondary mb-3">Prometheus did not answer about its targets.</div>
|
||||
<div className="text-secondary mb-3">{t("Prometheus did not answer about its targets.")}</div>
|
||||
) : s.jobs.length === 0 ? (
|
||||
<div className="text-secondary mb-3">None.</div>
|
||||
<div className="text-secondary mb-3">{t("None.")}</div>
|
||||
) : (
|
||||
<div className="table-responsive mb-3">
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Job</th>
|
||||
<th className="text-end">Up</th>
|
||||
<th className="text-end">Down</th>
|
||||
<th>{t("Job")}</th>
|
||||
<th className="text-end">{t("Up")}</th>
|
||||
<th className="text-end">{t("Down")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -83,7 +83,7 @@ function Card({ p }: { p: PrometheusInfo }) {
|
||||
|
||||
{s.down && s.down.length > 0 && (
|
||||
<>
|
||||
<h4>Not answering</h4>
|
||||
<h4>{t("Not answering")}</h4>
|
||||
<ul className="mb-3">
|
||||
{s.down.map((d) => (
|
||||
<li key={`${d.job}-${d.instance}`}>
|
||||
@@ -95,9 +95,9 @@ function Card({ p }: { p: PrometheusInfo }) {
|
||||
</>
|
||||
)}
|
||||
|
||||
<h4>Alerts firing</h4>
|
||||
<h4>{t("Alerts firing")}</h4>
|
||||
{!s.alerts ? (
|
||||
<div className="text-secondary mb-3">Prometheus did not answer about its alerts.</div>
|
||||
<div className="text-secondary mb-3">{t("Prometheus did not answer about its alerts.")}</div>
|
||||
) : firing.length === 0 ? (
|
||||
<div className="text-secondary mb-3">None{pending.length > 0 ? ` (${pending.length} pending)` : ""}.</div>
|
||||
) : (
|
||||
@@ -149,7 +149,7 @@ export default function Prometheus() {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Prometheus connected" hint="Add one under Integrations with its address (http://host:9090)." />
|
||||
<EmptyState title={t("No Prometheus connected")} hint="Add one under Integrations with its address (http://host:9090)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+32
-32
@@ -33,9 +33,9 @@ import { t } from "../i18n";
|
||||
|
||||
function proxmoxStatusBadge(status: string) {
|
||||
return status === "running" ? (
|
||||
<span className="badge bg-green-lt text-green">Running</span>
|
||||
<span className="badge bg-green-lt text-green">{t("Running")}</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary">Stopped</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Stopped")}</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ function formatBytes(bytes: number | null): string {
|
||||
}
|
||||
|
||||
function describeGuests(job: ProxmoxBackupJob): string {
|
||||
if (job.allGuests) return job.exclude ? `All guests (except ${job.exclude})` : "All guests";
|
||||
if (job.allGuests) return job.exclude ? `All guests (except ${job.exclude})` : t("All guests");
|
||||
return job.vmids ? `Guests ${job.vmids}` : "—";
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ function formatDuration(startIso: string, endIso: string | null): string {
|
||||
|
||||
function backupStatusBadge(task: ProxmoxBackupTask) {
|
||||
if (task.ok) return <span className="badge bg-green-lt text-green">{t("OK")}</span>;
|
||||
if (task.status === "running") return <span className="badge bg-blue-lt text-blue">Running</span>;
|
||||
if (task.status === "running") return <span className="badge bg-blue-lt text-blue">{t("Running")}</span>;
|
||||
return (
|
||||
<span className="badge bg-red-lt text-red" title={task.status}>
|
||||
Failed
|
||||
{t("Failed")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -187,7 +187,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
!(await confirmDialog({
|
||||
title: `Stop ${kind}`,
|
||||
message: `Stop ${kind} "${g.name}" immediately? Use Shutdown instead for a graceful power-off.`,
|
||||
confirmLabel: "Stop now",
|
||||
confirmLabel: t("Stop now"),
|
||||
danger: true,
|
||||
}))
|
||||
)
|
||||
@@ -228,7 +228,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Proxmox integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
|
||||
No Proxmox integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -275,7 +275,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadNodeStats(selected.id)}
|
||||
disabled={loadingNodeStats}
|
||||
>
|
||||
{loadingNodeStats ? "Refreshing…" : "Refresh"}
|
||||
{loadingNodeStats ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -284,11 +284,11 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
<div className="row g-3">
|
||||
<div className="col-md-6">
|
||||
<div className="mb-3">
|
||||
<div className="text-secondary small">Uptime</div>
|
||||
<div className="text-secondary small">{t("Uptime")}</div>
|
||||
<div>{formatUptime(n.uptime)}</div>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<div className="text-secondary small">CPU</div>
|
||||
<div className="text-secondary small">{t("CPU")}</div>
|
||||
<div>
|
||||
{n.cpuUsagePercent !== null ? `${n.cpuUsagePercent.toFixed(1)}%` : "—"}
|
||||
{n.cpuCores ? <span className="text-secondary"> ({n.cpuCores} cores)</span> : null}
|
||||
@@ -298,7 +298,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
</div>
|
||||
<div className={n.swapTotalBytes ? "mb-3" : ""}>
|
||||
<div className="text-secondary small">Memory</div>
|
||||
<div className="text-secondary small">{t("Memory")}</div>
|
||||
<div>
|
||||
{formatBytes(n.memUsedBytes)} / {formatBytes(n.memTotalBytes)}
|
||||
</div>
|
||||
@@ -306,7 +306,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
{!!n.swapTotalBytes && (
|
||||
<div>
|
||||
<div className="text-secondary small">Swap</div>
|
||||
<div className="text-secondary small">{t("Swap")}</div>
|
||||
<div>
|
||||
{formatBytes(n.swapUsedBytes)} / {formatBytes(n.swapTotalBytes)}
|
||||
</div>
|
||||
@@ -316,7 +316,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
|
||||
<div className="col-md-6">
|
||||
<div className="text-secondary small mb-1">Storage</div>
|
||||
<div className="text-secondary small mb-1">{t("Storage")}</div>
|
||||
{n.storages.length > 0 ? (
|
||||
<table className="table table-sm table-vcenter mb-0">
|
||||
<tbody>
|
||||
@@ -324,7 +324,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
<tr key={s.id}>
|
||||
<td>
|
||||
{s.id}
|
||||
{!s.active && <span className="badge bg-secondary-lt text-secondary ms-1">Inactive</span>}
|
||||
{!s.active && <span className="badge bg-secondary-lt text-secondary ms-1">{t("Inactive")}</span>}
|
||||
</td>
|
||||
<td className="text-secondary">{s.type}</td>
|
||||
<td>
|
||||
@@ -354,7 +354,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
{nodeStats?.length === 0 && (
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">No online Proxmox nodes found.</div>
|
||||
<div className="card-body text-secondary">{t("No online Proxmox nodes found.")}</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -369,7 +369,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadBackups(selected.id)}
|
||||
disabled={loadingBackups}
|
||||
>
|
||||
{loadingBackups ? "Refreshing…" : "Refresh"}
|
||||
{loadingBackups ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -397,9 +397,9 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-sm table-vcenter mb-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Schedule</th>
|
||||
<th>Storage</th>
|
||||
<th>Guests</th>
|
||||
<th>{t("Schedule")}</th>
|
||||
<th>{t("Storage")}</th>
|
||||
<th>{t("Guests")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -421,7 +421,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
!backupsError && <div className="text-secondary small mb-4">No backup jobs configured in Proxmox.</div>
|
||||
!backupsError && <div className="text-secondary small mb-4">{t("No backup jobs configured in Proxmox.")}</div>
|
||||
)}
|
||||
|
||||
<div className="text-secondary small mb-1 d-flex align-items-center justify-content-between">
|
||||
@@ -433,8 +433,8 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Node</th>
|
||||
<th>Type</th>
|
||||
<th>{t("Node")}</th>
|
||||
<th>{t("Type")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -466,11 +466,11 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Node</th>
|
||||
<th>Guest</th>
|
||||
<th>{t("Node")}</th>
|
||||
<th>{t("Guest")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
<th>{t("Started")}</th>
|
||||
<th>Duration</th>
|
||||
<th>{t("Duration")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -486,7 +486,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
!backupsError && <div className="text-secondary small mb-0">No recent backup runs found.</div>
|
||||
!backupsError && <div className="text-secondary small mb-0">{t("No recent backup runs found.")}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -515,7 +515,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadGuests(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -524,10 +524,10 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<ProxmoxGuest> label={t("Name")} sortKeyName="name" activeKey={guestSortKey} direction={guestSortDir} onSort={requestGuestSort} />
|
||||
<SortableTh<ProxmoxGuest> label="Node" sortKeyName="node" activeKey={guestSortKey} direction={guestSortDir} onSort={requestGuestSort} />
|
||||
<SortableTh<ProxmoxGuest> label="Type" sortKeyName="type" activeKey={guestSortKey} direction={guestSortDir} onSort={requestGuestSort} />
|
||||
<SortableTh<ProxmoxGuest> label={t("Node")} sortKeyName="node" activeKey={guestSortKey} direction={guestSortDir} onSort={requestGuestSort} />
|
||||
<SortableTh<ProxmoxGuest> label={t("Type")} sortKeyName="type" activeKey={guestSortKey} direction={guestSortDir} onSort={requestGuestSort} />
|
||||
<SortableTh<ProxmoxGuest>
|
||||
label="Uptime"
|
||||
label={t("Uptime")}
|
||||
sortKeyName="uptime"
|
||||
activeKey={guestSortKey}
|
||||
direction={guestSortDir}
|
||||
@@ -597,7 +597,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{sortedGuests?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} title="No guests found" hint="The cluster answered with no virtual machines or containers. Check that the API token can see them." action={{ label: "Check the integration", to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 6 : 5} title={t("No guests found")} hint="The cluster answered with no virtual machines or containers. Check that the API token can see them." action={{ label: t("Check the integration"), to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -609,7 +609,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</>
|
||||
)}
|
||||
{detail.selected && (
|
||||
<DetailDrawer title={((g) => g.name)(detail.selected)} subtitle={((g) => `${g.type === "qemu" ? "Virtual machine" : "Container"} ${g.vmid} on ${g.node}`)(detail.selected)} onClose={detail.close}>
|
||||
<DetailDrawer title={((g) => g.name)(detail.selected)} subtitle={((g) => `${g.type === "qemu" ? t("Virtual machine") : t("Container")} ${g.vmid} on ${g.node}`)(detail.selected)} onClose={detail.close}>
|
||||
<ObjectDetails data={detail.selected} />
|
||||
{selectedId !== null && <ProxmoxSnapshots integrationId={selectedId} guest={detail.selected} canTake={canEdit} canRoll={user.role === "admin"} />}
|
||||
</DetailDrawer>
|
||||
|
||||
@@ -29,15 +29,15 @@ function StatusBadge({ h }: { h: Row }) {
|
||||
if (!h.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Switched off")}</span>;
|
||||
if (!h.online)
|
||||
return (
|
||||
<span className="badge bg-red-lt text-red" title={h.error ?? "Nginx Proxy Manager could not set this host up"}>
|
||||
Not working
|
||||
<span className="badge bg-red-lt text-red" title={h.error ?? t("Nginx Proxy Manager could not set this host up")}>
|
||||
{t("Not working")}
|
||||
</span>
|
||||
);
|
||||
return <span className="badge bg-green-lt text-green">Working</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("Working")}</span>;
|
||||
}
|
||||
|
||||
function CertBadge({ h }: { h: Row }) {
|
||||
if (!h.certificate) return <span className="text-secondary">{h.sslForced ? "—" : "No certificate"}</span>;
|
||||
if (!h.certificate) return <span className="text-secondary">{h.sslForced ? "—" : t("No certificate")}</span>;
|
||||
const d = h.certDays;
|
||||
const color = d === null ? "secondary" : d < 0 ? "red" : d <= 3 ? "red" : d <= 14 ? "yellow" : "green";
|
||||
const words = d === null ? "no end date" : d < 0 ? `ran out ${-d} ${d === -1 ? "day" : "days"} ago` : d === 0 ? "ends today" : `${d} ${d === 1 ? "day" : "days"} left`;
|
||||
@@ -114,7 +114,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function switchHost(h: Row) {
|
||||
if (h.enabled && !(await confirmDialog({ title: "Switch off proxy host", message: `Switch off ${h.domains[0]}? Nginx Proxy Manager stops serving ${h.domains.length > 1 ? "its names" : "it"}. Nothing is lost, and switching it on again brings it back.`, confirmLabel: "Switch off", danger: true }))) return;
|
||||
if (h.enabled && !(await confirmDialog({ title: t("Switch off proxy host"), message: `Switch off ${h.domains[0]}? Nginx Proxy Manager stops serving ${h.domains.length > 1 ? "its names" : "it"}. Nothing is lost, and switching it on again brings it back.`, confirmLabel: t("Switch off"), danger: true }))) return;
|
||||
try {
|
||||
await api.npm.setHostEnabled(h.integrationId, h.id, !h.enabled);
|
||||
toast.success(`${h.domains[0]} is ${h.enabled ? "off" : "on"}.`);
|
||||
@@ -126,10 +126,10 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
|
||||
async function deleteHost(h: Row) {
|
||||
const typed = await promptDialog({
|
||||
title: "Delete proxy host",
|
||||
title: t("Delete proxy host"),
|
||||
message: `This deletes the proxy host ${h.domains.join(", ")} (it forwards to ${h.target}) in ${h.integrationName}: Nginx Proxy Manager stops serving ${h.domains.length > 1 ? "those names" : "that name"}. Type its first name to confirm.`,
|
||||
label: "First name",
|
||||
confirmLabel: "Delete",
|
||||
label: t("First name"),
|
||||
confirmLabel: t("Delete"),
|
||||
required: true,
|
||||
});
|
||||
if (typed === null) return;
|
||||
@@ -170,11 +170,11 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
<div className="ms-auto btn-list">
|
||||
{isAdmin && managing.length > 0 && (
|
||||
<button className="btn btn-primary" onClick={() => setForm({ mode: "new", integrationId: managing[0].id })}>
|
||||
New proxy host
|
||||
{t("New proxy host")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-outline-secondary" onClick={() => void readNow()} disabled={reading}>
|
||||
{reading ? "Reading…" : "Read now"}
|
||||
{reading ? "Reading…" : t("Read now")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -224,9 +224,9 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
{noNpm && (
|
||||
<div className="card">
|
||||
<EmptyState
|
||||
title="No Nginx Proxy Manager connected"
|
||||
title={t("No Nginx Proxy Manager connected")}
|
||||
hint="Add an Nginx Proxy Manager integration — a user that may only view proxy hosts and certificates is enough — and what it serves appears here."
|
||||
action={user.role === "admin" ? { label: "Add Nginx Proxy Manager", to: "/integrations" } : undefined}
|
||||
action={user.role === "admin" ? { label: t("Add Nginx Proxy Manager"), to: "/integrations" } : undefined}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -246,10 +246,10 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row row-cards mb-3">
|
||||
{[
|
||||
{ label: "Proxy hosts", value: rows.length, color: "" },
|
||||
{ label: "Not working", value: rows.filter((h) => h.enabled && !h.online).length, color: rows.some((h) => h.enabled && !h.online) ? "text-red" : "text-green" },
|
||||
{ label: t("Proxy hosts"), value: rows.length, color: "" },
|
||||
{ label: t("Not working"), value: rows.filter((h) => h.enabled && !h.online).length, color: rows.some((h) => h.enabled && !h.online) ? "text-red" : "text-green" },
|
||||
{ label: "Certificates ending within 14 days", value: soon, color: soon > 0 ? "text-yellow" : "text-green" },
|
||||
{ label: "Switched off", value: rows.filter((h) => !h.enabled).length, color: "" },
|
||||
{ label: t("Switched off"), value: rows.filter((h) => !h.enabled).length, color: "" },
|
||||
].map((c) => (
|
||||
<div className="col-6 col-lg-3" key={c.label}>
|
||||
<div className="card card-sm">
|
||||
@@ -270,7 +270,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
<div className="list-group list-group-flush">
|
||||
{problems.map((p) => (
|
||||
<div className="list-group-item d-flex align-items-center gap-2" key={p.key}>
|
||||
<span className={`badge ${p.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{p.severity === "critical" ? "Critical" : "Warning"}</span>
|
||||
<span className={`badge ${p.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{p.severity === "critical" ? t("Critical") : t("Warning")}</span>
|
||||
<span>{p.message}</span>
|
||||
</div>
|
||||
))}
|
||||
@@ -279,20 +279,20 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder="Search names, targets, servers…" shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
|
||||
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder={t("Search names, targets, servers…")} shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Row> label={t("Status")} sortKeyName="statusRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Name")} sortKeyName="domain" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Forwards to" sortKeyName="target" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Certificate" sortKeyName="certDays" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Forwards to")} sortKeyName="target" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Certificate")} sortKeyName="certDays" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{canManageAny && <th />}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(pageItems ?? []).length === 0 && <EmptyRow colSpan={canManageAny ? 5 : 4} title="No proxy hosts" filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />}
|
||||
{(pageItems ?? []).length === 0 && <EmptyRow colSpan={canManageAny ? 5 : 4} title={t("No proxy hosts")} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />}
|
||||
{(pageItems ?? []).map((h) => (
|
||||
<tr key={`${h.integrationName}-${h.id}`}>
|
||||
<td>
|
||||
@@ -309,7 +309,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{data && data.integrations.length > 1 && <div className="text-secondary small">{h.integrationName}</div>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Forwards to">
|
||||
<td className="stack-label" data-label={t("Forwards to")}>
|
||||
<span className="font-monospace">{h.target}</span>
|
||||
{h.server && (
|
||||
<div className="small">
|
||||
@@ -317,7 +317,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Certificate">
|
||||
<td className="stack-label" data-label={t("Certificate")}>
|
||||
<CertBadge h={h} />
|
||||
</td>
|
||||
{canManageAny && (
|
||||
@@ -328,7 +328,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary me-1" onClick={() => void switchHost(h)}>
|
||||
{h.enabled ? "Switch off" : "Switch on"}
|
||||
{h.enabled ? t("Switch off") : t("Switch on")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void deleteHost(h)}>
|
||||
{t("Delete")}
|
||||
|
||||
+25
-25
@@ -153,7 +153,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function remove(s: SecretRecord) {
|
||||
if (!(await confirmDialog({ title: "Delete secret", message: `Delete secret "${s.name}"?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete secret"), message: `Delete secret "${s.name}"?`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
setError(null);
|
||||
try {
|
||||
await api.secrets.remove(s.id);
|
||||
@@ -167,7 +167,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
async function bulkDelete() {
|
||||
const ids = Array.from(selection.selected);
|
||||
if (ids.length === 0) return;
|
||||
if (!(await confirmDialog({ title: "Delete secrets", message: `Delete ${ids.length} secret${ids.length !== 1 ? "s" : ""}?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete secrets"), message: `Delete ${ids.length} secret${ids.length !== 1 ? "s" : ""}?`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
setError(null);
|
||||
setBulkDeleting(true);
|
||||
try {
|
||||
@@ -212,7 +212,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
{canEdit && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{editingId ? "Edit secret" : "Add a secret"}</h3>
|
||||
<h3 className="card-title">{editingId ? t("Edit secret") : t("Add a secret")}</h3>
|
||||
</div>
|
||||
<form onSubmit={submit}>
|
||||
<div className="card-body row g-3">
|
||||
@@ -226,7 +226,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Type</label>
|
||||
<label className="form-label">{t("Type")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
value={form.type}
|
||||
@@ -240,7 +240,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Expiry date</label>
|
||||
<label className="form-label">{t("Expiry date")}</label>
|
||||
<input
|
||||
type="date"
|
||||
className="form-control"
|
||||
@@ -250,7 +250,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
onChange={(e) => setForm({ ...form, expiryDate: e.target.value })}
|
||||
/>
|
||||
{monitoredInForm ? (
|
||||
<div className="form-hint">Read from the live certificate.</div>
|
||||
<div className="form-hint">{t("Read from the live certificate.")}</div>
|
||||
) : (
|
||||
<label className="form-check mt-2 mb-0">
|
||||
<input
|
||||
@@ -259,7 +259,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
checked={neverExpires}
|
||||
onChange={(e) => setNeverExpires(e.target.checked)}
|
||||
/>
|
||||
<span className="form-check-label">Never expires</span>
|
||||
<span className="form-check-label">{t("Never expires")}</span>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
@@ -276,7 +276,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
<div className="form-hint">Connects over TLS and reads the certificate's real expiry, checked daily.</div>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Port</label>
|
||||
<label className="form-label">{t("Port")}</label>
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
@@ -290,7 +290,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
</>
|
||||
)}
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Warn (days before)</label>
|
||||
<label className="form-label">{t("Warn (days before)")}</label>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
@@ -319,7 +319,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={saving}>
|
||||
{editingId ? "Save changes" : "Add secret"}
|
||||
{editingId ? t("Save changes") : t("Add secret")}
|
||||
</button>
|
||||
{editingId && (
|
||||
<button type="button" className="btn" onClick={cancelEdit}>
|
||||
@@ -335,7 +335,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search name or description…"
|
||||
placeholder={t("Search name or description…")}
|
||||
filters={
|
||||
<select
|
||||
className="form-select form-select-sm w-auto"
|
||||
@@ -343,11 +343,11 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
value={statusFilter}
|
||||
onChange={(e) => setStatusFilter(e.target.value as typeof statusFilter)}
|
||||
>
|
||||
<option value="all">All statuses</option>
|
||||
<option value="all">{t("All statuses")}</option>
|
||||
<option value="ok">{t("OK")}</option>
|
||||
<option value="expiring">Expiring</option>
|
||||
<option value="expired">Expired</option>
|
||||
<option value="never">No expiry</option>
|
||||
<option value="expiring">{t("Expiring")}</option>
|
||||
<option value="expired">{t("Expired")}</option>
|
||||
<option value="never">{t("No expiry")}</option>
|
||||
</select>
|
||||
}
|
||||
shown={filtered.length}
|
||||
@@ -358,10 +358,10 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
<div className="card-header bg-blue-lt d-flex align-items-center gap-2">
|
||||
<span>{selection.count} selected</span>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={bulkDelete} disabled={bulkDeleting}>
|
||||
{bulkDeleting ? "Deleting…" : "Delete selected"}
|
||||
{bulkDeleting ? t("Deleting…") : t("Delete selected")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-link" onClick={selection.clear}>
|
||||
Clear selection
|
||||
{t("Clear selection")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -380,16 +380,16 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
</th>
|
||||
)}
|
||||
<SortableTh<SecretRecord> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SecretRecord> label="Type" sortKeyName="type" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SecretRecord> label={t("Type")} sortKeyName="type" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SecretRecord>
|
||||
label="Expiry"
|
||||
label={t("Expiry")}
|
||||
sortKeyName="expiryDate"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<SecretRecord>
|
||||
label="Days left"
|
||||
label={t("Days left")}
|
||||
sortKeyName="daysLeft"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -422,18 +422,18 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
<td>{s.name}</td>
|
||||
<td>{TYPE_LABELS[s.type]}</td>
|
||||
<td>
|
||||
{s.expiryDate ?? <span className="text-secondary">Never</span>}
|
||||
{s.expiryDate ?? <span className="text-secondary">{t("Never")}</span>}
|
||||
{s.checkHost && (
|
||||
<span
|
||||
className="badge bg-cyan-lt ms-2"
|
||||
title={`Read from ${s.checkHost}:${s.checkPort ?? 443}${s.lastCheckedAt ? ` — checked ${formatDateTime(new Date(s.lastCheckedAt))}` : ""}`}
|
||||
>
|
||||
Auto
|
||||
{t("Auto")}
|
||||
</span>
|
||||
)}
|
||||
{s.lastCheckError && (
|
||||
<span className="badge bg-red-lt text-red ms-1" title={`${s.lastCheckError} — showing the last known date`}>
|
||||
Check failed
|
||||
{t("Check failed")}
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
@@ -447,7 +447,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
<div className="btn-list flex-nowrap">
|
||||
{s.checkHost && (
|
||||
<button className="btn btn-sm" onClick={() => checkNow(s)} disabled={checkingId === s.id}>
|
||||
{checkingId === s.id ? "Checking…" : "Check now"}
|
||||
{checkingId === s.id ? t("Checking…") : t("Check now")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm" onClick={() => startEdit(s)}>
|
||||
@@ -463,7 +463,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
{secrets === null && <LoadingRow colSpan={canEdit ? 8 : 6} />}
|
||||
{secrets !== null && (sorted ?? []).length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 8 : 6} title="No secrets tracked yet" hint="Track an API token, a certificate or a password that expires, and you are warned before it does. The form is at the top of this page." filtered={secrets && secrets.length > 0 ? () => { setSearch(""); setStatusFilter("all"); } : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 8 : 6} title={t("No secrets tracked yet")} hint="Track an API token, a certificate or a password that expires, and you are warned before it does. The form is at the top of this page." filtered={secrets && secrets.length > 0 ? () => { setSearch(""); setStatusFilter("all"); } : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+26
-26
@@ -26,24 +26,24 @@ import { t } from "../i18n";
|
||||
|
||||
function semaphoreStatusBadge(template: SemaphoreTemplate) {
|
||||
const status = template.lastTask?.status;
|
||||
if (!status) return <span className="badge bg-secondary-lt text-secondary">Never run</span>;
|
||||
if (!status) return <span className="badge bg-secondary-lt text-secondary">{t("Never run")}</span>;
|
||||
switch (status) {
|
||||
case "success":
|
||||
return <span className="badge bg-green-lt text-green">Success</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("Success")}</span>;
|
||||
case "error":
|
||||
return <span className="badge bg-red-lt text-red">Failed</span>;
|
||||
return <span className="badge bg-red-lt text-red">{t("Failed")}</span>;
|
||||
case "stopped":
|
||||
return <span className="badge bg-secondary-lt text-secondary">Stopped</span>;
|
||||
return <span className="badge bg-secondary-lt text-secondary">{t("Stopped")}</span>;
|
||||
case "rejected":
|
||||
return <span className="badge bg-secondary-lt text-secondary">Rejected</span>;
|
||||
return <span className="badge bg-secondary-lt text-secondary">{t("Rejected")}</span>;
|
||||
case "waiting":
|
||||
case "starting":
|
||||
case "waiting_confirmation":
|
||||
case "confirmed":
|
||||
return <span className="badge bg-yellow-lt text-yellow">Queued</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{t("Queued")}</span>;
|
||||
case "running":
|
||||
case "stopping":
|
||||
return <span className="badge bg-blue-lt text-blue">Running</span>;
|
||||
return <span className="badge bg-blue-lt text-blue">{t("Running")}</span>;
|
||||
default:
|
||||
return <span className="badge bg-secondary-lt text-secondary">{status}</span>;
|
||||
}
|
||||
@@ -93,13 +93,13 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedId]);
|
||||
|
||||
async function runTemplate(t: SemaphoreTemplate) {
|
||||
async function runTemplate(tpl: SemaphoreTemplate) {
|
||||
if (!selectedId) return;
|
||||
if (!(await confirmDialog({ title: "Run template", message: `Run "${t.name}" now?`, confirmLabel: "Run now" }))) return;
|
||||
setRunningTemplate(t.id);
|
||||
if (!(await confirmDialog({ title: t("Run template"), message: `Run "${tpl.name}" now?`, confirmLabel: t("Run now") }))) return;
|
||||
setRunningTemplate(tpl.id);
|
||||
setError(null);
|
||||
try {
|
||||
await api.integrations.semaphore.run(selectedId, t.projectId, t.id);
|
||||
await api.integrations.semaphore.run(selectedId, tpl.projectId, tpl.id);
|
||||
loadTemplates(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -136,7 +136,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Semaphore integration configured yet.{" "}
|
||||
<Link to="/integrations">Add one under Integrations</Link>.
|
||||
<Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -184,7 +184,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadTemplates(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,43 +192,43 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<SemaphoreTemplate> label="Template" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SemaphoreTemplate> label={t("Template")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<SemaphoreTemplate>
|
||||
label="Project"
|
||||
label={t("Project")}
|
||||
sortKeyName="projectName"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<th>Last run</th>
|
||||
<th>{t("Last run")}</th>
|
||||
<th>{t("Status")}</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{pageItems?.map((t) => (
|
||||
<tr key={`${t.projectId}:${t.id}`} {...detail.rowProps(t)}>
|
||||
<td>{t.name}</td>
|
||||
<td className="text-secondary">{t.projectName}</td>
|
||||
{pageItems?.map((tpl) => (
|
||||
<tr key={`${tpl.projectId}:${tpl.id}`} {...detail.rowProps(tpl)}>
|
||||
<td>{tpl.name}</td>
|
||||
<td className="text-secondary">{tpl.projectName}</td>
|
||||
<td className="text-secondary">
|
||||
{t.lastTask ? <TimeAgo value={t.lastTask.end ?? t.lastTask.start ?? t.lastTask.created} /> : "—"}
|
||||
{tpl.lastTask ? <TimeAgo value={tpl.lastTask.end ?? tpl.lastTask.start ?? tpl.lastTask.created} /> : "—"}
|
||||
</td>
|
||||
<td>{semaphoreStatusBadge(t)}</td>
|
||||
<td>{semaphoreStatusBadge(tpl)}</td>
|
||||
{canEdit && (
|
||||
<td>
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
onClick={() => runTemplate(t)}
|
||||
disabled={runningTemplate === t.id}
|
||||
onClick={() => runTemplate(tpl)}
|
||||
disabled={runningTemplate === tpl.id}
|
||||
>
|
||||
{runningTemplate === t.id ? "Starting…" : "Run"}
|
||||
{runningTemplate === tpl.id ? t("Starting…") : t("Run")}
|
||||
</button>
|
||||
</td>
|
||||
)}
|
||||
</tr>
|
||||
))}
|
||||
{sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 5 : 4} title="No templates found" hint="Create a task template in a Semaphore project (a playbook to run) and it appears here, ready to run from this app." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 5 : 4} title={t("No templates found")} hint="Create a task template in a Semaphore project (a playbook to run) and it appears here, ready to run from this app." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function ServerCompare() {
|
||||
for (const l of loaded ?? []) for (const s of l.series ?? []) if (s.kind === "disk") found.set(s.metric, s.label);
|
||||
return [...found.entries()];
|
||||
}, [loaded]);
|
||||
const metricName = metrics.find(([key]) => key === metric)?.[1] ?? "CPU load";
|
||||
const metricName = metrics.find(([key]) => key === metric)?.[1] ?? t("CPU load");
|
||||
|
||||
const rows = (loaded ?? []).map((l, i) => {
|
||||
const s = l.series?.find((x) => x.metric === metric) ?? null;
|
||||
@@ -101,9 +101,9 @@ export default function ServerCompare() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
<h2 className="page-title mb-0">Compare servers</h2>
|
||||
<h2 className="page-title mb-0">{t("Compare servers")}</h2>
|
||||
<Link to="/servers" className="btn btn-sm btn-outline-secondary ms-auto">
|
||||
Pick different servers
|
||||
{t("Pick different servers")}
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -117,7 +117,7 @@ export default function ServerCompare() {
|
||||
<div className="card mb-3">
|
||||
<div className="card-header d-flex flex-wrap gap-2">
|
||||
<h3 className="card-title me-auto">{metricName}</h3>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="What to compare" value={metric} onChange={(e) => setMetric(e.target.value)}>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("What to compare")} value={metric} onChange={(e) => setMetric(e.target.value)}>
|
||||
{metrics.map(([key, name]) => (
|
||||
<option key={key} value={key}>
|
||||
{name}
|
||||
@@ -144,9 +144,9 @@ export default function ServerCompare() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Server")}</th>
|
||||
<th>Now</th>
|
||||
<th>Average</th>
|
||||
<th>Peak</th>
|
||||
<th>{t("Now")}</th>
|
||||
<th>{t("Average")}</th>
|
||||
<th>{t("Peak")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -166,7 +166,7 @@ export default function ServerCompare() {
|
||||
</>
|
||||
) : (
|
||||
<td colSpan={3} className="text-secondary">
|
||||
{r.hasAgent ? "No history for this" : "No agent history (not reported by an agent)"}
|
||||
{r.hasAgent ? t("No history for this") : "No agent history (not reported by an agent)"}
|
||||
</td>
|
||||
)}
|
||||
</tr>
|
||||
|
||||
@@ -88,7 +88,7 @@ function DisksTable({ disks }: { disks: { mount: string; sizeBytes: number; used
|
||||
if (disks.length === 0) return null;
|
||||
return (
|
||||
<div className="mt-3">
|
||||
<div className="text-secondary small mb-1">Disks</div>
|
||||
<div className="text-secondary small mb-1">{t("Disks")}</div>
|
||||
<table className="table table-sm table-vcenter mb-0">
|
||||
<tbody>
|
||||
{disks.map((d) => (
|
||||
@@ -116,12 +116,12 @@ const emptyTaskForm = {
|
||||
|
||||
/** The sections of a server's page, switched by `?view=`: what it is, how it is doing, how it is connected, how it has been, what runs on it, and how it is set up. */
|
||||
const SECTIONS = [
|
||||
{ key: "overview", label: "Overview" },
|
||||
{ key: "health", label: "Health" },
|
||||
{ key: "network", label: "Network" },
|
||||
{ key: "history", label: "History" },
|
||||
{ key: "tasks", label: "Tasks" },
|
||||
{ key: "settings", label: "Settings" },
|
||||
{ key: "overview", get label() { return t("Overview"); } },
|
||||
{ key: "health", get label() { return t("Health"); } },
|
||||
{ key: "network", get label() { return t("Network"); } },
|
||||
{ key: "history", get label() { return t("History"); } },
|
||||
{ key: "tasks", get label() { return t("Tasks"); } },
|
||||
{ key: "settings", get label() { return t("Settings"); } },
|
||||
] as const;
|
||||
type SectionKey = (typeof SECTIONS)[number]["key"];
|
||||
|
||||
@@ -323,7 +323,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function deleteTask(task: TaskRecord) {
|
||||
if (!(await confirmDialog({ title: t("Delete task"), message: `Delete "${task.name}"?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete task"), message: `Delete "${task.name}"?`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
try {
|
||||
await api.tasks.remove(task.id);
|
||||
loadTasks();
|
||||
@@ -417,7 +417,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
!(await confirmDialog({
|
||||
title: t("Stop server"),
|
||||
message: `Stop ${server.name} immediately? This is a hard power-off, not a graceful shutdown — use Shutdown instead if the guest OS should get a chance to close down cleanly.`,
|
||||
confirmLabel: "Stop now",
|
||||
confirmLabel: t("Stop now"),
|
||||
danger: true,
|
||||
}))
|
||||
)
|
||||
@@ -493,7 +493,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
{adminLinkForm && (
|
||||
<form onSubmit={submitAdminLink} className="row g-2 align-items-end mb-3">
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Label</label>
|
||||
<label className="form-label">{t("Label")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -522,7 +522,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
value={adminLinkPortPick}
|
||||
onChange={(e) => pickAdminLinkPort(e.target.value)}
|
||||
>
|
||||
<option value="">— pick a port to fill in the URL above —</option>
|
||||
<option value="">{t("— pick a port to fill in the URL above —")}</option>
|
||||
{adminLinkPorts.map((p) => (
|
||||
<option key={`${p.protocol}:${p.port}`} value={`${p.protocol}:${p.port}`}>
|
||||
{portOptionLabel(p)}
|
||||
@@ -629,7 +629,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
<ErrorNotice error={guestActionError} />
|
||||
<div className="row g-3">
|
||||
<div className="col-sm-6">
|
||||
<div className="text-secondary small">CPU</div>
|
||||
<div className="text-secondary small">{t("CPU")}</div>
|
||||
<div>
|
||||
{hardware.cpuCores ?? "—"} cores
|
||||
{hardware.cpuUsagePercent !== null && hardware.cpuUsagePercent !== undefined
|
||||
@@ -638,7 +638,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-sm-6">
|
||||
<div className="text-secondary small">Memory</div>
|
||||
<div className="text-secondary small">{t("Memory")}</div>
|
||||
<div>
|
||||
{formatBytes(hardware.memUsedBytes)} / {formatBytes(hardware.memTotalBytes)}
|
||||
</div>
|
||||
@@ -649,7 +649,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
<div>{formatBytes(hardware.diskBytes)}</div>
|
||||
</div>
|
||||
<div className="col-sm-6">
|
||||
<div className="text-secondary small">Uptime</div>
|
||||
<div className="text-secondary small">{t("Uptime")}</div>
|
||||
<div>{formatUptime(hardware.uptime)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -677,7 +677,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="row g-3">
|
||||
<div className="col-sm-6">
|
||||
<div className="text-secondary small">CPU</div>
|
||||
<div className="text-secondary small">{t("CPU")}</div>
|
||||
<div>
|
||||
{hardware.cpuModel || "Unknown model"}
|
||||
{hardware.cpuCores ? ` · ${hardware.cpuCores} cores` : ""}
|
||||
@@ -687,7 +687,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
</div>
|
||||
<div className="col-sm-6">
|
||||
<div className="text-secondary small">Memory</div>
|
||||
<div className="text-secondary small">{t("Memory")}</div>
|
||||
<div>
|
||||
{formatBytes(hardware.memUsedBytes)} / {formatBytes(hardware.memTotalBytes)}
|
||||
</div>
|
||||
@@ -723,10 +723,10 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
</ServerBlock>
|
||||
|
||||
<ServerBlock id="identity" label="Identity" className="col-lg-5">
|
||||
<ServerBlock id="identity" label={t("Identity")} className="col-lg-5">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Identity</h3>
|
||||
<h3 className="card-title">{t("Identity")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<dl className="row mb-0">
|
||||
@@ -745,7 +745,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
</dd>
|
||||
{detail.os && (
|
||||
<>
|
||||
<dt className="col-5">System</dt>
|
||||
<dt className="col-5">{t("System")}</dt>
|
||||
<dd className="col-7">
|
||||
{detail.os.product}
|
||||
{detail.os.state === "ended" && <span className="badge bg-red-lt text-red ms-2" title={`Support ended on ${detail.os.endsOn}`}>support ended</span>}
|
||||
@@ -808,10 +808,10 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
<ServerBlock id="notes" label={t("Notes")} at={40}>
|
||||
<NotesCard targetType="server" targetId={server.id} canEdit={canEditTasks} />
|
||||
</ServerBlock>
|
||||
<ServerBlock id="runbooks" label="Runbooks" at={50}>
|
||||
<ServerBlock id="runbooks" label={t("Runbooks")} at={50}>
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Runbooks</h3>
|
||||
<h3 className="card-title">{t("Runbooks")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<RunbookPanel targetType="server" targetId={server.id} targetName={server.name} canEdit={canEditTasks} />
|
||||
@@ -880,7 +880,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="d-flex align-items-center mb-3">
|
||||
<h3 className="mb-0">Tasks</h3>
|
||||
<h3 className="mb-0">{t("Tasks")}</h3>
|
||||
{canEditTasks && (
|
||||
<button className="btn btn-primary btn-sm ms-auto" onClick={openAddTask}>
|
||||
{t("Add task")}
|
||||
@@ -929,7 +929,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">Schedule</label>
|
||||
<label className="form-label">{t("Schedule")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
placeholder="e.g. daily at 02:00, or 0 2 * * *"
|
||||
|
||||
@@ -100,7 +100,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
setAutoUpdate(value);
|
||||
try {
|
||||
await api.servers.setAgentAutoUpdate(value);
|
||||
toast.success(value ? "Agents that are behind will update themselves at their next run." : "Agents will no longer update themselves.");
|
||||
toast.success(value ? t("Agents that are behind will update themselves at their next run.") : t("Agents will no longer update themselves."));
|
||||
} catch (err) {
|
||||
setAutoUpdate(!value);
|
||||
toast.error(readableError(err));
|
||||
@@ -139,7 +139,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function deleteServer(id: number) {
|
||||
if (!(await confirmDialog({ title: t("Remove server"), message: "Remove this server and all its tracked tasks?", confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove server"), message: t("Remove this server and all its tracked tasks?"), confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.servers.remove(id);
|
||||
toast.success(t("Server removed."));
|
||||
@@ -516,7 +516,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
<EmptyState
|
||||
title={t("No servers yet")}
|
||||
hint={t("Add a server and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates, and the app can tell when it goes quiet.")}
|
||||
action={isAdmin ? { label: "Add a server", onClick: () => setManagingServers(true) } : undefined}
|
||||
action={isAdmin ? { label: t("Add a server"), onClick: () => setManagingServers(true) } : undefined}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -29,10 +29,10 @@ function span(minutes: number): string {
|
||||
|
||||
const COLOR = { ok: "#2fb344", at_risk: "#f59f00", breached: "#e05252", no_data: "#9aa0a6" } as const;
|
||||
const BADGE = {
|
||||
ok: { label: "Within budget", cls: "bg-green-lt text-green" },
|
||||
at_risk: { label: "Budget nearly used", cls: "bg-yellow-lt text-yellow" },
|
||||
breached: { label: "Target missed", cls: "bg-red-lt text-red" },
|
||||
no_data: { label: "Nothing to measure yet", cls: "bg-secondary-lt text-secondary" },
|
||||
ok: { get label() { return t("Within budget"); }, cls: "bg-green-lt text-green" },
|
||||
at_risk: { get label() { return t("Budget nearly used"); }, cls: "bg-yellow-lt text-yellow" },
|
||||
breached: { get label() { return t("Target missed"); }, cls: "bg-red-lt text-red" },
|
||||
no_data: { get label() { return t("Nothing to measure yet"); }, cls: "bg-secondary-lt text-secondary" },
|
||||
} as const;
|
||||
|
||||
interface Draft {
|
||||
@@ -72,7 +72,7 @@ function Card({ level: l, isAdmin, onEdit, onRemove }: { level: ServiceLevel; is
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{b.state === "no_data" ? (
|
||||
<div className="text-secondary">{l.subjectName === null ? "What this measured has been removed." : `Nothing has been recorded for ${l.period.label} yet. ${SUBJECT_HINTS[l.subjectType]}`}</div>
|
||||
<div className="text-secondary">{l.subjectName === null ? t("What this measured has been removed.") : `Nothing has been recorded for ${l.period.label} yet. ${SUBJECT_HINTS[l.subjectType]}`}</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="row g-3 mb-2">
|
||||
@@ -83,25 +83,25 @@ function Card({ level: l, isAdmin, onEdit, onRemove }: { level: ServiceLevel; is
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">Down</div>
|
||||
<div className="text-secondary small">{t("Down")}</div>
|
||||
<div className="h2 mb-0">{l.measure.downMinutes > 0 ? span(l.measure.downMinutes) : "—"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">Allowed this month</div>
|
||||
<div className="text-secondary small">{t("Allowed this month")}</div>
|
||||
<div className="h2 mb-0">{span(b.allowedMinutes)}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary small">{b.remainingMinutes >= 0 ? "Left in the budget" : "Over the budget by"}</div>
|
||||
<div className="text-secondary small">{b.remainingMinutes >= 0 ? t("Left in the budget") : t("Over the budget by")}</div>
|
||||
<div className="h2 mb-0" style={{ color: b.remainingMinutes < 0 ? COLOR.breached : undefined }}>
|
||||
{b.remainingMinutes >= 0 ? span(b.remainingMinutes) : span(-b.remainingMinutes)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="progress progress-sm mb-1" role="progressbar" aria-label="Error budget used" aria-valuenow={Math.min(100, Math.round(used))} aria-valuemin={0} aria-valuemax={100}>
|
||||
<div className="progress progress-sm mb-1" role="progressbar" aria-label={t("Error budget used")} aria-valuenow={Math.min(100, Math.round(used))} aria-valuemin={0} aria-valuemax={100}>
|
||||
<div className="progress-bar" style={{ width: `${Math.min(100, used)}%`, background: COLOR[b.state] }} />
|
||||
</div>
|
||||
<div className="text-secondary small">
|
||||
{used >= 100 ? "The whole error budget is used" : `${Math.round(used)}% of the error budget is used`}
|
||||
{used >= 100 ? t("The whole error budget is used") : `${Math.round(used)}% of the error budget is used`}
|
||||
{b.projectedPercent !== null && b.state !== "breached" ? ` · at this pace, about ${b.projectedPercent}% by the end of the month` : ""}
|
||||
{l.alert ? "" : " · no alert for this one"}
|
||||
</div>
|
||||
@@ -109,7 +109,7 @@ function Card({ level: l, isAdmin, onEdit, onRemove }: { level: ServiceLevel; is
|
||||
)}
|
||||
{l.history.some((h) => h.percent !== null) && (
|
||||
<div className="mt-3">
|
||||
<div className="text-secondary small mb-1">The months before</div>
|
||||
<div className="text-secondary small mb-1">{t("The months before")}</div>
|
||||
<div className="d-flex flex-wrap gap-2">
|
||||
{l.history.map((h) => (
|
||||
<span
|
||||
@@ -163,7 +163,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
if (draft.id === null) await api.serviceLevels.create(input);
|
||||
else await api.serviceLevels.update(draft.id, input);
|
||||
toast.success(draft.id === null ? `Set a target for ${input.name}.` : "Saved.");
|
||||
toast.success(draft.id === null ? `Set a target for ${input.name}.` : t("Saved."));
|
||||
setDraft(null);
|
||||
load();
|
||||
} catch (err) {
|
||||
@@ -174,7 +174,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
async function remove(l: ServiceLevel) {
|
||||
if (!(await confirmDialog({ title: "Remove a target", message: `Remove the target for "${l.name}"? What was measured is kept; only the target goes.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove a target"), message: `Remove the target for "${l.name}"? What was measured is kept; only the target goes.`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.serviceLevels.remove(l.id);
|
||||
load();
|
||||
@@ -186,10 +186,10 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-1">
|
||||
<h3 className="mb-0">Service levels</h3>
|
||||
<h3 className="mb-0">{t("Service levels")}</h3>
|
||||
{isAdmin && !draft && (
|
||||
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
|
||||
Set a target
|
||||
{t("Set a target")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -203,7 +203,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
{draft && data && (
|
||||
<form className="card mb-3" onSubmit={save}>
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">{draft.id === null ? "Set a target" : `Edit ${draft.name || "the target"}`}</h3>
|
||||
<h3 className="card-title">{draft.id === null ? t("Set a target") : `Edit ${draft.name || "the target"}`}</h3>
|
||||
</div>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-4">
|
||||
@@ -214,7 +214,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="sl-type">
|
||||
Measured on
|
||||
{t("Measured on")}
|
||||
</label>
|
||||
<select
|
||||
id="sl-type"
|
||||
@@ -231,10 +231,10 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="sl-subject">
|
||||
Which one
|
||||
{t("Which one")}
|
||||
</label>
|
||||
<select id="sl-subject" className="form-select" required value={draft.subjectId} onChange={(e) => set("subjectId", e.target.value)}>
|
||||
<option value="">— choose —</option>
|
||||
<option value="">{t("— choose —")}</option>
|
||||
{subjects.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -245,7 +245,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="sl-target">
|
||||
Target, per calendar month
|
||||
{t("Target, per calendar month")}
|
||||
</label>
|
||||
<div className="input-group">
|
||||
<input id="sl-target" type="number" className="form-control" required min={90} max={99.999} step="any" value={draft.target} onChange={(e) => set("target", e.target.value)} />
|
||||
@@ -264,7 +264,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="card-footer d-flex gap-2">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === "" || draft.subjectId === ""}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
{busy ? "Saving…" : t("Save")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -278,9 +278,9 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState
|
||||
title="No targets are set"
|
||||
title={t("No targets are set")}
|
||||
hint="Say how available something should be — an endpoint check, a server, an integration — and see what is left of the month's error budget."
|
||||
action={isAdmin ? { label: "Set a target", onClick: () => setDraft({ ...EMPTY }) } : undefined}
|
||||
action={isAdmin ? { label: t("Set a target"), onClick: () => setDraft({ ...EMPTY }) } : undefined}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,14 +4,14 @@ import { searchSettings } from "../utils/settingsIndex";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const SUB_NAV = [
|
||||
{ to: "/settings/notifications", label: "Notifications" },
|
||||
{ to: "/settings/sign-in", label: "Sign-in" },
|
||||
{ to: "/settings/display", label: "Display" },
|
||||
{ to: "/settings/names", label: "Names" },
|
||||
{ to: "/settings/tags", label: "Tags" },
|
||||
{ to: "/settings/share", label: "Share links" },
|
||||
{ to: "/settings/api", label: "API and webhooks" },
|
||||
{ to: "/settings/data", label: "Data" },
|
||||
{ to: "/settings/notifications", get label() { return t("Notifications"); } },
|
||||
{ to: "/settings/sign-in", get label() { return t("Sign-in"); } },
|
||||
{ to: "/settings/display", get label() { return t("Display"); } },
|
||||
{ to: "/settings/names", get label() { return t("Names"); } },
|
||||
{ to: "/settings/tags", get label() { return t("Tags"); } },
|
||||
{ to: "/settings/share", get label() { return t("Share links"); } },
|
||||
{ to: "/settings/api", get label() { return t("API and webhooks"); } },
|
||||
{ to: "/settings/data", get label() { return t("Data"); } },
|
||||
];
|
||||
|
||||
/** A box that finds a setting by what it does ("quiet hours", "prometheus", "disk full") and goes to where it is set. */
|
||||
|
||||
@@ -3,14 +3,15 @@ import { useParams } from "react-router-dom";
|
||||
import { IconAlertTriangle, IconCircleCheck, IconHelpCircle, IconTool } from "@tabler/icons-react";
|
||||
import { api, type PublicStatus, type PublicStatusItem } from "../api/client";
|
||||
import { formatDateTime, setDateTimeSettings } from "../utils/date";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const REFRESH_MS = 30_000;
|
||||
|
||||
const STATE: Record<PublicStatusItem["state"], { label: string; badge: string }> = {
|
||||
up: { label: "Working", badge: "bg-green-lt text-green" },
|
||||
trouble: { label: "Having trouble", badge: "bg-yellow-lt text-yellow" },
|
||||
down: { label: "Not working", badge: "bg-red-lt text-red" },
|
||||
maintenance: { label: "Being worked on", badge: "bg-blue-lt text-blue" },
|
||||
up: { get label() { return t("Working"); }, badge: "bg-green-lt text-green" },
|
||||
trouble: { get label() { return t("Having trouble"); }, badge: "bg-yellow-lt text-yellow" },
|
||||
down: { get label() { return t("Not working"); }, badge: "bg-red-lt text-red" },
|
||||
maintenance: { get label() { return t("Being worked on"); }, badge: "bg-blue-lt text-blue" },
|
||||
unknown: { label: "Can't tell right now", badge: "bg-secondary-lt text-secondary" },
|
||||
};
|
||||
|
||||
@@ -27,15 +28,15 @@ function headline(page: PublicStatus): string {
|
||||
if (page.items.length === 0) return "Nothing to show yet";
|
||||
switch (page.level) {
|
||||
case "issue":
|
||||
return counts.down === 1 ? "One thing isn't working" : `${counts.down} things aren't working`;
|
||||
return counts.down === 1 ? t("One thing isn't working") : `${counts.down} things aren't working`;
|
||||
case "trouble":
|
||||
return counts.trouble === 1 ? "One thing is having trouble" : `${counts.trouble} things are having trouble`;
|
||||
return counts.trouble === 1 ? t("One thing is having trouble") : `${counts.trouble} things are having trouble`;
|
||||
case "maintenance":
|
||||
return counts.maintenance === 1 ? "One thing is being worked on" : `${counts.maintenance} things are being worked on`;
|
||||
return counts.maintenance === 1 ? t("One thing is being worked on") : `${counts.maintenance} things are being worked on`;
|
||||
case "unknown":
|
||||
return "Can't tell right now";
|
||||
default:
|
||||
return counts.unknown > 0 ? "Everything we can see is working" : "Everything is working";
|
||||
return counts.unknown > 0 ? t("Everything we can see is working") : t("Everything is working");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ export default function SharedStatus() {
|
||||
}, [token]);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = page?.title ?? "Status";
|
||||
document.title = page?.title ?? t("Status");
|
||||
}, [page?.title]);
|
||||
|
||||
return (
|
||||
@@ -98,7 +99,7 @@ export default function SharedStatus() {
|
||||
{state === "dead" ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-center py-5">
|
||||
<div className="h3 mb-1">This link doesn't work any more</div>
|
||||
<div className="h3 mb-1">{t("This link doesn't work any more")}</div>
|
||||
<div className="text-secondary">It may have ended or been taken back. Ask whoever gave it to you for a new one.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function SharedWall() {
|
||||
<span className="wall-status-symbol" aria-hidden="true">
|
||||
?
|
||||
</span>
|
||||
<span>This link doesn't work any more</span>
|
||||
<span>{t("This link doesn't work any more")}</span>
|
||||
</section>
|
||||
<div className="wall-empty">It may have ended or been taken back. Ask whoever gave it to you for a new one.</div>
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@ export default function SharedWall() {
|
||||
rotation={{ seconds: rotation.seconds, onChange: rotation.setSeconds }}
|
||||
footerActions={
|
||||
<button type="button" className="wall-link" onClick={() => void document.documentElement.requestFullscreen?.().catch(() => {})}>
|
||||
Full screen
|
||||
{t("Full screen")}
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -14,7 +14,7 @@ import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ s }: { s: SpeedtestInfo }) {
|
||||
if (!s.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!s.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!s.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!s.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (s.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
@@ -72,7 +72,7 @@ function History({ id, name }: { id: number; name: string }) {
|
||||
return (
|
||||
<div className="mt-3">
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<h4 className="mb-0">How fast it has been</h4>
|
||||
<h4 className="mb-0">{t("How fast it has been")}</h4>
|
||||
<div className="ms-auto">
|
||||
<RangeSelect value={shown} onChange={setDays} only={[1, 7, 30, 90]} />
|
||||
</div>
|
||||
@@ -118,7 +118,7 @@ function Card({ s, canRead, onRead }: { s: SpeedtestInfo; canRead: boolean; onRe
|
||||
<>
|
||||
<div className="row g-3">
|
||||
<Tile label="Download, latest" value={mbit(latest?.download ?? null)} sub={dl !== null && share(latest?.download ?? null, dl) !== null ? `${share(latest?.download ?? null, dl)}% of the ${dl} Mbit/s it is sold at` : null} />
|
||||
<Tile label="Upload, latest" value={mbit(latest?.upload ?? null)} sub={ul !== null && share(latest?.upload ?? null, ul) !== null ? `${share(latest?.upload ?? null, ul)}% of the ${ul} Mbit/s it is sold at` : null} />
|
||||
<Tile label={t("Upload, latest")} value={mbit(latest?.upload ?? null)} sub={ul !== null && share(latest?.upload ?? null, ul) !== null ? `${share(latest?.upload ?? null, ul)}% of the ${ul} Mbit/s it is sold at` : null} />
|
||||
<Tile label="Ping, latest" value={latest?.ping == null ? "—" : `${Math.round(latest.ping)} ms`} sub={latest ? undefined : "no completed test yet"} />
|
||||
<Tile
|
||||
label={`The middle of the last ${st.middle.count || 3}`}
|
||||
@@ -171,14 +171,14 @@ export default function Speedtest({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">Speedtest</h2>
|
||||
<PageIntro>
|
||||
What Speedtest Tracker has measured, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — this app never starts a test. <strong>The internet slower than it is sold at</strong> and <strong>speed tests that keep failing</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
What Speedtest Tracker has measured, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — this app never starts a test. <strong>{t("The internet slower than it is sold at")}</strong> and <strong>speed tests that keep failing</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Speedtest Tracker connected" hint="Add one under Integrations with its address and an API token (profile menu → API tokens, with the results:read ability)." />
|
||||
<EmptyState title={t("No Speedtest Tracker connected")} hint="Add one under Integrations with its address and an API token (profile menu → API tokens, with the results:read ability)." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+22
-22
@@ -145,7 +145,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Synology integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
|
||||
No Synology integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -179,14 +179,14 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">System</h3>
|
||||
<h3 className="card-title">{t("System")}</h3>
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
onClick={() => selected && loadSystem(selected.id)}
|
||||
disabled={loadingSystem}
|
||||
>
|
||||
{loadingSystem ? "Refreshing…" : "Refresh"}
|
||||
{loadingSystem ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -200,11 +200,11 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<div>{system?.hostname ?? "—"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Model</div>
|
||||
<div className="text-secondary">{t("Model")}</div>
|
||||
<div>{system?.model ?? "—"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Uptime</div>
|
||||
<div className="text-secondary">{t("Uptime")}</div>
|
||||
<div>{formatUptime(system?.uptime ?? null)}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
@@ -212,7 +212,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<div>{system?.ipAddresses.length ? system.ipAddresses.join(", ") : "—"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">CPU</div>
|
||||
<div className="text-secondary">{t("CPU")}</div>
|
||||
<div>
|
||||
{system?.cpu.loadPercent !== null && system?.cpu.loadPercent !== undefined
|
||||
? `${system.cpu.loadPercent.toFixed(0)}%`
|
||||
@@ -227,17 +227,17 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Memory</div>
|
||||
<div className="text-secondary">{t("Memory")}</div>
|
||||
<div>
|
||||
{formatBytes(system?.memory.usedBytes ?? null)} / {formatBytes(system?.memory.totalBytes ?? null)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Serial</div>
|
||||
<div className="text-secondary">{t("Serial")}</div>
|
||||
<div>{system?.serial ?? "—"}</div>
|
||||
</div>
|
||||
<div className="col-6 col-md-3">
|
||||
<div className="text-secondary">Firmware</div>
|
||||
<div className="text-secondary">{t("Firmware")}</div>
|
||||
<div>{system?.firmwareVersion ?? "—"}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -248,7 +248,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Volumes</h3>
|
||||
<h3 className="card-title">{t("Volumes")}</h3>
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
@@ -262,7 +262,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadStorage(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -270,16 +270,16 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<SynologyVolume> label="Volume" sortKeyName="id" activeKey={volumeSortKey} direction={volumeSortDir} onSort={requestVolumeSort} />
|
||||
<SortableTh<SynologyVolume> label={t("Volume")} sortKeyName="id" activeKey={volumeSortKey} direction={volumeSortDir} onSort={requestVolumeSort} />
|
||||
<SortableTh<SynologyVolume>
|
||||
label="Type"
|
||||
label={t("Type")}
|
||||
sortKeyName="deviceType"
|
||||
activeKey={volumeSortKey}
|
||||
direction={volumeSortDir}
|
||||
onSort={requestVolumeSort}
|
||||
/>
|
||||
<SortableTh<SynologyVolume>
|
||||
label="Used"
|
||||
label={t("Used")}
|
||||
sortKeyName="sizeUsed"
|
||||
activeKey={volumeSortKey}
|
||||
direction={volumeSortDir}
|
||||
@@ -309,7 +309,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{sortedVolumes?.length === 0 && (
|
||||
<EmptyRow colSpan={4} title="No volumes found" hint="The NAS answered with none. Check the account's permissions in DSM." action={{ label: "Check the integration", to: "/integrations" }} />
|
||||
<EmptyRow colSpan={4} title={t("No volumes found")} hint="The NAS answered with none. Check the account's permissions in DSM." action={{ label: t("Check the integration"), to: "/integrations" }} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -319,7 +319,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Disks</h3>
|
||||
<h3 className="card-title">{t("Disks")}</h3>
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
@@ -334,16 +334,16 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<SynologyDisk> label="Disk" sortKeyName="name" activeKey={diskSortKey} direction={diskSortDir} onSort={requestDiskSort} />
|
||||
<SortableTh<SynologyDisk> label={t("Disk")} sortKeyName="name" activeKey={diskSortKey} direction={diskSortDir} onSort={requestDiskSort} />
|
||||
<SortableTh<SynologyDisk>
|
||||
label="Device"
|
||||
label={t("Device")}
|
||||
sortKeyName="device"
|
||||
activeKey={diskSortKey}
|
||||
direction={diskSortDir}
|
||||
onSort={requestDiskSort}
|
||||
/>
|
||||
<SortableTh<SynologyDisk>
|
||||
label="Temp"
|
||||
label={t("Temp")}
|
||||
sortKeyName="temp"
|
||||
activeKey={diskSortKey}
|
||||
direction={diskSortDir}
|
||||
@@ -374,13 +374,13 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
<td>{healthBadge(d.smartStatus)}</td>
|
||||
<td>
|
||||
{healthBadge(d.status)}
|
||||
{d.exceedBadSectorThreshold && <span className="badge bg-yellow-lt text-yellow ms-1">Bad sectors</span>}
|
||||
{d.belowRemainLifeThreshold && <span className="badge bg-yellow-lt text-yellow ms-1">Low life</span>}
|
||||
{d.exceedBadSectorThreshold && <span className="badge bg-yellow-lt text-yellow ms-1">{t("Bad sectors")}</span>}
|
||||
{d.belowRemainLifeThreshold && <span className="badge bg-yellow-lt text-yellow ms-1">{t("Low life")}</span>}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{sortedDisks?.length === 0 && (
|
||||
<EmptyRow colSpan={5} title="No disks found" hint="The NAS answered with none. Check the account's permissions in DSM." action={{ label: "Check the integration", to: "/integrations" }} />
|
||||
<EmptyRow colSpan={5} title={t("No disks found")} hint="The NAS answered with none. Check the account's permissions in DSM." action={{ label: t("Check the integration"), to: "/integrations" }} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+18
-18
@@ -29,14 +29,14 @@ const KEY_EXPIRY_WARN_DAYS = 30;
|
||||
|
||||
function keyExpiryBadge(device: TailscaleDevice) {
|
||||
if (device.keyExpiryDisabled || !device.keyExpiry) {
|
||||
return <span className="text-secondary">Never</span>;
|
||||
return <span className="text-secondary">{t("Never")}</span>;
|
||||
}
|
||||
const daysLeft = (new Date(device.keyExpiry).getTime() - Date.now()) / 86_400_000;
|
||||
const style =
|
||||
daysLeft < 0 ? "bg-red-lt text-red" : daysLeft <= KEY_EXPIRY_WARN_DAYS ? "bg-yellow-lt text-yellow" : "bg-green-lt text-green";
|
||||
return (
|
||||
<>
|
||||
{formatDateTime(new Date(device.keyExpiry))} <span className={`badge ${style} ms-1`}>{daysLeft < 0 ? "Expired" : `${Math.floor(daysLeft)}d left`}</span>
|
||||
{formatDateTime(new Date(device.keyExpiry))} <span className={`badge ${style} ms-1`}>{daysLeft < 0 ? t("Expired") : `${Math.floor(daysLeft)}d left`}</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
if (!selectedId) return;
|
||||
try {
|
||||
await api.integrations.tailscale.setAuthorized(selectedId, device.id, authorized);
|
||||
toast.success(`${authorized ? "Authorized" : "Deauthorized"} ${device.label || device.hostname}.`);
|
||||
toast.success(`${authorized ? t("Authorized") : t("Deauthorized")} ${device.label || device.hostname}.`);
|
||||
loadDevices(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -100,7 +100,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
|
||||
async function removeDevice(device: TailscaleDevice) {
|
||||
if (!selectedId) return;
|
||||
if (!(await confirmDialog({ title: "Remove device", message: `Remove device "${device.label || device.hostname}" from the tailnet?`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove device"), message: `Remove device "${device.label || device.hostname}" from the tailnet?`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.integrations.tailscale.remove(selectedId, device.id);
|
||||
toast.success(`Removed ${device.label || device.hostname} from the tailnet.`);
|
||||
@@ -131,7 +131,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
if (!selectedId) return;
|
||||
const ids = Array.from(selection.selected);
|
||||
if (ids.length === 0) return;
|
||||
if (!(await confirmDialog({ title: "Remove devices", message: `Remove ${ids.length} device${ids.length !== 1 ? "s" : ""} from the tailnet?`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove devices"), message: `Remove ${ids.length} device${ids.length !== 1 ? "s" : ""} from the tailnet?`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
setError(null);
|
||||
setBulkActing(true);
|
||||
try {
|
||||
@@ -176,7 +176,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Tailscale integration configured yet.{" "}
|
||||
<Link to="/integrations">Add one under Integrations</Link>.
|
||||
<Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -228,7 +228,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
onClick={() => selected && loadDevices(selected.id)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -236,16 +236,16 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
<div className="card-header bg-blue-lt d-flex align-items-center gap-2">
|
||||
<span>{selection.count} selected</span>
|
||||
<button className="btn btn-sm btn-primary" onClick={() => bulkSetAuthorized(true)} disabled={bulkActing}>
|
||||
Authorize
|
||||
{t("Authorize")}
|
||||
</button>
|
||||
<button className="btn btn-sm" onClick={() => bulkSetAuthorized(false)} disabled={bulkActing}>
|
||||
Deauthorize
|
||||
{t("Deauthorize")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={bulkRemove} disabled={bulkActing}>
|
||||
{t("Remove")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-link" onClick={selection.clear}>
|
||||
Clear selection
|
||||
{t("Clear selection")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -263,9 +263,9 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
</th>
|
||||
)}
|
||||
<SortableTh<TailscaleDevice> label="Device" sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<TailscaleDevice> label={t("Device")} sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<TailscaleDevice>
|
||||
label="Address"
|
||||
label={t("Address")}
|
||||
sortKeyName="primaryAddress"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -281,7 +281,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<TailscaleDevice>
|
||||
label="Key expiry"
|
||||
label={t("Key expiry")}
|
||||
sortKeyName="keyExpiry"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -305,7 +305,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
<td>
|
||||
{d.label || d.hostname}
|
||||
{d.isExitNode && <span className="badge bg-purple-lt ms-2">Exit node</span>}
|
||||
{d.isExitNode && <span className="badge bg-purple-lt ms-2">{t("Exit node")}</span>}
|
||||
</td>
|
||||
<td className="text-secondary">{d.primaryAddress}</td>
|
||||
<td>{d.os || "—"}</td>
|
||||
@@ -315,7 +315,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary me-1">{t("Offline")}</span>
|
||||
)}
|
||||
{!d.authorized && <span className="badge bg-yellow-lt text-yellow">Unauthorized</span>}
|
||||
{!d.authorized && <span className="badge bg-yellow-lt text-yellow">{t("Unauthorized")}</span>}
|
||||
</td>
|
||||
<td className="text-secondary">{d.lastSeen ? formatDateTime(new Date(d.lastSeen)) : "—"}</td>
|
||||
<td>{keyExpiryBadge(d)}</td>
|
||||
@@ -324,11 +324,11 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
<div className="btn-list flex-nowrap">
|
||||
{d.authorized ? (
|
||||
<button className="btn btn-sm" onClick={() => setDeviceAuthorized(d, false)}>
|
||||
Deauthorize
|
||||
{t("Deauthorize")}
|
||||
</button>
|
||||
) : (
|
||||
<button className="btn btn-sm btn-primary" onClick={() => setDeviceAuthorized(d, true)}>
|
||||
Authorize
|
||||
{t("Authorize")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => removeDevice(d)}>
|
||||
@@ -340,7 +340,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={canEdit ? 8 : 6} title="No devices" hint="Devices appear here once they have joined the tailnet." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={canEdit ? 8 : 6} title={t("No devices")} hint={t("Devices appear here once they have joined the tailnet.")} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -13,7 +13,7 @@ import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ a }: { a: TechnitiumInstance }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
@@ -86,10 +86,10 @@ function ClusterSection({ cluster }: { cluster: NonNullable<TechnitiumInstance["
|
||||
<table className="table table-sm table-vcenter mb-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Node</th>
|
||||
<th>Role</th>
|
||||
<th>State</th>
|
||||
<th>Version</th>
|
||||
<th>{t("Node")}</th>
|
||||
<th>{t("Role")}</th>
|
||||
<th>{t("State")}</th>
|
||||
<th>{t("Version")}</th>
|
||||
<th>{t("Last seen")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -172,28 +172,28 @@ function Card({ a, canRead, onRead }: { a: TechnitiumInstance; canRead: boolean;
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile
|
||||
label={t("DNS answers")}
|
||||
value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"}
|
||||
value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : t("No")}
|
||||
sub={s.probe ? (s.probe.ok ? `a question about ${s.probe.name}, asked ${s.probe.host}:${s.dnsPort}` : `${s.probe.error ?? "no answer"} (${s.probe.host}:${s.dnsPort})`) : "no test yet"}
|
||||
tone={s.probe && !s.probe.ok ? "bad" : undefined}
|
||||
/>
|
||||
<Tile
|
||||
label="Blocking"
|
||||
value={s.blockingEnabled ? "On" : "Off"}
|
||||
label={t("Blocking")}
|
||||
value={s.blockingEnabled ? t("On") : t("Off")}
|
||||
sub={s.blockingEnabled ? (s.settings.blockLists.count === 0 ? "no block lists are set up" : null) : s.blockingOffSince ? `since ${formatAgo(s.blockingOffSince)}` : null}
|
||||
tone={!s.blockingEnabled && s.settings.blockLists.count > 0 ? "warn" : undefined}
|
||||
/>
|
||||
<Tile label="Queries, last day" value={st ? st.queries.toLocaleString() : "—"} sub={st ? `from ${st.clients.toLocaleString()} client${st.clients === 1 ? "" : "s"}` : "could not be read"} />
|
||||
<Tile label="Blocked" value={st ? st.blocked.toLocaleString() : "—"} sub={st ? (st.blockedPercent === null ? null : `${st.blockedPercent}% of the queries`) : "could not be read"} />
|
||||
<Tile label="From the cache" value={st ? (st.cachedPercent === null ? "—" : `${st.cachedPercent}%`) : "—"} sub={st ? `${st.cached.toLocaleString()} queries` : "could not be read"} />
|
||||
<Tile label={t("Queries, last day")} value={st ? st.queries.toLocaleString() : "—"} sub={st ? `from ${st.clients.toLocaleString()} client${st.clients === 1 ? "" : "s"}` : "could not be read"} />
|
||||
<Tile label={t("Blocked")} value={st ? st.blocked.toLocaleString() : "—"} sub={st ? (st.blockedPercent === null ? null : `${st.blockedPercent}% of the queries`) : "could not be read"} />
|
||||
<Tile label={t("From the cache")} value={st ? (st.cachedPercent === null ? "—" : `${st.cachedPercent}%`) : "—"} sub={st ? `${st.cached.toLocaleString()} queries` : "could not be read"} />
|
||||
<Tile
|
||||
label="Failed"
|
||||
label={t("Failed")}
|
||||
value={st ? (st.failurePercent === null ? "—" : `${st.failurePercent}%`) : "—"}
|
||||
sub={st ? `${st.serverFailure.toLocaleString()} server failures, ${st.refused.toLocaleString()} refused` : "could not be read"}
|
||||
tone={st && st.failurePercent !== null && st.queries >= 200 && st.failurePercent >= 20 ? "warn" : undefined}
|
||||
/>
|
||||
<Tile label="Running for" value={s.startedAt ? upFor(s.startedAt) : "—"} sub={s.startedAt ? `since ${new Date(s.startedAt).toLocaleString()}` : "it did not say"} />
|
||||
<Tile label={t("Running for")} value={s.startedAt ? upFor(s.startedAt) : "—"} sub={s.startedAt ? `since ${new Date(s.startedAt).toLocaleString()}` : "it did not say"} />
|
||||
<Tile
|
||||
label="DNS cache"
|
||||
label={t("DNS cache")}
|
||||
value={st && st.cachedEntries !== null ? st.cachedEntries.toLocaleString() : "—"}
|
||||
sub={cacheFill !== null ? `${cacheFill}% of ${cacheMax!.toLocaleString()} entries` : cacheMax !== null ? `up to ${cacheMax.toLocaleString()} entries` : null}
|
||||
tone={cacheFill !== null && cacheFill >= 95 ? "warn" : undefined}
|
||||
@@ -202,7 +202,7 @@ function Card({ a, canRead, onRead }: { a: TechnitiumInstance; canRead: boolean;
|
||||
|
||||
{st && st.queries > 0 && (
|
||||
<div className="mb-3">
|
||||
<h4>How the queries were answered</h4>
|
||||
<h4>{t("How the queries were answered")}</h4>
|
||||
<div className="progress mb-1">
|
||||
{HOW.map((h) => (
|
||||
<div key={h.key} className={`progress-bar ${h.className}`} style={{ width: `${(st[h.key] / st.queries) * 100}%` }} title={`${h.label}: ${st[h.key].toLocaleString()}`} />
|
||||
@@ -221,17 +221,17 @@ function Card({ a, canRead, onRead }: { a: TechnitiumInstance; canRead: boolean;
|
||||
|
||||
{st && (st.topBlocked.length > 0 || st.topClients.length > 0 || st.topDomains.length > 0) && (
|
||||
<div className="row g-3 mb-3">
|
||||
<Counted title="Blocked most" items={st.topBlocked} empty="Nothing blocked." />
|
||||
<Counted title="Asked about most" items={st.topDomains} empty="No queries." />
|
||||
<Counted title="Asking most" items={st.topClients} empty="No clients." />
|
||||
<Counted title={t("Blocked most")} items={st.topBlocked} empty="Nothing blocked." />
|
||||
<Counted title={t("Asked about most")} items={st.topDomains} empty="No queries." />
|
||||
<Counted title={t("Asking most")} items={st.topClients} empty="No clients." />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<ClusterSection cluster={s.cluster} />
|
||||
|
||||
<h4>Zones</h4>
|
||||
<h4>{t("Zones")}</h4>
|
||||
{s.zones === null ? (
|
||||
<div className="text-secondary small mb-3">They could not be read.</div>
|
||||
<div className="text-secondary small mb-3">{t("They could not be read.")}</div>
|
||||
) : (
|
||||
<div className="small mb-3">
|
||||
<div className="text-secondary">
|
||||
@@ -320,7 +320,7 @@ export default function TechnitiumDns({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">Technitium DNS</h2>
|
||||
<PageIntro>
|
||||
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web console can be up while DNS is not. Nothing is changed. <strong>DNS that stops answering</strong>, <strong>blocking left off for an hour</strong>,{" "}
|
||||
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web console can be up while DNS is not. Nothing is changed. <strong>{t("DNS that stops answering")}</strong>, <strong>blocking left off for an hour</strong>,{" "}
|
||||
<strong>block lists that stopped updating</strong> and <strong>an expired or unsynced zone</strong>, <strong>a cluster node that cannot be reached</strong> and <strong>a secondary that has stopped taking the primary's configuration</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>. Technitium does not report the CPU, memory or disk of the machine it runs on: put a <Link to="/servers">server agent</Link> there for that.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -328,7 +328,7 @@ export default function TechnitiumDns({ user }: { user: CurrentUser }) {
|
||||
{data && data.length === 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No Technitium DNS Server connected" hint="Add one under Integrations with the address of its web console and an API token (Administration → Sessions → Create Token). Zones and records are connected separately, under DNS." />
|
||||
<EmptyState title={t("No Technitium DNS Server connected")} hint="Add one under Integrations with the address of its web console and an API token (Administration → Sessions → Create Token). Zones and records are connected separately, under DNS." />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -103,7 +103,7 @@ function JobForm({ initial, people, places, busy, submitLabel, onSubmit, onCance
|
||||
</div>
|
||||
<div className="d-flex gap-2 mt-3">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || title.trim() === ""}>
|
||||
{busy ? "Saving…" : submitLabel}
|
||||
{busy ? t("Saving…") : submitLabel}
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button type="button" className="btn" onClick={onCancel}>
|
||||
@@ -186,7 +186,7 @@ export default function Todo({ user }: { user: CurrentUser }) {
|
||||
await api.todos.update(todo.id, { done: finished });
|
||||
if (finished) {
|
||||
toast.success(`Done: ${todo.title}`, {
|
||||
label: "Undo",
|
||||
label: t("Undo"),
|
||||
onClick: async () => {
|
||||
try {
|
||||
await api.todos.update(todo.id, { done: false });
|
||||
|
||||
+19
-19
@@ -22,10 +22,10 @@ function Badge({ u }: { u: UpsInfo }) {
|
||||
const s = u.state;
|
||||
if (!s) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!u.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (s.onBattery && s.lowBattery) return <span className="badge bg-red text-white">On battery — nearly empty</span>;
|
||||
if (s.onBattery) return <span className="badge bg-red-lt text-red">On battery</span>;
|
||||
if (s.lowBattery) return <span className="badge bg-red-lt text-red">Battery low</span>;
|
||||
return <span className="badge bg-green-lt text-green">On mains power</span>;
|
||||
if (s.onBattery && s.lowBattery) return <span className="badge bg-red text-white">{t("On battery — nearly empty")}</span>;
|
||||
if (s.onBattery) return <span className="badge bg-red-lt text-red">{t("On battery")}</span>;
|
||||
if (s.lowBattery) return <span className="badge bg-red-lt text-red">{t("Battery low")}</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("On mains power")}</span>;
|
||||
}
|
||||
|
||||
function Tile({ label, value, sub, bar }: { label: string; value: string; sub?: string; bar?: { percent: number; color: string } }) {
|
||||
@@ -92,23 +92,23 @@ function History({ id, name }: { id: number; name: string }) {
|
||||
{!history && !error && <BlockSkeleton lines={4} />}
|
||||
{history && (
|
||||
<>
|
||||
<div className="text-secondary small mb-1">Battery charge</div>
|
||||
<div className="text-secondary small mb-1">{t("Battery charge")}</div>
|
||||
<div className="mb-3">
|
||||
<TimeChart series={charge} from={from} to={to} unit="%" compact label={`${name}: battery charge`} empty="Nothing read in this stretch yet." />
|
||||
</div>
|
||||
<div className="text-secondary small mb-1">Load</div>
|
||||
<div className="text-secondary small mb-1">{t("Load")}</div>
|
||||
<div className="mb-3">
|
||||
<TimeChart series={load} from={from} to={to} unit="%" compact label={`${name}: load`} empty="This UPS doesn't say how loaded it is." />
|
||||
</div>
|
||||
{hasVolts && (
|
||||
<>
|
||||
<div className="text-secondary small mb-1">Mains voltage (V)</div>
|
||||
<div className="text-secondary small mb-1">{t("Mains voltage (V)")}</div>
|
||||
<div className="mb-3">
|
||||
<TimeChart series={volts} from={from} to={to} unit="value" compact label={`${name}: mains voltage`} empty="" format={(v) => `${Math.round(v)} V`} />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div className="text-secondary small mb-1">Mains power lost</div>
|
||||
<div className="text-secondary small mb-1">{t("Mains power lost")}</div>
|
||||
{history.onBatteryPeriods.length === 0 ? (
|
||||
<div className="text-secondary">Not at all in the last {shown === 1 ? "24 hours" : `${shown} days`}.</div>
|
||||
) : (
|
||||
@@ -147,7 +147,7 @@ function UpsCard({ u }: { u: UpsInfo }) {
|
||||
{u.status && !u.status.ok && (
|
||||
<div className="alert alert-warning" role="status">
|
||||
<div>
|
||||
Couldn’t be read: {u.status.error}.{s ? <> What is shown is from <TimeAgo value={s.updatedAt} />.</> : null}
|
||||
Couldn’t be read: {u.status.error}.{s ? <> {t("What is shown is from")} <TimeAgo value={s.updatedAt} />.</> : null}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -162,10 +162,10 @@ function UpsCard({ u }: { u: UpsInfo }) {
|
||||
)}
|
||||
{s ? (
|
||||
<div className="row row-cards mb-3">
|
||||
<Tile label="Battery" value={s.charge === null ? "—" : `${Math.round(s.charge)} %`} bar={s.charge === null ? undefined : { percent: s.charge, color: chargeColor }} sub={s.onBattery ? "running on it now" : s.statusText} />
|
||||
<Tile label={s.onBattery ? "Left on battery" : "Would last"} value={s.runtimeSeconds === null ? "—" : minutes(s.runtimeSeconds)} sub="at the present load" />
|
||||
<Tile label="Load" value={s.loadPercent === null ? "—" : `${Math.round(s.loadPercent)} %`} bar={s.loadPercent === null ? undefined : { percent: s.loadPercent, color: s.loadPercent >= 90 ? "#e05252" : "#4299e1" }} sub="of what it can carry" />
|
||||
<Tile label="Mains in" value={s.inputVoltage === null ? "—" : `${Math.round(s.inputVoltage)} V`} sub={s.outputVoltage === null ? undefined : `${Math.round(s.outputVoltage)} V out`} />
|
||||
<Tile label={t("Battery")} value={s.charge === null ? "—" : `${Math.round(s.charge)} %`} bar={s.charge === null ? undefined : { percent: s.charge, color: chargeColor }} sub={s.onBattery ? "running on it now" : s.statusText} />
|
||||
<Tile label={s.onBattery ? t("Left on battery") : t("Would last")} value={s.runtimeSeconds === null ? "—" : minutes(s.runtimeSeconds)} sub="at the present load" />
|
||||
<Tile label={t("Load")} value={s.loadPercent === null ? "—" : `${Math.round(s.loadPercent)} %`} bar={s.loadPercent === null ? undefined : { percent: s.loadPercent, color: s.loadPercent >= 90 ? "#e05252" : "#4299e1" }} sub="of what it can carry" />
|
||||
<Tile label={t("Mains in")} value={s.inputVoltage === null ? "—" : `${Math.round(s.inputVoltage)} V`} sub={s.outputVoltage === null ? undefined : `${Math.round(s.outputVoltage)} V out`} />
|
||||
</div>
|
||||
) : (
|
||||
!u.status && <div className="text-secondary mb-3">Not read yet — the first read happens within a minute of adding it.</div>
|
||||
@@ -176,10 +176,10 @@ function UpsCard({ u }: { u: UpsInfo }) {
|
||||
<History id={u.id} name={u.name} />
|
||||
</div>
|
||||
<div className="col-lg-5">
|
||||
<h4>On this UPS</h4>
|
||||
<h4>{t("On this UPS")}</h4>
|
||||
{u.carries.length === 0 ? (
|
||||
<EmptyState
|
||||
title="Nothing is recorded as needing it"
|
||||
title={t("Nothing is recorded as needing it")}
|
||||
hint={
|
||||
<>
|
||||
Say which servers it powers in the <Link to={`/map?view=dependencies&select=integration:${u.id}`}>dependency map</Link>, and they are listed here in the order to shut them down, and folded under this UPS’s alert if they go offline with it.
|
||||
@@ -192,7 +192,7 @@ function UpsCard({ u }: { u: UpsInfo }) {
|
||||
<ol className="list-group list-group-flush mb-2" style={{ listStyle: "none", paddingLeft: 0 }}>
|
||||
{[...steps.entries()].map(([step, items]) => (
|
||||
<li key={step} className="list-group-item px-0 d-flex gap-3">
|
||||
<span className="badge bg-blue-lt text-blue align-self-start" style={{ minWidth: 28 }} title={step === 1 ? "Shut down first" : `Shut down after step ${step - 1}`}>
|
||||
<span className="badge bg-blue-lt text-blue align-self-start" style={{ minWidth: 28 }} title={step === 1 ? t("Shut down first") : `Shut down after step ${step - 1}`}>
|
||||
{step}
|
||||
</span>
|
||||
<div className="d-flex flex-wrap gap-2">
|
||||
@@ -205,7 +205,7 @@ function UpsCard({ u }: { u: UpsInfo }) {
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
{u.orderLooped && <div className="text-secondary small">Some of these need each other, so their order here is only a guess.</div>}
|
||||
{u.orderLooped && <div className="text-secondary small">{t("Some of these need each other, so their order here is only a guess.")}</div>}
|
||||
<div className="text-secondary small">
|
||||
While this UPS runs on battery it counts as down in the dependency map: servers that go offline with it are folded under its alert instead of each being announced.
|
||||
</div>
|
||||
@@ -250,13 +250,13 @@ export default function Ups({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState
|
||||
title="No UPS is connected"
|
||||
title={t("No UPS is connected")}
|
||||
hint={
|
||||
<>
|
||||
Add an integration of type <strong>UPS</strong>: the address of the machine running NUT (<code>upsd</code>), or of the UPS’s network card for SNMP. The app only reads it.
|
||||
</>
|
||||
}
|
||||
action={user.role === "admin" ? { label: "Add an integration", to: "/integrations" } : undefined}
|
||||
action={user.role === "admin" ? { label: t("Add an integration"), to: "/integrations" } : undefined}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,15 +19,15 @@ import { t } from "../i18n";
|
||||
function statusBadge(monitor: UptimeKumaMonitor) {
|
||||
switch (monitor.status) {
|
||||
case "up":
|
||||
return <span className="badge bg-green-lt text-green">Up</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("Up")}</span>;
|
||||
case "down":
|
||||
return <span className="badge bg-red-lt text-red">Down</span>;
|
||||
return <span className="badge bg-red-lt text-red">{t("Down")}</span>;
|
||||
case "pending":
|
||||
return <span className="badge bg-yellow-lt text-yellow">Pending</span>;
|
||||
return <span className="badge bg-yellow-lt text-yellow">{t("Pending")}</span>;
|
||||
case "maintenance":
|
||||
return <span className="badge bg-blue-lt text-blue">{t("Maintenance")}</span>;
|
||||
default:
|
||||
return <span className="badge bg-secondary-lt text-secondary">Unknown</span>;
|
||||
return <span className="badge bg-secondary-lt text-secondary">{t("Unknown")}</span>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">
|
||||
No Uptime Kuma integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
|
||||
No Uptime Kuma integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -153,7 +153,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => selected && loadMonitors(selected.id)} disabled={loading}>
|
||||
{loading ? "Refreshing…" : "Refresh"}
|
||||
{loading ? t("Refreshing…") : t("Refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,19 +161,19 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<UptimeKumaMonitor> label="Monitor" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UptimeKumaMonitor> label={t("Monitor")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UptimeKumaMonitor> label={t("Target")} sortKeyName="target" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>{t("Server")}</th>
|
||||
<SortableTh<UptimeKumaMonitor> label={t("Status")} sortKeyName="status" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UptimeKumaMonitor>
|
||||
label="Response"
|
||||
label={t("Response")}
|
||||
sortKeyName="responseTimeMs"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<UptimeKumaMonitor> label="Uptime 24h" sortKeyName="uptime24h" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UptimeKumaMonitor> label="Uptime 30d" sortKeyName="uptime30d" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UptimeKumaMonitor> label={t("Uptime 24h")} sortKeyName="uptime24h" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UptimeKumaMonitor> label={t("Uptime 30d")} sortKeyName="uptime30d" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -205,7 +205,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
</tr>
|
||||
))}
|
||||
{sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={7} title="No monitors" hint="Add monitors in Uptime Kuma and they appear here, with the server each one watches." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={7} title={t("No monitors")} hint="Add monitors in Uptime Kuma and they appear here, with the server each one watches." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+10
-10
@@ -19,10 +19,10 @@ const ROLES: UserRole[] = ["viewer", "operator", "admin"];
|
||||
/** People and Signed in now: who has an account and what they may do, and who is signed in at this moment. Switched by `?view=sessions`. */
|
||||
const userTabs = (view: "people" | "sessions") => (
|
||||
<ViewTabs
|
||||
label="Users view"
|
||||
label={t("Users view")}
|
||||
tabs={[
|
||||
{ to: "/users", label: "People", active: view === "people" },
|
||||
{ to: "/users?view=sessions", label: "Signed in now", active: view === "sessions" },
|
||||
{ to: "/users", label: t("People"), active: view === "people" },
|
||||
{ to: "/users?view=sessions", label: t("Signed in now"), active: view === "sessions" },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -100,7 +100,7 @@ function People({ tabs }: { tabs: ReactNode }) {
|
||||
{followGroups && (
|
||||
<div className="alert alert-info">
|
||||
Roles are set from sign-in groups, so they can't be changed here: change a person's group in the identity provider, and their role follows at their next sign-in.{" "}
|
||||
<Link to="/settings/sign-in">Sign-in settings</Link>
|
||||
<Link to="/settings/sign-in">{t("Sign-in settings")}</Link>
|
||||
</div>
|
||||
)}
|
||||
<div className="card">
|
||||
@@ -112,11 +112,11 @@ function People({ tabs }: { tabs: ReactNode }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<UserRecord> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UserRecord> label="Email" sortKeyName="email" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UserRecord> label="Role" sortKeyName="role" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>Groups at last sign-in</th>
|
||||
<SortableTh<UserRecord> label={t("Email")} sortKeyName="email" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<UserRecord> label={t("Role")} sortKeyName="role" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>{t("Groups at last sign-in")}</th>
|
||||
<SortableTh<UserRecord>
|
||||
label="Last login"
|
||||
label={t("Last login")}
|
||||
sortKeyName="lastLoginAt"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
@@ -140,7 +140,7 @@ function People({ tabs }: { tabs: ReactNode }) {
|
||||
aria-label={`Role of ${u.name ?? u.email ?? "this user"}`}
|
||||
value={u.role}
|
||||
disabled={savingId === u.id || followGroups}
|
||||
title={followGroups ? "Set from sign-in groups" : undefined}
|
||||
title={followGroups ? t("Set from sign-in groups") : undefined}
|
||||
onChange={(e) => changeRole(u.id, e.target.value as UserRole)}
|
||||
>
|
||||
{ROLES.map((r) => (
|
||||
@@ -158,7 +158,7 @@ function People({ tabs }: { tabs: ReactNode }) {
|
||||
))}
|
||||
{users === null && <LoadingRow colSpan={5} />}
|
||||
{sorted?.length === 0 && (
|
||||
<EmptyRow colSpan={5} title="No users yet" hint="People appear here the first time they sign in through Authentik; you decide their role." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
<EmptyRow colSpan={5} title={t("No users yet")} hint="People appear here the first time they sign in through Authentik; you decide their role." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+12
-12
@@ -13,12 +13,12 @@ import { t } from "../i18n";
|
||||
type Row = AppVersions["rows"][number];
|
||||
|
||||
const LAG: Record<Row["lag"], { text: string; badge: string }> = {
|
||||
same: { text: "Up to date", badge: "bg-green-lt text-green" },
|
||||
same: { get text() { return t("Up to date"); }, badge: "bg-green-lt text-green" },
|
||||
patch: { text: "A patch behind", badge: "bg-blue-lt text-blue" },
|
||||
minor: { text: "A minor update behind", badge: "bg-yellow-lt text-yellow" },
|
||||
major: { text: "A major version behind", badge: "bg-red-lt text-red" },
|
||||
ahead: { text: "Ahead of the newest release", badge: "bg-secondary-lt text-secondary" },
|
||||
unknown: { text: "Not compared", badge: "bg-secondary-lt text-secondary" },
|
||||
ahead: { get text() { return t("Ahead of the newest release"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
unknown: { get text() { return t("Not compared"); }, badge: "bg-secondary-lt text-secondary" },
|
||||
};
|
||||
const ORDER: Record<Row["lag"], number> = { major: 0, minor: 1, patch: 2, unknown: 3, ahead: 4, same: 5 };
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function Versions({ user }: { user: CurrentUser }) {
|
||||
setBusy(true);
|
||||
try {
|
||||
adopt(await api.versions.save({ enabled, alertAfterDays }));
|
||||
toast.success(enabled ? "Saved." : "Switched off.");
|
||||
toast.success(enabled ? t("Saved.") : t("Switched off."));
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
} finally {
|
||||
@@ -92,7 +92,7 @@ export default function Versions({ user }: { user: CurrentUser }) {
|
||||
</span>
|
||||
</label>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2">
|
||||
<label htmlFor="alert-after">Warn when a newer release has been out for</label>
|
||||
<label htmlFor="alert-after">{t("Warn when a newer release has been out for")}</label>
|
||||
<input
|
||||
id="alert-after"
|
||||
className="form-control form-control-sm"
|
||||
@@ -106,12 +106,12 @@ export default function Versions({ user }: { user: CurrentUser }) {
|
||||
<span>days (0 = never)</span>
|
||||
{isAdmin && data.enabled && (
|
||||
<button className="btn btn-sm ms-auto" disabled={busy} onClick={() => void refresh()}>
|
||||
{busy ? "Looking…" : "Look up now"}
|
||||
{busy ? t("Looking…") : t("Look up now")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-secondary small mt-2">
|
||||
{data.enabled ? (data.lastCheckedAt ? <>Last looked up <TimeAgo value={data.lastCheckedAt} />.</> : "Not looked up yet — it is done a few minutes after it is switched on.") : "Switched off."} A warning is raised under <Link to="/alerts">{t("Alerts")}</Link> only with a number of days above 0.
|
||||
{data.enabled ? (data.lastCheckedAt ? <>{t("Last looked up")} <TimeAgo value={data.lastCheckedAt} />.</> : "Not looked up yet — it is done a few minutes after it is switched on.") : t("Switched off.")} A warning is raised under <Link to="/alerts">{t("Alerts")}</Link> only with a number of days above 0.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +119,7 @@ export default function Versions({ user }: { user: CurrentUser }) {
|
||||
{rows.length === 0 ? (
|
||||
<div className="card">
|
||||
<div className="card-body">
|
||||
<EmptyState title="No versions known yet" hint="An application's version is known once its integration has been read: Sonarr, Radarr, Prowlarr, Lidarr, Readarr, AdGuard Home, Grafana, Jellyfin, Immich, Paperless-ngx, Nextcloud, NetBox, Authentik and Prometheus are compared." />
|
||||
<EmptyState title={t("No versions known yet")} hint="An application's version is known once its integration has been read: Sonarr, Radarr, Prowlarr, Lidarr, Readarr, AdGuard Home, Grafana, Jellyfin, Immich, Paperless-ngx, Nextcloud, NetBox, Authentik and Prometheus are compared." />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -134,10 +134,10 @@ export default function Versions({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Application</th>
|
||||
<th>Running</th>
|
||||
<th>Newest release</th>
|
||||
<th>Compared</th>
|
||||
<th>{t("Application")}</th>
|
||||
<th>{t("Running")}</th>
|
||||
<th>{t("Newest release")}</th>
|
||||
<th>{t("Compared")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { api } from "../../api/client";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { toast } from "../../utils/toast";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
/**
|
||||
* Buttons on notifications: Acknowledge, Silence for an hour and Snooze until tomorrow, pressed from the message itself without signing in. Its own switch, saved at once (it is not
|
||||
@@ -27,7 +28,7 @@ export default function AlertActionsCard() {
|
||||
try {
|
||||
await api.settings.update({ alertActions: { enabled: value } });
|
||||
setEnabled(value);
|
||||
toast.success(value ? "Notifications now carry buttons." : "Buttons on notifications are switched off; their links stop working.");
|
||||
toast.success(value ? t("Notifications now carry buttons.") : "Buttons on notifications are switched off; their links stop working.");
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
} finally {
|
||||
@@ -38,16 +39,16 @@ export default function AlertActionsCard() {
|
||||
return (
|
||||
<div className="card mt-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Buttons on notifications</h3>
|
||||
<h3 className="card-title">{t("Buttons on notifications")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
Let a notification itself carry <strong>Acknowledge</strong>, <strong>Silence for an hour</strong> and <strong>Snooze until tomorrow</strong> — as buttons on an ntfy message or a phone push, and as a link in an email, a Gotify message, a Telegram message (a button), a Pushover message (a link) or the chat
|
||||
Let a notification itself carry <strong>{t("Acknowledge")}</strong>, <strong>{t("Silence for an hour")}</strong> and <strong>{t("Snooze until tomorrow")}</strong> — as buttons on an ntfy message or a phone push, and as a link in an email, a Gotify message, a Telegram message (a button), a Pushover message (a link) or the chat
|
||||
webhook — so a problem can be dealt with from the lock screen, without opening the app or signing in.
|
||||
</p>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={enabled === true} disabled={enabled === null || busy} onChange={(e) => void change(e.target.checked)} />
|
||||
<span className="form-check-label">Put buttons on notifications</span>
|
||||
<span className="form-check-label">{t("Put buttons on notifications")}</span>
|
||||
</label>
|
||||
<ul className="text-secondary small mb-3">
|
||||
<li>
|
||||
|
||||
@@ -9,9 +9,9 @@ import { PageSkeleton } from "../../components/Skeleton";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const SEVERITIES: { value: AlertTicketSeverity; label: string; hint: string }[] = [
|
||||
{ value: "critical", label: "Critical", hint: "A server down, a disk nearly full, a failed backup, something expired" },
|
||||
{ value: "warning", label: "Warning", hint: "Something about to expire, an integration failing" },
|
||||
{ value: "info", label: "Info", hint: "Updates waiting, monitors that can't be matched — rarely worth a ticket" },
|
||||
{ value: "critical", get label() { return t("Critical"); }, hint: "A server down, a disk nearly full, a failed backup, something expired" },
|
||||
{ value: "warning", get label() { return t("Warning"); }, get hint() { return t("Something about to expire, an integration failing"); } },
|
||||
{ value: "info", get label() { return t("Info"); }, get hint() { return t("Updates waiting, monitors that can't be matched — rarely worth a ticket"); } },
|
||||
];
|
||||
|
||||
/** Blank means "not set"; anything else must be a whole number. */
|
||||
@@ -132,24 +132,24 @@ export default function AlertTicketSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Open a ticket in osTicket when something goes wrong</h3>
|
||||
<h3 className="card-title">{t("Open a ticket in osTicket when something goes wrong")}</h3>
|
||||
<div className="card-actions">
|
||||
<label className="form-check form-switch mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={draft.enabled} onChange={(e) => set({ enabled: e.target.checked })} />
|
||||
<span className="form-check-label">{draft.enabled ? "On" : "Off"}</span>
|
||||
<span className="form-check-label">{draft.enabled ? t("On") : t("Off")}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
Every 15 minutes the problems on the <Link to="/alerts">Alerts page</Link> are checked, and one that is new and has lasted gets a ticket. One problem opens
|
||||
Every 15 minutes the problems on the <Link to="/alerts">{t("Alerts page")}</Link> are checked, and one that is new and has lasted gets a ticket. One problem opens
|
||||
one ticket, however many checks see it. Problems under a <Link to="/maintenance">maintenance window</Link> never do. osTicket's API can't close or update a
|
||||
ticket, so the ticket is yours from then on: close it in osTicket when it is dealt with, or — with a database login for it, set on the integration — from the Alerts page when you close the alert. The Alerts page shows which alerts have one.
|
||||
</p>
|
||||
<div className="alert alert-info">
|
||||
<div>
|
||||
<strong>Set this up in osTicket first.</strong> Under <em>Admin Panel → Manage → API Keys</em> add a key, tie it to this server's IP address (the one osTicket
|
||||
sees requests come from), and tick <em>Can create tickets</em>. Then enter the address and the key on the osTicket integration under{" "}
|
||||
<strong>{t("Set this up in osTicket first.")}</strong> {t("Under")} <em>Admin Panel → Manage → API Keys</em> add a key, tie it to this server's IP address (the one osTicket
|
||||
sees requests come from), and tick <em>{t("Can create tickets")}</em>. Then enter the address and the key on the osTicket integration under{" "}
|
||||
<Link to="/integrations">{t("Integrations")}</Link>.
|
||||
</div>
|
||||
</div>
|
||||
@@ -166,15 +166,15 @@ export default function AlertTicketSettings() {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{overview.integrations.length === 0 && <div className="form-hint text-warning">There is no osTicket integration yet. Add one under Integrations.</div>}
|
||||
{chosen && !chosen.enabled && <div className="form-hint text-warning">That integration is switched off.</div>}
|
||||
{overview.integrations.length === 0 && <div className="form-hint text-warning">{t("There is no osTicket integration yet. Add one under Integrations.")}</div>}
|
||||
{chosen && !chosen.enabled && <div className="form-hint text-warning">{t("That integration is switched off.")}</div>}
|
||||
</div>
|
||||
<div className="col-md-6 d-flex align-items-end">
|
||||
<button className="btn btn-outline-secondary" onClick={() => void sendTest()} disabled={busy !== null || dirty || !overview.settings.integrationId} title={dirty ? "Save first — the test uses the saved settings" : undefined}>
|
||||
{busy === "test" ? "Sending…" : "Send a test ticket"}
|
||||
<button className="btn btn-outline-secondary" onClick={() => void sendTest()} disabled={busy !== null || dirty || !overview.settings.integrationId} title={dirty ? t("Save first — the test uses the saved settings") : undefined}>
|
||||
{busy === "test" ? t("Sending…") : t("Send a test ticket")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary ms-2" onClick={() => void testClosing()} disabled={busy !== null || !overview.settings.integrationId || !chosen?.closeReady} title={chosen && !chosen.closeReady ? "This integration has no database login for closing tickets yet" : "Tries the login, the tables and the writes a close makes, and rolls them all back"}>
|
||||
{busy === "close" ? "Trying…" : "Test closing"}
|
||||
<button className="btn btn-outline-secondary ms-2" onClick={() => void testClosing()} disabled={busy !== null || !overview.settings.integrationId || !chosen?.closeReady} title={chosen && !chosen.closeReady ? t("This integration has no database login for closing tickets yet") : t("Tries the login, the tables and the writes a close makes, and rolls them all back")}>
|
||||
{busy === "close" ? t("Trying…") : t("Test closing")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
@@ -185,7 +185,7 @@ export default function AlertTicketSettings() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label">Tickets come from (name)</label>
|
||||
<label className="form-label">{t("Tickets come from (name)")}</label>
|
||||
<input className="form-control" maxLength={100} value={draft.requesterName} onChange={(e) => set({ requesterName: e.target.value })} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
@@ -194,11 +194,11 @@ export default function AlertTicketSettings() {
|
||||
<div className="form-hint">osTicket needs one for every ticket. Replies from staff would go here.</div>
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Help topic id</label>
|
||||
<label className="form-label">{t("Help topic id")}</label>
|
||||
<input className="form-control" inputMode="numeric" placeholder="default" value={draft.topicId ?? ""} onChange={(e) => set({ topicId: optionalNumber(e.target.value) })} />
|
||||
</div>
|
||||
<div className="col-md-2">
|
||||
<label className="form-label">Priority id</label>
|
||||
<label className="form-label">{t("Priority id")}</label>
|
||||
<input className="form-control" inputMode="numeric" placeholder="default" value={draft.priorityId ?? ""} onChange={(e) => set({ priorityId: optionalNumber(e.target.value) })} />
|
||||
</div>
|
||||
<div className="col-12">
|
||||
@@ -213,7 +213,7 @@ export default function AlertTicketSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Which problems</h3>
|
||||
<h3 className="card-title">{t("Which problems")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="row g-4">
|
||||
@@ -229,7 +229,7 @@ export default function AlertTicketSettings() {
|
||||
))}
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<div className="form-label">Kind</div>
|
||||
<div className="form-label">{t("Kind")}</div>
|
||||
<label className="form-check">
|
||||
<input type="checkbox" className="form-check-input" checked={draft.categories.length === 0} onChange={(e) => set({ categories: e.target.checked ? [] : overview.categories.map((c) => c.value) })} />
|
||||
<span className="form-check-label">{t("All kinds")}</span>
|
||||
@@ -248,19 +248,19 @@ export default function AlertTicketSettings() {
|
||||
</div>
|
||||
|
||||
<div className="col-md-4">
|
||||
<label className="form-label">Must last</label>
|
||||
<label className="form-label">{t("Must last")}</label>
|
||||
<select className="form-select" value={draft.confirmChecks} onChange={(e) => set({ confirmChecks: Number(e.target.value) })}>
|
||||
<option value={1}>Open a ticket straight away</option>
|
||||
<option value={2}>2 checks in a row (15–30 minutes)</option>
|
||||
<option value={3}>3 checks in a row (30–45 minutes)</option>
|
||||
<option value={4}>4 checks in a row (about an hour)</option>
|
||||
<option value={1}>{t("Open a ticket straight away")}</option>
|
||||
<option value={2}>{t("2 checks in a row (15–30 minutes)")}</option>
|
||||
<option value={3}>{t("3 checks in a row (30–45 minutes)")}</option>
|
||||
<option value={4}>{t("4 checks in a row (about an hour)")}</option>
|
||||
</select>
|
||||
<div className="form-hint">So a blip that fixes itself, like one failed call to an integration, never opens a ticket.</div>
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label">{t("Many at once")}</label>
|
||||
<div className="input-group">
|
||||
<span className="input-group-text">More than</span>
|
||||
<span className="input-group-text">{t("More than")}</span>
|
||||
<input className="form-control" type="number" min={1} max={50} value={draft.summaryAbove} onChange={(e) => set({ summaryAbove: Math.min(50, Math.max(1, Number(e.target.value) || 1)) })} />
|
||||
<span className="input-group-text">new</span>
|
||||
</div>
|
||||
@@ -276,7 +276,7 @@ export default function AlertTicketSettings() {
|
||||
</div>
|
||||
|
||||
<div className="col-12">
|
||||
<div className="form-label">Problems already there when this is switched on</div>
|
||||
<div className="form-label">{t("Problems already there when this is switched on")}</div>
|
||||
<label className="form-check">
|
||||
<input type="radio" className="form-check-input" name="existing" checked={draft.existingProblems === "ignore"} onChange={() => set({ existingProblems: "ignore" })} />
|
||||
<span className="form-check-label">
|
||||
@@ -296,10 +296,10 @@ export default function AlertTicketSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">What it has done</h3>
|
||||
<h3 className="card-title">{t("What it has done")}</h3>
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => void checkNow()} disabled={busy !== null || dirty || !overview.settings.enabled} title={dirty ? "Save first — the check uses the saved settings" : !overview.settings.enabled ? "Switched off" : undefined}>
|
||||
{busy === "run" ? "Checking…" : "Check now"}
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => void checkNow()} disabled={busy !== null || dirty || !overview.settings.enabled} title={dirty ? t("Save first — the check uses the saved settings") : !overview.settings.enabled ? t("Switched off") : undefined}>
|
||||
{busy === "run" ? t("Checking…") : t("Check now")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -310,7 +310,7 @@ export default function AlertTicketSettings() {
|
||||
{status.lastRun.error && <div className="text-danger small mt-1">{status.lastRun.error}</div>}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-secondary mb-2">No check has run yet.</div>
|
||||
<div className="text-secondary mb-2">{t("No check has run yet.")}</div>
|
||||
)}
|
||||
<div className="text-secondary small">
|
||||
Right now: {status.open} problem{status.open === 1 ? "" : "s"} with a ticket, {status.pending} waiting to last long enough, {status.baseline} already there and left alone.
|
||||
@@ -321,12 +321,12 @@ export default function AlertTicketSettings() {
|
||||
|
||||
<div className="d-flex flex-wrap align-items-center gap-2">
|
||||
<button className="btn btn-primary" onClick={() => void save()} disabled={busy !== null || !dirty}>
|
||||
{busy === "save" ? "Saving…" : "Save changes"}
|
||||
{busy === "save" ? t("Saving…") : t("Save changes")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={() => { setDraft(overview.settings); setError(null); setNotice(null); }} disabled={busy !== null || !dirty}>
|
||||
Discard changes
|
||||
{t("Discard changes")}
|
||||
</button>
|
||||
{dirty && <span className="text-secondary small">You have unsaved changes.</span>}
|
||||
{dirty && <span className="text-secondary small">{t("You have unsaved changes.")}</span>}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -14,10 +14,10 @@ import { t } from "../../i18n";
|
||||
const EVENT_WORDS: Record<WebhookEventName, string> = {
|
||||
"alert.opened": "A problem begins",
|
||||
"alert.resolved": "A problem ends",
|
||||
"maintenance.started": "Maintenance begins",
|
||||
"maintenance.ended": "Maintenance ends",
|
||||
"game_server.started": "A game server turns on",
|
||||
"game_server.stopped": "A game server turns off",
|
||||
get "maintenance.started"() { return t("Maintenance begins"); },
|
||||
get "maintenance.ended"() { return t("Maintenance ends"); },
|
||||
get "game_server.started"() { return t("A game server turns on"); },
|
||||
get "game_server.stopped"() { return t("A game server turns off"); },
|
||||
};
|
||||
|
||||
const hostOf = (address: string) => {
|
||||
@@ -78,7 +78,7 @@ export default function ApiSettings() {
|
||||
}
|
||||
|
||||
async function removeToken(item_: MetricsToken) {
|
||||
if (!(await confirmDialog({ title: "Remove metrics token", message: `Remove "${item_.label}"? Whatever scrapes with it stops working at once.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove metrics token"), message: `Remove "${item_.label}"? Whatever scrapes with it stops working at once.`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.metricsTokens.remove(item_.id);
|
||||
load();
|
||||
@@ -116,7 +116,7 @@ export default function ApiSettings() {
|
||||
}
|
||||
|
||||
async function testHook(h: EventWebhook) {
|
||||
setTestResults((r) => ({ ...r, [h.id]: "Sending…" }));
|
||||
setTestResults((r) => ({ ...r, [h.id]: t("Sending…") }));
|
||||
try {
|
||||
const res = await api.eventWebhooks.test(h.id);
|
||||
setTestResults((r) => ({ ...r, [h.id]: res.ok ? `✓ delivered (${res.result})` : `✕ ${res.result}` }));
|
||||
@@ -127,7 +127,7 @@ export default function ApiSettings() {
|
||||
}
|
||||
|
||||
async function removeHook(h: EventWebhook) {
|
||||
if (!(await confirmDialog({ title: "Remove webhook", message: `Remove "${h.label}"? It stops being sent anything.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove webhook"), message: `Remove "${h.label}"? It stops being sent anything.`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.eventWebhooks.remove(h.id);
|
||||
load();
|
||||
@@ -140,12 +140,12 @@ export default function ApiSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3 className="mb-3">API and webhooks</h3>
|
||||
<h3 className="mb-3">{t("API and webhooks")}</h3>
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Metrics for Prometheus</h3>
|
||||
<h3 className="card-title">{t("Metrics for Prometheus")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="metrics-tokens" />
|
||||
</div>
|
||||
@@ -167,7 +167,7 @@ export default function ApiSettings() {
|
||||
<div className="fw-bold mb-1">Token for {newSecret.label}</div>
|
||||
<div className="text-secondary mb-2">Copy it now — it can't be shown again. If it's lost, remove the token and make a new one.</div>
|
||||
<div className="input-group mb-2">
|
||||
<input className="form-control" readOnly value={newSecret.secret} aria-label="The metrics token" onFocus={(e) => e.currentTarget.select()} />
|
||||
<input className="form-control" readOnly value={newSecret.secret} aria-label={t("The metrics token")} onFocus={(e) => e.currentTarget.select()} />
|
||||
<CopyButton text={newSecret.secret} />
|
||||
</div>
|
||||
<div className="text-secondary small mb-1">In prometheus.yml:</div>
|
||||
@@ -187,9 +187,9 @@ export default function ApiSettings() {
|
||||
</div>
|
||||
)}
|
||||
<form className="d-flex flex-wrap gap-2 mb-3" onSubmit={makeToken}>
|
||||
<input className="form-control w-auto" style={{ minWidth: 220 }} required maxLength={60} placeholder="Name, e.g. Prometheus" aria-label="Name for the new token" value={tokenLabel} onChange={(e) => setTokenLabel(e.target.value)} />
|
||||
<input className="form-control w-auto" style={{ minWidth: 220 }} required maxLength={60} placeholder={t("Name, e.g. Prometheus")} aria-label={t("Name for the new token")} value={tokenLabel} onChange={(e) => setTokenLabel(e.target.value)} />
|
||||
<button className="btn btn-primary" disabled={busy || tokenLabel.trim() === ""}>
|
||||
Make a token
|
||||
{t("Make a token")}
|
||||
</button>
|
||||
</form>
|
||||
<div className="table-responsive">
|
||||
@@ -197,8 +197,8 @@ export default function ApiSettings() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Made</th>
|
||||
<th>Last used</th>
|
||||
<th>{t("Made")}</th>
|
||||
<th>{t("Last used")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -221,7 +221,7 @@ export default function ApiSettings() {
|
||||
))}
|
||||
{tokens === null && <LoadingRow colSpan={4} />}
|
||||
{tokens?.length === 0 && (
|
||||
<EmptyRow colSpan={4} title="No metrics tokens yet" hint="/metrics refuses everyone until a token is made. Make one for Prometheus and give it the secret, which is shown once." />
|
||||
<EmptyRow colSpan={4} title={t("No metrics tokens yet")} hint="/metrics refuses everyone until a token is made. Make one for Prometheus and give it the secret, which is shown once." />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -231,12 +231,12 @@ export default function ApiSettings() {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Event webhooks</h3>
|
||||
<h3 className="card-title">{t("Event webhooks")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="event-webhooks" />
|
||||
{!adding && (
|
||||
<button className="btn btn-sm btn-primary" onClick={() => setAdding(true)}>
|
||||
Add a webhook
|
||||
{t("Add a webhook")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -244,7 +244,7 @@ export default function ApiSettings() {
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
A webhook is sent a JSON message when something happens, for Home Assistant, n8n or a status board. This is separate from the chat-style webhook under Notifications, which carries the sentence a person would read. A problem is announced on the same terms as a
|
||||
notification — one under maintenance isn't until it ends. If you give a secret, each message carries <code>X-HLM-Signature: sha256=…</code>, an HMAC of the body, so the receiver can tell it came from here. A failed delivery is tried once more, and what was sent and how it went is kept under <em>Sent</em> — where a message can be sent again exactly as it was.
|
||||
notification — one under maintenance isn't until it ends. If you give a secret, each message carries <code>X-HLM-Signature: sha256=…</code>, an HMAC of the body, so the receiver can tell it came from here. A failed delivery is tried once more, and what was sent and how it went is kept under <em>{t("Sent")}</em> — where a message can be sent again exactly as it was.
|
||||
</p>
|
||||
{adding && (
|
||||
<form className="border rounded p-3 mb-3" onSubmit={makeHook}>
|
||||
@@ -257,18 +257,18 @@ export default function ApiSettings() {
|
||||
</div>
|
||||
<div className="col-md-8">
|
||||
<label className="form-label" htmlFor="wh-url">
|
||||
Address
|
||||
{t("Address")}
|
||||
</label>
|
||||
<input id="wh-url" type="url" className="form-control" required maxLength={500} placeholder="https://ha.example.lan/api/webhook/…" value={hookUrl} onChange={(e) => setHookUrl(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label" htmlFor="wh-secret">
|
||||
Secret (optional, signs each message)
|
||||
{t("Secret (optional, signs each message)")}
|
||||
</label>
|
||||
<input id="wh-secret" type="password" className="form-control" maxLength={200} autoComplete="off" value={hookSecret} onChange={(e) => setHookSecret(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<div className="form-label">Send when</div>
|
||||
<div className="form-label">{t("Send when")}</div>
|
||||
{(Object.keys(EVENT_WORDS) as WebhookEventName[]).map((ev) => (
|
||||
<label key={ev} className="form-check mb-1">
|
||||
<input
|
||||
@@ -293,7 +293,7 @@ export default function ApiSettings() {
|
||||
</div>
|
||||
<div className="btn-list mt-3">
|
||||
<button className="btn btn-primary" disabled={busy || hookLabel.trim() === "" || hookUrl.trim() === "" || hookEvents.size === 0}>
|
||||
{busy ? "Adding…" : "Add"}
|
||||
{busy ? "Adding…" : t("Add")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setAdding(false)}>
|
||||
{t("Cancel")}
|
||||
@@ -306,8 +306,8 @@ export default function ApiSettings() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Sends</th>
|
||||
<th>Last</th>
|
||||
<th>{t("Sends")}</th>
|
||||
<th>{t("Last")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -342,10 +342,10 @@ export default function ApiSettings() {
|
||||
{t("Test")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setLogOf(h)}>
|
||||
Sent
|
||||
{t("Sent")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void toggleHook(h)}>
|
||||
{h.enabled ? "Turn off" : "Turn on"}
|
||||
{h.enabled ? t("Turn off") : t("Turn on")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeHook(h)}>
|
||||
{t("Remove")}
|
||||
@@ -356,7 +356,7 @@ export default function ApiSettings() {
|
||||
))}
|
||||
{hooks === null && <LoadingRow colSpan={4} />}
|
||||
{hooks?.length === 0 && (
|
||||
<EmptyRow colSpan={4} title="No webhooks yet" hint="A webhook tells another system when an alert opens or resolves, when maintenance starts or ends, or when a game server is turned on or off." action={{ label: "Add a webhook", onClick: () => setAdding(true) }} />
|
||||
<EmptyRow colSpan={4} title={t("No webhooks yet")} hint="A webhook tells another system when an alert opens or resolves, when maintenance starts or ends, or when a game server is turned on or off." action={{ label: t("Add a webhook"), onClick: () => setAdding(true) }} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { confirmDialog } from "../../utils/dialogs";
|
||||
import { formatDateTime } from "../../utils/date";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { toast } from "../../utils/toast";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
/** "2026-10-25T18:00" for a datetime-local input, from a moment. */
|
||||
function wall(ms: number): string {
|
||||
@@ -23,10 +24,10 @@ function presets(): { label: string; value: string }[] {
|
||||
};
|
||||
const untilSunday = (7 - new Date().getDay()) % 7 || 7;
|
||||
return [
|
||||
{ label: "Until tomorrow evening", value: at18(1) },
|
||||
{ label: "Until Sunday evening", value: at18(untilSunday) },
|
||||
{ label: t("Until tomorrow evening"), value: at18(1) },
|
||||
{ label: t("Until Sunday evening"), value: at18(untilSunday) },
|
||||
{ label: "A week", value: at18(7) },
|
||||
{ label: "Two weeks", value: at18(14) },
|
||||
{ label: t("Two weeks"), value: at18(14) },
|
||||
];
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ export default function AwayCard({ canEdit }: { canEdit: boolean }) {
|
||||
// What is typed is the clock on this screen, so it is sent as the exact moment it means.
|
||||
const v = await api.away.start({ until: new Date(until).toISOString(), from: from ? new Date(from).toISOString() : null, criticalThrough: critical, note });
|
||||
setView(v);
|
||||
toast.success(v.away.state === "planned" ? "Away mode planned." : "Away mode is on — notifications are held.");
|
||||
toast.success(v.away.state === "planned" ? t("Away mode planned.") : t("Away mode is on — notifications are held."));
|
||||
window.dispatchEvent(new Event("away-changed"));
|
||||
setUntil("");
|
||||
setFrom("");
|
||||
@@ -76,12 +77,12 @@ export default function AwayCard({ canEdit }: { canEdit: boolean }) {
|
||||
|
||||
async function end() {
|
||||
const planned = view?.away.state === "planned";
|
||||
if (!planned && view && view.held > 0 && !(await confirmDialog({ title: "Back already?", message: `${view.held} notification${view.held === 1 ? " was" : "s were"} held. They are sent now as one digest.`, confirmLabel: "I'm back" }))) return;
|
||||
if (!planned && view && view.held > 0 && !(await confirmDialog({ title: t("Back already?"), message: `${view.held} notification${view.held === 1 ? " was" : "s were"} held. They are sent now as one digest.`, confirmLabel: "I'm back" }))) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
const v = await api.away.end();
|
||||
setView(v);
|
||||
toast.success(planned ? "Cancelled." : v.sent ? `Welcome back — ${v.sent} held notification${v.sent === 1 ? "" : "s"} sent.` : "Welcome back.");
|
||||
toast.success(planned ? t("Cancelled.") : v.sent ? `Welcome back — ${v.sent} held notification${v.sent === 1 ? "" : "s"} sent.` : t("Welcome back."));
|
||||
window.dispatchEvent(new Event("away-changed"));
|
||||
} catch (err) {
|
||||
setError(readableError(err));
|
||||
@@ -96,7 +97,7 @@ export default function AwayCard({ canEdit }: { canEdit: boolean }) {
|
||||
return (
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Away</h3>
|
||||
<h3 className="card-title">{t("Away")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -106,19 +107,19 @@ export default function AwayCard({ canEdit }: { canEdit: boolean }) {
|
||||
{error && <div className="alert alert-danger py-2">{error}</div>}
|
||||
{on && a ? (
|
||||
<div className="border rounded p-3 mb-2">
|
||||
<div className="fw-bold">{a.state === "planned" ? "Planned" : "Away"} until {formatDateTime(new Date(a.until!))}</div>
|
||||
<div className="fw-bold">{a.state === "planned" ? t("Planned") : t("Away")} until {formatDateTime(new Date(a.until!))}</div>
|
||||
<div className="text-secondary small">
|
||||
{a.state === "planned" && a.from ? (
|
||||
<>
|
||||
Starts {formatDateTime(new Date(a.from))} (<TimeAgo value={a.from} />).{" "}
|
||||
</>
|
||||
) : null}
|
||||
{a.criticalThrough ? "Critical alerts are still sent." : "Everything is held, critical alerts too."}
|
||||
{a.criticalThrough ? t("Critical alerts are still sent.") : t("Everything is held, critical alerts too.")}
|
||||
{a.note ? ` “${a.note}”` : ""} {a.state === "active" ? `${view!.held} held so far.` : ""}
|
||||
</div>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-primary mt-2" onClick={() => void end()} disabled={busy}>
|
||||
{a.state === "planned" ? "Cancel it" : "I'm back"}
|
||||
{a.state === "planned" ? t("Cancel it") : "I'm back"}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -146,17 +147,17 @@ export default function AwayCard({ canEdit }: { canEdit: boolean }) {
|
||||
<input id="away-from" type="datetime-local" className="form-control" value={from} onChange={(e) => setFrom(e.target.value)} />
|
||||
</div>
|
||||
</div>
|
||||
<input className="form-control mb-2" maxLength={200} placeholder="A note to yourself, e.g. Holiday in Spain (optional)" aria-label="Note" value={note} onChange={(e) => setNote(e.target.value)} />
|
||||
<input className="form-control mb-2" maxLength={200} placeholder="A note to yourself, e.g. Holiday in Spain (optional)" aria-label={t("Note")} value={note} onChange={(e) => setNote(e.target.value)} />
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={critical} onChange={(e) => setCritical(e.target.checked)} />
|
||||
<span className="form-check-label">Still send critical alerts (a server down, a disk full, mains power lost)</span>
|
||||
</label>
|
||||
<button className="btn btn-primary" disabled={busy || until === ""}>
|
||||
{busy ? "Saving…" : on ? "Change it" : "Start away mode"}
|
||||
{busy ? t("Saving…") : on ? t("Change it") : t("Start away mode")}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
{!canEdit && !on && <div className="text-secondary">Nobody is away. An administrator can set it.</div>}
|
||||
{!canEdit && !on && <div className="text-secondary">{t("Nobody is away. An administrator can set it.")}</div>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { api, type EncryptedExportFile, type ImportResult } from "../../api/clie
|
||||
import { confirmDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
import DatabaseBackups from "../../components/DatabaseBackups";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
function downloadJson(filename: string, data: unknown) {
|
||||
const blob = new Blob([JSON.stringify(data)], { type: "application/json" });
|
||||
@@ -68,7 +69,7 @@ export default function BackupSettings() {
|
||||
|
||||
async function handleImport() {
|
||||
if (!importFile) return;
|
||||
if (!(await confirmDialog({ title: "Import backup", message: "Import this backup? Existing integrations and DNS providers with the same name are left untouched — only new ones are added.", confirmLabel: "Import" }))) return;
|
||||
if (!(await confirmDialog({ title: t("Import backup"), message: "Import this backup? Existing integrations and DNS providers with the same name are left untouched — only new ones are added.", confirmLabel: t("Import") }))) return;
|
||||
setImporting(true);
|
||||
setImportError(null);
|
||||
setImportResult(null);
|
||||
@@ -88,16 +89,16 @@ export default function BackupSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3 className="mb-3">Backup</h3>
|
||||
<h3 className="mb-3">{t("Backup")}</h3>
|
||||
|
||||
<DatabaseBackups />
|
||||
|
||||
<h4 className="mb-3">Move your configuration</h4>
|
||||
<h4 className="mb-3">{t("Move your configuration")}</h4>
|
||||
<div className="row row-cards">
|
||||
<div className="col-md-6">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Export configuration</h3>
|
||||
<h3 className="card-title">{t("Export configuration")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -110,7 +111,7 @@ export default function BackupSettings() {
|
||||
<p className="text-secondary">Not included: DNS records, secrets, IPAM, servers, or the audit/diagnostic logs — this is configuration only.</p>
|
||||
<ErrorNotice error={exportError} />
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Passphrase</label>
|
||||
<label className="form-label">{t("Passphrase")}</label>
|
||||
<input
|
||||
type="password"
|
||||
className="form-control"
|
||||
@@ -120,14 +121,14 @@ export default function BackupSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Confirm passphrase</label>
|
||||
<label className="form-label">{t("Confirm passphrase")}</label>
|
||||
<input
|
||||
type="password"
|
||||
className={`form-control ${passphraseMismatch ? "is-invalid" : ""}`}
|
||||
value={exportPassphraseConfirm}
|
||||
onChange={(e) => setExportPassphraseConfirm(e.target.value)}
|
||||
/>
|
||||
{passphraseMismatch && <div className="invalid-feedback">Passphrases don't match.</div>}
|
||||
{passphraseMismatch && <div className="invalid-feedback">{t("Passphrases don't match.")}</div>}
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-footer d-flex align-items-center gap-2">
|
||||
@@ -136,7 +137,7 @@ export default function BackupSettings() {
|
||||
onClick={handleExport}
|
||||
disabled={exporting || exportPassphrase.length < 8 || exportPassphrase !== exportPassphraseConfirm}
|
||||
>
|
||||
{exporting ? "Exporting…" : "Export configuration"}
|
||||
{exporting ? t("Exporting…") : t("Export configuration")}
|
||||
</button>
|
||||
{exported && <span className="text-success small">✓ Downloaded</span>}
|
||||
</div>
|
||||
@@ -146,7 +147,7 @@ export default function BackupSettings() {
|
||||
<div className="col-md-6">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Import configuration</h3>
|
||||
<h3 className="card-title">{t("Import configuration")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -169,12 +170,12 @@ export default function BackupSettings() {
|
||||
</div>
|
||||
)}
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Backup file</label>
|
||||
<label className="form-label">{t("Backup file")}</label>
|
||||
<input ref={fileInputRef} type="file" accept="application/json,.json" className="form-control" onChange={handleFilePicked} />
|
||||
{importFileName && <div className="form-hint">Selected: {importFileName}</div>}
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Passphrase</label>
|
||||
<label className="form-label">{t("Passphrase")}</label>
|
||||
<input
|
||||
type="password"
|
||||
className="form-control"
|
||||
@@ -185,7 +186,7 @@ export default function BackupSettings() {
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-primary" onClick={handleImport} disabled={importing || !importFile || !importPassphrase}>
|
||||
{importing ? "Importing…" : "Import configuration"}
|
||||
{importing ? t("Importing…") : t("Import configuration")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ErrorNotice } from "../../components/Notice";
|
||||
import { PageSkeleton } from "../../components/Skeleton";
|
||||
import { BrandTag } from "../../components/BrandIcon";
|
||||
import { brandOf, isHexColor } from "../../utils/brands";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const PROVIDER_NAMES: Record<string, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -95,12 +96,12 @@ export default function BadgeSettings() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center justify-content-between mb-3">
|
||||
<h3 className="mb-0">Badges</h3>
|
||||
<h3 className="mb-0">{t("Badges")}</h3>
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
{saveError && <span className="text-danger small">{saveError}</span>}
|
||||
{saved && <span className="text-success small">✓ Colors saved</span>}
|
||||
<button className="btn btn-primary" onClick={handleSave} disabled={saving}>
|
||||
{saving ? "Saving…" : "Save Colors"}
|
||||
{saving ? "Saving…" : t("Save Colors")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -128,7 +129,7 @@ export default function BadgeSettings() {
|
||||
<div className="col-md-6">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Integration badge colors</h3>
|
||||
<h3 className="card-title">{t("Integration badge colors")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">Each kind's badge is in its brand's colour, with its logo where there is one (a few have an approximate colour: the brand has no open logo). Choose another colour for any of them to use that throughout the app instead.</p>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState } from "react";
|
||||
import { api } from "../../api/client";
|
||||
import { confirmDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
export default function CacheSettings() {
|
||||
const [clearing, setClearing] = useState(false);
|
||||
@@ -9,7 +10,7 @@ export default function CacheSettings() {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
async function handleClear() {
|
||||
if (!(await confirmDialog({ title: "Clear DNS cache", message: "Clear the DNS record cache? All zones will need to be re-synced afterwards.", confirmLabel: "Clear cache" }))) return;
|
||||
if (!(await confirmDialog({ title: t("Clear DNS cache"), message: "Clear the DNS record cache? All zones will need to be re-synced afterwards.", confirmLabel: t("Clear cache") }))) return;
|
||||
setClearing(true);
|
||||
setError(null);
|
||||
setCleared(false);
|
||||
@@ -26,10 +27,10 @@ export default function CacheSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3 className="mb-3">Cache</h3>
|
||||
<h3 className="mb-3">{t("Cache")}</h3>
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">DNS record cache</h3>
|
||||
<h3 className="card-title">{t("DNS record cache")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -40,7 +41,7 @@ export default function CacheSettings() {
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-danger" onClick={handleClear} disabled={clearing}>
|
||||
{clearing ? "Clearing…" : cleared ? "✓ Cache cleared" : "Clear DNS Cache"}
|
||||
{clearing ? t("Clearing…") : cleared ? "✓ Cache cleared" : t("Clear DNS Cache")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function DisplaySettings() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center justify-content-between mb-3">
|
||||
<h3 className="mb-0">Display</h3>
|
||||
<h3 className="mb-0">{t("Display")}</h3>
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
{saveError && <span className="text-danger small">{saveError}</span>}
|
||||
{saved && <span className="text-success small">✓ Settings saved</span>}
|
||||
@@ -114,15 +114,15 @@ export default function DisplaySettings() {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">Clock</label>
|
||||
<label className="form-label">{t("Clock")}</label>
|
||||
<select className="form-select" value={timeFormat} onChange={(e) => setTimeFormatState(e.target.value as TimeFormat)}>
|
||||
<option value="24h">24-hour (14:30:00)</option>
|
||||
<option value="12h">12-hour (2:30:00 PM)</option>
|
||||
<option value="24h">{t("24-hour (14:30:00)")}</option>
|
||||
<option value="12h">{t("12-hour (2:30:00 PM)")}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<div className="text-secondary small">Preview</div>
|
||||
<div className="text-secondary small">{t("Preview")}</div>
|
||||
<div>
|
||||
<code>
|
||||
{dateExample} {previewTime(timeFormat)}
|
||||
@@ -160,7 +160,7 @@ export default function DisplaySettings() {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Menu</h3>
|
||||
<h3 className="card-title">{t("Menu")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<label className="form-check mb-2">
|
||||
|
||||
@@ -3,14 +3,15 @@ import { api, type AppSettings } from "../../api/client";
|
||||
import { confirmDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
import { PageSkeleton } from "../../components/Skeleton";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const INTERVAL_OPTIONS: { value: number; label: string }[] = [
|
||||
{ value: 1, label: "Every hour" },
|
||||
{ value: 1, get label() { return t("Every hour"); } },
|
||||
{ value: 6, label: "Every 6 hours" },
|
||||
{ value: 12, label: "Every 12 hours" },
|
||||
{ value: 24, label: "Daily" },
|
||||
{ value: 168, label: "Weekly" },
|
||||
{ value: 720, label: "Monthly" },
|
||||
{ value: 24, get label() { return t("Daily"); } },
|
||||
{ value: 168, get label() { return t("Weekly"); } },
|
||||
{ value: 720, get label() { return t("Monthly"); } },
|
||||
];
|
||||
|
||||
export default function LogSettings() {
|
||||
@@ -54,7 +55,7 @@ export default function LogSettings() {
|
||||
}
|
||||
|
||||
async function handlePurgeNow() {
|
||||
if (!(await confirmDialog({ title: "Delete old log entries", message: `Delete diagnostic and audit log entries older than ${retentionDays} days now?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete old log entries"), message: `Delete diagnostic and audit log entries older than ${retentionDays} days now?`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
setPurging(true);
|
||||
setPurgeError(null);
|
||||
setPurgeResult(null);
|
||||
@@ -73,12 +74,12 @@ export default function LogSettings() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center justify-content-between mb-3">
|
||||
<h3 className="mb-0">Logs</h3>
|
||||
<h3 className="mb-0">{t("Logs")}</h3>
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
{saveError && <span className="text-danger small">{saveError}</span>}
|
||||
{saved && <span className="text-success small">✓ Settings saved</span>}
|
||||
<button className="btn btn-primary" onClick={handleSave} disabled={saving}>
|
||||
{saving ? "Saving…" : "Save Settings"}
|
||||
{saving ? "Saving…" : t("Save Settings")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,7 +90,7 @@ export default function LogSettings() {
|
||||
<div className="col-md-7">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Automatic purge</h3>
|
||||
<h3 className="card-title">{t("Automatic purge")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -99,11 +100,11 @@ export default function LogSettings() {
|
||||
</p>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={enabled} onChange={(e) => setEnabled(e.target.checked)} />
|
||||
<span className="form-check-label">Automatically purge old log entries</span>
|
||||
<span className="form-check-label">{t("Automatically purge old log entries")}</span>
|
||||
</label>
|
||||
<div className="row g-3">
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">Keep entries for</label>
|
||||
<label className="form-label">{t("Keep entries for")}</label>
|
||||
<div className="input-group">
|
||||
<input
|
||||
type="number"
|
||||
@@ -118,7 +119,7 @@ export default function LogSettings() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">Purge frequency</label>
|
||||
<label className="form-label">{t("Purge frequency")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
value={intervalHours}
|
||||
@@ -140,7 +141,7 @@ export default function LogSettings() {
|
||||
<div className="col-md-5">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Purge now</h3>
|
||||
<h3 className="card-title">{t("Purge now")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -157,7 +158,7 @@ export default function LogSettings() {
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-outline-danger" onClick={handlePurgeNow} disabled={purging}>
|
||||
{purging ? "Purging…" : "Purge now"}
|
||||
{purging ? t("Purging…") : t("Purge now")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -101,16 +101,16 @@ export default function NameSettings() {
|
||||
function addList() {
|
||||
const key = `new-${newCount}`;
|
||||
setNewCount((n) => n + 1);
|
||||
setDrafts((all) => [...all, { key, label: "New list", text: "" }]);
|
||||
setDrafts((all) => [...all, { key, label: t("New list"), text: "" }]);
|
||||
select(key);
|
||||
setNotice(null);
|
||||
}
|
||||
|
||||
async function removeList(d: Draft) {
|
||||
const ok = await confirmDialog({
|
||||
title: "Delete list",
|
||||
title: t("Delete list"),
|
||||
message: `Delete “${d.label.trim() || "this list"}”? It's removed when you save${d.id && builtinIds.includes(d.id) ? ", and can be brought back with “Restore built-in lists”" : ""}.`,
|
||||
confirmLabel: "Delete",
|
||||
confirmLabel: t("Delete"),
|
||||
danger: true,
|
||||
});
|
||||
if (!ok) return;
|
||||
@@ -124,9 +124,9 @@ export default function NameSettings() {
|
||||
async function resetToBuiltIn(d: Draft) {
|
||||
if (!d.id) return;
|
||||
const ok = await confirmDialog({
|
||||
title: "Reset list",
|
||||
title: t("Reset list"),
|
||||
message: `Put “${d.label.trim() || d.id}” back to its built-in names? Your edits to this list are lost (once you save).`,
|
||||
confirmLabel: "Reset",
|
||||
confirmLabel: t("Reset"),
|
||||
danger: true,
|
||||
});
|
||||
if (!ok) return;
|
||||
@@ -229,7 +229,7 @@ export default function NameSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Name lists</h3>
|
||||
<h3 className="card-title">{t("Name lists")}</h3>
|
||||
<div className="card-actions btn-list">
|
||||
{missingBuiltIns.length > 0 && (
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => void restoreBuiltIns()}>
|
||||
@@ -237,7 +237,7 @@ export default function NameSettings() {
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-outline-primary btn-sm" onClick={addList} disabled={drafts.length >= 20}>
|
||||
New list
|
||||
{t("New list")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -247,7 +247,7 @@ export default function NameSettings() {
|
||||
it works as a hostname. Changes apply when you save.
|
||||
</div>
|
||||
{drafts.length === 0 ? (
|
||||
<div className="text-secondary">No lists. Add one, or restore the built-in ones.</div>
|
||||
<div className="text-secondary">{t("No lists. Add one, or restore the built-in ones.")}</div>
|
||||
) : (
|
||||
<ul className="nav nav-pills gap-1">
|
||||
{drafts.map((d, i) => (
|
||||
@@ -267,7 +267,7 @@ export default function NameSettings() {
|
||||
<div className="card-body">
|
||||
<div className="row g-3">
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">List name</label>
|
||||
<label className="form-label">{t("List name")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
maxLength={MAX_LABEL}
|
||||
@@ -278,18 +278,18 @@ export default function NameSettings() {
|
||||
<div className="col-md-6 d-flex align-items-end justify-content-md-end">
|
||||
<div className="btn-list">
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => setImportOpen((v) => !v)}>
|
||||
Import from Skatteverket…
|
||||
{t("Import from Skatteverket…")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={sortList} disabled={selectedParsed.names.length < 2}>
|
||||
Sort A–Z
|
||||
{t("Sort A–Z")}
|
||||
</button>
|
||||
{selected.id && builtinIds.includes(selected.id) && (
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => void resetToBuiltIn(selected)}>
|
||||
Reset to built-in
|
||||
{t("Reset to built-in")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-outline-danger btn-sm" onClick={() => void removeList(selected)}>
|
||||
Delete list
|
||||
{t("Delete list")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -297,7 +297,7 @@ export default function NameSettings() {
|
||||
|
||||
{importOpen && (
|
||||
<div className="border rounded p-3 mt-3">
|
||||
<div className="fw-bold mb-1">Import the most common names from Skatteverket</div>
|
||||
<div className="fw-bold mb-1">{t("Import the most common names from Skatteverket")}</div>
|
||||
<div className="text-secondary small mb-3">
|
||||
Skatteverket publishes the given names of newborns in Sweden, by sex and birth year, as open data. This fetches the most common ones
|
||||
across the years you pick (the running year isn't counted — it isn't complete). You see them first; nothing changes until you add
|
||||
@@ -305,14 +305,14 @@ export default function NameSettings() {
|
||||
</div>
|
||||
<div className="d-flex flex-wrap align-items-end gap-2">
|
||||
<div>
|
||||
<label className="form-label mb-1">Names for</label>
|
||||
<label className="form-label mb-1">{t("Names for")}</label>
|
||||
<select className="form-select" value={sex} onChange={(e) => setSex(e.target.value as "girls" | "boys")}>
|
||||
<option value="girls">Girls</option>
|
||||
<option value="boys">Boys</option>
|
||||
<option value="girls">{t("Girls")}</option>
|
||||
<option value="boys">{t("Boys")}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="form-label mb-1">Latest years</label>
|
||||
<label className="form-label mb-1">{t("Latest years")}</label>
|
||||
<select className="form-select" value={years} onChange={(e) => setYears(Number(e.target.value))}>
|
||||
{[1, 2, 3, 4, 5].map((n) => (
|
||||
<option key={n} value={n}>
|
||||
@@ -322,7 +322,7 @@ export default function NameSettings() {
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="form-label mb-1">How many names</label>
|
||||
<label className="form-label mb-1">{t("How many names")}</label>
|
||||
<input
|
||||
type="number"
|
||||
className="form-control"
|
||||
@@ -334,7 +334,7 @@ export default function NameSettings() {
|
||||
/>
|
||||
</div>
|
||||
<button className="btn btn-primary" onClick={() => void fetchPreview()} disabled={fetching}>
|
||||
{fetching ? "Fetching…" : "Fetch names"}
|
||||
{fetching ? t("Fetching…") : t("Fetch names")}
|
||||
</button>
|
||||
</div>
|
||||
<ErrorNotice error={importError} className="mt-3 mb-0" />
|
||||
@@ -357,10 +357,10 @@ export default function NameSettings() {
|
||||
</div>
|
||||
<div className="btn-list">
|
||||
<button className="btn btn-primary btn-sm" onClick={() => applyPreview("add")}>
|
||||
Add to this list
|
||||
{t("Add to this list")}
|
||||
</button>
|
||||
<button className="btn btn-outline-primary btn-sm" onClick={() => applyPreview("replace")}>
|
||||
Replace this list
|
||||
{t("Replace this list")}
|
||||
</button>
|
||||
<button className="btn btn-link btn-sm" onClick={() => setPreview(null)}>
|
||||
{t("Cancel")}
|
||||
@@ -398,12 +398,12 @@ export default function NameSettings() {
|
||||
|
||||
<div className="d-flex flex-wrap align-items-center gap-2">
|
||||
<button className="btn btn-primary" onClick={() => void save()} disabled={busy || !dirty || problem !== null}>
|
||||
{busy ? "Saving…" : "Save changes"}
|
||||
{busy ? "Saving…" : t("Save changes")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={discard} disabled={busy || !dirty}>
|
||||
Discard changes
|
||||
{t("Discard changes")}
|
||||
</button>
|
||||
{dirty && !problem && <span className="text-secondary small">You have unsaved changes.</span>}
|
||||
{dirty && !problem && <span className="text-secondary small">{t("You have unsaved changes.")}</span>}
|
||||
{problem && <span className="text-danger small">{problem}</span>}
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -82,13 +82,13 @@ const DEFAULT_QUIET_HOURS: QuietHoursSettings = { enabled: false, start: "22:00"
|
||||
const DEFAULT_DIGEST: DigestSettings = { enabled: false, day: 1, time: "08:00" };
|
||||
// Monday first, as a week reads; the numbers are what the server keeps (0 = Sunday).
|
||||
const DIGEST_DAYS: { value: number; label: string }[] = [
|
||||
{ value: 1, label: "Monday" },
|
||||
{ value: 2, label: "Tuesday" },
|
||||
{ value: 3, label: "Wednesday" },
|
||||
{ value: 4, label: "Thursday" },
|
||||
{ value: 5, label: "Friday" },
|
||||
{ value: 6, label: "Saturday" },
|
||||
{ value: 0, label: "Sunday" },
|
||||
{ value: 1, get label() { return t("Monday"); } },
|
||||
{ value: 2, get label() { return t("Tuesday"); } },
|
||||
{ value: 3, get label() { return t("Wednesday"); } },
|
||||
{ value: 4, get label() { return t("Thursday"); } },
|
||||
{ value: 5, get label() { return t("Friday"); } },
|
||||
{ value: 6, get label() { return t("Saturday"); } },
|
||||
{ value: 0, get label() { return t("Sunday"); } },
|
||||
];
|
||||
const DEFAULT_HEALTH_CHECKS: HealthCheckSettings = { serverOfflineMinutes: 60, diskUsagePercent: 90, domainWarnDays: 30, diskForecastDays: 14, backupStaleHours: 48, restoreTestDays: 0, newPortAlerts: true, flapRaises: 3, deviceOfflineMinutes: 10, osSupportWarnDays: 90, baselineAlerts: true, containerAlerts: true, vulnerabilityAlerts: true, vulnerabilityHighThreshold: 0, imageAgeDays: 0, containerIgnore: [] };
|
||||
const DEFAULT_MONTHLY: MonthlyReportSettings = { enabled: false, quarterly: false, annual: false, day: 1, time: "08:00" };
|
||||
@@ -98,19 +98,19 @@ type EventKey = { [K in keyof NotificationEvents]: NotificationEvents[K] extends
|
||||
|
||||
/** The groups of events on the What to send tab, one shown at a time (`?section=`) so the page is a card long, not five. */
|
||||
const SECTIONS = [
|
||||
{ id: "servers", label: "Servers and disks" },
|
||||
{ id: "secrets", label: "Secrets, keys and domains" },
|
||||
{ id: "backups", label: "Backups and updates" },
|
||||
{ id: "integrations", label: "Integrations and automation" },
|
||||
{ id: "dns", label: "DNS changes" },
|
||||
{ id: "servers", get label() { return t("Servers and disks"); } },
|
||||
{ id: "secrets", get label() { return t("Secrets, keys and domains"); } },
|
||||
{ id: "backups", get label() { return t("Backups and updates"); } },
|
||||
{ id: "integrations", get label() { return t("Integrations and automation"); } },
|
||||
{ id: "dns", get label() { return t("DNS changes"); } },
|
||||
] as const;
|
||||
type SectionId = (typeof SECTIONS)[number]["id"];
|
||||
|
||||
const TABS = [
|
||||
{ id: "channels", label: "Channels" },
|
||||
{ id: "events", label: "What to send" },
|
||||
{ id: "routing", label: "Who hears what" },
|
||||
{ id: "when", label: "When" },
|
||||
{ id: "channels", get label() { return t("Channels"); } },
|
||||
{ id: "events", get label() { return t("What to send"); } },
|
||||
{ id: "routing", get label() { return t("Who hears what"); } },
|
||||
{ id: "when", get label() { return t("When"); } },
|
||||
] as const;
|
||||
type TabId = (typeof TABS)[number]["id"];
|
||||
|
||||
@@ -167,15 +167,15 @@ function ChannelRow({
|
||||
<div className="flex-fill" style={{ minWidth: 0 }}>
|
||||
<div className="fw-bold">
|
||||
{name}{" "}
|
||||
{enabled && complete && <span className="badge bg-green-lt text-green">On</span>}
|
||||
{enabled && !complete && <span className="badge bg-yellow-lt text-yellow">On, but not filled in</span>}
|
||||
{!enabled && complete && <span className="badge bg-secondary-lt text-secondary">Off</span>}
|
||||
{!enabled && !complete && <span className="badge bg-secondary-lt text-secondary">Not set up</span>}
|
||||
{enabled && complete && <span className="badge bg-green-lt text-green">{t("On")}</span>}
|
||||
{enabled && !complete && <span className="badge bg-yellow-lt text-yellow">{t("On, but not filled in")}</span>}
|
||||
{!enabled && complete && <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>}
|
||||
{!enabled && !complete && <span className="badge bg-secondary-lt text-secondary">{t("Not set up")}</span>}
|
||||
</div>
|
||||
<div className="text-secondary small text-truncate">{complete && summary ? summary : description}</div>
|
||||
</div>
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" aria-expanded={open} aria-controls={panelId} onClick={onOpen}>
|
||||
{open ? "Close" : complete ? "Edit" : "Set up"}
|
||||
{open ? t("Close") : complete ? "Edit" : t("Set up")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -430,7 +430,7 @@ export default function NotificationSettings() {
|
||||
setMonthlyResult(null);
|
||||
try {
|
||||
await api.reports.sendMonthly();
|
||||
setMonthlyResult({ ok: true, message: "Sent through the channels that are on." });
|
||||
setMonthlyResult({ ok: true, message: t("Sent through the channels that are on.") });
|
||||
} catch (err) {
|
||||
setMonthlyResult({ ok: false, message: readableError(err) });
|
||||
} finally {
|
||||
@@ -443,7 +443,7 @@ export default function NotificationSettings() {
|
||||
setFlushResult(null);
|
||||
try {
|
||||
const res = await api.settings.flushQuietHours();
|
||||
setFlushResult(res.flushed > 0 ? `Sent a digest of ${res.flushed} queued notification${res.flushed !== 1 ? "s" : ""}.` : "Nothing was queued.");
|
||||
setFlushResult(res.flushed > 0 ? `Sent a digest of ${res.flushed} queued notification${res.flushed !== 1 ? "s" : ""}.` : t("Nothing was queued."));
|
||||
setQueuedCount(0);
|
||||
} catch (err) {
|
||||
setFlushResult(err instanceof Error ? err.message : String(err));
|
||||
@@ -457,7 +457,7 @@ export default function NotificationSettings() {
|
||||
setTestGotifyResult(null);
|
||||
try {
|
||||
await api.settings.testGotify(gotify);
|
||||
setTestGotifyResult({ ok: true, message: "Notification sent successfully." });
|
||||
setTestGotifyResult({ ok: true, message: t("Notification sent successfully.") });
|
||||
} catch (err) {
|
||||
setTestGotifyResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
|
||||
} finally {
|
||||
@@ -470,7 +470,7 @@ export default function NotificationSettings() {
|
||||
setTestNtfyResult(null);
|
||||
try {
|
||||
await api.settings.testNtfy(ntfy);
|
||||
setTestNtfyResult({ ok: true, message: "Notification sent successfully." });
|
||||
setTestNtfyResult({ ok: true, message: t("Notification sent successfully.") });
|
||||
} catch (err) {
|
||||
setTestNtfyResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
|
||||
} finally {
|
||||
@@ -483,7 +483,7 @@ export default function NotificationSettings() {
|
||||
setTestTelegramResult(null);
|
||||
try {
|
||||
await api.settings.testTelegram(telegram);
|
||||
setTestTelegramResult({ ok: true, message: "Message sent successfully." });
|
||||
setTestTelegramResult({ ok: true, message: t("Message sent successfully.") });
|
||||
} catch (err) {
|
||||
setTestTelegramResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
|
||||
} finally {
|
||||
@@ -496,7 +496,7 @@ export default function NotificationSettings() {
|
||||
setTestPushoverResult(null);
|
||||
try {
|
||||
await api.settings.testPushover(pushover);
|
||||
setTestPushoverResult({ ok: true, message: "Notification sent successfully." });
|
||||
setTestPushoverResult({ ok: true, message: t("Notification sent successfully.") });
|
||||
} catch (err) {
|
||||
setTestPushoverResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
|
||||
} finally {
|
||||
@@ -509,7 +509,7 @@ export default function NotificationSettings() {
|
||||
setTestSmtpResult(null);
|
||||
try {
|
||||
await api.settings.testSmtp(smtp);
|
||||
setTestSmtpResult({ ok: true, message: "Test email sent successfully." });
|
||||
setTestSmtpResult({ ok: true, message: t("Test email sent successfully.") });
|
||||
} catch (err) {
|
||||
setTestSmtpResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
|
||||
} finally {
|
||||
@@ -522,7 +522,7 @@ export default function NotificationSettings() {
|
||||
setTestWebhookResult(null);
|
||||
try {
|
||||
await api.settings.testWebhook(webhook);
|
||||
setTestWebhookResult({ ok: true, message: "Webhook delivered successfully." });
|
||||
setTestWebhookResult({ ok: true, message: t("Webhook delivered successfully.") });
|
||||
} catch (err) {
|
||||
setTestWebhookResult({ ok: false, message: err instanceof Error ? err.message : String(err) });
|
||||
} finally {
|
||||
@@ -550,19 +550,19 @@ export default function NotificationSettings() {
|
||||
<h3 className="mb-0">
|
||||
Notifications
|
||||
<Link className="ms-3 fs-5 fw-normal" to="/notification-history">
|
||||
See what was sent
|
||||
{t("See what was sent")}
|
||||
</Link>
|
||||
</h3>
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
{saveError && <span className="text-danger small">{saveError}</span>}
|
||||
{saved && <span className="text-success small">✓ Settings saved</span>}
|
||||
{dirty && !saved && <span className="badge bg-yellow-lt text-yellow">Unsaved changes</span>}
|
||||
{dirty && !saved && <span className="badge bg-yellow-lt text-yellow">{t("Unsaved changes")}</span>}
|
||||
<button className="btn btn-primary" onClick={handleSave} disabled={saving || !dirty}>
|
||||
{saving ? "Saving…" : "Save Settings"}
|
||||
{saving ? "Saving…" : t("Save Settings")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<ul className="nav nav-tabs mt-3" role="tablist" aria-label="Notification settings">
|
||||
<ul className="nav nav-tabs mt-3" role="tablist" aria-label={t("Notification settings")}>
|
||||
{TABS.map((t) => (
|
||||
<li className="nav-item" role="presentation" key={t.id}>
|
||||
<button
|
||||
@@ -596,7 +596,7 @@ export default function NotificationSettings() {
|
||||
{/* ── Channels ── */}
|
||||
<div role="tabpanel" id="panel-channels" aria-labelledby="tab-channels" hidden={tab !== "channels"} className="pt-3">
|
||||
<p className="text-secondary">Every notification goes to each channel that is on. Open one to fill it in and send a test.</p>
|
||||
{channelsOn === 0 && <div className="alert alert-warning">No channel is on, so nothing is sent anywhere yet. Set one up below.</div>}
|
||||
{channelsOn === 0 && <div className="alert alert-warning">{t("No channel is on, so nothing is sent anywhere yet. Set one up below.")}</div>}
|
||||
|
||||
<ChannelRow
|
||||
name="Gotify"
|
||||
@@ -609,19 +609,19 @@ export default function NotificationSettings() {
|
||||
onOpen={() => setOpenChannel(openChannel === "gotify" ? null : "gotify")}
|
||||
>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Gotify URL</label>
|
||||
<label className="form-label">{t("Gotify URL")}</label>
|
||||
<input className="form-control" placeholder="http://gotify.example.com" value={gotify.url} onChange={(e) => setGotify((g) => ({ ...g, url: e.target.value }))} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">App token</label>
|
||||
<label className="form-label">{t("App token")}</label>
|
||||
<input type="password" className="form-control" placeholder="Your Gotify app token" value={gotify.token} onChange={(e) => setGotify((g) => ({ ...g, token: e.target.value }))} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Priority (1–10)</label>
|
||||
<label className="form-label">{t("Priority (1–10)")}</label>
|
||||
<input type="number" min={1} max={10} className="form-control" value={gotify.priority} onChange={(e) => setGotify((g) => ({ ...g, priority: Number(e.target.value) }))} />
|
||||
</div>
|
||||
<button className="btn btn-outline-secondary" onClick={handleTestGotify} disabled={testingGotify || !gotify.url || !gotify.token}>
|
||||
{testingGotify ? "Sending…" : "Send test"}
|
||||
{testingGotify ? t("Sending…") : t("Send test")}
|
||||
</button>
|
||||
<TestBadge result={testGotifyResult} />
|
||||
</ChannelRow>
|
||||
@@ -646,16 +646,16 @@ export default function NotificationSettings() {
|
||||
>
|
||||
<div className="row g-2 mb-2">
|
||||
<div className="col-8">
|
||||
<label className="form-label">Server URL</label>
|
||||
<label className="form-label">{t("Server URL")}</label>
|
||||
<input className="form-control" placeholder="https://ntfy.sh" value={ntfy.url} onChange={(e) => setNtfy((n) => ({ ...n, url: e.target.value }))} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<label className="form-label">Priority (1–5)</label>
|
||||
<label className="form-label">{t("Priority (1–5)")}</label>
|
||||
<input type="number" min={1} max={5} className="form-control" value={ntfy.priority} onChange={(e) => setNtfy((n) => ({ ...n, priority: Number(e.target.value) }))} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Topic</label>
|
||||
<label className="form-label">{t("Topic")}</label>
|
||||
<input className="form-control" placeholder="your-topic" value={ntfy.topic} onChange={(e) => setNtfy((n) => ({ ...n, topic: e.target.value }))} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
@@ -663,7 +663,7 @@ export default function NotificationSettings() {
|
||||
<input type="password" className="form-control" value={ntfy.token} onChange={(e) => setNtfy((n) => ({ ...n, token: e.target.value }))} />
|
||||
</div>
|
||||
<button className="btn btn-outline-secondary" onClick={handleTestNtfy} disabled={testingNtfy || !ntfy.url || !ntfy.topic}>
|
||||
{testingNtfy ? "Sending…" : "Send test"}
|
||||
{testingNtfy ? t("Sending…") : t("Send test")}
|
||||
</button>
|
||||
<TestBadge result={testNtfyResult} />
|
||||
</ChannelRow>
|
||||
@@ -679,7 +679,7 @@ export default function NotificationSettings() {
|
||||
onOpen={() => setOpenChannel(openChannel === "telegram" ? null : "telegram")}
|
||||
>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Bot token</label>
|
||||
<label className="form-label">{t("Bot token")}</label>
|
||||
<input type="password" className="form-control" placeholder="123456789:AA…" autoComplete="off" value={telegram.token} onChange={(e) => setTelegram((t) => ({ ...t, token: e.target.value }))} />
|
||||
<div className="form-hint">
|
||||
Make a bot by messaging{" "}
|
||||
@@ -690,7 +690,7 @@ export default function NotificationSettings() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Chat id</label>
|
||||
<label className="form-label">{t("Chat id")}</label>
|
||||
<input className="form-control" placeholder="123456789, -1001234567890 or @yourchannel" value={telegram.chatId} onChange={(e) => setTelegram((t) => ({ ...t, chatId: e.target.value }))} />
|
||||
<div className="form-hint">
|
||||
Send your bot a message (or add it to the group or channel and post there), then open <code>https://api.telegram.org/bot<token>/getUpdates</code> in a browser: the number after <code>"chat":{"id":</code> is the chat id. A group’s is negative. The bot cannot message you until you have written to it first.
|
||||
@@ -699,11 +699,11 @@ export default function NotificationSettings() {
|
||||
<div className="form-check mb-3">
|
||||
<input id="telegram-silent" type="checkbox" className="form-check-input" checked={telegram.silent} onChange={(e) => setTelegram((t) => ({ ...t, silent: e.target.checked }))} />
|
||||
<label htmlFor="telegram-silent" className="form-check-label">
|
||||
Send silently (no sound or buzz — the message waits in the chat)
|
||||
{t("Send silently (no sound or buzz — the message waits in the chat)")}
|
||||
</label>
|
||||
</div>
|
||||
<button className="btn btn-outline-secondary" onClick={handleTestTelegram} disabled={testingTelegram || !telegram.token || !telegram.chatId}>
|
||||
{testingTelegram ? "Sending…" : "Send test"}
|
||||
{testingTelegram ? t("Sending…") : t("Send test")}
|
||||
</button>
|
||||
<TestBadge result={testTelegramResult} />
|
||||
</ChannelRow>
|
||||
@@ -727,31 +727,31 @@ export default function NotificationSettings() {
|
||||
onOpen={() => setOpenChannel(openChannel === "pushover" ? null : "pushover")}
|
||||
>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Application token</label>
|
||||
<label className="form-label">{t("Application token")}</label>
|
||||
<input type="password" className="form-control" placeholder="Made at pushover.net → Create an Application/API Token" autoComplete="off" value={pushover.appToken} onChange={(e) => setPushover((p) => ({ ...p, appToken: e.target.value }))} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">User key (or group key)</label>
|
||||
<label className="form-label">{t("User key (or group key)")}</label>
|
||||
<input type="password" className="form-control" placeholder="Shown at the top of your pushover.net page" autoComplete="off" value={pushover.userKey} onChange={(e) => setPushover((p) => ({ ...p, userKey: e.target.value }))} />
|
||||
</div>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">Device (optional)</label>
|
||||
<label className="form-label">{t("Device (optional)")}</label>
|
||||
<input className="form-control" placeholder="all devices" maxLength={100} value={pushover.device} onChange={(e) => setPushover((p) => ({ ...p, device: e.target.value }))} />
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label">Priority</label>
|
||||
<label className="form-label">{t("Priority")}</label>
|
||||
<select className="form-select" value={pushover.priority} onChange={(e) => setPushover((p) => ({ ...p, priority: Number(e.target.value) }))}>
|
||||
<option value={-2}>Lowest — no notification</option>
|
||||
<option value={-1}>Low — no sound</option>
|
||||
<option value={-2}>{t("Lowest — no notification")}</option>
|
||||
<option value={-1}>{t("Low — no sound")}</option>
|
||||
<option value={0}>{t("Normal")}</option>
|
||||
<option value={1}>High — ignores quiet hours</option>
|
||||
<option value={1}>{t("High — ignores quiet hours")}</option>
|
||||
<option value={2}>Emergency — repeats every minute for an hour, until acknowledged</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<button className="btn btn-outline-secondary" onClick={handleTestPushover} disabled={testingPushover || !pushover.appToken || !pushover.userKey}>
|
||||
{testingPushover ? "Sending…" : "Send test"}
|
||||
{testingPushover ? t("Sending…") : t("Send test")}
|
||||
</button>
|
||||
<TestBadge result={testPushoverResult} />
|
||||
</ChannelRow>
|
||||
@@ -768,40 +768,40 @@ export default function NotificationSettings() {
|
||||
>
|
||||
<div className="row g-2 mb-2">
|
||||
<div className="col-8">
|
||||
<label className="form-label">SMTP host</label>
|
||||
<label className="form-label">{t("SMTP host")}</label>
|
||||
<input className="form-control" placeholder="smtp.example.com" value={smtp.host} onChange={(e) => setSmtp((s) => ({ ...s, host: e.target.value }))} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<label className="form-label">Port</label>
|
||||
<label className="form-label">{t("Port")}</label>
|
||||
<input type="number" className="form-control" placeholder="587" value={smtp.port} onChange={(e) => setSmtp((s) => ({ ...s, port: Number(e.target.value) }))} />
|
||||
</div>
|
||||
</div>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={smtp.secure} onChange={(e) => setSmtp((s) => ({ ...s, secure: e.target.checked }))} />
|
||||
<span className="form-check-label">Use TLS/SSL (port 465)</span>
|
||||
<span className="form-check-label">{t("Use TLS/SSL (port 465)")}</span>
|
||||
</label>
|
||||
<div className="row g-2 mb-2">
|
||||
<div className="col-6">
|
||||
<label className="form-label">Username (optional)</label>
|
||||
<label className="form-label">{t("Username (optional)")}</label>
|
||||
<input className="form-control" value={smtp.username} onChange={(e) => setSmtp((s) => ({ ...s, username: e.target.value }))} />
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label className="form-label">Password (optional)</label>
|
||||
<label className="form-label">{t("Password (optional)")}</label>
|
||||
<input type="password" className="form-control" value={smtp.password} onChange={(e) => setSmtp((s) => ({ ...s, password: e.target.value }))} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-6">
|
||||
<label className="form-label">From</label>
|
||||
<label className="form-label">{t("From")}</label>
|
||||
<input type="email" className="form-control" placeholder="homelab@example.com" value={smtp.from} onChange={(e) => setSmtp((s) => ({ ...s, from: e.target.value }))} />
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label className="form-label">To</label>
|
||||
<label className="form-label">{t("To")}</label>
|
||||
<input type="email" className="form-control" placeholder="you@example.com" value={smtp.to} onChange={(e) => setSmtp((s) => ({ ...s, to: e.target.value }))} />
|
||||
</div>
|
||||
</div>
|
||||
<button className="btn btn-outline-secondary" onClick={handleTestSmtp} disabled={testingSmtp || !smtp.host || !smtp.from || !smtp.to}>
|
||||
{testingSmtp ? "Sending…" : "Send test"}
|
||||
{testingSmtp ? t("Sending…") : t("Send test")}
|
||||
</button>
|
||||
<TestBadge result={testSmtpResult} />
|
||||
</ChannelRow>
|
||||
@@ -821,15 +821,15 @@ export default function NotificationSettings() {
|
||||
onOpen={() => setOpenChannel(openChannel === "webhook" ? null : "webhook")}
|
||||
>
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Webhook URL</label>
|
||||
<label className="form-label">{t("Webhook URL")}</label>
|
||||
<input type="url" className="form-control" placeholder="https://discord.com/api/webhooks/…" value={webhook.url} onChange={(e) => setWebhook((w) => ({ ...w, url: e.target.value }))} />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Secret (optional, sent as X-Webhook-Secret header)</label>
|
||||
<label className="form-label">{t("Secret (optional, sent as X-Webhook-Secret header)")}</label>
|
||||
<input type="password" className="form-control" value={webhook.secret} onChange={(e) => setWebhook((w) => ({ ...w, secret: e.target.value }))} />
|
||||
</div>
|
||||
<button className="btn btn-outline-secondary" onClick={handleTestWebhook} disabled={testingWebhook || !webhook.url}>
|
||||
{testingWebhook ? "Sending…" : "Send test"}
|
||||
{testingWebhook ? t("Sending…") : t("Send test")}
|
||||
</button>
|
||||
<TestBadge result={testWebhookResult} />
|
||||
</ChannelRow>
|
||||
@@ -845,7 +845,7 @@ export default function NotificationSettings() {
|
||||
onOpen={() => setOpenChannel(openChannel === "webpush" ? null : "webpush")}
|
||||
>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Contact (optional)</label>
|
||||
<label className="form-label">{t("Contact (optional)")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
maxLength={200}
|
||||
@@ -862,7 +862,7 @@ export default function NotificationSettings() {
|
||||
{/* ── What to send ── */}
|
||||
<div role="tabpanel" id="panel-events" aria-labelledby="tab-events" hidden={tab !== "events"} className="pt-3">
|
||||
<p className="text-secondary">Which events send a notification, on every channel that is on. Each group keeps its thresholds beside the switch they belong to.</p>
|
||||
<ul className="nav nav-pills mb-3" role="group" aria-label="Groups of notifications">
|
||||
<ul className="nav nav-pills mb-3" role="group" aria-label={t("Groups of notifications")}>
|
||||
{SECTIONS.map((s) => (
|
||||
<li className="nav-item" key={s.id}>
|
||||
<button type="button" className={`nav-link ${section === s.id ? "active" : ""}`} aria-pressed={section === s.id} onClick={() => selectSection(s.id)}>
|
||||
@@ -875,12 +875,12 @@ export default function NotificationSettings() {
|
||||
<div className="col-lg-8" hidden={section !== "servers"}>
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Servers and disks</h3>
|
||||
<h3 className="card-title">{t("Servers and disks")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{toggle("healthAlerts", "Server offline, disk nearly full, or Synology volume/disk problem")}
|
||||
<NumberField
|
||||
label="Server offline after"
|
||||
label={t("Server offline after")}
|
||||
value={healthChecks.serverOfflineMinutes}
|
||||
min={15}
|
||||
max={10080}
|
||||
@@ -890,7 +890,7 @@ export default function NotificationSettings() {
|
||||
onChange={(v) => setHealthChecks((h) => ({ ...h, serverOfflineMinutes: v }))}
|
||||
/>
|
||||
<NumberField
|
||||
label="Disk usage alert at"
|
||||
label={t("Disk usage alert at")}
|
||||
value={healthChecks.diskUsagePercent}
|
||||
min={50}
|
||||
max={99}
|
||||
@@ -900,7 +900,7 @@ export default function NotificationSettings() {
|
||||
onChange={(v) => setHealthChecks((h) => ({ ...h, diskUsagePercent: v }))}
|
||||
/>
|
||||
<NumberField
|
||||
label="Warn when a disk will fill within"
|
||||
label={t("Warn when a disk will fill within")}
|
||||
value={healthChecks.diskForecastDays}
|
||||
min={0}
|
||||
max={90}
|
||||
@@ -965,19 +965,19 @@ export default function NotificationSettings() {
|
||||
<div className="col-lg-8" hidden={section !== "secrets"}>
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Secrets, keys and domains</h3>
|
||||
<h3 className="card-title">{t("Secrets, keys and domains")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{toggle("secretCheck", "Secret expiry reminder")}
|
||||
{toggle("tailscaleKeyCheck", "Tailscale key expiry reminder")}
|
||||
{toggle("domainExpiryCheck", "Domain registration expiring or expired (daily reminder)")}
|
||||
<NumberField
|
||||
label="Domain expiry warning"
|
||||
label={t("Domain expiry warning")}
|
||||
value={healthChecks.domainWarnDays}
|
||||
min={1}
|
||||
max={365}
|
||||
unit="days before"
|
||||
hint="Reminded daily from then until it's renewed."
|
||||
hint={t("Reminded daily from then until it's renewed.")}
|
||||
disabled={!notifications.domainExpiryCheck}
|
||||
onChange={(v) => setHealthChecks((h) => ({ ...h, domainWarnDays: v }))}
|
||||
/>
|
||||
@@ -988,7 +988,7 @@ export default function NotificationSettings() {
|
||||
<div className="col-lg-8" hidden={section !== "backups"}>
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Backups and updates</h3>
|
||||
<h3 className="card-title">{t("Backups and updates")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{toggle("proxmoxBackupCheck", "Proxmox backup failed, a guest has no coverage, or its newest backup is too old")}
|
||||
@@ -1035,7 +1035,7 @@ export default function NotificationSettings() {
|
||||
value={healthChecks.containerIgnore.join("\n")}
|
||||
onChange={(e) => setHealthChecks((h) => ({ ...h, containerIgnore: e.target.value.split("\n").map((l) => l.trim()).filter(Boolean) }))}
|
||||
/>
|
||||
<div className="form-hint">The scanner containers Dockhand starts (dockhand-grype-*, dockhand-trivy-*) are always left alone. There is also a <em>Leave alone</em> button on the Docker page.</div>
|
||||
<div className="form-hint">The scanner containers Dockhand starts (dockhand-grype-*, dockhand-trivy-*) are always left alone. There is also a <em>{t("Leave alone")}</em> button on the Docker page.</div>
|
||||
<label className="form-check mt-3 mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={healthChecks.vulnerabilityAlerts} onChange={(e) => setHealthChecks((h) => ({ ...h, vulnerabilityAlerts: e.target.checked }))} />
|
||||
<span className="form-check-label">
|
||||
@@ -1059,7 +1059,7 @@ export default function NotificationSettings() {
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<NumberField
|
||||
label="Warn about running Docker images that were built more than"
|
||||
label={t("Warn about running Docker images that were built more than")}
|
||||
value={healthChecks.imageAgeDays}
|
||||
min={0}
|
||||
max={3650}
|
||||
@@ -1075,12 +1075,12 @@ export default function NotificationSettings() {
|
||||
<div className="col-lg-8" hidden={section !== "integrations"}>
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Integrations and automation</h3>
|
||||
<h3 className="card-title">{t("Integrations and automation")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{toggle("integrationFailureAlerts", "Integration/DNS provider failing repeatedly")}
|
||||
<NumberField
|
||||
label="Alert after"
|
||||
label={t("Alert after")}
|
||||
value={notifications.integrationFailureThreshold}
|
||||
min={1}
|
||||
max={20}
|
||||
@@ -1099,7 +1099,7 @@ export default function NotificationSettings() {
|
||||
<div className="col-lg-8" hidden={section !== "dns"}>
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">DNS changes</h3>
|
||||
<h3 className="card-title">{t("DNS changes")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{toggle("dnsAdd", "DNS record added")}
|
||||
@@ -1130,12 +1130,12 @@ export default function NotificationSettings() {
|
||||
<div className="col-md-6">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Time zone and daily reminders</h3>
|
||||
<h3 className="card-title">{t("Time zone and daily reminders")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="notify-tz">
|
||||
Time zone
|
||||
{t("Time zone")}
|
||||
</label>
|
||||
<select id="notify-tz" className="form-select" value={notifications.timezone} onChange={(e) => setNotifications((n) => ({ ...n, timezone: e.target.value }))}>
|
||||
{TIMEZONES.map((tz) => (
|
||||
@@ -1144,11 +1144,11 @@ export default function NotificationSettings() {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="form-hint">Used for the daily reminders, quiet hours and the weekly digest below.</div>
|
||||
<div className="form-hint">{t("Used for the daily reminders, quiet hours and the weekly digest below.")}</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="form-label" htmlFor="notify-daily">
|
||||
Daily reminder time
|
||||
{t("Daily reminder time")}
|
||||
</label>
|
||||
<input
|
||||
id="notify-daily"
|
||||
@@ -1169,7 +1169,7 @@ export default function NotificationSettings() {
|
||||
<div className="col-md-6">
|
||||
<div className="card h-100">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Quiet hours</h3>
|
||||
<h3 className="card-title">{t("Quiet hours")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -1179,7 +1179,7 @@ export default function NotificationSettings() {
|
||||
</p>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={quietHours.enabled} onChange={(e) => setQuietHours((q) => ({ ...q, enabled: e.target.checked }))} />
|
||||
<span className="form-check-label">Enable quiet hours</span>
|
||||
<span className="form-check-label">{t("Enable quiet hours")}</span>
|
||||
</label>
|
||||
<div className="row g-2 mb-2">
|
||||
<div className="col-6">
|
||||
@@ -1187,7 +1187,7 @@ export default function NotificationSettings() {
|
||||
<input type="time" className="form-control" value={quietHours.start} disabled={!quietHours.enabled} onChange={(e) => setQuietHours((q) => ({ ...q, start: e.target.value }))} />
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label className="form-label">End</label>
|
||||
<label className="form-label">{t("End")}</label>
|
||||
<input type="time" className="form-control" value={quietHours.end} disabled={!quietHours.enabled} onChange={(e) => setQuietHours((q) => ({ ...q, end: e.target.value }))} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -1205,7 +1205,7 @@ export default function NotificationSettings() {
|
||||
{queuedCount} notification{queuedCount !== 1 ? "s" : ""} currently queued.
|
||||
</span>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={handleFlushNow} disabled={flushing}>
|
||||
{flushing ? "Sending…" : "Flush now"}
|
||||
{flushing ? t("Sending…") : t("Flush now")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -1221,7 +1221,7 @@ export default function NotificationSettings() {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Monthly report</h3>
|
||||
<h3 className="card-title">{t("Monthly report")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -1230,12 +1230,12 @@ export default function NotificationSettings() {
|
||||
</p>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={monthly.enabled} onChange={(e) => setMonthly((m) => ({ ...m, enabled: e.target.checked }))} />
|
||||
<span className="form-check-label">Send the monthly report</span>
|
||||
<span className="form-check-label">{t("Send the monthly report")}</span>
|
||||
</label>
|
||||
<div className="row g-2 mb-3" style={{ maxWidth: 420 }}>
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="monthly-day">
|
||||
Day of the month
|
||||
{t("Day of the month")}
|
||||
</label>
|
||||
<select id="monthly-day" className="form-select" value={monthly.day} disabled={!monthly.enabled} onChange={(e) => setMonthly((m) => ({ ...m, day: Number(e.target.value) }))}>
|
||||
{Array.from({ length: 28 }, (_, i) => i + 1).map((d) => (
|
||||
@@ -1247,7 +1247,7 @@ export default function NotificationSettings() {
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="monthly-time">
|
||||
Time
|
||||
{t("Time")}
|
||||
</label>
|
||||
<input id="monthly-time" type="time" className="form-control" value={monthly.time} disabled={!monthly.enabled} onChange={(e) => setMonthly((m) => ({ ...m, time: e.target.value }))} />
|
||||
</div>
|
||||
@@ -1262,10 +1262,10 @@ export default function NotificationSettings() {
|
||||
</label>
|
||||
<div className="btn-list">
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={handleMonthlyPreview} disabled={monthlyBusy !== null}>
|
||||
{monthlyBusy === "preview" ? "Gathering…" : "Preview last month"}
|
||||
{monthlyBusy === "preview" ? t("Gathering…") : t("Preview last month")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={handleMonthlySend} disabled={monthlyBusy !== null}>
|
||||
{monthlyBusy === "send" ? "Sending…" : "Send last month now"}
|
||||
{monthlyBusy === "send" ? t("Sending…") : t("Send last month now")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="form-hint mt-2">The day and time are saved with the Save button; the preview and "send now" don't depend on them. The day is at most the 28th, so every month has it.</div>
|
||||
@@ -1285,7 +1285,7 @@ export default function NotificationSettings() {
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Weekly digest</h3>
|
||||
<h3 className="card-title">{t("Weekly digest")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -1295,12 +1295,12 @@ export default function NotificationSettings() {
|
||||
</p>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={digest.enabled} onChange={(e) => setDigest((d) => ({ ...d, enabled: e.target.checked }))} />
|
||||
<span className="form-check-label">Send the weekly digest</span>
|
||||
<span className="form-check-label">{t("Send the weekly digest")}</span>
|
||||
</label>
|
||||
<div className="row g-2 mb-3" style={{ maxWidth: 420 }}>
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="digest-day">
|
||||
Day
|
||||
{t("Day")}
|
||||
</label>
|
||||
<select id="digest-day" className="form-select" value={digest.day} disabled={!digest.enabled} onChange={(e) => setDigest((d) => ({ ...d, day: Number(e.target.value) }))}>
|
||||
{DIGEST_DAYS.map((d) => (
|
||||
@@ -1312,17 +1312,17 @@ export default function NotificationSettings() {
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<label className="form-label" htmlFor="digest-time">
|
||||
Time
|
||||
{t("Time")}
|
||||
</label>
|
||||
<input id="digest-time" type="time" className="form-control" value={digest.time} disabled={!digest.enabled} onChange={(e) => setDigest((d) => ({ ...d, time: e.target.value }))} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="btn-list">
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={handleDigestPreview} disabled={digestBusy !== null}>
|
||||
{digestBusy === "preview" ? "Gathering…" : "Preview"}
|
||||
{digestBusy === "preview" ? t("Gathering…") : t("Preview")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-outline-secondary" onClick={handleDigestSend} disabled={digestBusy !== null}>
|
||||
{digestBusy === "send" ? "Sending…" : "Send it now"}
|
||||
{digestBusy === "send" ? t("Sending…") : t("Send it now")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="form-hint mt-2">The day and time are saved with the Save button; the preview and "send it now" don't depend on them.</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import BackupSettings from "./BackupSettings";
|
||||
import LogSettings from "./LogSettings";
|
||||
import CacheSettings from "./CacheSettings";
|
||||
import StorageSettings from "./StorageSettings";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
// Settings used to have twelve tabs of its own. Two of them gather the ones that belong together; each part is the same page it always was,
|
||||
// switched by `?view=` (so it can be linked to, and the old addresses redirect here).
|
||||
@@ -17,10 +18,10 @@ export function DisplayGroup() {
|
||||
return (
|
||||
<>
|
||||
<ViewTabs
|
||||
label="Display settings"
|
||||
label={t("Display settings")}
|
||||
tabs={[
|
||||
{ to: "/settings/display", label: "Dates, times and tables", active: view === "display" },
|
||||
{ to: "/settings/display?view=badges", label: "Badge colours", active: view === "badges" },
|
||||
{ to: "/settings/display?view=badges", label: t("Badge colours"), active: view === "badges" },
|
||||
]}
|
||||
/>
|
||||
{view === "badges" ? <BadgeSettings /> : <DisplaySettings />}
|
||||
@@ -36,12 +37,12 @@ export function DataGroup() {
|
||||
return (
|
||||
<>
|
||||
<ViewTabs
|
||||
label="Data settings"
|
||||
label={t("Data settings")}
|
||||
tabs={[
|
||||
{ to: "/settings/data", label: "Backup", active: view === "backup" },
|
||||
{ to: "/settings/data?view=logs", label: "Logs", active: view === "logs" },
|
||||
{ to: "/settings/data?view=storage", label: "Storage", active: view === "storage" },
|
||||
{ to: "/settings/data?view=cache", label: "Cache", active: view === "cache" },
|
||||
{ to: "/settings/data", label: t("Backup"), active: view === "backup" },
|
||||
{ to: "/settings/data?view=logs", label: t("Logs"), active: view === "logs" },
|
||||
{ to: "/settings/data?view=storage", label: t("Storage"), active: view === "storage" },
|
||||
{ to: "/settings/data?view=cache", label: t("Cache"), active: view === "cache" },
|
||||
]}
|
||||
/>
|
||||
{view === "logs" ? <LogSettings /> : view === "cache" ? <CacheSettings /> : view === "storage" ? <StorageSettings /> : <BackupSettings />}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { EmptyRow } from "../../components/EmptyState";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const LASTS: { days: number | null; label: string }[] = [
|
||||
{ days: null, label: "Until I remove it" },
|
||||
{ days: null, get label() { return t("Until I remove it"); } },
|
||||
{ days: 7, label: "7 days" },
|
||||
{ days: 30, label: "30 days" },
|
||||
{ days: 90, label: "90 days" },
|
||||
@@ -23,7 +23,7 @@ const LASTS: { days: number | null; label: string }[] = [
|
||||
];
|
||||
|
||||
const DETAIL_WORDS: Record<ShareLinkDetail, string> = {
|
||||
summary: "Numbers only",
|
||||
get summary() { return t("Numbers only"); },
|
||||
names: "With names",
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function ShareSettings() {
|
||||
}
|
||||
|
||||
async function remove(link: ShareLink) {
|
||||
if (!(await confirmDialog({ title: "Remove share link", message: `Remove "${link.label}"? Any screen showing it stops working at once.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Remove share link"), message: `Remove "${link.label}"? Any screen showing it stops working at once.`, confirmLabel: t("Remove"), danger: true }))) return;
|
||||
try {
|
||||
await api.shareLinks.remove(link.id);
|
||||
toast.success(`Removed ${link.label}.`);
|
||||
@@ -92,7 +92,7 @@ export default function ShareSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3 className="mb-3">Share links</h3>
|
||||
<h3 className="mb-3">{t("Share links")}</h3>
|
||||
<p className="text-secondary">
|
||||
A share link opens a page <strong>without signing in</strong>: the <strong>wall display</strong> — how things are, on one screen, for a TV in the hall — or a <strong>status page</strong> — whether each of the things you choose is working, with names people at home will recognise, for family or housemates who only want to know "is the movie server up?" — or a <strong>calendar feed</strong> — what is coming up (expiries, planned maintenance …), for a phone's calendar to subscribe to. It can only look; it can't change anything.
|
||||
</p>
|
||||
@@ -117,7 +117,7 @@ export default function ShareSettings() {
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">Copy it now — it can't be shown again. If it's lost, remove the link and make a new one.</p>
|
||||
<div className="input-group">
|
||||
<input className="form-control" readOnly value={created.url} aria-label="The share link address" onFocus={(e) => e.currentTarget.select()} />
|
||||
<input className="form-control" readOnly value={created.url} aria-label={t("The share link address")} onFocus={(e) => e.currentTarget.select()} />
|
||||
<CopyButton text={created.url} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -131,19 +131,19 @@ export default function ShareSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Make a link</h3>
|
||||
<h3 className="card-title">{t("Make a link")}</h3>
|
||||
</div>
|
||||
<form onSubmit={create}>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="share-label">
|
||||
What it is for
|
||||
{t("What it is for")}
|
||||
</label>
|
||||
<input id="share-label" className="form-control" required maxLength={60} placeholder="e.g. Hall TV" value={label} onChange={(e) => setLabel(e.target.value)} />
|
||||
<input id="share-label" className="form-control" required maxLength={60} placeholder={t("e.g. Hall TV")} value={label} onChange={(e) => setLabel(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="share-kind">
|
||||
What it opens
|
||||
{t("What it opens")}
|
||||
</label>
|
||||
<select id="share-kind" className="form-select" value={kind} onChange={(e) => setKind(e.target.value as ShareLinkKind)}>
|
||||
<option value="wall">The wall display — how things are</option>
|
||||
@@ -154,7 +154,7 @@ export default function ShareSettings() {
|
||||
{(kind === "wall" || kind === "calendar") && (
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="share-detail">
|
||||
How much it shows
|
||||
{t("How much it shows")}
|
||||
</label>
|
||||
<select id="share-detail" className="form-select" value={detail} onChange={(e) => setDetail(e.target.value as ShareLinkDetail)}>
|
||||
{kind === "wall" ? (
|
||||
@@ -192,7 +192,7 @@ export default function ShareSettings() {
|
||||
<label className="form-label" htmlFor="share-title">
|
||||
Heading <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<input id="share-title" className="form-control" maxLength={60} placeholder="Defaults to the name above" value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
<input id="share-title" className="form-control" maxLength={60} placeholder={t("Defaults to the name above")} value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label" htmlFor="share-message">
|
||||
@@ -204,7 +204,7 @@ export default function ShareSettings() {
|
||||
)}
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="share-lasts">
|
||||
How long it works
|
||||
{t("How long it works")}
|
||||
</label>
|
||||
<select id="share-lasts" className="form-select" value={days ?? ""} onChange={(e) => setDays(e.target.value === "" ? null : Number(e.target.value))}>
|
||||
{LASTS.map((l) => (
|
||||
@@ -224,7 +224,7 @@ export default function ShareSettings() {
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || label.trim() === ""}>
|
||||
{busy ? "Making…" : "Make link"}
|
||||
{busy ? "Making…" : t("Make link")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -232,7 +232,7 @@ export default function ShareSettings() {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Links</h3>
|
||||
<h3 className="card-title">{t("Links")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="share-links" />
|
||||
</div>
|
||||
@@ -242,10 +242,10 @@ export default function ShareSettings() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Shows</th>
|
||||
<th>Made</th>
|
||||
<th>Works until</th>
|
||||
<th>Last opened</th>
|
||||
<th>{t("Shows")}</th>
|
||||
<th>{t("Made")}</th>
|
||||
<th>{t("Works until")}</th>
|
||||
<th>{t("Last opened")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -259,13 +259,13 @@ export default function ShareSettings() {
|
||||
<td className="text-secondary">
|
||||
{l.createdBy ?? "—"}, <TimeAgo value={l.createdAt} fromDb />
|
||||
</td>
|
||||
<td>{l.expired ? <span className="badge bg-red-lt text-red">Ended</span> : l.expiresAt ? formatDateTime(new Date(l.expiresAt)) : "Until removed"}</td>
|
||||
<td>{l.expired ? <span className="badge bg-red-lt text-red">{t("Ended")}</span> : l.expiresAt ? formatDateTime(new Date(l.expiresAt)) : t("Until removed")}</td>
|
||||
<td className="text-secondary">{l.lastUsedAt ? <TimeAgo value={l.lastUsedAt} /> : "Never"}</td>
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
{l.kind === "status" && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setEditing({ id: l.id, label: l.label })}>
|
||||
Choose what it shows…
|
||||
{t("Choose what it shows…")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(l)}>
|
||||
@@ -276,7 +276,7 @@ export default function ShareSettings() {
|
||||
</tr>
|
||||
))}
|
||||
{links?.length === 0 && (
|
||||
<EmptyRow colSpan={6} title="No share links yet" hint="A link lets a wall display, a status page or a calendar feed be used without signing in. Make one with the form above." />
|
||||
<EmptyRow colSpan={6} title={t("No share links yet")} hint="A link lets a wall display, a status page or a calendar feed be used without signing in. Make one with the form above." />
|
||||
)}
|
||||
{links === null && !error && (
|
||||
<tr>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { PageSkeleton } from "../../components/Skeleton";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { toast } from "../../utils/toast";
|
||||
import ExportTableButton from "../../components/ExportTableButton";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const DEFAULTS: SignInSettingsData = { roleFromGroups: false, groupsClaim: "groups", adminGroups: [], operatorGroups: [], otherwise: "viewer" };
|
||||
const NO_PICTURES: ProfilePictureSettings = { gravatar: false, identityProvider: false };
|
||||
@@ -87,16 +88,16 @@ export default function SignInSettings() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center justify-content-between mb-3">
|
||||
<h3 className="mb-0">Sign-in</h3>
|
||||
<h3 className="mb-0">{t("Sign-in")}</h3>
|
||||
<button className="btn btn-primary" onClick={save} disabled={busy !== null || !dirty || noAdmin}>
|
||||
{busy === "save" ? "Saving…" : "Save"}
|
||||
{busy === "save" ? t("Saving…") : t("Save")}
|
||||
</button>
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Roles from groups</h3>
|
||||
<h3 className="card-title">{t("Roles from groups")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -106,7 +107,7 @@ export default function SignInSettings() {
|
||||
</p>
|
||||
<label className="form-check mb-3">
|
||||
<input type="checkbox" className="form-check-input" checked={enabled} onChange={(e) => setEnabled(e.target.checked)} />
|
||||
<span className="form-check-label">Set roles from groups at each sign-in</span>
|
||||
<span className="form-check-label">{t("Set roles from groups at each sign-in")}</span>
|
||||
</label>
|
||||
<div className="row g-3">
|
||||
<div className="col-md-4">
|
||||
@@ -117,20 +118,20 @@ export default function SignInSettings() {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="si-admin">
|
||||
Admin groups
|
||||
{t("Admin groups")}
|
||||
</label>
|
||||
<textarea id="si-admin" className="form-control" rows={3} placeholder={"homelab-admins"} value={adminText} onChange={(e) => setAdminText(e.target.value)} />
|
||||
<div className="form-hint">One per line, or separated by commas. Case doesn't matter.</div>
|
||||
<div className="form-hint">{t("One per line, or separated by commas. Case doesn't matter.")}</div>
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="si-operator">
|
||||
Operator groups
|
||||
{t("Operator groups")}
|
||||
</label>
|
||||
<textarea id="si-operator" className="form-control" rows={3} placeholder={"homelab-ops"} value={operatorText} onChange={(e) => setOperatorText(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<label className="form-label" htmlFor="si-otherwise">
|
||||
Someone in none of those groups
|
||||
{t("Someone in none of those groups")}
|
||||
</label>
|
||||
<select id="si-otherwise" className="form-select" value={otherwise} onChange={(e) => setOtherwise(e.target.value as "viewer" | "keep")}>
|
||||
<option value="viewer">becomes a viewer</option>
|
||||
@@ -145,7 +146,7 @@ export default function SignInSettings() {
|
||||
</div>
|
||||
<div className="card-footer d-flex flex-wrap align-items-center gap-2">
|
||||
<button className="btn btn-outline-secondary" onClick={check} disabled={busy !== null}>
|
||||
{busy === "check" ? "Checking…" : "Check against the groups people had last time"}
|
||||
{busy === "check" ? t("Checking…") : t("Check against the groups people had last time")}
|
||||
</button>
|
||||
<span className="text-secondary small">Changes nothing — it shows what each person would be.</span>
|
||||
</div>
|
||||
@@ -153,7 +154,7 @@ export default function SignInSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Profile pictures</h3>
|
||||
<h3 className="card-title">{t("Profile pictures")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">
|
||||
@@ -186,7 +187,7 @@ export default function SignInSettings() {
|
||||
{preview && (
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">What these rules would do</h3>
|
||||
<h3 className="card-title">{t("What these rules would do")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="role-preview" />
|
||||
</div>
|
||||
@@ -200,10 +201,10 @@ export default function SignInSettings() {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Person</th>
|
||||
<th>Groups at last sign-in</th>
|
||||
<th>Now</th>
|
||||
<th>Would be</th>
|
||||
<th>{t("Person")}</th>
|
||||
<th>{t("Groups at last sign-in")}</th>
|
||||
<th>{t("Now")}</th>
|
||||
<th>{t("Would be")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -60,9 +60,9 @@ export default function StorageSettings() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-3">
|
||||
<h3 className="mb-0">Storage</h3>
|
||||
<h3 className="mb-0">{t("Storage")}</h3>
|
||||
<button className="btn btn-sm ms-auto" onClick={load} disabled={loading}>
|
||||
{loading ? "Measuring…" : "Measure again"}
|
||||
{loading ? "Measuring…" : t("Measure again")}
|
||||
</button>
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -73,7 +73,7 @@ export default function StorageSettings() {
|
||||
{usage.attention.length > 0 && (
|
||||
<div className="alert alert-warning" role="status">
|
||||
<div>
|
||||
<div className="fw-bold mb-1">{usage.attention.length === 1 ? "One history needs a look" : `${usage.attention.length} histories need a look`}</div>
|
||||
<div className="fw-bold mb-1">{usage.attention.length === 1 ? t("One history needs a look") : `${usage.attention.length} histories need a look`}</div>
|
||||
<ul className="mb-0 ps-3">
|
||||
{usage.attention.map((a) => (
|
||||
<li key={a.table}>
|
||||
@@ -87,10 +87,10 @@ export default function StorageSettings() {
|
||||
|
||||
<div className="row row-cards mb-3">
|
||||
{[
|
||||
{ label: "In total", value: formatBytes(usage.totalBytes), sub: "database, backups and sessions" },
|
||||
{ label: "Database", value: formatBytes(db.bytes + db.walBytes), sub: `${db.tables} tables${db.freeBytes > 0 ? `, ${formatBytes(db.freeBytes)} of it free` : ""}` },
|
||||
{ label: "Backups", value: formatBytes(usage.backups.bytes), sub: `${usage.backups.files} ${usage.backups.files === 1 ? "file" : "files"}` },
|
||||
{ label: "Sessions", value: formatBytes(usage.sessions.bytes), sub: `${usage.sessions.files} signed in ${usage.sessions.files === 1 ? "browser" : "browsers"}` },
|
||||
{ label: t("In total"), value: formatBytes(usage.totalBytes), sub: "database, backups and sessions" },
|
||||
{ label: t("Database"), value: formatBytes(db.bytes + db.walBytes), sub: `${db.tables} tables${db.freeBytes > 0 ? `, ${formatBytes(db.freeBytes)} of it free` : ""}` },
|
||||
{ label: t("Backups"), value: formatBytes(usage.backups.bytes), sub: `${usage.backups.files} ${usage.backups.files === 1 ? "file" : "files"}` },
|
||||
{ label: t("Sessions"), value: formatBytes(usage.sessions.bytes), sub: `${usage.sessions.files} signed in ${usage.sessions.files === 1 ? "browser" : "browsers"}` },
|
||||
].map((tile) => (
|
||||
<div key={tile.label} className="col-6 col-lg-3">
|
||||
<div className="card card-sm">
|
||||
@@ -106,10 +106,10 @@ export default function StorageSettings() {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">What takes the room</h3>
|
||||
<h3 className="card-title">{t("What takes the room")}</h3>
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm" onClick={() => setShowAll((v) => !v)}>
|
||||
{showAll ? "Only the larger ones" : `All ${usage.tables.length} tables`}
|
||||
{showAll ? t("Only the larger ones") : `All ${usage.tables.length} tables`}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -118,12 +118,12 @@ export default function StorageSettings() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("Table")}</th>
|
||||
<th className="text-end">Size</th>
|
||||
<th className="text-end">Rows</th>
|
||||
<th className="text-end">{t("Size")}</th>
|
||||
<th className="text-end">{t("Rows")}</th>
|
||||
<th className="text-end">Added a day</th>
|
||||
<th>Kept</th>
|
||||
<th>Reaches back</th>
|
||||
<th>Trimming</th>
|
||||
<th>{t("Kept")}</th>
|
||||
<th>{t("Reaches back")}</th>
|
||||
<th>{t("Trimming")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -157,7 +157,7 @@ export default function StorageSettings() {
|
||||
</div>
|
||||
<div className="card-footer text-secondary small">
|
||||
Sizes count a table with its indexes. Space freed by trimming is reused by the next rows rather than handed back, so the file does not shrink on its own. How long the logs are kept is set under{" "}
|
||||
<Link to="/settings/data?view=logs">Logs</Link>; the rest is fixed.
|
||||
<Link to="/settings/data?view=logs">{t("Logs")}</Link>; the rest is fixed.
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -69,7 +69,7 @@ export default function TagSettings() {
|
||||
}
|
||||
|
||||
async function rename(item_: TagEntry) {
|
||||
const input = await promptDialog({ title: "Rename tag", message: `Rename “${item_.name}” to:`, defaultValue: item_.name, confirmLabel: "Rename", required: true });
|
||||
const input = await promptDialog({ title: t("Rename tag"), message: `Rename “${item_.name}” to:`, defaultValue: item_.name, confirmLabel: t("Rename"), required: true });
|
||||
if (input === null) return;
|
||||
const to = normalizeTagInput(input);
|
||||
if (!to || to === item_.name) return;
|
||||
@@ -77,21 +77,21 @@ export default function TagSettings() {
|
||||
if (
|
||||
target &&
|
||||
!(await confirmDialog({
|
||||
title: "Merge tags",
|
||||
title: t("Merge tags"),
|
||||
message: `“${to}” already exists. Merge “${item_.name}” into it? Every server tagged “${item_.name}” will get “${to}” instead.`,
|
||||
confirmLabel: "Merge",
|
||||
confirmLabel: t("Merge"),
|
||||
}))
|
||||
)
|
||||
return;
|
||||
await run(
|
||||
() => api.tags.rename(item_.name, to),
|
||||
(res) => `${res.merged ? "Merged" : "Renamed"} “${item_.name}” ${res.merged ? "into" : "to"} “${to}” — ${res.updatedServers} server${res.updatedServers === 1 ? "" : "s"} updated.`,
|
||||
(res) => `${res.merged ? t("Merged") : t("Renamed")} “${item_.name}” ${res.merged ? "into" : "to"} “${to}” — ${res.updatedServers} server${res.updatedServers === 1 ? "" : "s"} updated.`,
|
||||
);
|
||||
}
|
||||
|
||||
async function remove(item_: TagEntry) {
|
||||
const used = item_.count > 0 ? ` It's on ${item_.count} server${item_.count === 1 ? "" : "s"} and will be removed from ${item_.count === 1 ? "it" : "them"}.` : "";
|
||||
if (!(await confirmDialog({ title: "Delete tag", message: `Delete the tag “${item_.name}”?${used}`, confirmLabel: "Delete", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: t("Delete tag"), message: `Delete the tag “${item_.name}”?${used}`, confirmLabel: t("Delete"), danger: true }))) return;
|
||||
await run(
|
||||
() => api.tags.remove(item_.name),
|
||||
(res) => `Deleted “${item_.name}”${res.updatedServers > 0 ? ` and removed it from ${res.updatedServers} server${res.updatedServers === 1 ? "" : "s"}` : ""}.`,
|
||||
@@ -108,7 +108,7 @@ export default function TagSettings() {
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Add a tag</h3>
|
||||
<h3 className="card-title">{t("Add a tag")}</h3>
|
||||
</div>
|
||||
<form onSubmit={add}>
|
||||
<div className="card-body">
|
||||
@@ -127,10 +127,10 @@ export default function TagSettings() {
|
||||
/>
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={newColor !== null} onChange={(e) => setNewColor(e.target.checked ? DEFAULT_PICK : null)} />
|
||||
<span className="form-check-label">Choose a colour</span>
|
||||
<span className="form-check-label">{t("Choose a colour")}</span>
|
||||
</label>
|
||||
{newColor !== null && (
|
||||
<input type="color" className="form-control form-control-color" value={newColor} onChange={(e) => setNewColor(e.target.value)} aria-label="Colour" />
|
||||
<input type="color" className="form-control form-control-color" value={newColor} onChange={(e) => setNewColor(e.target.value)} aria-label={t("Colour")} />
|
||||
)}
|
||||
{previewName && (
|
||||
<span className={preview.className} style={preview.style}>
|
||||
@@ -138,7 +138,7 @@ export default function TagSettings() {
|
||||
</span>
|
||||
)}
|
||||
<button type="submit" className="btn btn-primary ms-auto" disabled={busy || !newName.trim()}>
|
||||
Add tag
|
||||
{t("Add tag")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,7 +147,7 @@ export default function TagSettings() {
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">All tags</h3>
|
||||
<h3 className="card-title">{t("All tags")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="tags" />
|
||||
</div>
|
||||
@@ -156,9 +156,9 @@ export default function TagSettings() {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th>{t("Tag")}</th>
|
||||
<th>{t("Servers")}</th>
|
||||
<th>Colour</th>
|
||||
<th>{t("Colour")}</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -187,7 +187,7 @@ export default function TagSettings() {
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<span className="text-secondary small">Automatic</span>
|
||||
<span className="text-secondary small">{t("Automatic")}</span>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(item_.name, DEFAULT_PICK)}>
|
||||
{t("Choose…")}
|
||||
</button>
|
||||
@@ -205,7 +205,7 @@ export default function TagSettings() {
|
||||
)}
|
||||
{item_.color && !(draft && draft !== item_.color) && (
|
||||
<button className="btn btn-sm btn-link p-0" onClick={() => void saveColor(item_, null)} disabled={busy}>
|
||||
Reset to automatic
|
||||
{t("Reset to automatic")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -213,7 +213,7 @@ export default function TagSettings() {
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => void rename(item_)} disabled={busy}>
|
||||
Rename
|
||||
{t("Rename")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(item_)} disabled={busy}>
|
||||
{t("Delete")}
|
||||
@@ -225,7 +225,7 @@ export default function TagSettings() {
|
||||
})}
|
||||
{tags === null && <LoadingRow colSpan={4} />}
|
||||
{tags && tags.length === 0 && (
|
||||
<EmptyRow colSpan={4} title="No tags yet" hint="Tags are labels for grouping and filtering servers (prod, lab, nas). Add one above, or tag a server from its own page." />
|
||||
<EmptyRow colSpan={4} title={t("No tags yet")} hint="Tags are labels for grouping and filtering servers (prod, lab, nas). Add one above, or tag a server from its own page." />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ErrorNotice } from "../../components/Notice";
|
||||
import { BlockSkeleton } from "../../components/Skeleton";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { toast } from "../../utils/toast";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const pretty = (body: string) => {
|
||||
try {
|
||||
@@ -50,7 +51,7 @@ export default function WebhookDeliveries({ hook, onClose, onChanged }: { hook:
|
||||
<DetailDrawer title={`Sent to ${hook.label}`} subtitle="The last 100 messages, and none older than two weeks" onClose={onClose}>
|
||||
<ErrorNotice error={error} />
|
||||
{rows === null && !error && <BlockSkeleton lines={4} />}
|
||||
{rows?.length === 0 && <EmptyState title="Nothing has been sent yet" hint="Each message sent to this webhook is listed here with how it went. Use Test on the webhook to send one." />}
|
||||
{rows?.length === 0 && <EmptyState title={t("Nothing has been sent yet")} hint="Each message sent to this webhook is listed here with how it went. Use Test on the webhook to send one." />}
|
||||
<div className="list-group list-group-flush">
|
||||
{rows?.map((d) => (
|
||||
<div key={d.id} className="list-group-item px-0">
|
||||
@@ -66,10 +67,10 @@ export default function WebhookDeliveries({ hook, onClose, onChanged }: { hook:
|
||||
</div>
|
||||
<div className="btn-list mt-2">
|
||||
<button className="btn btn-sm" onClick={() => setOpen(open === d.id ? null : d.id)} disabled={d.body === null} aria-expanded={open === d.id}>
|
||||
{open === d.id ? "Hide the message" : "Show the message"}
|
||||
{open === d.id ? t("Hide the message") : t("Show the message")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => void retry(d)} disabled={!d.retryable || sending !== null} title={d.retryable ? "Send exactly this message again, with the same id and signature" : "Too large to have been kept"}>
|
||||
{sending === d.id ? "Sending…" : "Send again"}
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => void retry(d)} disabled={!d.retryable || sending !== null} title={d.retryable ? t("Send exactly this message again, with the same id and signature") : t("Too large to have been kept")}>
|
||||
{sending === d.id ? t("Sending…") : t("Send again")}
|
||||
</button>
|
||||
</div>
|
||||
{!d.retryable && <div className="text-secondary small mt-1">This message was too large to keep, so it cannot be shown or sent again.</div>}
|
||||
|
||||
Reference in new issue
Block a user