Add a Swedish interface with a per-person language switch

A small translation system (the English text is its own key, so anything
without a Swedish entry stays English) and a Language switch in the user menu,
saved on the account (users.language) and following the browser when no choice
has been made. Swedish covers the menu, shared parts (search, tables, dialogs,
relative times), the sign-in page and the everyday pages: Dashboard, Alerts,
Servers, Updates, Maintenance, My work, Coming up, To do, Integrations and the
display settings. Server-written messages stay English for now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-12 21:49:49 +01:00
1 parent e7f23ba13f
commit 645816d5a8
168 files changed
+12142 -1422

No files matched your search

+8 -7
View File
@@ -10,14 +10,15 @@ import { formatAgo } from "../utils/duration";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (a.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">{t("In order")}</span>;
}
function Tile({ label, value, sub, tone }: { label: string; value: string; sub?: string | null; tone?: "bad" | "warn" }) {
@@ -87,7 +88,7 @@ function Card({ a, canRead, onRead }: { a: AdguardInstance; canRead: boolean; on
<>
<div className="row g-3 mb-3">
<Tile
label="DNS answers"
label={t("DNS answers")}
value={!s.running ? "Not running" : s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "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}
@@ -170,8 +171,8 @@ export default function AdguardHome({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">AdGuard Home</h2>
<PageIntro>
Read every two minutes (see <Link to="/integrations">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>,{" "}
<strong>protection left off for an hour</strong> and <strong>filter lists that stopped updating</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
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>,{" "}
<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} />
{!data && !error && <BlockSkeleton lines={4} />}
+10 -9
View File
@@ -10,6 +10,7 @@ import { ErrorNotice } from "../components/Notice";
import TableToolbar from "../components/TableToolbar";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
interface LinkForm {
serverId: number | "";
@@ -152,7 +153,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title mb-3">Admin Links</h2>
<h2 className="page-title mb-3">{t("Admin Links")}</h2>
<PageIntro>
Every admin bookmark added to a server's own page (Infrastructure → Servers → a server → Admin Links) — Dockge,
Webmin, Cockpit, and the like — in one place, instead of visiting each server to find them.
@@ -167,7 +168,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
<form onSubmit={submit}>
<div className="card-body row g-3">
<div className="col-md-3">
<label className="form-label">Server</label>
<label className="form-label">{t("Server")}</label>
<select
className="form-select"
required
@@ -210,7 +211,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
</div>
{form.serverId !== "" && (
<div className="col-12">
<label className="form-label">Fill from a known port (optional)</label>
<label className="form-label">{t("Fill from a known port (optional)")}</label>
<select
className="form-select"
style={{ maxWidth: 460 }}
@@ -245,7 +246,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
{editing ? "Save changes" : "Add link"}
</button>
<button type="button" className="btn" onClick={cancelForm}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -262,7 +263,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
actions={
canEdit && !showForm ? (
<button className="btn btn-primary btn-sm" onClick={startAdd}>
Add link
{t("Add link")}
</button>
) : undefined
}
@@ -273,10 +274,10 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<AdminLink> label="Server" sortKeyName="serverName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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} />
<th>URL</th>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -296,10 +297,10 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" onClick={() => startEdit(l)}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(l)}>
Delete
{t("Delete")}
</button>
</div>
</td>
+11 -10
View File
@@ -9,6 +9,7 @@ import TimeAgo from "../components/TimeAgo";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
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)." },
@@ -119,7 +120,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
<ErrorNotice error={error} />
<div className="mb-3">
<label className="form-label" htmlFor="rule-name">
Name
{t("Name")}
</label>
<input id="rule-name" className="form-control" maxLength={80} value={name} onChange={(e) => setName(e.target.value)} placeholder="e.g. CPU above 90% for 15 minutes" autoFocus />
<div className="form-text">It is in the alert&rsquo;s message, in square brackets.</div>
@@ -140,7 +141,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
{metric === "disk" && (
<div className="mb-3">
<label className="form-label" htmlFor="rule-mount">
Which disk <span className="text-secondary">(optional)</span>
Which disk <span className="text-secondary">{t("(optional)")}</span>
</label>
<input id="rule-mount" className="form-control" value={mount} onChange={(e) => setMount(e.target.value)} placeholder="every disk — or a mount point like /data, or C:" />
</div>
@@ -183,8 +184,8 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
How serious
</label>
<select id="rule-severity" className="form-select" value={severity} onChange={(e) => setSeverity(e.target.value as "warning" | "critical")}>
<option value="warning">Warning</option>
<option value="critical">Critical</option>
<option value="warning">{t("Warning")}</option>
<option value="critical">{t("Critical")}</option>
</select>
</div>
<div className="col-6">
@@ -192,7 +193,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
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">Every server</option>
<option value="all">{t("Every server")}</option>
<option value="server">One server</option>
<option value="tag" disabled={tags.length === 0}>
Servers with a tag
@@ -221,7 +222,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
</select>
)}
<div className="text-secondary small mb-3">
Severity and kind decide who hears of it: these are <strong>Monitoring</strong> alerts, so the routing rules under Settings → Notifications apply to them like any other.
Severity and kind decide who hears of it: these are <strong>{t("Monitoring")}</strong> alerts, so the routing rules under Settings → Notifications apply to them like any other.
</div>
{tried && (
<div className={`alert ${tried.length > 0 ? "alert-warning" : "alert-success"} py-2`}>
@@ -338,11 +339,11 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
<thead>
<tr>
<th>Rule</th>
<th>Severity</th>
<th>{t("Severity")}</th>
<th>Right now</th>
{canEdit && (
<th className="w-1">
<span className="visually-hidden">Actions</span>
<span className="visually-hidden">{t("Actions")}</span>
</th>
)}
</tr>
@@ -355,7 +356,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
{!r.enabled && <span className="badge bg-secondary-lt text-secondary ms-2">off</span>}
<div className="text-secondary small">{sentence(r)}</div>
</td>
<td className="stack-label" data-label="Severity">
<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>
</td>
<td className="stack-label" data-label="Right now">
@@ -392,7 +393,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
{r.enabled ? "Switch off" : "Switch on"}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(r)} aria-label={`Remove ${r.name}`}>
Remove
{t("Remove")}
</button>
</div>
</td>
+3 -2
View File
@@ -5,6 +5,7 @@ import AlertRules from "./AlertRules";
import ServiceLevels from "./ServiceLevels";
import NotificationSettings from "./settings/NotificationSettings";
import AlertTicketSettings from "./settings/AlertTicketSettings";
import { t } from "../i18n";
type View = "rules" | "levels" | "tickets";
@@ -26,14 +27,14 @@ export default function AlertSettings({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<h2 className="page-title mb-0">Alert settings</h2>
<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 →
</Link>
)}
</div>
<ViewTabs label="Alert settings" tabs={tabs} />
<ViewTabs label={t("Alert settings")} tabs={tabs} />
{view === "levels" ? <ServiceLevels user={user} /> : view === "tickets" ? <AlertTicketSettings /> : <AlertRules user={user} />}
</>
);
+53 -52
View File
@@ -30,6 +30,7 @@ import AlertNoise from "../components/AlertNoise";
import BulkBar from "../components/BulkBar";
import { AckBulkDrawer, SilenceBulkDrawer } from "../components/BulkDrawers";
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 },
@@ -55,7 +56,7 @@ type Row = AlertItem & { rank: number };
/** Now, History and Noise: what is wrong right now, every time something was raised and went away, and which alerts keep coming back. The same page, switched by `?view=`. */
const alertTabs = (view: "now" | "history" | "noise") => (
<ViewTabs
label="Alerts view"
label={t("Alerts view")}
tabs={[
{ to: "/alerts", label: "Now", active: view === "now" },
{ to: "/alerts?view=history", label: "History", active: view === "history" },
@@ -81,7 +82,7 @@ export default function Alerts({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-2">
<h2 className="page-title mb-0">Alerts</h2>
<h2 className="page-title mb-0">{t("Alerts")}</h2>
</div>
{alertTabs(view)}
{view === "history" ? <IncidentHistory /> : <AlertNoise />}
@@ -273,7 +274,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
async function reopen(a: AlertItem) {
try {
await api.alerts.reopen(a.id);
toast.success("Opened again.");
toast.success(t("Opened again."));
await load(true);
reloadBadge();
} catch (err) {
@@ -283,7 +284,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
async function wake(a: AlertItem) {
try {
await api.alerts.unsnooze(a.id);
toast.success("Awake again.");
toast.success(t("Awake again."));
await load(true);
reloadBadge();
} catch (err) {
@@ -346,13 +347,13 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Alerts</h2>
<h2 className="page-title mb-0">{t("Alerts")}</h2>
<div className="ms-auto btn-list">
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={!sorted?.length}>
Export CSV
{t("Export CSV")}
</button>
<button className="btn btn-outline-secondary" onClick={() => void load(true)} disabled={loading}>
{loading ? "Checking…" : "Check now"}
{loading ? t("Checking…") : t("Check now")}
</button>
</div>
</div>
@@ -364,7 +365,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<>
{" "}
<span title={formatDateTime(new Date(report.generatedAt))}>
Checked {formatAgo(report.generatedAt)}
{t("Checked")} {formatAgo(report.generatedAt)}
{report.cached ? " (a recent result, reused)" : ""}.
</span>
</>
@@ -374,7 +375,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
{!report && !error && (
<div className="card">
<div className="card-body text-secondary">Checking everything — this can take a few seconds…</div>
<div className="card-body text-secondary">{t("Checking everything — this can take a few seconds…")}</div>
</div>
)}
@@ -425,7 +426,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
{report.couldntCheck.length > 0 && (
<div className="alert alert-warning">
<div>
<div className="fw-bold mb-1">Couldn't check everything — what's missing below isn't necessarily fine</div>
<div className="fw-bold mb-1">{t("Couldn't check everything — what's missing below isn't necessarily fine")}</div>
<ul className="mb-0">
{report.couldntCheck.map((c) => (
<li key={c.name}>
@@ -448,11 +449,11 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<div className="card-body text-center py-5">
{report.couldntCheck.length === 0 ? (
<>
<div className="h3 text-green mb-1">All clear</div>
<div className="text-secondary">Nothing needs attention right now.</div>
<div className="h3 text-green mb-1">{t("All clear")}</div>
<div className="text-secondary">{t("Nothing needs attention right now.")}</div>
</>
) : (
<div className="text-secondary">No problems found in what could be checked — see the warning above for what couldn't.</div>
<div className="text-secondary">{t("No problems found in what could be checked — see the warning above for what couldn't.")}</div>
)}
</div>
</div>
@@ -461,14 +462,14 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<TableToolbar
search={search}
onSearch={setSearch}
placeholder="Search alerts…"
placeholder={t("Search alerts…")}
filters={
<>
<select className="form-select form-select-sm w-auto" aria-label="Severity" value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
<option value="all">All severities</option>
<option value="critical">Critical</option>
<option value="warning">Warning</option>
<option value="info">Info</option>
<select className="form-select form-select-sm w-auto" aria-label={t("Severity")} value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
<option value="all">{t("All severities")}</option>
<option value="critical">{t("Critical")}</option>
<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)}>
{(Object.keys(GROUP_BY_LABELS) as GroupBy[]).map((g) => (
@@ -477,8 +478,8 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
</option>
))}
</select>
<select className="form-select form-select-sm w-auto" aria-label="Kind of alert" value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
<option value="all">All kinds</option>
<select className="form-select form-select-sm w-auto" aria-label={t("Kind of alert")} value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
<option value="all">{t("All kinds")}</option>
{presentCategories.map((c) => (
<option key={c} value={c}>
{CATEGORY_LABELS[c]}
@@ -486,11 +487,11 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
))}
</select>
{(counts?.acknowledged ?? 0) > 0 && (
<select className="form-select form-select-sm w-auto" aria-label="Whether somebody is on it" value={attention} onChange={(e) => setAttention(e.target.value as typeof attention)}>
<option value="all">Acknowledged or not</option>
<option value="unacknowledged">Nobody is on it</option>
<option value="acknowledged">Acknowledged</option>
<option value="mine">Handed to me</option>
<select className="form-select form-select-sm w-auto" aria-label={t("Whether somebody is on it")} value={attention} onChange={(e) => setAttention(e.target.value as typeof attention)}>
<option value="all">{t("Acknowledged or not")}</option>
<option value="unacknowledged">{t("Nobody is on it")}</option>
<option value="acknowledged">{t("Acknowledged")}</option>
<option value="mine">{t("Handed to me")}</option>
</select>
)}
{canSilence && shownIds.length > 0 && (
@@ -510,19 +511,19 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
})
}
/>
<span className="form-check-label">Pick all {shownIds.length} shown</span>
<span className="form-check-label">{t("Pick all {n} shown", { n: shownIds.length })}</span>
</label>
)}
{(counts?.grouped ?? 0) > 0 && (
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={grouped} onChange={(e) => chooseGrouped(e.target.checked)} />
<span className="form-check-label">Group under their cause</span>
<span className="form-check-label">{t("Group under their cause")}</span>
</label>
)}
{(counts?.silenced ?? 0) + (counts?.grouped ?? 0) > 0 && (
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={showSilenced} onChange={(e) => setShowSilenced(e.target.checked)} />
<span className="form-check-label">{(counts?.grouped ?? 0) > 0 ? "Show silenced and grouped" : "Show silenced"}</span>
<span className="form-check-label">{(counts?.grouped ?? 0) > 0 ? t("Show silenced and grouped") : t("Show silenced")}</span>
</label>
)}
</>
@@ -532,13 +533,13 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Row> label="Severity" sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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="Source" sortKeyName="source" 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} />
{canSilence && (
<th className="w-1">
<span className="visually-hidden">Actions</span>
<span className="visually-hidden">{t("Actions")}</span>
</th>
)}
</tr>
@@ -561,7 +562,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<td className="stack-wide">
{a.message}
{a.flapping && (
<span className="badge bg-red-lt text-red ms-2" title="Raised and cleared again and again within an hour — its messages are held back until it has been calm for an hour">
<span className="badge bg-red-lt text-red ms-2" title={t("Raised and cleared again and again within an hour — its messages are held back until it has been calm for an hour")}>
flapping
</span>
)}
@@ -579,7 +580,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
</span>
) : (
a.silenced && (
<span className="badge bg-secondary-lt text-secondary ms-2" title="Under a maintenance window — notifications for this are held back">
<span className="badge bg-secondary-lt text-secondary ms-2" title={t("Under a maintenance window — notifications for this are held back")}>
silenced
</span>
)
@@ -593,7 +594,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
</div>
)}
{a.ack && !a.ack.active && (
<div className="small mt-1 text-secondary">Its acknowledgement ran out — nobody is on it now.</div>
<div className="small mt-1 text-secondary">{t("Its acknowledgement ran out — nobody is on it now.")}</div>
)}
{a.incidentId != null && (
<div className="small">
@@ -608,7 +609,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
)}
{a.affects && a.affects.length > 0 && (
<div className="text-secondary small">
Also takes down {a.affects.length} {a.affects.length === 1 ? "thing" : "things"}: {a.affects.join(", ")}
{tn(a.affects.length, "Also takes down {n} thing: {list}", "Also takes down {n} things: {list}", { list: a.affects.join(", ") })}
</div>
)}
{(childrenOf.get(a.id)?.length ?? 0) > 0 && (
@@ -625,7 +626,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
})
}
>
{open.has(a.id) ? "Hide" : "Show"} the {childrenOf.get(a.id)!.length} {childrenOf.get(a.id)!.length === 1 ? "alert" : "alerts"} held back under this
{open.has(a.id) ? t("Hide") : t("Show")} the {childrenOf.get(a.id)!.length} {childrenOf.get(a.id)!.length === 1 ? "alert" : "alerts"} held back under this
</button>
)}
{a.ticket &&
@@ -648,27 +649,27 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<div className="btn-list flex-nowrap">
{!a.silenced && (
<button type="button" className={`btn btn-sm ${a.ack?.active ? "btn-outline-primary" : "btn-outline-secondary"}`} onClick={() => setAcking(a)}>
{a.ack?.active ? "Acknowledged" : "Acknowledge…"}
{a.ack?.active ? t("Acknowledged") : t("Acknowledge…")}
</button>
)}
{!a.silenced && (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setSnoozing(a)} title="Hide it until a time, and hear of it again then if it is still there">
Snooze…
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setSnoozing(a)} title={t("Hide it until a time, and hear of it again then if it is still there")}>
{t("Snooze…")}
</button>
)}
{!a.silenced && (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setClosing(a)} title="Dealt with, or accepted: hide it until it gets worse">
Close…
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setClosing(a)} title={t("Dealt with, or accepted: hide it until it gets worse")}>
{t("Close…")}
</button>
)}
{a.closed && (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void reopen(a)}>
Open again
{t("Open again")}
</button>
)}
{a.snoozed && (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void wake(a)}>
Wake now
{t("Wake now")}
</button>
)}
{!a.snoozed && !a.closed && <SilenceButton alert={a} onDone={() => void load(true)} />}
@@ -710,25 +711,25 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<div className="has-bulk-bar" />
<BulkBar count={pickedIds.length} noun={pickedIds.length === 1 ? "alert" : "alerts"} onClear={() => setPicked(new Set())}>
<button type="button" className="btn btn-sm btn-primary" onClick={() => setBulkForm("ack")}>
Acknowledge…
{t("Acknowledge…")}
</button>
<button type="button" className="btn btn-sm" onClick={() => void bulkUnack()}>
Remove acknowledgement
{t("Remove acknowledgement")}
</button>
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("snooze")}>
Snooze…
{t("Snooze…")}
</button>
<button type="button" className="btn btn-sm" onClick={() => void bulkWake()}>
Wake
{t("Wake")}
</button>
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("close")} title="Dealt with, or accepted: hide them until they get worse">
Close…
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("close")} title={t("Dealt with, or accepted: hide them until they get worse")}>
{t("Close…")}
</button>
<button type="button" className="btn btn-sm" onClick={() => void bulkReopen()}>
Open again
{t("Open again")}
</button>
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("silence")}>
Silence…
{t("Silence…")}
</button>
</BulkBar>
</>
+20 -19
View File
@@ -10,6 +10,7 @@ import { formatDate } from "../utils/date";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const EXPIRY = [
{ value: "90", label: "90 days" },
@@ -69,12 +70,12 @@ export default function ApiTokens() {
}
}
async function remove(t: ApiToken) {
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 "${t.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: "Remove", danger: true }))) return;
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;
try {
await api.apiTokens.remove(t.id);
toast.success(`Removed "${t.label}".`);
await api.apiTokens.remove(item_.id);
toast.success(`Removed "${item_.label}".`);
load();
} catch (err) {
toast.error(readableError(err));
@@ -86,7 +87,7 @@ export default function ApiTokens() {
return (
<>
<div className="d-flex align-items-center mb-1">
<h2 className="page-title mb-0">API tokens</h2>
<h2 className="page-title mb-0">{t("API tokens")}</h2>
</div>
<PageIntro>
Read-only access to your installation&rsquo;s data for scripts, Home Assistant and dashboards. A token can only read, sees what you see, and stops working when you are removed. Make one for each thing that reads, so each can be removed on its own.
@@ -150,13 +151,13 @@ export default function ApiTokens() {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Starts with</th>
<th>Made</th>
<th>Last used</th>
<th>Ends</th>
<th>{t("Ends")}</th>
<th className="w-1">
<span className="visually-hidden">Actions</span>
<span className="visually-hidden">{t("Actions")}</span>
</th>
</tr>
</thead>
@@ -168,27 +169,27 @@ export default function ApiTokens() {
</td>
</tr>
)}
{tokens?.map((t) => (
<tr key={t.id}>
{tokens?.map((item_) => (
<tr key={item_.id}>
<td className="stack-wide">
<strong>{t.label}</strong>
{t.expired && <span className="badge bg-red-lt text-red ms-2">expired</span>}
<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">
{t.tokenPrefix}…
{item_.tokenPrefix}…
</td>
<td className="stack-label" data-label="Made">
<TimeAgo value={t.createdAt} fromDb />
<TimeAgo value={item_.createdAt} fromDb />
</td>
<td className="stack-label" data-label="Last used">
{t.lastUsedAt ? <TimeAgo value={t.lastUsedAt} /> : <span className="text-secondary">never</span>}
{item_.lastUsedAt ? <TimeAgo value={item_.lastUsedAt} /> : <span className="text-secondary">never</span>}
</td>
<td className="stack-label" data-label="Ends">
{t.expiresAt ? formatDate(new Date(t.expiresAt)) : <span className="text-secondary">no end</span>}
<td className="stack-label" data-label={t("Ends")}>
{item_.expiresAt ? formatDate(new Date(item_.expiresAt)) : <span className="text-secondary">no end</span>}
</td>
<td className="stack-wide">
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(t)}>
Remove
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(item_)}>
{t("Remove")}
</button>
</td>
</tr>
+10 -9
View File
@@ -12,14 +12,15 @@ import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (a.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">{t("In order")}</span>;
}
/** "in 12 days", "today", "3 days ago": how long until something runs out, in words, coloured by how close it is. */
@@ -68,7 +69,7 @@ function Card({ a }: { a: AuthentikInfo }) {
<th>Outpost</th>
<th>Type</th>
<th className="text-end">Serves</th>
<th>Reporting</th>
<th>{t("Reporting")}</th>
<th>Last heard</th>
</tr>
</thead>
@@ -153,7 +154,7 @@ function ManageCard({ a, onChanged }: { a: AuthentikInfo; onChanged: () => void
<AuthentikGroupList a={a} />
</>
) : (
<div className="text-secondary">Switched off under Integrations.</div>
<div className="text-secondary">{t("Switched off under Integrations.")}</div>
)}
</div>
</div>
@@ -198,8 +199,8 @@ export default function Authentik({ user }: { user: CurrentUser }) {
)}
{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">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">Alerts</Link>.
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>.
{isAdmin && (
<>
{" "}
@@ -209,7 +210,7 @@ export default function Authentik({ user }: { user: CurrentUser }) {
</PageIntro>
) : (
<p className="text-secondary">
Make a user — with a one-time link for them to choose their own password — switch users off, edit or delete them, and make and rename groups and change who is in them. It needs a token that may do that on the integration (<Link to="/integrations">Integrations</Link> → edit),
Make a user — with a one-time link for them to choose their own password — switch users off, edit or delete them, and make and rename groups and change who is in them. It needs a token that may do that on the integration (<Link to="/integrations">{t("Integrations")}</Link> → edit),
and everything done here is written in the audit log.
</p>
)}
+18 -17
View File
@@ -16,6 +16,7 @@ import { downloadCsv } from "../utils/csv";
import { readableError } from "../utils/errors";
import { EmptyRow } from "../components/EmptyState";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
interface Row extends CoverageGuest {
/** Worst first, so a default sort puts what needs attention at the top. */
@@ -96,11 +97,11 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
}
}
async function removeTest(t: RestoreTestEntry) {
async function removeTest(item_: RestoreTestEntry) {
await removeWithUndo({
remove: () => api.backups.removeRestoreTest(t.id),
restore: () => api.backups.recordRestoreTest({ key: t.subjectKey, label: t.label, testedAt: t.testedAt, result: t.result, note: t.note ?? undefined }),
message: `Removed the test of "${t.label}" from ${t.testedAt}.`,
remove: () => api.backups.removeRestoreTest(item_.id),
restore: () => api.backups.recordRestoreTest({ key: item_.subjectKey, label: item_.label, testedAt: item_.testedAt, result: item_.result, note: item_.note ?? undefined }),
message: `Removed the test of "${item_.label}" from ${item_.testedAt}.`,
reload: () => {
loadTests();
load();
@@ -242,7 +243,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
<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="Status" sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>Restore test</th>
</tr>
</thead>
@@ -361,7 +362,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
{saving ? "Saving…" : "Record it"}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -380,7 +381,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
</div>
<div className="card-body text-secondary small pb-0">
A backup nobody has restored is a hope, not a backup. Record each time you try one — for a guest above, or for anything else (a share, a database). A failed test is raised on the
Alerts page; under Settings → Notifications you can also ask to be reminded when a guest with backups hasn&rsquo;t had one in a while{report?.restoreTestDays ? ` (now: ${report.restoreTestDays} days)` : ""}.
Alerts page; under Settings → Notifications you can also ask to be reminded when a guest with backups hasn&rsquo;item_ had one in a while{report?.restoreTestDays ? ` (now: ${report.restoreTestDays} days)` : ""}.
</div>
{custom.length > 0 && (
<div className="card-body pb-0">
@@ -402,7 +403,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
<th>What</th>
<th>Result</th>
<th>Note</th>
{isAdmin && <th className="w-1">Actions</th>}
{isAdmin && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -413,21 +414,21 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
</td>
</tr>
)}
{tests?.map((t) => (
<tr key={t.id}>
<td className="stack-label" data-label="Date">{t.testedAt}</td>
<td>{t.label}</td>
{tests?.map((item_) => (
<tr key={item_.id}>
<td className="stack-label" data-label="Date">{item_.testedAt}</td>
<td>{item_.label}</td>
<td>
<span className={`badge ${RESTORE[t.result].badge}`}>{RESTORE[t.result].label}</span>
<span className={`badge ${RESTORE[item_.result].badge}`}>{RESTORE[item_.result].label}</span>
</td>
<td className="text-secondary stack-wide">
{t.note ?? "—"}
{t.testedBy && <span className="small"> · {t.testedBy}</span>}
{item_.note ?? "—"}
{item_.testedBy && <span className="small"> · {item_.testedBy}</span>}
</td>
{isAdmin && (
<td className="stack-wide">
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeTest(t)}>
Remove
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeTest(item_)}>
{t("Remove")}
</button>
</td>
)}
+8 -7
View File
@@ -9,6 +9,7 @@ import EmptyState from "../components/EmptyState";
import { downloadCsv } from "../utils/csv";
import { formatDate, formatTime } from "../utils/date";
import { readableError } from "../utils/errors";
import { t } from "../i18n";
const TONE_DOT: Record<ChangeEntry["tone"], string> = { good: "#2fb344", bad: "#e05252", info: "#4299e1", neutral: "#8a94a6" };
@@ -42,7 +43,7 @@ export default function ChangeLog() {
return (
<>
<div className="d-flex align-items-center mb-2">
<h2 className="page-title mb-0">Change log</h2>
<h2 className="page-title mb-0">{t("Change log")}</h2>
</div>
{changeTabs("audit")}
<AuditLogView />
@@ -144,9 +145,9 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Change log</h2>
<h2 className="page-title mb-0">{t("Change log")}</h2>
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={!entries || entries.length === 0}>
Export CSV
{t("Export CSV")}
</button>
</div>
{tabs}
@@ -159,15 +160,15 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
<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)}>
<option value="">All kinds</option>
<option value="">{t("All kinds")}</option>
{kinds.map((k) => (
<option key={k.id} value={k.id}>
{k.label}
</option>
))}
</select>
<select className="form-select w-auto" aria-label="Server" value={serverId ?? ""} onChange={(e) => setParam("serverId", e.target.value || null)}>
<option value="">Every server</option>
<select className="form-select w-auto" aria-label={t("Server")} value={serverId ?? ""} onChange={(e) => setParam("serverId", e.target.value || null)}>
<option value="">{t("Every server")}</option>
{servers.map((s) => (
<option key={s.id} value={s.id}>
{s.name}
@@ -190,7 +191,7 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
{q || kind || serverId ? (
<EmptyState
filtered
title="Nothing matches that"
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 }); } }}
/>
+16 -15
View File
@@ -8,6 +8,7 @@ import { downloadCsv } from "../utils/csv";
import { formatDate, formatTime } from "../utils/date";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const KINDS: { id: AgendaKind; label: string }[] = [
{ id: "secret", label: "Secrets" },
@@ -57,11 +58,11 @@ function sectionsOf(items: AgendaItem[]): Section[] {
const now = items.filter((i) => i.daysLeft < 0 || i.kind === "updates");
const rest = items.filter((i) => !(i.daysLeft < 0 || i.kind === "updates"));
return [
{ id: "now", title: "Needs attention now", hint: "Already past its date, or waiting", items: now },
{ id: "today", title: "Today", items: rest.filter((i) => i.daysLeft === 0) },
{ id: "week", title: "This week", items: rest.filter((i) => i.daysLeft >= 1 && i.daysLeft <= 7) },
{ id: "month", title: "The rest of the month", hint: "8 to 30 days away", items: rest.filter((i) => i.daysLeft >= 8 && i.daysLeft <= 30) },
{ id: "later", title: "Further ahead", items: rest.filter((i) => i.daysLeft > 30) },
{ id: "now", title: t("Needs attention now"), hint: t("Already past its date, or waiting"), items: now },
{ id: "today", title: t("Today"), items: rest.filter((i) => i.daysLeft === 0) },
{ id: "week", title: t("This week"), items: rest.filter((i) => i.daysLeft >= 1 && i.daysLeft <= 7) },
{ id: "month", title: t("The rest of the month"), hint: "8 to 30 days away", items: rest.filter((i) => i.daysLeft >= 8 && i.daysLeft <= 30) },
{ id: "later", title: t("Further ahead"), items: rest.filter((i) => i.daysLeft > 30) },
].filter((s) => s.items.length > 0);
}
@@ -191,9 +192,9 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Coming up</h2>
<h2 className="page-title mb-0">{t("Coming up")}</h2>
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={shown.length === 0}>
Export CSV
{t("Export CSV")}
</button>
</div>
<PageIntro>
@@ -230,7 +231,7 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
<div className="card mb-3">
<div className="card-body">
<div className="d-flex flex-wrap gap-2 align-items-center mb-2">
<select className="form-select w-auto" aria-label="How far ahead" value={days} onChange={(e) => setParam("days", e.target.value === "90" ? null : e.target.value)}>
<select className="form-select w-auto" aria-label={t("How far ahead")} value={days} onChange={(e) => setParam("days", e.target.value === "90" ? null : e.target.value)}>
{RANGES.map((r) => (
<option key={r.days} value={r.days}>
{r.label}
@@ -238,8 +239,8 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
))}
</select>
{serversWithItems.length > 0 && (
<select className="form-select w-auto" aria-label="Server" value={serverId ?? ""} onChange={(e) => setParam("server", e.target.value || null)}>
<option value="">Every server</option>
<select className="form-select w-auto" aria-label={t("Server")} value={serverId ?? ""} onChange={(e) => setParam("server", e.target.value || null)}>
<option value="">{t("Every server")}</option>
{serversWithItems.map((id) => (
<option key={id} value={id}>
{servers.get(id) ?? `Server ${id}`}
@@ -250,16 +251,16 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
{(hiddenRecurring > 0 || everyOccurrence) && (
<label className="form-check mb-0 ms-2">
<input type="checkbox" className="form-check-input" checked={everyOccurrence} onChange={(e) => setEveryOccurrence(e.target.checked)} />
<span className="form-check-label">Every time a recurring maintenance happens{hiddenRecurring > 0 ? ` (${hiddenRecurring} more)` : ""}</span>
<span className="form-check-label">{t("Every time a recurring maintenance happens")}{hiddenRecurring > 0 ? ` (${hiddenRecurring} more)` : ""}</span>
</label>
)}
{filtered && (
<button className="btn btn-sm btn-link" onClick={() => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true })}>
Clear filters
{t("Clear filters")}
</button>
)}
</div>
<div className="d-flex flex-wrap gap-2" role="group" aria-label="Kinds of things">
<div className="d-flex flex-wrap gap-2" role="group" aria-label={t("Kinds of things")}>
{KINDS.map((k) => {
const n = counts.get(k.id) ?? 0;
const on = chosen.has(k.id);
@@ -277,9 +278,9 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
{agenda !== null && sections.length === 0 && (
<div className="card">
{filtered ? (
<EmptyState filtered title="Nothing matches that" hint="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: "Clear filters", onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
) : (
<EmptyState title="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.`} />
<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.`} />
)}
</div>
)}
+3 -2
View File
@@ -9,6 +9,7 @@ import { readableError } from "../utils/errors";
import { promptDialog } from "../utils/dialogs";
import { ErrorNotice, SuccessNotice } from "../components/Notice";
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." },
@@ -158,10 +159,10 @@ export default function Consistency({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Consistency</h2>
<h2 className="page-title mb-0">{t("Consistency")}</h2>
<div className="ms-auto btn-list">
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={visible.length === 0}>
Export CSV
{t("Export CSV")}
</button>
<button className="btn btn-outline-secondary" onClick={() => void load()} disabled={loading}>
{loading ? "Checking…" : "Refresh"}
+7 -6
View File
@@ -10,6 +10,7 @@ import { formatDate } from "../utils/date";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const money = (n: number, currency: string) => {
try {
@@ -175,7 +176,7 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
{saving ? "Saving…" : "Save"}
</button>
<button type="button" className="btn" disabled={saving} onClick={onCancel}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -235,9 +236,9 @@ export default function Costs({ user }: { user: CurrentUser }) {
<>
<div className="d-flex flex-wrap align-items-center gap-3 mb-3">
<div style={{ flex: "1 1 320px", minWidth: 0 }}>
<h2 className="page-title mb-0">Costs</h2>
<h2 className="page-title mb-0">{t("Costs")}</h2>
<PageIntro className="small mt-1">
What the homelab costs, in one place: what you pay for by hand and what can be read (a Hetzner project&rsquo;s estimate — see <Link to="/hetzner">Hetzner Cloud</Link>). Each currency has its own total; none is converted into another. A day a bill falls on shows under <Link to="/coming-up">Coming up</Link>.
What the homelab costs, in one place: what you pay for by hand and what can be read (a Hetzner project&rsquo;s estimate — see <Link to="/hetzner">Hetzner Cloud</Link>). Each currency has its own total; none is converted into another. A day a bill falls on shows under <Link to="/coming-up">{t("Coming up")}</Link>.
</PageIntro>
</div>
{isAdmin && !form && (
@@ -327,7 +328,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
<td className="text-secondary">—</td>
<td className="text-end">
<Link to={a.link} className="btn btn-sm">
Open
{t("Open")}
</Link>
</td>
</tr>
@@ -348,10 +349,10 @@ export default function Costs({ user }: { user: CurrentUser }) {
{isAdmin && (
<div className="btn-list justify-content-end flex-nowrap">
<button className="btn btn-sm" onClick={() => setForm({ id: i.id, value: { name: i.name, amount: i.amount, currency: i.currency, period: i.period, category: i.category, renewsOn: i.renewsOn, note: i.note } })}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(i)}>
Remove
{t("Remove")}
</button>
</div>
)}
+100 -99
View File
@@ -31,6 +31,7 @@ import { TYPE_GROUPS, TYPE_LABELS, TYPE_PAGES } from "../utils/integrationTypes"
import type { Agenda, Heartbeat } from "../api/client";
import BrandIcon from "../components/BrandIcon";
import { kindOfLabel } from "../utils/brands";
import { t } from "../i18n";
const DNS_TYPE_COLORS: Record<string, string> = {
A: "#60a5fa",
@@ -220,15 +221,15 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
<div className={`card h-100 ${hidden ? "card-hidden" : ""} ${problem ? `card-problem card-problem-${problem}` : ""}`}>
{editing && (
<div className="card-customise">
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} earlier`} title="Move earlier" onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, -1)}>
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} earlier`} title={t("Move earlier")} onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, -1)}>
<IconArrowLeft size={16} aria-hidden="true" />
</button>
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} later`} title="Move later" onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, 1)}>
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} later`} title={t("Move later")} onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, 1)}>
<IconArrowRight size={16} aria-hidden="true" />
</button>
<button type="button" className="btn btn-sm ms-auto d-inline-flex align-items-center gap-1" aria-pressed={hidden} onClick={() => void setCardHidden(label, !hidden)}>
{hidden ? <IconEye size={16} aria-hidden="true" /> : <IconEyeOff size={16} aria-hidden="true" />}
{hidden ? "Show" : "Hide"}
{hidden ? t("Show") : t("Hide")}
<span className="visually-hidden"> {label}</span>
</button>
</div>
@@ -249,31 +250,31 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
}
/** The status badge of a Technitium DNS Server widget: switched off, not read yet, can't be read, or what its alerts say (red for a critical one, yellow for the rest). */
function technitiumBadge(enabled: boolean, t: TechnitiumInstance | null): ReactNode {
if (!enabled) return <span className="badge bg-secondary-lt text-secondary">Disabled</span>;
if (!t || !t.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
if (!t.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (t.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (t.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
function technitiumBadge(enabled: boolean, tech: TechnitiumInstance | null): ReactNode {
if (!enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Disabled")}</span>;
if (!tech || !tech.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
if (!tech.fresh) return <span className="badge bg-yellow-lt text-yellow">{t("Can’t be read")}</span>;
if (tech.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (tech.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">{t("In order")}</span>;
}
const TECHNITIUM_HOW_COLORS: Record<string, string> = { "from cache": "#60a5fa", resolved: "#22d3ee", "own zones": "#4ade80", blocked: "#fb923c", dropped: "#f87171" };
/** What the Technitium DNS Server widget says: whether DNS answers and how fast, the last day's queries and how many were blocked, how they were answered, and what is wrong. The page has the rest. */
function TechnitiumBody({ enabled, instance, loading }: { enabled: boolean; instance: TechnitiumInstance | null; loading: boolean }) {
if (!enabled) return <div className="text-secondary">Switched off under Integrations.</div>;
if (!enabled) return <div className="text-secondary">{t("Switched off under Integrations.")}</div>;
if (loading) return <WidgetSkeleton />;
const s = instance?.state ?? null;
const open = (
<div className="mt-2">
<Link to="/technitium">Open Technitium DNS</Link>
<Link to="/technitium">{t("Open Technitium DNS")}</Link>
</div>
);
if (!instance || !s) {
return (
<>
<div className="text-secondary">Not read yet.</div>
<div className="text-secondary">{t("Not read yet.")}</div>
{open}
</>
);
@@ -292,18 +293,18 @@ function TechnitiumBody({ enabled, instance, loading }: { enabled: boolean; inst
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="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` : "No"} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
</div>
<div className="col-4">
<MiniStat label="Queries, 24 h" value={st ? st.queries.toLocaleString() : "—"} />
<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} />
</div>
</div>
{how.length > 0 && <BreakdownBar data={how} colors={TECHNITIUM_HOW_COLORS} compact />}
{!s.blockingEnabled && s.settings.blockLists.count > 0 && <div className="small text-yellow mt-2">Blocking is switched off.</div>}
{!instance.fresh && <div className="small text-yellow mt-2">The last read is old, so this may be out of date.</div>}
{!s.blockingEnabled && s.settings.blockLists.count > 0 && <div className="small text-yellow mt-2">{t("Blocking is switched off.")}</div>}
{!instance.fresh && <div className="small text-yellow mt-2">{t("The last read is old, so this may be out of date.")}</div>}
{instance.problems.slice(0, 2).map((p) => (
<div key={p.key} className={`small mt-1 ${p.severity === "critical" ? "text-red" : "text-yellow"}`}>
{p.message}
@@ -422,7 +423,7 @@ function MyWorkStrip() {
<strong>{work.needsAttention}</strong> {work.needsAttention === 1 ? "thing" : "things"} of yours {work.needsAttention === 1 ? "wants" : "want"} a look — alerts handed to you or about to run out, maintenance about to end, update runs still going, jobs that are due.
</span>
<Link to="/my-work" className="btn btn-sm btn-primary ms-auto">
My work
{t("My work")}
</Link>
</div>
);
@@ -755,12 +756,12 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
).map(([type, count]) => ({ label: SECRET_TYPE_LABELS[type as SecretRecord["type"]] ?? type, count }));
const setupSteps: SetupStep[] = [
{ id: "integration", title: "Connect an integration", description: "Proxmox, Synology, Tailscale, Docker, Uptime Kuma… each gets its own page and shows up in alerts.", to: "/integrations", action: "Add one", done: (integrations?.length ?? 0) > 0 },
{ id: "server", title: "Add a server and install its agent", description: "The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.", to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
{ id: "dns", title: "Connect a DNS provider", description: "See your zones and records, and have names matched to servers.", to: "/dns", action: "Connect", done: (dnsStats?.totalProviders ?? 0) > 0 },
{ id: "secret", title: "Track something that expires", description: "An API token, a certificate or a password — you're warned before it runs out.", to: "/secrets", action: "Add one", done: (secrets?.length ?? 0) > 0 },
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, Telegram, Pushover, email, a webhook or push to your phone, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
{ id: "people", title: "Let someone else in (optional)", description: "Others sign in with Authentik and appear under Users; you decide their role.", to: "/users", action: "Open Users", done: (userCount ?? 0) > 1 },
{ id: "integration", title: t("Connect an integration"), description: t("Proxmox, Synology, Tailscale, Docker, Uptime Kuma… each gets its own page and shows up in alerts."), to: "/integrations", action: t("Add one"), done: (integrations?.length ?? 0) > 0 },
{ id: "server", title: t("Add a server and install its agent"), description: t("The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet."), to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
{ id: "dns", title: t("Connect a DNS provider"), description: t("See your zones and records, and have names matched to servers."), to: "/dns", action: t("Connect"), done: (dnsStats?.totalProviders ?? 0) > 0 },
{ id: "secret", title: t("Track something that expires"), description: t("An API token, a certificate or a password — you're warned before it runs out."), to: "/secrets", action: t("Add one"), done: (secrets?.length ?? 0) > 0 },
{ id: "notify", title: t("Choose how you'll be told about problems"), description: t("Gotify, ntfy, Telegram, Pushover, email, a webhook or push to your phone, with the checks you want."), to: "/settings/notifications", action: t("Set up"), done: notifyConfigured === true },
{ id: "people", title: t("Let someone else in (optional)"), description: t("Others sign in with Authentik and appear under Users; you decide their role."), to: "/users", action: t("Open Users"), done: (userCount ?? 0) > 1 },
];
// What the endpoint checks say: the ones that keep failing, and the certificates that are running out.
@@ -786,15 +787,15 @@ 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: "connect a DNS provider to see zones and records" });
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: "Secrets", to: "/secrets", what: "track when a token, certificate or password expires" });
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 (integrations !== null) {
for (const { type, label } of WIDGETS) {
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: "connect it under Integrations" });
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: t("connect it under Integrations") });
}
}
@@ -803,30 +804,30 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<div className="row row-cards mb-3">
<div className="col-12">
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<h2 className="page-title mb-0">Dashboard</h2>
<h2 className="page-title mb-0">{t("Dashboard")}</h2>
<div className="ms-auto d-flex gap-2">
<button type="button" className={`btn btn-sm ${editing ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={editing} onClick={() => setEditingDashboard(!editing)}>
{editing ? "Done" : "Customise"}
{editing ? t("Done") : t("Customise")}
</button>
<Link to="/wall" className="btn btn-sm btn-outline-secondary" title="A full-screen status board for a spare monitor or tablet">
Wall display
<Link to="/wall" className="btn btn-sm btn-outline-secondary" title={t("A full-screen status board for a spare monitor or tablet")}>
{t("Wall display")}
</Link>
</div>
</div>
{editing && (
<div className="alert alert-info d-flex flex-wrap align-items-center gap-2" role="status">
<span>Move the Overview cards with the arrows, and hide any card you don't use — the ones at the top too. It saves as you go, for you only, and follows you to other browsers.</span>
<span>{t("Move the Overview cards with the arrows, and hide any card you don't use — the ones at the top too. It saves as you go, for you only, and follows you to other browsers.")}</span>
<label className="form-check mb-0 ms-auto">
<input type="checkbox" className="form-check-input" checked={problemsFirst} onChange={(e) => setProblemsFirst(e.target.checked)} />
<span className="form-check-label">Cards with a problem come first</span>
<span className="form-check-label">{t("Cards with a problem come first")}</span>
</label>
<button type="button" className="btn btn-sm" onClick={() => void resetDashboardLayout()}>
Reset to default
{t("Reset to default")}
</button>
</div>
)}
<p className="text-secondary">
Welcome back, {user.name ?? user.email ?? user.sub}.
{t("Welcome back,")} {user.name ?? user.email ?? user.sub}.
</p>
</div>
</div>
@@ -835,19 +836,19 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<div className="row row-cards mb-3">
{showTopLeft && (
<div className={showTopLeft && todoCard.shown ? "col-xl-6" : "col-12"}>
<Hideable label="Needs attention">
<Hideable label={t("Needs attention")}>
<StatusStrip />
</Hideable>
{(user.role === "admin" || user.role === "operator") && (
<Hideable label="My work">
<Hideable label={t("My work")}>
<MyWorkStrip />
</Hideable>
)}
<Hideable label="Since you last looked">
<Hideable label={t("Since you last looked")}>
<WhatChanged role={user.role} />
</Hideable>
{isAdmin && integrations !== null && dnsStats !== null && serverSummary !== null && secrets !== null && notifyConfigured !== null && (
<Hideable label="Getting started">
<Hideable label={t("Getting started")}>
<SetupGuide steps={setupSteps} />
</Hideable>
)}
@@ -872,14 +873,14 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
)}
<SectionHeader title="Overview" hint="DNS, Secrets, Servers and Domains are built into this app rather than connected integrations, but get the same at-a-glance treatment." />
<SectionHeader title={t("Overview")} hint={t("DNS, Secrets, Servers and Domains are built into this app rather than connected integrations, but get the same at-a-glance treatment.")} />
<div className="row row-cards mb-3">
<WidgetCard
label="DNS"
hide={dnsStats?.totalProviders === 0}
badge={
!dnsStats ? undefined : dnsStats.totalProviders === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
) : (
<span className="badge bg-green-lt text-green">
{dnsStats.enabledProviders} enabled
@@ -898,10 +899,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Domains" value={dnsStats.totalZones} />
<MiniStat label={t("Domains")} value={dnsStats.totalZones} />
</div>
<div className="col-4">
<MiniStat label="Records" value={dnsStats.totalRecords} />
<MiniStat label={t("Records")} value={dnsStats.totalRecords} />
</div>
<div className="col-4">
<MiniStat label="Providers" value={`${dnsStats.enabledProviders}/${dnsStats.totalProviders}`} />
@@ -923,17 +924,17 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</WidgetCard>
<WidgetCard
label="Secrets"
label={t("Secrets")}
hide={secrets !== null && totalSecrets === 0}
badge={
!secrets ? undefined : totalSecrets === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
) : expiredSecrets > 0 ? (
<span className="badge bg-red-lt text-red">{expiredSecrets} expired</span>
) : expiringSecrets > 0 ? (
<span className="badge bg-yellow-lt text-yellow">{expiringSecrets} expiring</span>
) : (
<span className="badge bg-green-lt text-green">All OK</span>
<span className="badge bg-green-lt text-green">{t("All OK")}</span>
)
}
>
@@ -941,7 +942,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<WidgetSkeleton />
) : totalSecrets === 0 ? (
<div className="text-secondary">
Configure a secret from the <Link to="/secrets">Secrets</Link> page.
Configure a secret from the <Link to="/secrets">{t("Secrets")}</Link> page.
</div>
) : (
<>
@@ -962,11 +963,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</WidgetCard>
<WidgetCard
label="Servers"
label={t("Servers")}
hide={serverSummary?.total === 0}
badge={
!serverSummary ? undefined : serverSummary.total === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
) : serverSummary.offline.length > 0 ? (
<span className="badge bg-red-lt text-red">{serverSummary.offline.length} offline</span>
) : serverSummary.fullDisks.length > 0 ? (
@@ -974,9 +975,9 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{serverSummary.fullDisks.length} disk{serverSummary.fullDisks.length === 1 ? "" : "s"} nearly full
</span>
) : serverSummary.online > 0 ? (
<span className="badge bg-green-lt text-green">All online</span>
<span className="badge bg-green-lt text-green">{t("All online")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary">No agent data</span>
<span className="badge bg-secondary-lt text-secondary">{t("No agent data")}</span>
)
}
>
@@ -985,23 +986,23 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
!serverError && <WidgetSkeleton />
) : serverSummary.total === 0 ? (
<div className="text-secondary">
Add a server from the <Link to="/servers">Servers</Link> page.
Add a server from the <Link to="/servers">{t("Servers")}</Link> page.
</div>
) : (
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Servers" value={<Link to="/servers" className="text-reset text-decoration-none">{serverSummary.total}</Link>} />
<MiniStat label={t("Servers")} value={<Link to="/servers" className="text-reset text-decoration-none">{serverSummary.total}</Link>} />
</div>
<div className="col-4">
<MiniStat
label="Online"
label={t("Online")}
value={serverSummary.online + serverSummary.offline.length === 0 ? "—" : `${serverSummary.online}/${serverSummary.online + serverSummary.offline.length}`}
/>
</div>
<div className="col-4">
<MiniStat
label="Offline"
label={t("Offline")}
value={serverSummary.offline.length}
accent={serverSummary.offline.length > 0 ? "#ef4444" : undefined}
/>
@@ -1009,8 +1010,8 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<BreakdownBar
data={[
{ label: "Online", count: serverSummary.online },
{ label: "Offline", count: serverSummary.offline.length },
{ label: t("Online"), count: serverSummary.online },
{ label: t("Offline"), count: serverSummary.offline.length },
{ label: "No data", count: serverSummary.noData },
].filter((d) => d.count > 0)}
colors={SERVER_STATE_COLORS}
@@ -1018,7 +1019,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
/>
{serverSummary.offline.length > 0 && (
<div className="small mt-2">
<span className="text-red">Offline:</span>{" "}
<span className="text-red">{t("Offline:")}</span>{" "}
{serverSummary.offline.slice(0, 3).map((s, i) => (
<span key={s.id}>
{i > 0 && ", "}
@@ -1062,19 +1063,19 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</WidgetCard>
<WidgetCard
label="Domains"
label={t("Domains")}
hide={domainList !== null && domains.length === 0}
badge={
!domainList ? undefined : domains.length === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
) : expiredDomains.length > 0 ? (
<span className="badge bg-red-lt text-red">{expiredDomains.length} expired</span>
) : expiringDomains.length > 0 ? (
<span className="badge bg-yellow-lt text-yellow">{expiringDomains.length} expiring</span>
) : okDomains > 0 ? (
<span className="badge bg-green-lt text-green">All OK</span>
<span className="badge bg-green-lt text-green">{t("All OK")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary">No expiry dates</span>
<span className="badge bg-secondary-lt text-secondary">{t("No expiry dates")}</span>
)
}
>
@@ -1083,7 +1084,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
!domainError && <WidgetSkeleton />
) : domains.length === 0 ? (
<div className="text-secondary">
Domains for your DNS zones appear on the <Link to="/dns?view=domains">Domains</Link> page after the next daily check, or add one there.
Domains for your DNS zones appear on the <Link to="/dns?view=domains">{t("Domains")}</Link> page after the next daily check, or add one there.
</div>
) : (
<>
@@ -1110,7 +1111,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
/>
{expiredDomains.length > 0 && (
<div className="small mt-2">
<span className="text-red">Expired:</span>{" "}
<span className="text-red">{t("Expired:")}</span>{" "}
{expiredDomains.slice(0, 3).map((d, i) => (
<span key={d.id}>
{i > 0 && ", "}
@@ -1122,7 +1123,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
)}
{expiringDomains.length > 0 && (
<div className="small mt-2">
<span className="text-yellow">Expiring:</span>{" "}
<span className="text-yellow">{t("Expiring:")}</span>{" "}
{expiringDomains
.slice()
.sort((a, b) => a.daysLeft! - b.daysLeft!)
@@ -1138,12 +1139,12 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
)}
{nextDomain && nextDomain.status === "ok" && (
<div className="text-secondary small mt-2">
Next to expire: {nextDomain.name} in {nextDomain.daysLeft} days ({nextDomain.expiresAt})
{t("Next to expire:")} {nextDomain.name} in {nextDomain.daysLeft} days ({nextDomain.expiresAt})
</div>
)}
{failingDomainChecks > 0 && (
<div className="text-secondary small mt-2">
{failingDomainChecks} domain{failingDomainChecks === 1 ? "" : "s"} couldn't be refreshed — see the <Link to="/dns?view=domains">Domains</Link> page.
{failingDomainChecks} domain{failingDomainChecks === 1 ? "" : "s"} couldn't be refreshed — see the <Link to="/dns?view=domains">{t("Domains")}</Link> page.
</div>
)}
</>
@@ -1151,7 +1152,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</WidgetCard>
<WidgetCard
label="Endpoints"
label={t("Endpoints")}
hide={endpointChecks !== null && endpointChecks.length === 0}
badge={
!endpointChecks ? undefined : endpointsDown.length > 0 ? (
@@ -1161,7 +1162,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{endpointCerts} certificate{endpointCerts === 1 ? "" : "s"} to renew
</span>
) : (
<span className="badge bg-green-lt text-green">All answering</span>
<span className="badge bg-green-lt text-green">{t("All answering")}</span>
)
}
>
@@ -1186,28 +1187,28 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
))}
<div className="text-secondary small mt-2">
<Link to="/endpoints">All checks</Link>
<Link to="/endpoints">{t("All checks")}</Link>
</div>
</>
)}
</WidgetCard>
<WidgetCard
label="Coming up"
label={t("Coming up")}
badge={
!agenda ? undefined : soonPast > 0 ? (
<span className="badge bg-red-lt text-red">{soonPast} past their date</span>
) : soonWeek > 0 ? (
<span className="badge bg-yellow-lt text-yellow">{soonWeek} this week</span>
) : (
<span className="badge bg-green-lt text-green">Nothing soon</span>
<span className="badge bg-green-lt text-green">{t("Nothing soon")}</span>
)
}
>
{!agenda ? (
<WidgetSkeleton />
) : soon.length === 0 ? (
<div className="text-secondary small">Nothing expires, ends or is planned in the next 30 days.</div>
<div className="text-secondary small">{t("Nothing expires, ends or is planned in the next 30 days.")}</div>
) : (
<>
{soon.slice(0, 5).map((i) => (
@@ -1224,18 +1225,18 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</>
)}
<div className="text-secondary small mt-2">
<Link to="/coming-up">Everything coming up</Link>
<Link to="/coming-up">{t("Everything coming up")}</Link>
</div>
</WidgetCard>
<WidgetCard
label="Heartbeats"
label={t("Heartbeats")}
hide={heartbeatList !== null && heartbeatList.length === 0}
badge={
!heartbeatList ? undefined : beatsWrong.length > 0 ? (
<span className="badge bg-red-lt text-red">{beatsWrong.length} not reporting</span>
) : (
<span className="badge bg-green-lt text-green">All reporting</span>
<span className="badge bg-green-lt text-green">{t("All reporting")}</span>
)
}
>
@@ -1248,10 +1249,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<MiniStat label="Jobs" value={heartbeatList.filter((h) => h.enabled).length} />
</div>
<div className="col-4">
<MiniStat label="On time" value={heartbeatList.filter((h) => h.state === "up" || h.state === "running").length} />
<MiniStat label={t("On time")} value={heartbeatList.filter((h) => h.state === "up" || h.state === "running").length} />
</div>
<div className="col-4">
<MiniStat label="Late or failed" value={beatsWrong.length} accent={beatsWrong.length > 0 ? "#ef4444" : undefined} />
<MiniStat label={t("Late or failed")} value={beatsWrong.length} accent={beatsWrong.length > 0 ? "#ef4444" : undefined} />
</div>
</div>
{beatsWrong.slice(0, 3).map((h) => (
@@ -1260,7 +1261,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
))}
<div className="text-secondary small mt-2">
<Link to="/heartbeats">All heartbeats</Link>
<Link to="/heartbeats">{t("All heartbeats")}</Link>
</div>
</>
)}
@@ -1302,9 +1303,9 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
isLive ? (
<span className="badge bg-green-lt text-green">Connected</span>
) : integration ? (
<span className="badge bg-yellow-lt text-yellow">Connecting…</span>
<span className="badge bg-yellow-lt text-yellow">{t("Connecting…")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary">Not connected</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not connected")}</span>
)
}
>
@@ -1312,7 +1313,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Online / Total" value={`${tailscaleSummary!.online}/${tailscaleSummary!.total}`} />
<MiniStat label={t("Online / Total")} value={`${tailscaleSummary!.online}/${tailscaleSummary!.total}`} />
</div>
<div className="col-4">
<MiniStat
@@ -1323,7 +1324,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<div className="col-4">
<MiniStat
label="Keys expiring"
label={t("Keys expiring")}
value={tailscaleSummary!.expiringSoon}
accent={tailscaleSummary!.expiringSoon > 0 ? "#f59e0b" : undefined}
/>
@@ -1348,7 +1349,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<div className="col-4">
<MiniStat
label="Failing builds"
label={t("Failing builds")}
value={giteaSummary!.failing}
accent={giteaSummary!.failing > 0 ? "#ef4444" : undefined}
/>
@@ -1362,14 +1363,14 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Running / Total" value={`${dockhandSummary!.running}/${dockhandSummary!.total}`} />
<MiniStat label={t("Running / Total")} value={`${dockhandSummary!.running}/${dockhandSummary!.total}`} />
</div>
<div className="col-4">
<MiniStat label="Hosts" value={dockhandSummary!.hostCount} />
</div>
<div className="col-4">
<MiniStat
label="Updates"
label={t("Updates")}
value={dockhandSummary!.updatesAvailable}
accent={dockhandSummary!.updatesAvailable > 0 ? "#f59e0b" : undefined}
/>
@@ -1383,11 +1384,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-6">
<MiniStat label="Templates" value={semaphoreSummary!.total} />
<MiniStat label={t("Templates")} value={semaphoreSummary!.total} />
</div>
<div className="col-6">
<MiniStat
label="Last failed"
label={t("Last failed")}
value={semaphoreSummary!.failing}
accent={semaphoreSummary!.failing > 0 ? "#ef4444" : undefined}
/>
@@ -1401,7 +1402,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Running / Total" value={`${proxmoxSummary!.running}/${proxmoxSummary!.total}`} />
<MiniStat label={t("Running / Total")} value={`${proxmoxSummary!.running}/${proxmoxSummary!.total}`} />
</div>
<div className="col-4">
<MiniStat label="VMs" value={proxmoxSummary!.vmCount} />
@@ -1433,7 +1434,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<div className="col-4">
<MiniStat
label="CPU load"
label={t("CPU load")}
value={synologySummary!.cpuLoadPercent !== null ? `${synologySummary!.cpuLoadPercent.toFixed(0)}%` : "—"}
/>
</div>
@@ -1461,7 +1462,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<MiniStat label="Down" value={uptimeKumaSummary!.down} accent={uptimeKumaSummary!.down > 0 ? "#ef4444" : undefined} />
</div>
<div className="col-4">
<MiniStat label="Matched to a server" value={`${uptimeKumaSummary!.matched}/${uptimeKumaSummary!.total}`} />
<MiniStat label={t("Matched to a server")} value={`${uptimeKumaSummary!.matched}/${uptimeKumaSummary!.total}`} />
</div>
</div>
{uptimeKumaSummary!.statusBreakdown.length > 0 && (
@@ -1491,7 +1492,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
) : isLiveOsTicket ? (
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Open" value={osTicketSummary!.total} />
<MiniStat label={t("Open")} value={osTicketSummary!.total} />
</div>
<div className="col-4">
<MiniStat
@@ -1502,7 +1503,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<div className="col-4">
<MiniStat
label="Awaiting reply"
label={t("Awaiting reply")}
value={osTicketSummary!.awaitingReply}
accent={osTicketSummary!.awaitingReply > 0 ? "#f59e0b" : undefined}
/>
@@ -1514,7 +1515,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<WidgetSkeleton />
) : (
<>
Configure this integration from the <Link to="/integrations">Integrations</Link> page.
Configure this integration from the <Link to="/integrations">{t("Integrations")}</Link> page.
</>
)}
</div>
@@ -1530,15 +1531,15 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
const alerts = integrationAlerts.get(i.id);
const failing = i.enabled && i.health?.status === "failing";
const badge = !i.enabled ? (
<span className="badge bg-secondary-lt text-secondary">Disabled</span>
<span className="badge bg-secondary-lt text-secondary">{t("Disabled")}</span>
) : failing || alerts?.critical ? (
<span className="badge bg-red-lt text-red">{failing ? "Failing" : "Needs a look"}</span>
<span className="badge bg-red-lt text-red">{failing ? t("Failing") : t("Needs a look")}</span>
) : alerts ? (
<span className="badge bg-yellow-lt text-yellow">Needs a look</span>
<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-secondary-lt text-secondary">Not checked yet</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not checked yet")}</span>
);
return (
<WidgetCard key={i.id} label={i.name === TYPE_LABELS[i.type] ? i.name : `${TYPE_LABELS[i.type]}: ${i.name}`} badge={badge}>
@@ -1578,7 +1579,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{notSetUp.length > 0 && (
<div className="card mt-4">
<div className="card-header">
<h3 className="card-title">Not set up yet</h3>
<h3 className="card-title">{t("Not set up yet")}</h3>
</div>
<div className="list-group list-group-flush">
{notSetUp.map((n) => (
+16 -15
View File
@@ -27,6 +27,7 @@ import { toast } from "../utils/toast";
import { readableError } from "../utils/errors";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import { BrandTag } from "../components/BrandIcon";
import { t } from "../i18n";
const PROVIDER_LABELS: Record<DnsProviderType, string> = {
cloudflare: "Cloudflare",
@@ -364,7 +365,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onClick={exportProvidersCsv}
disabled={!providers || providers.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
</div>
<div className="table-responsive">
@@ -372,7 +373,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<thead>
<tr>
<SortableTh<DnsProviderSummary>
label="Name"
label={t("Name")}
sortKeyName="name"
activeKey={providerSortKey}
direction={providerSortDir}
@@ -386,13 +387,13 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onSort={requestProviderSort}
/>
<SortableTh<DnsProviderSummary>
label="Status"
label={t("Status")}
sortKeyName="enabled"
activeKey={providerSortKey}
direction={providerSortDir}
onSort={requestProviderSort}
/>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -412,7 +413,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</td>
<td>
<button className="btn btn-sm btn-outline-danger" onClick={() => removeProvider(p)}>
Delete
{t("Delete")}
</button>
</td>
</tr>
@@ -436,7 +437,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<>
{" "}
<button className="btn btn-link p-0 align-baseline" onClick={() => setManagingProviders(true)}>
Add one
{t("Add one")}
</button>
.
</>
@@ -475,7 +476,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onClick={exportZonesCsv}
disabled={!sortedZones || sortedZones.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
</div>
</div>
@@ -500,7 +501,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<tr>
<SortableTh<DnsZone> label="Zone" sortKeyName="name" activeKey={zoneSortKey} direction={zoneSortDir} onSort={requestZoneSort} />
<SortableTh<DnsZone>
label="Records"
label={t("Records")}
sortKeyName="recordCount"
activeKey={zoneSortKey}
direction={zoneSortDir}
@@ -555,7 +556,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onClick={exportRecordsCsv}
disabled={!sortedRecords || sortedRecords.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
{canEdit && (
<button className="btn btn-sm btn-outline-secondary me-2" onClick={syncZone} disabled={syncing}>
@@ -603,7 +604,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</datalist>
</div>
<div className="col-3">
<label className="form-label">Name</label>
<label className="form-label">{t("Name")}</label>
<input
className="form-control"
required
@@ -659,7 +660,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
{editingRecordId ? "Save changes" : "Add record"}
</button>
<button type="button" className="btn" onClick={() => setRecordForm(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -670,7 +671,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<thead>
<tr>
<SortableTh<DnsRecord> label="Type" sortKeyName="type" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
<SortableTh<DnsRecord> label="Name" sortKeyName="name" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
<SortableTh<DnsRecord> label={t("Name")} sortKeyName="name" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
<SortableTh<DnsRecord>
label="Content"
sortKeyName="content"
@@ -679,7 +680,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onSort={requestRecordSort}
/>
<SortableTh<DnsRecord> label="TTL" sortKeyName="ttl" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -695,10 +696,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" onClick={() => startEditRecord(r)}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => removeRecord(r)}>
Delete
{t("Delete")}
</button>
</div>
</td>
+10 -9
View File
@@ -22,10 +22,11 @@ import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
import DockerVulnerabilities from "./DockerVulnerabilities";
import { t } from "../i18n";
function updateBadge(c: DockhandContainer) {
if (c.updateAvailable === null) return <span className="text-secondary">—</span>;
if (!c.updateAvailable) return <span className="badge bg-green-lt text-green">Up to date</span>;
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
@@ -254,7 +255,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
</select>
)}
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
Export CSV
{t("Export CSV")}
</button>
{canEdit && (
<button className="btn btn-sm btn-outline-secondary" onClick={checkForUpdates} disabled={checkingUpdates}>
@@ -274,7 +275,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<DockhandContainer> label="Container" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<DockhandContainer> label={t("Container")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<DockhandContainer>
label="Host"
sortKeyName="environmentName"
@@ -282,8 +283,8 @@ export default function Docker({ user }: { user: CurrentUser }) {
direction={sortDir}
onSort={requestSort}
/>
<SortableTh<DockhandContainer> label="Image" sortKeyName="image" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<DockhandContainer> label="Status" sortKeyName="state" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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"
sortKeyName="updateAvailable"
@@ -291,7 +292,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
direction={sortDir}
onSort={requestSort}
/>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -317,14 +318,14 @@ export default function Docker({ user }: { user: CurrentUser }) {
onClick={() => containerAction(c, "restart")}
disabled={actingOnContainer === c.id}
>
Restart
{t("Restart")}
</button>
<button
className="btn btn-sm btn-outline-danger"
onClick={() => containerAction(c, "stop")}
disabled={actingOnContainer === c.id}
>
Stop
{t("Stop")}
</button>
</>
) : (
@@ -333,7 +334,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
onClick={() => containerAction(c, "start")}
disabled={actingOnContainer === c.id}
>
Start
{t("Start")}
</button>
)}
{user.role === "admin" && (c.problem || c.leftAlone) && (
+3 -2
View File
@@ -3,6 +3,7 @@ import { Link } from "react-router-dom";
import { api, type DockhandVulnerabilitiesResponse, type DockhandVulnerabilityEnvironment } from "../api/client";
import TimeAgo from "../components/TimeAgo";
import { readableError } from "../utils/errors";
import { t } from "../i18n";
const count = (v: number | null) => (v === null ? "—" : v.toLocaleString());
@@ -51,7 +52,7 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
<th>Package</th>
<th>Installed</th>
<th>Fixed in</th>
<th>Image</th>
<th>{t("Image")}</th>
<th>Used by</th>
</tr>
</thead>
@@ -118,7 +119,7 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
From the scans Dockhand has already run on its images (it scans when it is told to — nothing is scanned from here). An image that was never scanned is not known to be clean.{" "}
{data.alerts ? (
<>
<strong>Critical</strong> findings are an alert — see <Link to="/alerts">Alerts</Link>;{" "}
<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.
+10 -9
View File
@@ -10,6 +10,7 @@ import { formatBytes } from "./settings/StorageSettings";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import FigureHistory from "../components/FigureHistory";
import { t } from "../i18n";
const KIND_NAMES: Record<DownloadClient["kind"], string> = { qbittorrent: "qBittorrent", sabnzbd: "SABnzbd" };
const SHOWN = 25;
@@ -40,11 +41,11 @@ 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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (c.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (c.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (c.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (c.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">{t("In order")}</span>;
}
function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) {
@@ -68,7 +69,7 @@ function ItemsTable({ items, stuck }: { items: DownloadItem[]; stuck: Set<string
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>State</th>
<th>Progress</th>
<th>Speed</th>
@@ -168,7 +169,7 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
)}
{c.kind === "qbittorrent" ? (
<Tile
label="Network"
label={t("Network")}
value={s.connection === null ? "—" : s.connection}
sub={s.connection === "firewalled" ? "no incoming connections — it still works" : s.connection === "disconnected" ? "no peers or DHT" : null}
warn={s.connection === "disconnected"}
@@ -261,10 +262,10 @@ export default function Downloads({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
return (
<>
<h2 className="page-title">Download clients</h2>
<h2 className="page-title">{t("Download clients")}</h2>
<PageIntro>
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">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{" "}
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">Alerts</Link>. What Sonarr, Radarr and the others think of their downloads is on <Link to="/media">Media managers</Link>.
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{" "}
<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} />
{!data && !error && <BlockSkeleton lines={4} />}
+9 -8
View File
@@ -12,6 +12,7 @@ import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
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" },
@@ -84,7 +85,7 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>When</th>
<th>{t("When")}</th>
<th>Result</th>
<th className="text-end">Took</th>
<th className="text-end">Size</th>
@@ -175,7 +176,7 @@ function Address({ path, name, onDone }: { path: string; name: string; onDone: (
<code>send-http-level=All</code> matters: Duplicati otherwise only reports problems, and a backup that quietly stops reporting could not be told from one that works. Each backup shows up here after its next run.
</div>
<button className="btn btn-sm" onClick={onDone}>
Done
{t("Done")}
</button>
</div>
);
@@ -270,7 +271,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
</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">Alerts</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job&rsquo;s warnings to see what they said, and switch on <em>Alert on warnings</em> for the jobs where they matter.
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&rsquo;s warnings to see what they said, and switch on <em>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)} />}
@@ -283,7 +284,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<div className="card-body row g-3">
<div className="col-md-5">
<label className="form-label" htmlFor="dup-name">
Name
{t("Name")}
</label>
<input id="dup-name" className="form-control" required maxLength={100} placeholder="e.g. Jackie" value={name} onChange={(e) => setName(e.target.value)} />
</div>
@@ -307,7 +308,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
{busy ? "Adding…" : "Add and show its address"}
</button>
<button type="button" className="btn" onClick={() => setAdding(false)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -349,7 +350,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
</div>
{isAdmin && (
<button className="btn btn-sm btn-outline-danger ms-auto" onClick={() => void removeSource(s.id, s.name)} aria-label={`Remove ${s.name}`}>
Remove
{t("Remove")}
</button>
)}
</div>
@@ -379,7 +380,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<th className="text-end">Changed</th>
<th>Expected every</th>
<th>State</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -425,7 +426,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" onClick={() => setHistory(b)}>
History
{t("History")}
</button>
{canEdit && (
<>
+12 -11
View File
@@ -18,6 +18,7 @@ import { EmptyRow } from "../components/EmptyState";
import EndpointSuggestions from "../components/EndpointSuggestions";
import EndpointHistory from "../components/EndpointHistory";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const KIND_LABELS: Record<EndpointKind, string> = { http: "Web address", tcp: "Port", tls: "Certificate" };
const KIND_HINTS: Record<EndpointKind, string> = {
@@ -249,7 +250,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-1">
<h2 className="page-title mb-0">Endpoints</h2>
<h2 className="page-title mb-0">{t("Endpoints")}</h2>
{isAdmin && !draft && (
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
Add a check
@@ -257,7 +258,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
)}
</div>
<PageIntro>
The app asks a web address, a port or a certificate whether it is fine, every few minutes, and says so on the <Link to="/alerts">Alerts</Link> page and in notifications when it keeps failing or a
The app asks a web address, a port or a certificate whether it is fine, every few minutes, and says so on the <Link to="/alerts">{t("Alerts")}</Link> page and in notifications when it keeps failing or a
certificate is about to run out.
</PageIntro>
<ErrorNotice error={error} />
@@ -285,7 +286,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<div className="card-body row g-3">
<div className="col-md-4">
<label className="form-label" htmlFor="ep-name">
Name
{t("Name")}
</label>
<input id="ep-name" className="form-control" required maxLength={100} placeholder="e.g. Gitea" value={draft.name} onChange={(e) => set("name", e.target.value)} />
</div>
@@ -467,7 +468,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</label>
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={draft.enabled} onChange={(e) => set("enabled", e.target.checked)} />
<span className="form-check-label">Switched on</span>
<span className="form-check-label">{t("Switched on")}</span>
</label>
</div>
<div className="col-12 text-secondary small">Only addresses this server may reach are accepted: not itself (loopback) and not the cloud metadata address. Your own network is fine.</div>
@@ -477,7 +478,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
{busy ? "Saving…" : "Save"}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -490,12 +491,12 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<thead>
<tr>
<SortableTh<Row> label="Check" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Status" sortKeyName="rank" 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="Checked" sortKeyName="lastCheckedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{(canCheck || isAdmin) && <th className="w-1">Actions</th>}
<SortableTh<Row> label={t("Checked")} sortKeyName="lastCheckedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{(canCheck || isAdmin) && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -571,7 +572,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<span className="text-secondary">{c.certDays} d left</span>
)}
</td>
<td className="text-secondary stack-label" data-label="Checked">
<td className="text-secondary stack-label" data-label={t("Checked")}>
{c.lastCheckedAt ? <TimeAgo value={c.lastCheckedAt} /> : "—"}
</td>
{(canCheck || isAdmin) && (
@@ -585,10 +586,10 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
{isAdmin && (
<>
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(toDraft(c))}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(c)}>
Remove
{t("Remove")}
</button>
</>
)}
+14 -13
View File
@@ -13,6 +13,7 @@ import { toast } from "../utils/toast";
import { barPosition, eventText, onHeadline } from "../utils/gamePower";
import { formatDateTime } from "../utils/date";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
type Server = FragnetServerInfo;
@@ -20,11 +21,11 @@ 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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (a.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">{t("In order")}</span>;
}
function StateBadge({ s }: { s: Server }) {
@@ -315,16 +316,16 @@ function ServerRow({ a, s, readAt, canAct, open, onToggle, onSignal, onBackup, b
<div className="btn-list justify-content-end flex-nowrap">
{!running && (
<button className="btn btn-sm" disabled={busy} onClick={() => onSignal(s, "start")}>
Start
{t("Start")}
</button>
)}
{running && (
<>
<button className="btn btn-sm" disabled={busy} onClick={() => onSignal(s, "restart")}>
Restart
{t("Restart")}
</button>
<button className="btn btn-sm" disabled={busy} onClick={() => onSignal(s, "stop")}>
Stop
{t("Stop")}
</button>
</>
)}
@@ -448,7 +449,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">Game servers</div>
<div className="text-secondary small">{t("Game servers")}</div>
<div className="h2 mb-0">{s.servers.length}</div>
<div className="text-secondary small">
{running} running{stopped > 0 ? `, ${stopped} stopped` : ""}
@@ -468,7 +469,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">Backups</div>
<div className="text-secondary small">{t("Backups")}</div>
<div className="h2 mb-0">{s.servers.reduce((n, x) => n + (x.backups?.filter((b) => b.completedAt !== null && b.successful).length ?? 0), 0)}</div>
<div className="text-secondary small">{a.options.backupDays > 0 && a.options.alerts.backups ? `one is wanted every ${a.options.backupDays} days` : "not judged"}</div>
</div>
@@ -488,7 +489,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Server</th>
<th>{t("Server")}</th>
<th>State</th>
<th>Address</th>
<th>Use</th>
@@ -538,10 +539,10 @@ export default function GameServers({ user }: { user: CurrentUser }) {
}, [tick]);
return (
<>
<h2 className="page-title">Game servers</h2>
<h2 className="page-title">{t("Game servers")}</h2>
<PageIntro>
What Fragnet&rsquo;s game panel says about your servers, read every few minutes (see <Link to="/integrations">Integrations</Link>). <strong>A backup that is late</strong> and <strong>a disk or memory nearly full</strong> are alerts — see <Link to="/alerts">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">Costs</Link>.
What Fragnet&rsquo;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.
{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} />
{!data && !error && <BlockSkeleton lines={4} />}
+3 -2
View File
@@ -15,6 +15,7 @@ import {
} from "../utils/generators";
import { ErrorNotice } from "../components/Notice";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const MIXED = "mixed";
@@ -85,7 +86,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title mb-3">Generator</h2>
<h2 className="page-title mb-3">{t("Generator")}</h2>
<PageIntro>
Usernames and passwords are generated locally in your browser — nothing is sent to or stored on the server. Server names are
picked in your browser too, from name lists the server hands out.
@@ -95,7 +96,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">Server name</h3>
<h3 className="card-title">{t("Server name")}</h3>
</div>
<div className="card-body">
<p className="text-secondary">
+4 -3
View File
@@ -15,6 +15,7 @@ import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
function runStatusBadge(repo: GiteaRepo) {
const run = repo.latestRun;
@@ -164,7 +165,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
<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}>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -183,8 +184,8 @@ export default function Gitea({ user }: { user: CurrentUser }) {
<SortableTh<GiteaRepo> label="Last updated" sortKeyName="updatedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>Last run</th>
<th>Branch</th>
<th>Status</th>
{canEdit && <th className="w-1">Actions</th>}
<th>{t("Status")}</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
+7 -6
View File
@@ -9,14 +9,15 @@ import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (g.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (g.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (g.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (g.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">{t("In order")}</span>;
}
function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) {
@@ -80,7 +81,7 @@ function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; on
<tr>
<th>Rule</th>
<th>State</th>
<th>Where</th>
<th>{t("Where")}</th>
<th>Since</th>
</tr>
</thead>
@@ -153,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">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">Alerts</Link>.
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>.
Grafana can notify about its own alerts too; with both you hear twice.
</PageIntro>
<ErrorNotice error={error} />
+14 -13
View File
@@ -18,6 +18,7 @@ import { formatDateTime } from "../utils/date";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
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" },
@@ -120,7 +121,7 @@ function HowToCall({ url, onClose, name }: { url: string; onClose: () => void; n
</div>
<div className="card-footer">
<button className="btn" onClick={onClose}>
Done
{t("Done")}
</button>
</div>
</div>
@@ -231,7 +232,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-1">
<h2 className="page-title mb-0">Heartbeats</h2>
<h2 className="page-title mb-0">{t("Heartbeats")}</h2>
{isAdmin && !draft && (
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
Add a heartbeat
@@ -240,7 +241,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</div>
<PageIntro>
For jobs that should run on their own — a backup, a sync, a cleanup. The job calls an address when it finishes; if the call doesn&rsquo;t come in time, or the job says it failed, it appears on the{" "}
<Link to="/alerts">Alerts</Link> page and in notifications.
<Link to="/alerts">{t("Alerts")}</Link> page and in notifications.
</PageIntro>
<ErrorNotice error={error} />
@@ -267,7 +268,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<div className="card-body row g-3">
<div className="col-md-4">
<label className="form-label" htmlFor="hb-name">
Name
{t("Name")}
</label>
<input id="hb-name" className="form-control" required maxLength={100} placeholder="e.g. Nightly backup of the NAS" value={draft.name} onChange={(e) => set("name", e.target.value)} />
</div>
@@ -310,14 +311,14 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-5">
<label className="form-label" htmlFor="hb-notes">
Notes <span className="text-secondary">(optional)</span>
Notes <span className="text-secondary">{t("(optional)")}</span>
</label>
<input id="hb-notes" className="form-control" maxLength={500} placeholder="Where the job lives, who to ask" value={draft.notes} onChange={(e) => set("notes", e.target.value)} />
</div>
<div className="col-md-3 d-flex align-items-end">
<label className="form-check mb-2">
<input type="checkbox" className="form-check-input" checked={draft.enabled} onChange={(e) => set("enabled", e.target.checked)} />
<span className="form-check-label">Switched on</span>
<span className="form-check-label">{t("Switched on")}</span>
</label>
</div>
</div>
@@ -326,7 +327,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
{busy ? "Saving…" : "Save"}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -339,11 +340,11 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<thead>
<tr>
<SortableTh<Row> label="Job" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Status" sortKeyName="rank" 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} />
<th>Recent runs</th>
{isAdmin && <th className="w-1">Actions</th>}
<th>{t("Recent runs")}</th>
{isAdmin && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -387,7 +388,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<span className="text-secondary">—</span>
)}
</td>
<td className="stack-label" data-label="Recent runs">
<td className="stack-label" data-label={t("Recent runs")}>
<Ticks recent={h.recent} />
</td>
{isAdmin && (
@@ -399,13 +400,13 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</button>
)}
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(toDraft(h))}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={() => void newAddress(h)}>
New address
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(h)}>
Remove
{t("Remove")}
</button>
</div>
</td>
+12 -11
View File
@@ -10,14 +10,15 @@ import { formatBytes } from "./settings/StorageSettings";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (p.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (p.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">{t("In order")}</span>;
}
export function StatusBadge({ status }: { status: string }) {
@@ -137,7 +138,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">Servers</div>
<div className="text-secondary small">{t("Servers")}</div>
<div className="h2 mb-0">{s.servers.length}</div>
<div className="text-secondary small">{s.servers.filter((x) => x.status === "running").length} running</div>
</div>
@@ -181,13 +182,13 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Server</th>
<th>Status</th>
<th>{t("Server")}</th>
<th>{t("Status")}</th>
<th>Type</th>
<th>Location</th>
<th>Address</th>
<th>Traffic this month</th>
<th>Backups</th>
<th>{t("Backups")}</th>
<th>Price/mo</th>
</tr>
</thead>
@@ -212,7 +213,7 @@ function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onR
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Type</th>
<th>Address</th>
<th>Targets</th>
@@ -356,8 +357,8 @@ export default function Hetzner({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">Hetzner Cloud</h2>
<PageIntro>
One project per integration, read every few minutes (see <Link to="/integrations">Integrations</Link>) — nothing is started, stopped or changed. <strong>A server that was running and is now off</strong>, <strong>traffic close to the month&rsquo;s quota</strong>,{" "}
<strong>rescue mode left on</strong>, <strong>backups that are late</strong>, <strong>a traffic quota the month is on course to pass</strong>, <strong>unhealthy load balancer targets</strong>, <strong>certificates about to end</strong> and <strong>floating IPs that point at nothing</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
One project per integration, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is started, stopped or changed. <strong>A server that was running and is now off</strong>, <strong>traffic close to the month&rsquo;s quota</strong>,{" "}
<strong>rescue mode left on</strong>, <strong>backups that are late</strong>, <strong>a traffic quota the month is on course to pass</strong>, <strong>unhealthy load balancer targets</strong>, <strong>certificates about to end</strong> and <strong>floating IPs that point at nothing</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+10 -9
View File
@@ -8,14 +8,15 @@ import { BlockSkeleton } from "../components/Skeleton";
import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (a.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">{t("In order")}</span>;
}
function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) {
@@ -89,11 +90,11 @@ function Card({ a, canRead, onRead }: { a: RobotAccount; canRead: boolean; onRea
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Server</th>
<th>{t("Server")}</th>
<th>Product</th>
<th>Address</th>
<th>Traffic</th>
<th>Status</th>
<th>{t("Status")}</th>
<th>Rescue</th>
<th>Paid</th>
</tr>
@@ -154,7 +155,7 @@ function Card({ a, canRead, onRead }: { a: RobotAccount; canRead: boolean; onRea
<th>Storage box</th>
<th>Product</th>
<th>Location</th>
<th>Linked to</th>
<th>{t("Linked to")}</th>
<th>State</th>
<th>Paid</th>
</tr>
@@ -209,8 +210,8 @@ export default function HetznerRobot({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">Hetzner Robot</h2>
<PageIntro>
Dedicated servers and storage boxes at Hetzner (Robot — the cloud servers are on <Link to="/hetzner">Hetzner Cloud</Link>), read every fifteen minutes (see <Link to="/integrations">Integrations</Link>) — nothing is reset, ordered or cancelled.{" "}
<strong>A server or storage box that is cancelled and about to shut down</strong>, <strong>a locked storage box</strong>, <strong>a rescue system left on</strong> and <strong>a server stuck being set up</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
Dedicated servers and storage boxes at Hetzner (Robot — the cloud servers are on <Link to="/hetzner">Hetzner Cloud</Link>), read every fifteen minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is reset, ordered or cancelled.{" "}
<strong>A server or storage box that is cancelled and about to shut down</strong>, <strong>a locked storage box</strong>, <strong>a rescue system left on</strong> and <strong>a server stuck being set up</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+5 -4
View File
@@ -11,6 +11,7 @@ import { useChartRange } from "../utils/chartRanges";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
type Integration = HaOverview["integrations"][number];
@@ -337,12 +338,12 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Now</th>
<th>Alert when</th>
<th>Last changed</th>
<th className="w-1">
<span className="visually-hidden">Actions</span>
<span className="visually-hidden">{t("Actions")}</span>
</th>
</tr>
</thead>
@@ -368,7 +369,7 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
<div className="btn-list flex-nowrap">
{w.entity?.value !== null && w.entity?.value !== undefined && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => setCharting({ id: i.id, w })}>
History
{t("History")}
</button>
)}
{canAct && (
@@ -377,7 +378,7 @@ export default function HomeAssistant({ user }: { user: CurrentUser }) {
Limits
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void stop(i.id, w)} aria-label={`Stop watching ${shownName(w)}`}>
Stop
{t("Stop")}
</button>
</>
)}
+8 -7
View File
@@ -9,14 +9,15 @@ import { formatBytes } from "./settings/StorageSettings";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (i.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (i.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (i.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (i.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">{t("In order")}</span>;
}
const n = (v: number | null) => (v === null ? "—" : v.toLocaleString());
@@ -103,7 +104,7 @@ function Card({ i }: { i: ImmichInfo }) {
<thead>
<tr>
<th>Queue</th>
<th className="text-end">Active</th>
<th className="text-end">{t("Active")}</th>
<th className="text-end">Waiting</th>
<th className="text-end">Failed</th>
<th />
@@ -152,8 +153,8 @@ export default function Immich() {
<>
<h2 className="page-title">Immich</h2>
<PageIntro>
Photos are what cannot be made again, and Immich fails quietly. It is read every few minutes with an API key (see <Link to="/integrations">Integrations</Link>). A <strong>disk under the library that is filling up</strong> and <strong>background jobs that have failed</strong> (thumbnails and
metadata that were never made) are alerts — see <Link to="/alerts">Alerts</Link>.
Photos are what cannot be made again, and Immich fails quietly. It is read every few minutes with an API key (see <Link to="/integrations">{t("Integrations")}</Link>). A <strong>disk under the library that is filling up</strong> and <strong>background jobs that have failed</strong> (thumbnails and
metadata that were never made) are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+2 -1
View File
@@ -14,6 +14,7 @@ import { toast } from "../utils/toast";
import { CATEGORY_NAMES, durationWords, incidentPath, SEVERITY_BADGE } from "../components/IncidentHistory";
import { useBreadcrumbTail } from "../utils/breadcrumb";
import WhatChangedBefore from "../components/WhatChangedBefore";
import { t } from "../i18n";
const KIND_ICON: Record<TimelineKind, JSX.Element> = {
alert: <IconAlertTriangle size={16} />,
@@ -235,7 +236,7 @@ export default function IncidentDetail({ user }: { user: CurrentUser }) {
<div className="col-lg-4">
<div className="card">
<div className="card-header">
<h3 className="card-title">Notes</h3>
<h3 className="card-title">{t("Notes")}</h3>
</div>
<div className="card-body">
{detail.notes.length === 0 && <div className="text-secondary mb-3">Nothing written yet. What was it? What fixed it? What would you do differently?</div>}
+30 -29
View File
@@ -22,6 +22,7 @@ import { useSortable } from "../hooks/useSortable";
import SortableTh from "../components/SortableTh";
import PageIntro from "../components/PageIntro";
import { BrandTag } from "../components/BrandIcon";
import { t } from "../i18n";
function HealthBadge({ i }: { i: IntegrationSummary }) {
const status = integrationStatus(i);
@@ -29,7 +30,7 @@ function HealthBadge({ i }: { i: IntegrationSummary }) {
if (status.key === "failing") return <span className="badge bg-red-lt text-red">{status.label}</span>;
if (status.key === "working") return <span className="badge bg-green-lt text-green">{status.label}</span>;
return (
<span className="badge bg-secondary-lt text-secondary" title="Nothing has called it since the app started. Use Test to check it now.">
<span className="badge bg-secondary-lt text-secondary" title={t("Nothing has called it since the app started. Use Test to check it now.")}>
{status.label}
</span>
);
@@ -57,7 +58,7 @@ function rememberLayout(layout: "cards" | "table") {
const integrationTabs = (view: "list" | "calls") => (
<ViewTabs
label="Integrations view"
label={t("Integrations view")}
tabs={[
{ to: "/integrations", label: "Integrations", active: view === "list" },
{ to: "/integrations?view=calls", label: "Call log", active: view === "calls" },
@@ -73,7 +74,7 @@ export default function Integrations({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-2">
<h2 className="page-title mb-0">Integrations</h2>
<h2 className="page-title mb-0">{t("Integrations")}</h2>
</div>
{integrationTabs("calls")}
<DiagLogView />
@@ -140,7 +141,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
}
async function removeIntegration(i: IntegrationSummary) {
if (!(await confirmDialog({ title: "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: "Delete", danger: true }))) return;
try {
await api.integrations.remove(i.id);
toast.success(`Deleted ${i.name}.`);
@@ -197,28 +198,28 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<>
{i.enabled && (
<Link to={page} className="btn btn-sm btn-primary">
Open
{t("Open")}
</Link>
)}
{isOperator && i.enabled && <ReadNowButton integrationId={i.id} name={i.name} onDone={loadIntegrations} />}
{isAdmin && (
<>
<button className="btn btn-sm" onClick={() => testIntegration(i)} disabled={testingId === i.id}>
{testingId === i.id ? "Testing…" : "Test"}
{testingId === i.id ? t("Testing…") : t("Test")}
</button>
{i.enabled && INSPECTABLE.includes(i.type) && (
<button className="btn btn-sm" onClick={() => setInspecting(i)} title="Read it once now and see what each request got back — to check that what is shown is what is there">
Inspect
<button className="btn btn-sm" onClick={() => setInspecting(i)} title={t("Read it once now and see what each request got back — to check that what is shown is what is there")}>
{t("Inspect")}
</button>
)}
<button className="btn btn-sm" onClick={() => setEditingIntegration(i)}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm" onClick={() => toggleEnabled(i)}>
{i.enabled ? "Disable" : "Enable"}
{i.enabled ? t("Disable") : t("Enable")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => removeIntegration(i)}>
Delete
{t("Delete")}
</button>
</>
)}
@@ -232,7 +233,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
if (!result || testingId === i.id) return null;
return (
<span className={`badge ms-2 ${result.ok ? "bg-green-lt text-green" : "bg-red-lt text-red"}`}>
Test {result.ok ? `passed${result.latencyMs !== undefined ? ` (${result.latencyMs}ms)` : ""}` : "failed"}
{t("Test")} {result.ok ? `passed${result.latencyMs !== undefined ? ` (${result.latencyMs}ms)` : ""}` : "failed"}
</span>
);
}
@@ -241,14 +242,14 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<div>
<h2 className="page-title mb-0">Integrations</h2>
<h2 className="page-title mb-0">{t("Integrations")}</h2>
<PageIntro className="small mt-1">
Each connected system gets its own page — open it from here or from the sidebar, in the group shown. Add and manage credentials here.
{t("Each connected system gets its own page — open it from here or from the sidebar, in the group shown. Add and manage credentials here.")}
</PageIntro>
</div>
{isAdmin && !adding && !editingIntegration && (
<button className="btn btn-primary ms-auto flex-shrink-0 text-nowrap" onClick={() => setAdding(true)}>
Add integration
{t("Add integration")}
</button>
)}
</div>
@@ -281,11 +282,11 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<TableToolbar
search={tableSearch.query}
onSearch={tableSearch.setQuery}
placeholder="Search integrations…"
placeholder={t("Search integrations…")}
filters={
<select
className="form-select form-select-sm w-auto"
aria-label="Show integrations that are"
aria-label={t("Show integrations that are")}
value={statusFilter}
onChange={(e) =>
setSearchParams(
@@ -299,19 +300,19 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
)
}
>
<option value="">Any status</option>
<option value="failing">Failing</option>
<option value="">{t("Any status")}</option>
<option value="failing">{t("Failing")}</option>
<option value="working">Working</option>
<option value="disabled">Disabled</option>
<option value="disabled">{t("Disabled")}</option>
</select>
}
actions={
<div className="btn-group btn-group-sm" role="group" aria-label="How to show the integrations">
<div className="btn-group btn-group-sm" role="group" aria-label={t("How to show the integrations")}>
<button type="button" className={`btn ${layout === "cards" ? "active" : ""}`} aria-pressed={layout === "cards"} onClick={() => chooseLayout("cards")}>
Cards
{t("Cards")}
</button>
<button type="button" className={`btn ${layout === "table" ? "active" : ""}`} aria-pressed={layout === "table"} onClick={() => chooseLayout("table")}>
Table
{t("Table")}
</button>
</div>
}
@@ -328,13 +329,13 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<IntegrationRow> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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="Status" sortKeyName="statusRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th scope="col">Last 30 days</th>
<th scope="col">Actions</th>
<SortableTh<IntegrationRow> label={t("Status")} sortKeyName="statusRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th scope="col">{t("Last 30 days")}</th>
<th scope="col">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -409,12 +410,12 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<div className="col-12">
<div className="card">
<div className="card-body text-secondary text-center">
{tableSearch.active || statusFilter ? "Nothing matches that." : "No integrations configured yet."}
{tableSearch.active || statusFilter ? t("Nothing matches that.") : t("No integrations configured yet.")}
{isAdmin && !tableSearch.active && !statusFilter && (
<>
{" "}
<button className="btn btn-link p-0 align-baseline" onClick={() => setAdding(true)}>
Add one
{t("Add one")}
</button>
.
</>
+14 -13
View File
@@ -19,6 +19,7 @@ import { EmptyRow } from "../components/EmptyState";
import BulkBar from "../components/BulkBar";
import { HardwareBulkDrawer } from "../components/BulkDrawers";
import { doBulk, plural } from "../utils/bulk";
import { t } from "../i18n";
const KINDS = Object.keys(KIND_LABELS) as AssetKind[];
@@ -266,7 +267,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Inventory</h2>
<h2 className="page-title mb-0">{t("Inventory")}</h2>
<div className="ms-auto d-flex gap-2">
<Link to="/inventory/racks" className="btn">
Racks
@@ -293,11 +294,11 @@ export default function Inventory({ user }: { user: CurrentUser }) {
<div className="card-actions btn-list">
{canEdit && (
<button className="btn btn-sm btn-primary" onClick={() => setDraft(toDraft(focused))}>
Edit
{t("Edit")}
</button>
)}
<button className="btn btn-sm" onClick={() => setParams((p) => { const n = new URLSearchParams(p); n.delete("asset"); return n; }, { replace: true })}>
Close
{t("Close")}
</button>
</div>
</div>
@@ -354,7 +355,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
<div className="card-body row g-3">
<div className="col-md-5">
<label className="form-label" htmlFor="inv-name">
Name
{t("Name")}
</label>
<input id="inv-name" className="form-control" required maxLength={120} value={draft.name} onChange={(e) => set("name", e.target.value)} />
</div>
@@ -465,7 +466,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-5">
<label className="form-label" htmlFor="inv-notes">
Notes
{t("Notes")}
</label>
<input id="inv-notes" className="form-control" maxLength={2000} value={draft.notes} onChange={(e) => set("notes", e.target.value)} />
</div>
@@ -475,7 +476,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
{busy ? "Saving…" : "Save"}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -542,13 +543,13 @@ export default function Inventory({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Asset> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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="Where" sortKeyName="location" 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} />
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -580,7 +581,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
)}
</td>
<td>{KIND_LABELS[a.kind]}</td>
<td className="stack-label" data-label="Where">
<td className="stack-label" data-label={t("Where")}>
{a.location ?? "—"}
{a.rackUnit && <span className="text-secondary"> · {a.rackUnit}</span>}
</td>
@@ -597,10 +598,10 @@ export default function Inventory({ user }: { user: CurrentUser }) {
<td className="stack-wide">
<div className="btn-list flex-nowrap">
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(toDraft(a))}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(a)}>
Remove
{t("Remove")}
</button>
</div>
</td>
@@ -655,7 +656,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer">
<button type="submit" className="btn btn-primary">
Save
{t("Save")}
</button>
</div>
</form>
+2 -1
View File
@@ -6,6 +6,7 @@ import { ErrorNotice } from "../components/Notice";
import { BlockSkeleton } from "../components/Skeleton";
import { readableError } from "../utils/errors";
import { KIND_LABELS } from "../utils/inventory";
import { t } from "../i18n";
/** Label sizes, in millimetres, as they are stuck on: a rack-mount sticker, a standard address label, a larger one for a shelf. */
const SIZES = {
@@ -101,7 +102,7 @@ export default function InventoryLabels() {
<h3 className="card-title">Which hardware</h3>
<div className="card-actions btn-list">
<button className="btn btn-sm" onClick={() => setChosen(new Set((assets ?? []).map((a) => a.id)))}>
All
{t("All")}
</button>
<button className="btn btn-sm" onClick={() => setChosen(new Set())}>
None
+2 -1
View File
@@ -9,6 +9,7 @@ import { readableError } from "../utils/errors";
import { KIND_LABELS, money } from "../utils/inventory";
import type { AssetKind } from "../api/client";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const YEARS = [3, 5, 7, 10];
@@ -102,7 +103,7 @@ export default function InventoryLifecycle() {
))}
</select>
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={!report}>
Export CSV
{t("Export CSV")}
</button>
<Link to="/inventory" className="btn">
Back to the inventory
+7 -6
View File
@@ -13,6 +13,7 @@ import { confirmDialog, promptDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice";
import TableToolbar from "../components/TableToolbar";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import { t } from "../i18n";
const emptyForm: IpamInput = { ipAddress: "", label: "", vendor: "", location: "", notes: "" };
@@ -252,7 +253,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title mb-3">IP Addresses</h2>
<h2 className="page-title mb-3">{t("IP Addresses")}</h2>
<ErrorNotice error={error} />
{syncResult && <div className="alert alert-success">Synced from {syncResult}</div>}
@@ -364,7 +365,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-2">
<label className="form-label">Notes</label>
<label className="form-label">{t("Notes")}</label>
<input
className="form-control"
value={form.notes}
@@ -377,7 +378,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
{editing ? "Save changes" : "Add IP address"}
</button>
<button type="button" className="btn" onClick={cancelForm}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -448,7 +449,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
<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>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -484,7 +485,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" onClick={() => startEdit(entry)}>
Edit
{t("Edit")}
</button>
{!entry.excluded && (
<button className="btn btn-sm" onClick={() => excludeAround(entry)} title="Hide this and every address in the same range">
@@ -492,7 +493,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
</button>
)}
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(entry)}>
Delete
{t("Delete")}
</button>
</div>
</td>
+5 -4
View File
@@ -11,13 +11,14 @@ import { useChartRange } from "../utils/chartRanges";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (j.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (j.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</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>;
}
@@ -184,7 +185,7 @@ export default function Jellyfin() {
<>
<h2 className="page-title">Jellyfin</h2>
<PageIntro>
Whether Jellyfin is up and who is watching. It is read every couple of minutes with an API key (see <Link to="/integrations">Integrations</Link>). A Jellyfin that <strong>wants a restart</strong>, a <strong>scheduled task that failed</strong> or a burst of{" "}
Whether Jellyfin is up and who is watching. It is read every couple of minutes with an API key (see <Link to="/integrations">{t("Integrations")}</Link>). A Jellyfin that <strong>wants a restart</strong>, a <strong>scheduled task that failed</strong> or a burst of{" "}
<strong>failed sign-ins</strong> is an alert; and an update run on the machine it lives on <strong>asks first when somebody is streaming</strong>.
</PageIntro>
<ErrorNotice error={error} />
+3 -2
View File
@@ -1,4 +1,5 @@
import { useEnvironment } from "../utils/environment";
import { t } from "../i18n";
export default function Login() {
const environment = useEnvironment();
@@ -11,9 +12,9 @@ export default function Login() {
</span>
{environment?.name && <span className="badge env-badge">{environment.name}</span>}
</h1>
<p>Sign in with your homelab identity provider to continue.</p>
<p>{t("Sign in with your homelab identity provider to continue.")}</p>
<a className="btn btn-primary w-100" href="/auth/login">
Sign in with Authentik
{t("Sign in with Authentik")}
</a>
</div>
</div>
+65 -64
View File
@@ -23,6 +23,7 @@ import RecurringMaintenance from "../components/RecurringMaintenance";
import ExportTableButton from "../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const DURATIONS: { minutes: number; label: string }[] = [
{ minutes: 30, label: "30 minutes" },
@@ -100,12 +101,12 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
}, []);
async function startBulk(scope: MaintenanceBulkScope) {
const words = DURATIONS.find((d) => d.minutes === minutes)?.label ?? `${minutes} minutes`;
const words = t(DURATIONS.find((d) => d.minutes === minutes)?.label ?? "{n} minutes", { n: minutes });
// Everything is the one choice that can hide a real outage, so it asks first.
if (
scope === "everything" &&
!(await confirmDialog({
title: "Silence everything?",
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",
danger: true,
@@ -129,7 +130,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
}
async function endAll() {
if (!(await confirmDialog({ title: "End all maintenance", message: `End all ${windows?.length ?? 0} windows now? Alerts about them become active again.`, confirmLabel: "End all", danger: true }))) return;
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;
setError(null);
try {
const res = await api.maintenance.endAll();
@@ -248,7 +249,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title mb-3">Maintenance</h2>
<h2 className="page-title mb-3">{t("Maintenance")}</h2>
<PageIntro>
Silence alerts about one server or integration while you work on it. Every window ends on its own — anything
still wrong when it ends alerts then, so nothing stays hidden.
@@ -258,25 +259,25 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
{canEdit && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Start maintenance</h3>
<h3 className="card-title">{t("Start maintenance")}</h3>
</div>
<form onSubmit={start}>
<div className="card-body row g-3">
<div className="col-md-4">
<label className="form-label">What are you working on?</label>
<label className="form-label">{t("What are you working on?")}</label>
<select className="form-select" required value={target} onChange={(e) => setTarget(e.target.value)}>
<option value="">Choose…</option>
<option value="">{t("Choose…")}</option>
{targets && targets.servers.length + targets.integrations.length + targets.dnsProviders.length + targets.devices.length > 1 && (
<optgroup label="Many at once">
<option value="all:everything">Everything — every server, integration, network device and DNS provider</option>
<optgroup label={t("Many at once")}>
<option value="all:everything">{t("Everything — every server, integration, network device and DNS provider")}</option>
{targets.devices.length > 1 && <option value="all:devices">All network devices ({targets.devices.length})</option>}
{targets.servers.length > 1 && <option value="all:servers">All servers ({targets.servers.length})</option>}
{targets.integrations.length > 1 && <option value="all:integrations">All integrations (the enabled ones)</option>}
{targets.dnsProviders.length > 1 && <option value="all:dns_providers">All DNS providers (the enabled ones)</option>}
{targets.integrations.length > 1 && <option value="all:integrations">{t("All integrations (the enabled ones)")}</option>}
{targets.dnsProviders.length > 1 && <option value="all:dns_providers">{t("All DNS providers (the enabled ones)")}</option>}
</optgroup>
)}
{targets && targets.servers.length > 0 && (
<optgroup label="Servers">
<optgroup label={t("Servers")}>
{targets.servers.map((s) => (
<option key={`s${s.id}`} value={`server:${s.id}`}>
{s.name}
@@ -285,7 +286,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</optgroup>
)}
{targets && targets.integrations.length > 0 && (
<optgroup label="Integrations">
<optgroup label={t("Integrations")}>
{targets.integrations.map((i) => (
<option key={`i${i.id}`} value={`integration:${i.id}`}>
{i.name} ({i.type})
@@ -294,7 +295,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</optgroup>
)}
{targets && targets.devices.length > 0 && (
<optgroup label="Network devices">
<optgroup label={t("Network devices")}>
{targets.devices.map((d) => (
<option key={`n${d.id}`} value={`device:${d.id}`}>
{d.name} ({d.kind.replace("_", " ")})
@@ -303,7 +304,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</optgroup>
)}
{targets && targets.dnsProviders.length > 0 && (
<optgroup label="DNS providers">
<optgroup label={t("DNS providers")}>
{targets.dnsProviders.map((p) => (
<option key={`d${p.id}`} value={`dns_provider:${p.id}`}>
{p.name} ({p.providerType})
@@ -318,13 +319,13 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<select className="form-select" value={minutes} onChange={(e) => setMinutes(Number(e.target.value))}>
{DURATIONS.map((d) => (
<option key={d.minutes} value={d.minutes}>
{d.label}
{t(d.label)}
</option>
))}
</select>
</div>
<div className="col-md-5">
<label className="form-label">Reason (optional)</label>
<label className="form-label">{t("Reason (optional)")}</label>
<input
className="form-control"
maxLength={200}
@@ -341,7 +342,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer">
<button type="submit" className="btn btn-primary" disabled={busy || !target}>
{busy ? "Starting…" : "Start maintenance"}
{busy ? t("Starting…") : t("Start maintenance")}
</button>
</div>
</form>
@@ -362,25 +363,25 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
{canEdit && kumaIntegrations && kumaIntegrations.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Import from Uptime Kuma</h3>
<h3 className="card-title">{t("Import from Uptime Kuma")}</h3>
</div>
<form onSubmit={importFromUptimeKuma}>
<div className="card-body row g-3">
<div className="text-secondary">
<strong>Sync schedule</strong> copies Uptime Kuma's maintenance windows — the one running now and the
<strong>{t("Sync schedule")}</strong> copies Uptime Kuma's maintenance windows — the one running now and the
next one of each daily, weekly or one-off window — onto the servers their monitors belong to, so they
show up under Scheduled below and silence alerts when they start. It needs the login username and
password filled in on the integration, and runs by itself every 15 minutes when{" "}
<em>Keep maintenance windows in step</em> is ticked there.
<em>{t("Keep maintenance windows in step")}</em> is ticked there.
</div>
<div className="text-secondary">
<strong>Import now</strong> only looks at what is in maintenance <em>this moment</em>: pick a duration
<strong>{t("Import now")}</strong> only looks at what is in maintenance <em>this moment</em>: pick a duration
— it doesn't have to match Uptime Kuma's own schedule exactly, and importing again later just extends
the window instead of stacking a second one.
</div>
{kumaIntegrations.length > 1 && (
<div className="col-md-5">
<label className="form-label">Uptime Kuma integration</label>
<label className="form-label">{t("Uptime Kuma integration")}</label>
<select
className="form-select"
value={kumaIntegrationId}
@@ -400,7 +401,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<select className="form-select" value={kumaMinutes} onChange={(e) => setKumaMinutes(Number(e.target.value))}>
{DURATIONS.map((d) => (
<option key={d.minutes} value={d.minutes}>
{d.label}
{t(d.label)}
</option>
))}
</select>
@@ -428,7 +429,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
{m.unmatched.length > 0 && <span className="text-secondary"> · nothing here for {m.unmatched.join(", ")}</span>}
{m.unmatched.length > 0 && (
<div className="text-secondary small">
Is one of those yours? Add its address under <em>Address aliases</em> below, saying what it belongs to.
Is one of those yours? Add its address under <em>{t("Address aliases")}</em> below, saying what it belongs to.
</div>
)}
<div className="text-secondary small">
@@ -485,13 +486,13 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
)}
<div className="card-footer d-flex align-items-center gap-3">
<button type="button" className="btn btn-primary" onClick={syncFromUptimeKuma} disabled={syncBusy || kumaIntegrationId === ""}>
{syncBusy ? "Syncing…" : "Sync schedule"}
{syncBusy ? t("Syncing…") : t("Sync schedule")}
</button>
<button type="submit" className="btn" disabled={kumaBusy || kumaIntegrationId === ""}>
{kumaBusy ? "Importing…" : "Import now"}
{kumaBusy ? t("Importing…") : t("Import now")}
</button>
{kumaIntegrationId === "" && (
<span className="text-secondary">Every Uptime Kuma integration is disabled — enable one under Integrations.</span>
<span className="text-secondary">{t("Every Uptime Kuma integration is disabled — enable one under Integrations.")}</span>
)}
</div>
</form>
@@ -501,7 +502,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
{canEdit && kumaIntegrations && kumaIntegrations.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Address aliases</h3>
<h3 className="card-title">{t("Address aliases")}</h3>
<div className="card-actions">
<ExportTableButton filename="maintenance-aliases" />
</div>
@@ -515,7 +516,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
there. Matching stays exact: only the address you list counts.
</div>
<div className="col-md-4">
<label className="form-label">Address in Uptime Kuma</label>
<label className="form-label">{t("Address in Uptime Kuma")}</label>
<input
className="form-control"
required
@@ -526,11 +527,11 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-5">
<label className="form-label">Belongs to</label>
<label className="form-label">{t("Belongs to")}</label>
<select className="form-select" required value={aliasTarget} onChange={(e) => setAliasTarget(e.target.value)}>
<option value="">Choose…</option>
<option value="">{t("Choose…")}</option>
{targets && targets.servers.length > 0 && (
<optgroup label="Servers">
<optgroup label={t("Servers")}>
{targets.servers.map((s) => (
<option key={`s${s.id}`} value={`server:${s.id}`}>
{s.name}
@@ -539,7 +540,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</optgroup>
)}
{targets && targets.integrations.length > 0 && (
<optgroup label="Integrations">
<optgroup label={t("Integrations")}>
{targets.integrations.map((i) => (
<option key={`i${i.id}`} value={`integration:${i.id}`}>
{i.name} ({i.type})
@@ -548,7 +549,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</optgroup>
)}
{targets && targets.dnsProviders.length > 0 && (
<optgroup label="DNS providers">
<optgroup label={t("DNS providers")}>
{targets.dnsProviders.map((p) => (
<option key={`d${p.id}`} value={`dns_provider:${p.id}`}>
{p.name} ({p.providerType})
@@ -560,7 +561,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-3 d-flex align-items-end">
<button type="submit" className="btn btn-primary" disabled={aliasBusy || !aliasTarget || !aliasAddress.trim()}>
{aliasBusy ? "Adding…" : "Add alias"}
{aliasBusy ? t("Adding…") : t("Add alias")}
</button>
</div>
</div>
@@ -576,8 +577,8 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<thead>
<tr>
<th>Address</th>
<th>Belongs to</th>
<th className="w-1">Actions</th>
<th>{t("Belongs to")}</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -589,7 +590,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</td>
<td>
<button className="btn btn-sm btn-outline-danger" onClick={() => removeAlias(a)}>
Remove
{t("Remove")}
</button>
</td>
</tr>
@@ -613,11 +614,11 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Target</th>
<th>Reason</th>
<th>{t("Target")}</th>
<th>{t("Reason")}</th>
<th>Starts</th>
<th>Ends</th>
{canEdit && <th className="w-1">Actions</th>}
<th>{t("Ends")}</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -635,7 +636,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
{canEdit && (
<td>
<button className="btn btn-sm btn-outline-secondary" onClick={() => end(w)}>
Cancel
{t("Cancel")}
</button>
</td>
)}
@@ -653,7 +654,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Active</h3>
<h3 className="card-title">{t("Active")}</h3>
<div className="card-actions">
<ExportTableButton filename="maintenance-active" />
{canEdit && (windows?.length ?? 0) > 1 && (
@@ -667,11 +668,11 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Target</th>
<th>Reason</th>
<th>Ends</th>
<th>Started by</th>
{canEdit && <th className="w-1">Actions</th>}
<th>{t("Target")}</th>
<th>{t("Reason")}</th>
<th>{t("Ends")}</th>
<th>{t("Started by")}</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -679,7 +680,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<tr key={w.id}>
<td>
{w.targetName} <span className="text-secondary">· {w.targetKind}</span>
{w.source?.startsWith("kuma:") && <span className="badge bg-cyan-lt ms-2">Uptime Kuma</span>}
{w.source?.startsWith("kuma:") && <span className="badge bg-cyan-lt ms-2">{t("Uptime Kuma")}</span>}
</td>
<td className="text-secondary">{w.reason ?? "—"}</td>
<td data-csv={w.endsAt}>
@@ -690,7 +691,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
{canEdit && (
<td>
<button className="btn btn-sm btn-outline-secondary" onClick={() => end(w)}>
End now
{t("End now")}
</button>
</td>
)}
@@ -698,7 +699,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
))}
{windows === null && <LoadingRow colSpan={canEdit ? 5 : 4} />}
{windows?.length === 0 && (
<EmptyRow colSpan={canEdit ? 5 : 4} title="Nothing is in maintenance" hint="Every alert is live. Start a window above before you work on something, so it doesn't raise alarms while you do." />
<EmptyRow colSpan={canEdit ? 5 : 4} title={t("Nothing is in maintenance")} hint={t("Every alert is live. Start a window above before you work on something, so it doesn't raise alarms while you do.")} />
)}
</tbody>
</table>
@@ -707,18 +708,18 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
<div className="card">
<div className="card-header">
<h3 className="card-title">What gets silenced</h3>
<h3 className="card-title">{t("What gets silenced")}</h3>
</div>
<div className="card-body">
<div className="row">
<div className="col-md-6">
<div className="fw-bold mb-1">Silenced for the target</div>
<div className="fw-bold mb-1">{t("Silenced for the target")}</div>
<ul className="text-secondary">
<li>Server offline and disk-full alerts (for a server).</li>
<li>Storage, volume and disk-health alerts (for a Proxmox or Synology integration).</li>
<li>Backup-failure and uncovered-guest alerts (for a Proxmox integration).</li>
<li>Backup-verification-failure alerts (for a Proxmox Backup Server integration).</li>
<li>Failed-run alerts for the Semaphore or Gitea integration you choose.</li>
<li>{t("Server offline and disk-full alerts (for a server).")}</li>
<li>{t("Storage, volume and disk-health alerts (for a Proxmox or Synology integration).")}</li>
<li>{t("Backup-failure and uncovered-guest alerts (for a Proxmox integration).")}</li>
<li>{t("Backup-verification-failure alerts (for a Proxmox Backup Server integration).")}</li>
<li>{t("Failed-run alerts for the Semaphore or Gitea integration you choose.")}</li>
<li>
"Integration down" alerts for that <em>type</em> of service — these are tracked per type (e.g. all
Proxmox), not per instance, so with two Proxmox integrations a failure on the other one is silenced
@@ -727,12 +728,12 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
</ul>
</div>
<div className="col-md-6">
<div className="fw-bold mb-1">Not silenced</div>
<div className="fw-bold mb-1">{t("Not silenced")}</div>
<ul className="text-secondary">
<li>Secret and certificate expiry, Tailscale key expiry, Docker update reminders.</li>
<li>DNS record change notifications.</li>
<li>{t("Secret and certificate expiry, Tailscale key expiry, Docker update reminders.")}</li>
<li>{t("DNS record change notifications.")}</li>
</ul>
<div className="fw-bold mb-1">When a window ends</div>
<div className="fw-bold mb-1">{t("When a window ends")}</div>
<div className="text-secondary">
A problem that started during it and is still there alerts on the next check (within 15 minutes). One
that was already alerted before it began and has since cleared is reported as cleared; one that
+2 -1
View File
@@ -8,6 +8,7 @@ import { ErrorNotice } from "../components/Notice";
import { PageSkeleton } from "../components/Skeleton";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const NODE_W = 210;
const NODE_H = 46;
@@ -102,7 +103,7 @@ export default function MapPage({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Map</h2>
<h2 className="page-title mb-0">{t("Map")}</h2>
<div className="btn-group ms-auto" role="group" aria-label="What to draw">
<button type="button" className={`btn btn-sm ${view === "connections" ? "active" : ""}`} aria-pressed={view === "connections"} onClick={() => choose("connections")}>
Connections
+10 -9
View File
@@ -10,17 +10,18 @@ import { formatBytes } from "./settings/StorageSettings";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import FigureHistory from "../components/FigureHistory";
import { t } from "../i18n";
const KIND_NAMES: Record<ArrApp["kind"], string> = { sonarr: "Sonarr", radarr: "Radarr", prowlarr: "Prowlarr", lidarr: "Lidarr", readarr: "Readarr" };
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (a.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">{t("In order")}</span>;
}
function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) {
@@ -78,7 +79,7 @@ function Card({ a, canRead, onRead }: { a: ArrApp; canRead: boolean; onRead: ()
{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="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={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} />
@@ -121,7 +122,7 @@ function Card({ a, canRead, onRead }: { a: ArrApp; canRead: boolean; onRead: ()
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Title</th>
<th>{t("Title")}</th>
<th>State</th>
<th>Progress</th>
<th>In the queue</th>
@@ -220,10 +221,10 @@ export default function Media({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
return (
<>
<h2 className="page-title">Media managers</h2>
<h2 className="page-title">{t("Media managers")}</h2>
<PageIntro>
Sonarr, Radarr, Prowlarr, Lidarr and Readarr, read every few minutes (see <Link to="/integrations">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{" "}
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
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{" "}
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+10 -9
View File
@@ -9,6 +9,7 @@ import { formatDate, formatDateTime } from "../utils/date";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
/** "2 h 40 min", "35 min", "3 d 4 h". */
function span(minutes: number): string {
@@ -52,8 +53,8 @@ function ServiceLevelsSection({ rows, partial }: { rows: ServiceLevelResult[]; p
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Target</th>
<th className="text-end">Target</th>
<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>
@@ -89,7 +90,7 @@ function Availability({ title, rows, hint }: { title: string; rows: Availability
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th className="text-end">Up</th>
<th className="text-end">Down for</th>
</tr>
@@ -239,10 +240,10 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
<div className="text-secondary">Nothing was measured for this month. Servers are measured from when their agent first reported, endpoints from when they were first checked.</div>
) : (
<>
<Availability title="Servers" rows={r.servers} hint="From when each stopped reporting and reported again; the worst first." />
<Availability title={t("Servers")} rows={r.servers} hint="From when each stopped reporting and reported again; the worst first." />
{r.endpoints.length > 0 && (
<div className="mb-3">
<h4 className="mb-1">Endpoints</h4>
<h4 className="mb-1">{t("Endpoints")}</h4>
<div className="text-secondary small mb-2">From every check's answers, day by day (the days are UTC days).</div>
<div className="table-responsive">
<table className="table table-vcenter table-sm">
@@ -268,7 +269,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
</div>
</div>
)}
<Availability title="Integrations" rows={r.integrations} hint="How often the calls to each kind of integration worked." />
<Availability title={t("Integrations")} rows={r.integrations} hint="How often the calls to each kind of integration worked." />
</>
)}
</div>
@@ -303,7 +304,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
<thead>
<tr>
<th>Began</th>
<th>Where</th>
<th>{t("Where")}</th>
<th>What</th>
<th>Worst</th>
<th className="text-end">Lasted</th>
@@ -337,7 +338,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Updates</h3>
<h3 className="card-title">{t("Updates")}</h3>
</div>
<div className="card-body">
{r.updates.runs === 0 && r.updates.planRuns.runs === 0 ? (
@@ -360,7 +361,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Server</th>
<th>{t("Server")}</th>
<th className="text-end">Runs</th>
<th className="text-end">Failed</th>
<th className="text-end">Installed</th>
+20 -19
View File
@@ -11,6 +11,7 @@ import { formatRemaining } from "../utils/duration";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const SEVERITY: Record<string, string> = { critical: "bg-red-lt text-red", warning: "bg-yellow-lt text-yellow", info: "bg-blue-lt text-blue" };
@@ -59,7 +60,7 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
onClick: async () => {
try {
await api.maintenance.start({ targetType: w.targetType as never, targetId: w.targetId, minutes: minutesFor(w, 0), reason: w.reason ?? undefined });
toast.info("Put back.");
toast.info(t("Put back."));
} catch (err) {
toast.error(readableError(err));
} finally {
@@ -101,24 +102,24 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">My work</h2>
<h2 className="page-title mb-0">{t("My work")}</h2>
</div>
<PageIntro>
What has your name on it: alerts you acknowledged or were handed, maintenance you started and update runs you started, and jobs handed to you. Whatever is about to run out is marked, and listed first.
{t("What has your name on it: alerts you acknowledged or were handed, maintenance you started and update runs you started, and jobs handed to you. Whatever is about to run out is marked, and listed first.")}
</PageIntro>
{work === null && <BlockSkeleton lines={4} />}
{nothing && (
<div className="card">
<EmptyState title="Nothing on your plate" hint="When you acknowledge an alert, are handed one, put something under maintenance or start an update run, it is listed here until it is done." />
<EmptyState title={t("Nothing on your plate")} hint={t("When you acknowledge an alert, are handed one, put something under maintenance or start an update run, it is listed here until it is done.")} />
</div>
)}
{work && work.alerts.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Alerts you have</h3>
<h3 className="card-title">{t("Alerts you have")}</h3>
</div>
<div className="table-responsive">
<table className="table table-vcenter card-table table-stack">
@@ -139,7 +140,7 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
</td>
<td className="stack-label text-nowrap" data-label="Lasts">
{a.until ? (
<span className={a.endsSoon ? "text-yellow" : "text-secondary"} title="When the acknowledgement runs out and the alert counts as nobody's again">
<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 "}
<TimeAgo value={a.until} />
</span>
@@ -151,11 +152,11 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
<div className="btn-list flex-nowrap">
{full && (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setAcking(full)}>
Change…
{t("Change…")}
</button>
)}
<Link to="/alerts" className="btn btn-sm btn-outline-secondary">
Alerts
{t("Alerts")}
</Link>
</div>
</td>
@@ -171,10 +172,10 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
{work && work.todos.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Jobs handed to you</h3>
<h3 className="card-title">{t("Jobs handed to you")}</h3>
<div className="card-actions">
<Link to="/todo?who=me" className="small">
To do
{t("To do")}
</Link>
</div>
</div>
@@ -197,10 +198,10 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
{work && work.windows.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Maintenance you started</h3>
<h3 className="card-title">{t("Maintenance you started")}</h3>
<div className="card-actions">
<Link to="/maintenance" className="small">
Maintenance
{t("Maintenance")}
</Link>
</div>
</div>
@@ -213,9 +214,9 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
<strong>{w.targetName}</strong> <span className="text-secondary small">{w.targetKind}</span>
{w.reason && <div className="small text-secondary">{w.reason}</div>}
</td>
<td className="stack-label text-nowrap" data-label="Ends">
<td className="stack-label text-nowrap" data-label={t("Ends")}>
<span className={w.endsSoon ? "text-yellow" : "text-secondary"}>
Ends in {formatRemaining(w.endsAt)}
{t("Ends in")} {formatRemaining(w.endsAt)}
</span>
</td>
<td className="stack-wide text-nowrap">
@@ -227,7 +228,7 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
+4 h
</button>
<button type="button" className="btn btn-sm btn-outline-danger" disabled={busy === w.id} onClick={() => void end(w)}>
End now
{t("End now")}
</button>
</div>
</td>
@@ -242,10 +243,10 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
{work && work.updateRuns.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Update runs you started</h3>
<h3 className="card-title">{t("Update runs you started")}</h3>
<div className="card-actions">
<Link to="/updates" className="small">
Updates
{t("Updates")}
</Link>
</div>
</div>
@@ -262,7 +263,7 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
{r.running ? (
<span className="badge bg-blue-lt text-blue">Running</span>
) : r.status === "done" ? (
<span className="badge bg-green-lt text-green">Done</span>
<span className="badge bg-green-lt text-green">{t("Done")}</span>
) : (
<span className="badge bg-red-lt text-red">{r.status}</span>
)}
@@ -272,7 +273,7 @@ export default function MyWorkPage({ user }: { user: CurrentUser }) {
</span>
)}
</td>
<td className="stack-label text-nowrap" data-label="Started">
<td className="stack-label text-nowrap" data-label={t("Started")}>
<TimeAgo value={r.startedAt} />
</td>
</tr>
+5 -4
View File
@@ -8,13 +8,14 @@ import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (n.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (n.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">{t("In order")}</span>;
}
const failed = (status: string | null) => status === "error" || status === "crashed";
@@ -112,7 +113,7 @@ export default function N8n() {
<>
<h2 className="page-title">n8n</h2>
<PageIntro>
Which automations have quietly stopped working. It is read every few minutes with an API key (see <Link to="/integrations">Integrations</Link>). A <strong>workflow that is switched on and failed on its last run</strong> is an alert — see <Link to="/alerts">Alerts</Link>; it clears when the workflow next succeeds.
Which automations have quietly stopped working. It is read every few minutes with an API key (see <Link to="/integrations">{t("Integrations")}</Link>). A <strong>workflow that is switched on and failed on its last run</strong> is an alert — see <Link to="/alerts">{t("Alerts")}</Link>; it clears when the workflow next succeeds.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+6 -5
View File
@@ -8,13 +8,14 @@ import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (n.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (n.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">{t("In order")}</span>;
}
const count = (v: number | null) => (v === null ? "—" : v.toLocaleString());
@@ -58,7 +59,7 @@ function Card({ n }: { n: NetBoxInfo }) {
<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="IP addresses" value={count(s.ipAddresses)} />
<Tile label={t("IP addresses")} value={count(s.ipAddresses)} />
</div>
<h4>Servers with no address in NetBox</h4>
@@ -109,7 +110,7 @@ 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">Integrations</Link>). <strong>No background worker running</strong> is an alert — see <Link to="/alerts">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>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} />}
+12 -11
View File
@@ -23,6 +23,7 @@ import { downloadCsv } from "../utils/csv";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const KIND_LABELS: Record<NetworkDeviceKind, string> = { gateway: "Gateway", switch: "Switch", access_point: "Access point", other: "Other" };
@@ -44,7 +45,7 @@ const STATE_RANK: Record<NetworkDevice["state"], number> = { offline: 0, updatin
function StateBadge({ d }: { d: NetworkDevice }) {
switch (d.state) {
case "online":
return <span className="badge bg-green-lt text-green">Online</span>;
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">
@@ -146,7 +147,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Network devices</h2>
<h2 className="page-title mb-0">{t("Network devices")}</h2>
{canAct && controllers.length > 0 && (
<div className="ms-auto btn-list">
<button className="btn btn-outline-secondary" onClick={() => void readNow()} disabled={reading}>
@@ -251,8 +252,8 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Row> label="Status" sortKeyName="stateRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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} />
@@ -260,7 +261,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
<SortableTh<Row> label="Needed by" sortKeyName="dependents" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{canAct && (
<th className="w-1">
<span className="visually-hidden">Actions</span>
<span className="visually-hidden">{t("Actions")}</span>
</th>
)}
</tr>
@@ -333,7 +334,7 @@ export default function NetworkDevices({ user }: { user: CurrentUser }) {
{!d.inMaintenance && <SilenceButton target={{ type: "device", id: d.id, name: d.name }} onDone={() => void load()} />}
<RunbookEntry targetType="device" targetId={d.id} targetName={d.name} canEdit={canAct} offerAdd />
<button type="button" className="btn btn-link btn-sm p-0" onClick={() => setNoting(d)}>
Notes
{t("Notes")}
</button>
</div>
</td>
@@ -395,7 +396,7 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>VLAN</th>
<th>Address range</th>
<th>Purpose</th>
@@ -430,8 +431,8 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
<thead>
<tr>
<th>Name (SSID)</th>
<th>Security</th>
<th>Network</th>
<th>{t("Security")}</th>
<th>{t("Network")}</th>
<th>VLAN</th>
<th>State</th>
</tr>
@@ -443,8 +444,8 @@ function NetworksAndWifi({ data }: { data: NetworkOverview }) {
<strong>{s.name}</strong>
{where(s) && <div className="text-secondary small">{where(s)}</div>}
</td>
<td className="stack-label" data-label="Security">{s.security ?? <span className="text-secondary">—</span>}</td>
<td className="stack-label" data-label="Network">{s.networkName ?? <span className="text-secondary">—</span>}</td>
<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>
</tr>
+7 -6
View File
@@ -9,14 +9,15 @@ import { formatBytes } from "./settings/StorageSettings";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (n.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (n.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (n.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (n.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">{t("In order")}</span>;
}
const count = (v: number | null) => (v === null ? "—" : v.toLocaleString());
@@ -68,7 +69,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">Users</div>
<div className="text-secondary small">{t("Users")}</div>
<div className="h2 mb-0">{count(s.users)}</div>
<div className="text-secondary small">{s.active24h === null ? "" : `${s.active24h} active in the last day`}</div>
</div>
@@ -139,7 +140,7 @@ 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">Integrations</Link>). <strong>Maintenance mode left on</strong>, <strong>a database that wants upgrading</strong>, <strong>background jobs that have stopped</strong> and <strong>the data disk running low</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
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>.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+4 -3
View File
@@ -10,6 +10,7 @@ import { readableError } from "../utils/errors";
import { channelName, isLogStatus, STATUS_BADGE, STATUS_HINT, STATUS_LABEL, STATUS_ORDER, type LogStatus } from "../utils/notificationLog";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
/**
* What was sent: every notification, newest first, with how it went through each channel — or why it did not: held for quiet hours, a routing rule said nobody, no channel to send it to.
@@ -83,7 +84,7 @@ export default function NotificationHistory() {
</PageIntro>
<div className="row g-2 mb-3">
<div className="col-sm-4 col-md-3">
<select className="form-select" aria-label="Show" value={status} onChange={(e) => setParam("status", e.target.value || null)}>
<select className="form-select" aria-label={t("Show")} value={status} onChange={(e) => setParam("status", e.target.value || null)}>
<option value="">Everything</option>
{STATUS_ORDER.map((s) => (
<option key={s} value={s}>
@@ -117,10 +118,10 @@ export default function NotificationHistory() {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>When</th>
<th>{t("When")}</th>
<th>Notification</th>
<th>How it went</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
+35 -34
View File
@@ -10,13 +10,14 @@ import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
function priorityBadge(t: OsTicketTicket) {
if (!t.priorityName) return <span className="text-secondary">—</span>;
const color = t.priorityColor || "#6c757d";
function priorityBadge(item_: OsTicketTicket) {
if (!item_.priorityName) return <span className="text-secondary">—</span>;
const color = item_.priorityColor || "#6c757d";
return (
<span className="badge" style={{ backgroundColor: `${color}22`, color, border: `1px solid ${color}55` }}>
{t.priorityName}
{item_.priorityName}
</span>
);
}
@@ -70,19 +71,19 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
downloadCsv(
"osticket-open-tickets.csv",
["Number", "Subject", "Status", "Priority", "Department", "Assigned to", "Requester", "Overdue", "Awaiting reply", "Created", "Last activity", "Due"],
sortedTickets.map((t) => [
t.number,
t.subject ?? "",
t.statusName,
t.priorityName ?? "",
t.departmentName ?? "",
t.staffName ?? t.teamName ?? "Unassigned",
t.requesterName ?? t.requesterEmail ?? "",
t.isOverdue ? "yes" : "no",
t.isAnswered ? "no" : "yes",
formatDateTime(new Date(t.createdAt)),
t.lastActivityAt ? formatDateTime(new Date(t.lastActivityAt)) : "",
t.dueAt ? formatDateTime(new Date(t.dueAt)) : "",
sortedTickets.map((item_) => [
item_.number,
item_.subject ?? "",
item_.statusName,
item_.priorityName ?? "",
item_.departmentName ?? "",
item_.staffName ?? item_.teamName ?? "Unassigned",
item_.requesterName ?? item_.requesterEmail ?? "",
item_.isOverdue ? "yes" : "no",
item_.isAnswered ? "no" : "yes",
formatDateTime(new Date(item_.createdAt)),
item_.lastActivityAt ? formatDateTime(new Date(item_.lastActivityAt)) : "",
item_.dueAt ? formatDateTime(new Date(item_.dueAt)) : "",
]),
);
}
@@ -169,7 +170,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
onClick={exportCsv}
disabled={!sortedTickets || sortedTickets.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -208,7 +209,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
direction={sortDir}
onSort={requestSort}
/>
<SortableTh<OsTicketTicket> label="Created" sortKeyName="createdAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<OsTicketTicket> label={t("Created")} sortKeyName="createdAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<OsTicketTicket>
label="Last activity"
sortKeyName="lastActivityAt"
@@ -226,30 +227,30 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
</tr>
</thead>
<tbody>
{sortedTickets?.map((t) => (
<tr key={t.ticketId}>
<td>{t.number}</td>
{sortedTickets?.map((item_) => (
<tr key={item_.ticketId}>
<td>{item_.number}</td>
<td>
{t.subject || <span className="text-secondary">(no subject)</span>}
<div className="text-secondary small">{t.statusName}</div>
{item_.subject || <span className="text-secondary">(no subject)</span>}
<div className="text-secondary small">{item_.statusName}</div>
</td>
<td>{priorityBadge(t)}</td>
<td className="text-secondary">{t.departmentName ?? "—"}</td>
<td className="text-secondary">{t.staffName ?? t.teamName ?? "Unassigned"}</td>
<td className="text-secondary">{t.requesterName ?? t.requesterEmail ?? "—"}</td>
<td className="text-secondary" title={formatDateTime(new Date(t.createdAt))}>
{formatAgo(t.createdAt)}
<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_.requesterName ?? item_.requesterEmail ?? "—"}</td>
<td className="text-secondary" title={formatDateTime(new Date(item_.createdAt))}>
{formatAgo(item_.createdAt)}
</td>
<td className="text-secondary">
{t.lastActivityAt ? (
<span title={formatDateTime(new Date(t.lastActivityAt))}>{formatAgo(t.lastActivityAt)}</span>
{item_.lastActivityAt ? (
<span title={formatDateTime(new Date(item_.lastActivityAt))}>{formatAgo(item_.lastActivityAt)}</span>
) : (
"—"
)}
</td>
<td>
{t.isOverdue && <span className="badge bg-red-lt text-red me-1">Overdue</span>}
{!t.isAnswered && <span className="badge bg-yellow-lt text-yellow">Awaiting reply</span>}
{item_.isOverdue && <span className="badge bg-red-lt text-red me-1">Overdue</span>}
{!item_.isAnswered && <span className="badge bg-yellow-lt text-yellow">{t("Awaiting reply")}</span>}
</td>
</tr>
))}
+7 -6
View File
@@ -9,16 +9,17 @@ import { formatBytes } from "./settings/StorageSettings";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import FigureHistory from "../components/FigureHistory";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (p.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (p.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">{t("In order")}</span>;
}
const n = (v: number | null) => (v === null ? "—" : v.toLocaleString());
@@ -153,8 +154,8 @@ 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">Integrations</Link>). <strong>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">Alerts</Link>.
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{" "}
<strong>disk that is filling up</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+3 -2
View File
@@ -16,6 +16,7 @@ import IntegrationPageTitle from "../components/IntegrationPageTitle";
import { ErrorNotice } from "../components/Notice";
import ExportTableButton from "../components/ExportTableButton";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
function formatBytes(bytes: number | null): string {
if (bytes === null) return "—";
@@ -228,7 +229,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
onClick={exportCsv}
disabled={!sortedDatastores || sortedDatastores.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -306,7 +307,7 @@ export default function PbsBackup({ user: _user, tabs }: { user: CurrentUser; /*
<tr>
<th>Datastore</th>
<th>Backup</th>
<th>When</th>
<th>{t("When")}</th>
</tr>
</thead>
<tbody>
+14 -13
View File
@@ -23,6 +23,7 @@ import { portName } from "../utils/portName";
import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import { t } from "../i18n";
const emptyForm: PortForwardInput = {
label: "",
@@ -229,7 +230,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title mb-3">Ports</h2>
<h2 className="page-title mb-3">{t("Ports")}</h2>
<ViewTabs
label="Ports view"
@@ -253,10 +254,10 @@ export default function Ports({ user }: { user: CurrentUser }) {
{reportingServers} of {totalServers} server{totalServers !== 1 ? "s" : ""} reporting
</span>
<button className="btn btn-sm btn-outline-secondary" onClick={exportAgentCsv} disabled={!sortedAgentPorts?.length}>
Export CSV
{t("Export CSV")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={loadAgentPorts}>
Refresh
{t("Refresh")}
</button>
</div>
</div>
@@ -286,7 +287,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<AgentPortRow> label="Server" sortKeyName="serverName" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
<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>
@@ -311,7 +312,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
className="badge bg-yellow-lt text-yellow ms-2"
title="It began listening after this server's first report and nobody has said it is expected. It is on the Alerts page until you mark it as expected or it stops listening."
>
New
{t("New")}
</span>
)}
</td>
@@ -326,7 +327,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
<td className="text-end">
{p.isNew && (
<button className="btn btn-sm btn-outline-primary" onClick={() => void markExpected([p])} disabled={marking.has(portId(p))} title="Notes it as expected on the server's Ports card, so there is no alert for it">
Mark as expected
{t("Mark as expected")}
</button>
)}
</td>
@@ -422,7 +423,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-3">
<label className="form-label">Source</label>
<label className="form-label">{t("Source")}</label>
<input
className="form-control"
placeholder="Home router, OPNsense, Cloudflare Tunnel…"
@@ -444,7 +445,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
{editing ? "Save changes" : "Add port opening"}
</button>
<button type="button" className="btn" onClick={cancelForm}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -465,7 +466,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
</button>
)}
<button className="btn btn-sm btn-outline-secondary" onClick={exportForwardsCsv} disabled={!sortedForwards?.length}>
Export CSV
{t("Export CSV")}
</button>
</div>
</div>
@@ -483,9 +484,9 @@ export default function Ports({ user }: { user: CurrentUser }) {
onSort={requestForwardSort}
/>
<th>Destination</th>
<SortableTh<PortForward> label="Source" sortKeyName="source" activeKey={forwardSortKey} direction={forwardSortDir} onSort={requestForwardSort} />
<SortableTh<PortForward> label={t("Source")} sortKeyName="source" activeKey={forwardSortKey} direction={forwardSortDir} onSort={requestForwardSort} />
<th>Comment</th>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -509,10 +510,10 @@ export default function Ports({ user }: { user: CurrentUser }) {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" onClick={() => startEdit(f)}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(f)}>
Delete
{t("Delete")}
</button>
</div>
</td>
+8 -7
View File
@@ -6,6 +6,7 @@ import { formatDateTime } from "../utils/date";
import { formatAgo } from "../utils/duration";
import { readableError } from "../utils/errors";
import { ErrorNotice } from "../components/Notice";
import { t } from "../i18n";
const CHANNEL_LABELS = { gotify: "Gotify", ntfy: "ntfy", telegram: "Telegram", pushover: "Pushover", smtp: "email (SMTP)", webhook: "webhook", webPush: "web push" } as const;
@@ -50,7 +51,7 @@ export default function Privacy() {
return (
<>
<h2 className="page-title mb-3">Privacy</h2>
<h2 className="page-title mb-3">{t("Privacy")}</h2>
<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{" "}
@@ -73,7 +74,7 @@ export default function Privacy() {
</div>
<div className="card-body">
<dl className="row mb-0">
<dt className="col-sm-3">Name</dt>
<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>
<dd className="col-sm-9">{data.me.user.email ?? "—"}</dd>
@@ -105,7 +106,7 @@ export default function Privacy() {
<th>From</th>
<th>Browser</th>
<th>Last active</th>
<th>Ends</th>
<th>{t("Ends")}</th>
</tr>
</thead>
<tbody>
@@ -205,7 +206,7 @@ export default function Privacy() {
<td>Until deleted. Settings → Data → Backup exports include them, encrypted with a passphrase you choose.</td>
</tr>
<tr>
<td>Inventory</td>
<td>{t("Inventory")}</td>
<td>IP addresses, cached DNS records, domain registrations, port notes, tags and maintenance windows.</td>
<td>Until deleted.</td>
</tr>
@@ -233,12 +234,12 @@ export default function Privacy() {
(which server or integration, what is wrong), a link back to this app, and the requester name and email set there go to your osTicket's API.
</li>
<li className="mb-2">
<strong>DNS providers</strong>
<strong>{t("DNS providers")}</strong>
{outbound && outbound.dnsProviderTypes.length > 0 ? ` (${outbound.dnsProviderTypes.join(", ")})` : ""} — zones and records are read
from, and changed at, the provider.
</li>
<li className="mb-2">
<strong>Notifications</strong> —{" "}
<strong>{t("Notifications")}</strong> —{" "}
{enabledChannels.length === 0 ? (
"no channel is switched on, so no alerts leave the server."
) : (
@@ -334,7 +335,7 @@ export default function Privacy() {
<div className="card-body">
<ul className="mb-0">
<li className="mb-2">
<strong>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">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
+7 -6
View File
@@ -8,17 +8,18 @@ import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import FigureHistory from "../components/FigureHistory";
import { t } from "../i18n";
/** Alerts every pipeline carries to prove it works: they are always firing, so they are not shown as firing. */
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (p.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (p.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (p.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">{t("In order")}</span>;
}
function Card({ p }: { p: PrometheusInfo }) {
@@ -140,8 +141,8 @@ export default function Prometheus() {
<>
<h2 className="page-title">Prometheus</h2>
<PageIntro>
What Prometheus already measures, in the same list as everything else. It is read every couple of minutes (see <Link to="/integrations">Integrations</Link>). A <strong>target that has not answered for five minutes</strong> and an <strong>alert that Prometheus&rsquo;s rules are firing</strong> are
alerts — see <Link to="/alerts">Alerts</Link>. Alerts that Grafana manages itself are not seen.
What Prometheus already measures, in the same list as everything else. It is read every couple of minutes (see <Link to="/integrations">{t("Integrations")}</Link>). A <strong>target that has not answered for five minutes</strong> and an <strong>alert that Prometheus&rsquo;s rules are firing</strong> are
alerts — see <Link to="/alerts">{t("Alerts")}</Link>. Alerts that Grafana manages itself are not seen.
</PageIntro>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
+18 -17
View File
@@ -29,6 +29,7 @@ import { formatDateTime } from "../utils/date";
import ExportTableButton from "../components/ExportTableButton";
import { EmptyRow } from "../components/EmptyState";
import ProxmoxSnapshots from "../components/ProxmoxSnapshots";
import { t } from "../i18n";
function proxmoxStatusBadge(status: string) {
return status === "running" ? (
@@ -73,7 +74,7 @@ function formatDuration(startIso: string, endIso: string | null): string {
}
function backupStatusBadge(task: ProxmoxBackupTask) {
if (task.ok) return <span className="badge bg-green-lt text-green">OK</span>;
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>;
return (
<span className="badge bg-red-lt text-red" title={task.status}>
@@ -361,7 +362,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Backups</h3>
<h3 className="card-title">{t("Backups")}</h3>
<div className="card-actions">
<button
className="btn btn-sm btn-outline-secondary"
@@ -399,7 +400,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
<th>Schedule</th>
<th>Storage</th>
<th>Guests</th>
<th>Status</th>
<th>{t("Status")}</th>
</tr>
</thead>
<tbody>
@@ -410,9 +411,9 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
<td className="text-secondary">{describeGuests(j)}</td>
<td>
{j.enabled ? (
<span className="badge bg-green-lt text-green">Enabled</span>
<span className="badge bg-green-lt text-green">{t("Enabled")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary">Disabled</span>
<span className="badge bg-secondary-lt text-secondary">{t("Disabled")}</span>
)}
</td>
</tr>
@@ -431,10 +432,10 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
<table className="table table-sm table-vcenter mb-4">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Node</th>
<th>Type</th>
<th>Status</th>
<th>{t("Status")}</th>
</tr>
</thead>
<tbody>
@@ -467,8 +468,8 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
<tr>
<th>Node</th>
<th>Guest</th>
<th>Status</th>
<th>Started</th>
<th>{t("Status")}</th>
<th>{t("Started")}</th>
<th>Duration</th>
</tr>
</thead>
@@ -507,7 +508,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
onClick={exportGuestsCsv}
disabled={!sortedGuests || sortedGuests.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -522,7 +523,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<ProxmoxGuest> label="Name" sortKeyName="name" activeKey={guestSortKey} direction={guestSortDir} onSort={requestGuestSort} />
<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>
@@ -533,13 +534,13 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
onSort={requestGuestSort}
/>
<SortableTh<ProxmoxGuest>
label="Status"
label={t("Status")}
sortKeyName="status"
activeKey={guestSortKey}
direction={guestSortDir}
onSort={requestGuestSort}
/>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -564,21 +565,21 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
onClick={() => guestAction(g, "restart")}
disabled={actingOnGuest === g.vmid}
>
Restart
{t("Restart")}
</button>
<button
className="btn btn-sm"
onClick={() => guestAction(g, "shutdown")}
disabled={actingOnGuest === g.vmid}
>
Shutdown
{t("Shutdown")}
</button>
<button
className="btn btn-sm btn-outline-danger"
onClick={() => guestAction(g, "stop")}
disabled={actingOnGuest === g.vmid}
>
Stop
{t("Stop")}
</button>
</>
) : (
@@ -587,7 +588,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
onClick={() => guestAction(g, "start")}
disabled={actingOnGuest === g.vmid}
>
Start
{t("Start")}
</button>
)}
</div>
+9 -8
View File
@@ -18,6 +18,7 @@ import { formatDate } from "../utils/date";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
type Row = NpmHost & { integrationId: number; canManage: boolean; integrationName: string; domain: string; target: string; certDays: number | null; certName: string; statusRank: number; serverName: string };
@@ -25,7 +26,7 @@ const DAY_MS = 86_400_000;
const daysLeft = (iso: string | null): number | null => (iso && Number.isFinite(Date.parse(iso)) ? Math.floor((Date.parse(iso) - Date.now()) / DAY_MS) : null);
function StatusBadge({ h }: { h: Row }) {
if (!h.enabled) return <span className="badge bg-secondary-lt text-secondary">Switched off</span>;
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"}>
@@ -164,7 +165,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Proxy hosts</h2>
<h2 className="page-title mb-0">{t("Proxy hosts")}</h2>
{(user.role === "admin" || user.role === "operator") && data && data.integrations.length > 0 && (
<div className="ms-auto btn-list">
{isAdmin && managing.length > 0 && (
@@ -184,7 +185,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
</PageIntro>
{isAdmin && data && data.integrations.length > 0 && !canManageAny && (
<div className="text-secondary small mb-3">
To make and change proxy hosts from here, give the Nginx Proxy Manager integration a user with <em>Manage</em> on Proxy Hosts: <Link to="/integrations">Integrations</Link> → edit → <em>Email of a user that may manage</em>.
To make and change proxy hosts from here, give the Nginx Proxy Manager integration a user with <em>{t("Manage")}</em> on Proxy Hosts: <Link to="/integrations">{t("Integrations")}</Link> → edit → <em>Email of a user that may manage</em>.
</div>
)}
{form && form.mode === "new" && (
@@ -264,7 +265,7 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
{problems.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Needs attention</h3>
<h3 className="card-title">{t("Needs attention")}</h3>
</div>
<div className="list-group list-group-flush">
{problems.map((p) => (
@@ -283,8 +284,8 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Row> label="Status" sortKeyName="statusRank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Name" sortKeyName="domain" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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} />
{canManageAny && <th />}
@@ -324,13 +325,13 @@ export default function ProxyHosts({ user }: { user: CurrentUser }) {
{h.canManage && (
<>
<button className="btn btn-sm btn-outline-secondary me-1" onClick={() => setForm({ mode: "edit", row: h })}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-secondary me-1" onClick={() => void switchHost(h)}>
{h.enabled ? "Switch off" : "Switch on"}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void deleteHost(h)}>
Delete
{t("Delete")}
</button>
</>
)}
+14 -13
View File
@@ -14,6 +14,7 @@ import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast";
import TableToolbar from "../components/TableToolbar";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import { t } from "../i18n";
const TYPE_LABELS: Record<SecretRecord["type"], string> = {
api_token: "API Token",
@@ -205,7 +206,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title mb-3">Secrets</h2>
<h2 className="page-title mb-3">{t("Secrets")}</h2>
<ErrorNotice error={error} />
{canEdit && (
@@ -216,7 +217,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
<form onSubmit={submit}>
<div className="card-body row g-3">
<div className="col-md-4">
<label className="form-label">Name</label>
<label className="form-label">{t("Name")}</label>
<input
className="form-control"
required
@@ -300,7 +301,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-6">
<label className="form-label">Description</label>
<label className="form-label">{t("Description")}</label>
<input
className="form-control"
value={form.description}
@@ -308,7 +309,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-6">
<label className="form-label">Notes</label>
<label className="form-label">{t("Notes")}</label>
<input
className="form-control"
value={form.notes}
@@ -322,7 +323,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
</button>
{editingId && (
<button type="button" className="btn" onClick={cancelEdit}>
Cancel
{t("Cancel")}
</button>
)}
</div>
@@ -338,12 +339,12 @@ export default function Secrets({ user }: { user: CurrentUser }) {
filters={
<select
className="form-select form-select-sm w-auto"
aria-label="Status"
aria-label={t("Status")}
value={statusFilter}
onChange={(e) => setStatusFilter(e.target.value as typeof statusFilter)}
>
<option value="all">All statuses</option>
<option value="ok">OK</option>
<option value="ok">{t("OK")}</option>
<option value="expiring">Expiring</option>
<option value="expired">Expired</option>
<option value="never">No expiry</option>
@@ -378,7 +379,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
/>
</th>
)}
<SortableTh<SecretRecord> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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="Expiry"
@@ -394,15 +395,15 @@ export default function Secrets({ user }: { user: CurrentUser }) {
direction={sortDir}
onSort={requestSort}
/>
<SortableTh<SecretRecord> label="Status" sortKeyName="status" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<SecretRecord> label={t("Status")} sortKeyName="status" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<SecretRecord>
label="Description"
label={t("Description")}
sortKeyName="description"
activeKey={sortKey}
direction={sortDir}
onSort={requestSort}
/>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -450,10 +451,10 @@ export default function Secrets({ user }: { user: CurrentUser }) {
</button>
)}
<button className="btn btn-sm" onClick={() => startEdit(s)}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(s)}>
Delete
{t("Delete")}
</button>
</div>
</td>
+4 -3
View File
@@ -22,6 +22,7 @@ import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
function semaphoreStatusBadge(template: SemaphoreTemplate) {
const status = template.lastTask?.status;
@@ -176,7 +177,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
<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}>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -200,8 +201,8 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
onSort={requestSort}
/>
<th>Last run</th>
<th>Status</th>
{canEdit && <th className="w-1">Actions</th>}
<th>{t("Status")}</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
+4 -3
View File
@@ -6,6 +6,7 @@ import RangeSelect from "../components/RangeSelect";
import { CHART_RANGES, useChartRange } from "../utils/chartRanges";
import { BlockSkeleton } from "../components/Skeleton";
import ExportTableButton from "../components/ExportTableButton";
import { t } from "../i18n";
const MAX_SERVERS = 4;
// A colour and a dash pattern for each line, so they can be told apart by either.
@@ -109,7 +110,7 @@ export default function ServerCompare() {
{ids.length < 2 ? (
<div className="card">
<div className="card-body text-secondary">
Pick two to {MAX_SERVERS} servers to compare. On the <Link to="/servers">Servers</Link> page, press Compare and choose them.
Pick two to {MAX_SERVERS} servers to compare. On the <Link to="/servers">{t("Servers")}</Link> page, press Compare and choose them.
</div>
</div>
) : (
@@ -128,7 +129,7 @@ export default function ServerCompare() {
</div>
<div className="card-body">
{failed ? (
<div className="text-secondary">Couldn't load the history.</div>
<div className="text-secondary">{t("Couldn't load the history.")}</div>
) : loaded === null ? (
<BlockSkeleton lines={5} />
) : (
@@ -142,7 +143,7 @@ export default function ServerCompare() {
<table className="table table-vcenter">
<thead>
<tr>
<th>Server</th>
<th>{t("Server")}</th>
<th>Now</th>
<th>Average</th>
<th>Peak</th>
+59 -58
View File
@@ -47,6 +47,7 @@ import ConnectedThrough from "../components/ConnectedThrough";
import HetznerServerCard from "../components/HetznerServerCard";
import ServerBlock, { ArrangeBar } from "../components/ServerBlock";
import ServerStatusStrip from "../components/ServerStatusStrip";
import { t } from "../i18n";
const SCHEDULE_TYPE_OPTIONS: { value: ScheduleType; label: string }[] = Object.entries(SCHEDULE_TYPE_LABELS).map(
([value, label]) => ({ value: value as ScheduleType, label }),
@@ -322,7 +323,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
}
async function deleteTask(task: TaskRecord) {
if (!(await confirmDialog({ title: "Delete task", message: `Delete "${task.name}"?`, confirmLabel: "Delete", danger: true }))) return;
if (!(await confirmDialog({ title: t("Delete task"), message: `Delete "${task.name}"?`, confirmLabel: "Delete", danger: true }))) return;
try {
await api.tasks.remove(task.id);
loadTasks();
@@ -414,7 +415,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
if (
action === "stop" &&
!(await confirmDialog({
title: "Stop server",
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",
danger: true,
@@ -451,7 +452,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{server.description && <div className="text-secondary">{server.description}</div>}
</div>
<button className="btn btn-outline-secondary ms-auto" onClick={loadDetail} disabled={refreshing}>
{refreshing ? "Refreshing…" : "Refresh"}
{refreshing ? t("Refreshing…") : t("Refresh")}
</button>
</div>
<ErrorNotice error={error} />
@@ -466,7 +467,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
/>
<ViewTabs
label="Sections of this server's page"
label={t("Sections of this server's page")}
tabs={SECTIONS.map((t) => ({ to: t.key === "overview" ? `/servers/${serverId}` : `/servers/${serverId}?view=${t.key}`, label: t.key === "tasks" && tasks && tasks.length > 0 ? `Tasks (${tasks.length})` : t.label, active: view === t.key }))}
/>
@@ -474,14 +475,14 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
<>
<ArrangeBar />
<div className="d-flex flex-column">
<ServerBlock id="admin-links" label="Admin Links" at={0}>
<ServerBlock id="admin-links" label={t("Admin Links")} at={0}>
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Admin Links</h3>
<h3 className="card-title">{t("Admin Links")}</h3>
{canEditTasks && !adminLinkForm && (
<div className="card-actions">
<button className="btn btn-sm btn-primary" onClick={openAddAdminLink}>
Add link
{t("Add link")}
</button>
</div>
)}
@@ -514,7 +515,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</div>
{!!adminLinkPorts?.length && (
<div className="col-12">
<label className="form-label">Fill from a known port (optional)</label>
<label className="form-label">{t("Fill from a known port (optional)")}</label>
<select
className="form-select"
style={{ maxWidth: 460 }}
@@ -532,17 +533,17 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
)}
<div className="col-md-3 d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={savingAdminLink}>
{editingAdminLinkId ? "Save" : "Add"}
{editingAdminLinkId ? t("Save") : t("Add")}
</button>
<button type="button" className="btn" onClick={cancelAdminLinkForm}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
)}
{links.length === 0 ? (
<div className="text-secondary">No admin links added yet — e.g. Dockge, Webmin, or Cockpit for this server.</div>
<div className="text-secondary">{t("No admin links added yet — e.g. Dockge, Webmin, or Cockpit for this server.")}</div>
) : (
<div className="d-flex flex-wrap gap-2">
{links.map((l) => (
@@ -552,10 +553,10 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</a>
{canEditTasks && (
<>
<button className="btn btn-outline-secondary btn-sm" onClick={() => startEditAdminLink(l)} title="Edit">
<button className="btn btn-outline-secondary btn-sm" onClick={() => startEditAdminLink(l)} title={t("Edit")}>
✎
</button>
<button className="btn btn-outline-danger btn-sm" onClick={() => removeAdminLink(l)} title="Remove">
<button className="btn btn-outline-danger btn-sm" onClick={() => removeAdminLink(l)} title={t("Remove")}>
×
</button>
</>
@@ -568,21 +569,21 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</div>
</ServerBlock>
<ServerBlock id="hetzner" label="Hetzner Cloud" at={10}>
<ServerBlock id="hetzner" label={t("Hetzner Cloud")} at={10}>
<HetznerServerCard serverId={serverId} />
</ServerBlock>
<ServerBlock id="hardware-identity" label="Hardware, network and identity" at={20} noFold>
<ServerBlock id="hardware-identity" label={t("Hardware, network and identity")} at={20} noFold>
<div className="row row-cards mb-3">
<ServerBlock id="hardware" label="Hardware & Network" className="col-lg-7">
<ServerBlock id="hardware" label={t("Hardware & Network")} className="col-lg-7">
<div className="card h-100">
<div className="card-header">
<h3 className="card-title">Hardware &amp; Network</h3>
<h3 className="card-title">{t("Hardware & Network")}</h3>
</div>
<div className="card-body">
{hardware.source === "none" && (
<div className="text-secondary">
No hardware data yet. Install the agent on this server, or link it to a Proxmox VM/LXC (under Settings).
{t("No hardware data yet. Install the agent on this server, or link it to a Proxmox VM/LXC (under Settings).")}
</div>
)}
{hardware.error && <div className="alert alert-danger">{hardware.error}</div>}
@@ -604,22 +605,22 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{hardware.status === "running" ? (
<>
<button className="btn btn-sm" onClick={() => guestAction("restart")} disabled={actingOnGuest}>
Restart
{t("Restart")}
</button>
<button className="btn btn-sm" onClick={() => guestAction("shutdown")} disabled={actingOnGuest}>
Shutdown
{t("Shutdown")}
</button>
<button
className="btn btn-sm btn-outline-danger"
onClick={() => guestAction("stop")}
disabled={actingOnGuest}
>
Stop
{t("Stop")}
</button>
</>
) : (
<button className="btn btn-sm btn-primary" onClick={() => guestAction("start")} disabled={actingOnGuest}>
Start
{t("Start")}
</button>
)}
</div>
@@ -644,7 +645,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{usageBar(hardware.memUsedBytes, hardware.memTotalBytes)}
</div>
<div className="col-sm-6">
<div className="text-secondary small">Disk (allocated)</div>
<div className="text-secondary small">{t("Disk (allocated)")}</div>
<div>{formatBytes(hardware.diskBytes)}</div>
</div>
<div className="col-sm-6">
@@ -655,7 +656,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
<DisksTable disks={hardware.disks ?? []} />
{hardware.guestAgentAvailable === false && (
<div className="text-secondary small mt-3">
IP addresses unavailable — the QEMU guest agent isn't installed or running on this VM.
{t("IP addresses unavailable — the QEMU guest agent isn't installed or running on this VM.")}
</div>
)}
{server.proxmoxGuestType === "qemu" &&
@@ -672,7 +673,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{hardware.source === "agent" && (
<>
<div className="text-secondary small mb-3">
Reported by the agent as of {server.lastSeenAt ? formatDateTime(new Date(server.lastSeenAt)) : "unknown"}.
{t("Reported by the agent as of")} {server.lastSeenAt ? formatDateTime(new Date(server.lastSeenAt)) : "unknown"}.
</div>
<div className="row g-3">
<div className="col-sm-6">
@@ -682,7 +683,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{hardware.cpuCores ? ` · ${hardware.cpuCores} cores` : ""}
</div>
{hardware.cpuLoadPercent !== null && hardware.cpuLoadPercent !== undefined && (
<div className="text-secondary small">Load: {hardware.cpuLoadPercent.toFixed(1)}%</div>
<div className="text-secondary small">{t("Load:")} {hardware.cpuLoadPercent.toFixed(1)}%</div>
)}
</div>
<div className="col-sm-6">
@@ -699,7 +700,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{ipAddresses.length > 0 && (
<div className="mt-3">
<div className="text-secondary small mb-1">IP addresses</div>
<div className="text-secondary small mb-1">{t("IP addresses")}</div>
<ul className="list-unstyled mb-0">
{ipAddresses.map((ip) => {
const matches = dnsMatches.filter((m) => m.ip === ip);
@@ -730,15 +731,15 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
<div className="card-body">
<dl className="row mb-0">
<ServerHostname server={server} isAdmin={isAdmin} onChanged={loadDetail} />
<dt className="col-5">OS type</dt>
<dt className="col-5">{t("OS type")}</dt>
<dd className="col-7">{server.osType}</dd>
<dt className="col-5">Token</dt>
<dt className="col-5">{t("Token")}</dt>
<dd className="col-7 text-secondary">{server.apiTokenPrefix}…</dd>
<dt className="col-5">Created</dt>
<dt className="col-5">{t("Created")}</dt>
<dd className="col-7">{formatDateTime(new Date(server.createdAt))}</dd>
<dt className="col-5">Last seen</dt>
<dt className="col-5">{t("Last seen")}</dt>
<dd className="col-7">{server.lastSeenAt ? <TimeAgo value={server.lastSeenAt} /> : "never"}</dd>
<dt className="col-5">Last 30 days</dt>
<dt className="col-5">{t("Last 30 days")}</dt>
<dd className="col-7">
<UptimeRibbon kind="servers" id={server.id} name={server.name} />
</dd>
@@ -753,13 +754,13 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</dd>
</>
)}
<dt className="col-5">Runs on</dt>
<dt className="col-5">{t("Runs on")}</dt>
<dd className="col-7">
<RunsOn serverId={server.id} parent={detail.relations.parent} noParent={server.noParent} canEdit={isAdmin} onChanged={() => void loadDetail()} />
</dd>
{detail.relations.children.length > 0 && (
<>
<dt className="col-5">Runs here</dt>
<dt className="col-5">{t("Runs here")}</dt>
<dd className="col-7">
{detail.relations.children.map((c, i) => (
<span key={c.id}>
@@ -772,18 +773,18 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
)}
{server.lastSeenAt && (
<>
<dt className="col-5">Agent</dt>
<dt className="col-5">{t("Agent")}</dt>
<dd className="col-7">
{agentVersionWords(server.agentVersion)}{" "}
{agentState(server, detail.agentLatest) === "behind" ? (
<span className="badge bg-yellow-lt text-yellow" title="Run its install command again to update it (Servers → Manage servers), or switch on automatic agent updates on the Servers page.">
<span className="badge bg-yellow-lt text-yellow" title={t("Run its install command again to update it (Servers → Manage servers), or switch on automatic agent updates on the Servers page.")}>
update available
</span>
) : (
<span className="badge bg-green-lt text-green">current</span>
)}
</dd>
<dt className="col-5">Updates</dt>
<dt className="col-5">{t("Updates")}</dt>
<dd className="col-7">
<UpdatesBadge updates={server.pendingUpdates} />
{server.updatesPendingSince && server.pendingUpdates && server.pendingUpdates.count > 0 && (
@@ -801,10 +802,10 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</div>
</ServerBlock>
<ServerBlock id="todos" label="To do" at={30}>
<ServerBlock id="todos" label={t("To do")} at={30}>
<TodosCard targetType="server" targetId={server.id} canEdit={canEditTasks} />
</ServerBlock>
<ServerBlock id="notes" label="Notes" at={40}>
<ServerBlock id="notes" label={t("Notes")} at={40}>
<NotesCard targetType="server" targetId={server.id} canEdit={canEditTasks} />
</ServerBlock>
<ServerBlock id="runbooks" label="Runbooks" at={50}>
@@ -870,7 +871,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{canEditTasks && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Run a playbook</h3>
<h3 className="card-title">{t("Run a playbook")}</h3>
</div>
<div className="card-body">
<RunPlaybook serverName={server.name} defaultLimit={server.name} />
@@ -882,7 +883,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
<h3 className="mb-0">Tasks</h3>
{canEditTasks && (
<button className="btn btn-primary btn-sm ms-auto" onClick={openAddTask}>
Add task
{t("Add task")}
</button>
)}
</div>
@@ -890,12 +891,12 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{taskForm && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">{editingTask ? "Edit task" : "Add a task manually"}</h3>
<h3 className="card-title">{editingTask ? t("Edit task") : t("Add a task manually")}</h3>
</div>
<form onSubmit={submitTask}>
<div className="card-body row g-3">
<div className="col-md-3">
<label className="form-label">Schedule type</label>
<label className="form-label">{t("Schedule type")}</label>
<select
className="form-select"
value={taskForm.scheduleType}
@@ -909,7 +910,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</select>
</div>
<div className="col-md-9">
<label className="form-label">Name</label>
<label className="form-label">{t("Name")}</label>
<input
className="form-control"
required
@@ -919,7 +920,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-6">
<label className="form-label">Command / description</label>
<label className="form-label">{t("Command / description")}</label>
<input
className="form-control"
placeholder="e.g. docker exec pg-backup /backup.sh"
@@ -944,13 +945,13 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
checked={taskForm.enabled}
onChange={(e) => setTaskForm({ ...taskForm, enabled: e.target.checked })}
/>
<span className="form-check-label">Enabled</span>
<span className="form-check-label">{t("Enabled")}</span>
</label>
</div>
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={savingTask}>
{editingTask ? "Save changes" : "Add task"}
{editingTask ? t("Save changes") : t("Add task")}
</button>
<button
type="button"
@@ -960,7 +961,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
setEditingTask(null);
}}
>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -969,7 +970,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
<div className="card">
{tasks && tasks.length === 0 && (
<div className="card-body text-secondary">No scheduled tasks found for this server yet.</div>
<div className="card-body text-secondary">{t("No scheduled tasks found for this server yet.")}</div>
)}
{tasks && tasks.length > 0 && (
<ServerTaskTable tasks={tasks} canEditTasks={canEditTasks} onEdit={openEditTask} onDelete={deleteTask} />
@@ -983,11 +984,11 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{isAdmin && (server.proxmoxIntegrationId || !server.hideProxmoxLink) ? (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Proxmox link</h3>
<h3 className="card-title">{t("Proxmox link")}</h3>
{!server.proxmoxIntegrationId && (
<div className="card-actions">
<button className="btn btn-link btn-sm p-0" onClick={() => toggleHideProxmoxLink(true)}>
Not a VM? Hide this
{t("Not a VM? Hide this")}
</button>
</div>
)}
@@ -996,19 +997,19 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
{server.proxmoxIntegrationId ? (
<div className="d-flex align-items-center gap-3">
<span className="text-secondary">
Linked to {hardware.integrationName ?? "a Proxmox integration"} — {server.proxmoxGuestType}/{server.proxmoxVmid} on{" "}
{t("Linked to")} {hardware.integrationName ?? "a Proxmox integration"} — {server.proxmoxGuestType}/{server.proxmoxVmid} on{" "}
{server.proxmoxNode}
</span>
<button className="btn btn-outline-danger btn-sm ms-auto" onClick={unlinkProxmox} disabled={linking}>
Unlink
{t("Unlink")}
</button>
</div>
) : (proxmoxIntegrations?.length ?? 0) === 0 ? (
<div className="text-secondary">No enabled Proxmox integrations configured yet.</div>
<div className="text-secondary">{t("No enabled Proxmox integrations configured yet.")}</div>
) : (
<div className="row g-2 align-items-end">
<div className="col-md-4">
<label className="form-label">Proxmox integration</label>
<label className="form-label">{t("Proxmox integration")}</label>
<select
className="form-select"
value={pickedIntegrationId ?? ""}
@@ -1017,7 +1018,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
setPickedGuestKey("");
}}
>
<option value="">Choose…</option>
<option value="">{t("Choose…")}</option>
{proxmoxIntegrations?.map((i) => (
<option key={i.id} value={i.id}>
{i.name}
@@ -1033,7 +1034,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
disabled={!proxmoxGuests}
onChange={(e) => setPickedGuestKey(e.target.value)}
>
<option value="">Choose…</option>
<option value="">{t("Choose…")}</option>
{proxmoxGuests?.map((g) => (
<option key={`${g.node}/${g.type}/${g.vmid}`} value={`${g.node}/${g.type}/${g.vmid}`}>
{g.name} ({g.type} #{g.vmid} on {g.node})
@@ -1043,7 +1044,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-3">
<button className="btn btn-primary w-100" onClick={linkProxmox} disabled={linking || !pickedGuestKey}>
{linking ? "Linking…" : "Link"}
{linking ? t("Linking…") : t("Link")}
</button>
</div>
{linkError && (
+56 -55
View File
@@ -27,6 +27,7 @@ import BulkBar from "../components/BulkBar";
import { RunsOnBulkDrawer, SilenceBulkDrawer, TagBulkDrawer } from "../components/BulkDrawers";
import { doBulk, plural } from "../utils/bulk";
import { BrandTag } from "../components/BrandIcon";
import { t } from "../i18n";
export default function Servers({ user }: { user: CurrentUser }) {
@@ -135,10 +136,10 @@ export default function Servers({ user }: { user: CurrentUser }) {
}
async function deleteServer(id: number) {
if (!(await confirmDialog({ title: "Remove server", message: "Remove this server and all its tracked tasks?", confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove server"), message: "Remove this server and all its tracked tasks?", confirmLabel: "Remove", danger: true }))) return;
try {
await api.servers.remove(id);
toast.success("Server removed.");
toast.success(t("Server removed."));
await loadServers();
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
@@ -233,14 +234,14 @@ export default function Servers({ user }: { user: CurrentUser }) {
<BrandTag kind="proxmox" custom={integrationColors.proxmox} />
) : s.lastSeenAt ? (
agentState(s, agentLatest) === "behind" ? (
<span className="badge bg-yellow-lt text-yellow" title="Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.">
Agent behind
<span className="badge bg-yellow-lt text-yellow" title={t("Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.")}>
{t("Agent behind")}
</span>
) : (
<span className="badge bg-green-lt text-green">Agent</span>
<span className="badge bg-green-lt text-green">{t("Agent")}</span>
)
) : (
<span className="badge bg-secondary-lt text-secondary">No data</span>
<span className="badge bg-secondary-lt text-secondary">{t("No data")}</span>
)}
</div>
{s.tags.length > 0 && (
@@ -249,7 +250,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
</div>
)}
<div className="text-secondary small mt-2">
{s.lastSeenAt ? <>Last seen <TimeAgo value={s.lastSeenAt} /></> : "Never reported"}
{s.lastSeenAt ? <>{t("Last seen")} <TimeAgo value={s.lastSeenAt} /></> : t("Never reported")}
</div>
<div className="mt-2">
<UptimeRibbon kind="servers" id={s.id} name={s.name} />
@@ -275,10 +276,10 @@ export default function Servers({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Servers</h2>
<h2 className="page-title mb-0">{t("Servers")}</h2>
{isAdmin && (
<button className="btn btn-outline-secondary ms-auto" onClick={() => setManagingServers((v) => !v)}>
{managingServers ? "Back to servers" : "Manage servers"}
{managingServers ? t("Back to servers") : t("Manage servers")}
</button>
)}
</div>
@@ -289,7 +290,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
<div className="card-body py-2">
<label className="form-check form-switch mb-0">
<input className="form-check-input" type="checkbox" checked={autoUpdate} onChange={(e) => void changeAutoUpdate(e.target.checked)} />
<span className="form-check-label">Update agents automatically</span>
<span className="form-check-label">{t("Update agents automatically")}</span>
</label>
<div className="text-secondary small mt-1">
An agent that is behind this app downloads the newer script from here, checks it against a checksum the server gives, and replaces itself at its next run. Off by default. An agent needs the
@@ -303,12 +304,12 @@ export default function Servers({ user }: { user: CurrentUser }) {
<>
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Add a server</h3>
<h3 className="card-title">{t("Add a server")}</h3>
</div>
<form onSubmit={createServer}>
<div className="card-body row g-3">
<div className="col-md-3">
<label className="form-label">Server name</label>
<label className="form-label">{t("Server name")}</label>
<input
className="form-control"
required
@@ -318,14 +319,14 @@ export default function Servers({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-2">
<label className="form-label">Operating system</label>
<label className="form-label">{t("Operating system")}</label>
<select className="form-select" value={serverOs} onChange={(e) => setServerOs(e.target.value as AgentOs)}>
<option value="linux">Linux</option>
<option value="windows">Windows</option>
</select>
</div>
<div className="col-md-3">
<label className="form-label">Hostname</label>
<label className="form-label">{t("Hostname")}</label>
<input
className="form-control"
placeholder="optional"
@@ -334,7 +335,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
/>
</div>
<div className="col-md-4">
<label className="form-label">Description</label>
<label className="form-label">{t("Description")}</label>
<input
className="form-control"
placeholder="optional"
@@ -345,7 +346,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer">
<button type="submit" className="btn btn-primary">
Add server
{t("Add server")}
</button>
</div>
</form>
@@ -354,10 +355,10 @@ export default function Servers({ user }: { user: CurrentUser }) {
{newToken && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Agent token for {newToken.server.name}</h3>
<h3 className="card-title">{t("Agent token for")} {newToken.server.name}</h3>
</div>
<div className="card-body">
<p className="text-secondary">This token is only shown once — copy it now.</p>
<p className="text-secondary">{t("This token is only shown once — copy it now.")}</p>
<div className="input-group mb-3">
<code className="form-control">{newToken.token}</code>
<CopyButton text={newToken.token} />
@@ -370,7 +371,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
onChange={(e) => setInsecureAgent(e.target.checked)}
/>
<span className="form-check-label">
This Homelab Manager instance uses a self-signed certificate (skip TLS verification on the agent)
{t("This Homelab Manager instance uses a self-signed certificate (skip TLS verification on the agent)")}
</span>
</label>
<p className="text-secondary">{AGENT_RUN_HINT[agentOsOf(newToken.server.osType)].install}</p>
@@ -389,7 +390,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer">
<button className="btn" onClick={() => setNewToken(null)}>
Dismiss
{t("Dismiss")}
</button>
</div>
</div>
@@ -398,7 +399,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
{uninstallFor && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Uninstall agent from {uninstallFor.name}</h3>
<h3 className="card-title">{t("Uninstall agent from")} {uninstallFor.name}</h3>
</div>
<div className="card-body">
<p className="text-secondary">{AGENT_RUN_HINT[agentOsOf(uninstallFor.osType)].uninstall}</p>
@@ -411,7 +412,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer">
<button className="btn" onClick={() => setUninstallFor(null)}>
Dismiss
{t("Dismiss")}
</button>
</div>
</div>
@@ -421,32 +422,32 @@ export default function Servers({ user }: { user: CurrentUser }) {
<div className="card-header">
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} />
<button className="btn btn-outline-secondary btn-sm ms-auto" onClick={exportCsv} disabled={servers.length === 0}>
Export CSV
{t("Export CSV")}
</button>
</div>
<div className="table-responsive">
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<ServerRecord> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<ServerRecord> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<ServerRecord>
label="Hostname"
label={t("Hostname")}
sortKeyName="hostname"
activeKey={sortKey}
direction={sortDir}
onSort={requestSort}
/>
<th>Tags</th>
<th>Token</th>
<th>{t("Tags")}</th>
<th>{t("Token")}</th>
<SortableTh<ServerRecord>
label="Last seen"
label={t("Last seen")}
sortKeyName="lastSeenAt"
activeKey={sortKey}
direction={sortDir}
onSort={requestSort}
/>
<th>Last 30 days</th>
<th className="w-1">Actions</th>
<th>{t("Last 30 days")}</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -455,7 +456,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
<td>
<Link to={`/servers/${s.id}`}>{s.name}</Link>
{agentState(s, agentLatest) === "behind" && (
<span className="badge bg-yellow-lt text-yellow ms-2" title="Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.">
<span className="badge bg-yellow-lt text-yellow ms-2" title={t("Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.")}>
agent behind
</span>
)}
@@ -474,13 +475,13 @@ export default function Servers({ user }: { user: CurrentUser }) {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" onClick={() => rotateToken(s.id)}>
Rotate token
{t("Rotate token")}
</button>
<button className="btn btn-sm" onClick={() => setUninstallFor(s)}>
Uninstall
{t("Uninstall")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => deleteServer(s.id)}>
Delete
{t("Delete")}
</button>
</div>
</td>
@@ -488,7 +489,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
))}
{!loaded && <LoadingRow colSpan={7} />}
{loaded && sortedServers?.length === 0 && (
<EmptyRow colSpan={7} title="No servers yet" hint="Add a server with the form above and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<EmptyRow colSpan={7} title={t("No servers yet")} hint={t("Add a server with the form above and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates.")} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
)}
</tbody>
</table>
@@ -505,24 +506,24 @@ export default function Servers({ user }: { user: CurrentUser }) {
) : servers.length === 0 ? (
<div className="card">
<EmptyState
title="No servers yet"
hint="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."
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}
/>
</div>
) : (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} placeholder="Search servers…" />
<div className="btn-group btn-group-sm" role="group" aria-label="Show servers that are">
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} placeholder={t("Search servers…")} />
<div className="btn-group btn-group-sm" role="group" aria-label={t("Show servers that are")}>
<button type="button" className={`btn btn-sm ${status === null ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={status === null} onClick={() => setStatus(null)}>
All
{t("All")}
</button>
<button type="button" className={`btn btn-sm ${status === "offline" ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={status === "offline"} onClick={() => setStatus("offline")}>
Not reporting{offlineIds ? ` (${offlineCount})` : ""}
{t("Not reporting")}{offlineIds ? ` (${offlineCount})` : ""}
</button>
<button type="button" className={`btn btn-sm ${status === "online" ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={status === "online"} onClick={() => setStatus("online")}>
Reporting{offlineIds ? ` (${onlineCount})` : ""}
{t("Reporting")}{offlineIds ? ` (${onlineCount})` : ""}
</button>
</div>
<div className="ms-auto d-flex flex-wrap gap-2">
@@ -540,7 +541,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
}
}}
>
Compare
{t("Compare")}
</button>
)}
{canChange && (
@@ -556,7 +557,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
}
}}
>
Select
{t("Select")}
</button>
)}
</div>
@@ -569,35 +570,35 @@ export default function Servers({ user }: { user: CurrentUser }) {
<div className="ms-auto d-flex gap-2">
{picked.length >= 2 ? (
<Link to={`/servers/compare?ids=${picked.join(",")}`} className="btn btn-sm btn-primary">
Compare {picked.length} servers
{t("Compare")} {picked.length} servers
</Link>
) : (
<button type="button" className="btn btn-sm btn-primary" disabled>
Compare
{t("Compare")}
</button>
)}
<button type="button" className="btn btn-sm" onClick={stopComparing}>
Cancel
{t("Cancel")}
</button>
</div>
</div>
)}
{selecting && (
<div className="alert alert-info d-flex flex-wrap align-items-center gap-2" role="status">
<span>Pick the servers to change together, then choose what to do from the bar at the foot of the page. {chosenIds.length} picked.</span>
<span>{t("Pick the servers to change together, then choose what to do from the bar at the foot of the page.")} {chosenIds.length} picked.</span>
<div className="ms-auto d-flex gap-2">
<button type="button" className="btn btn-sm" onClick={() => setChosen(new Set(visibleServers.map((s) => s.id)))} disabled={visibleServers.length === 0}>
Pick all {visibleServers.length} shown
{t("Pick all {n} shown", { n: visibleServers.length })}
</button>
<button type="button" className="btn btn-sm" onClick={stopSelecting}>
Done
{t("Done")}
</button>
</div>
</div>
)}
{allTags.length > 0 && (
<div className="d-flex flex-wrap align-items-center gap-1 mb-3">
<span className="text-secondary small me-1">Tags</span>
<span className="text-secondary small me-1">{t("Tags")}</span>
{allTags.map((tag) => {
const active = selectedTags.includes(tag);
const look = tagBadge(tag, tagColors);
@@ -616,7 +617,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
})}
{selectedTags.length > 0 && (
<button type="button" className="btn btn-link btn-sm p-0 ms-1" onClick={() => changeParams((next) => next.delete("tag"))}>
Clear
{t("Clear")}
</button>
)}
</div>
@@ -667,14 +668,14 @@ export default function Servers({ user }: { user: CurrentUser }) {
<div className="has-bulk-bar" />
<BulkBar count={chosenIds.length} noun={chosenIds.length === 1 ? "server" : "servers"} onClear={() => setChosen(new Set())}>
<button type="button" className="btn btn-sm btn-primary" onClick={() => setBulkForm("tag")}>
Tag…
{t("Tag…")}
</button>
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("silence")}>
Silence…
{t("Silence…")}
</button>
{isAdmin && (
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("runson")}>
Runs on…
{t("Runs on…")}
</button>
)}
</BulkBar>
+5 -4
View File
@@ -7,6 +7,7 @@ import { BlockSkeleton } from "../components/Skeleton";
import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { t } from "../i18n";
const SUBJECT_WORDS: Record<ServiceLevelSubject, string> = { endpoint: "Endpoint check", server: "Server", integration: "Integration" };
const SUBJECT_HINTS: Record<ServiceLevelSubject, string> = {
@@ -61,10 +62,10 @@ function Card({ level: l, isAdmin, onEdit, onRemove }: { level: ServiceLevel; is
{isAdmin && (
<div className="card-actions btn-list flex-nowrap">
<button className="btn btn-sm btn-outline-secondary" onClick={onEdit}>
Edit
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={onRemove}>
Remove
{t("Remove")}
</button>
</div>
)}
@@ -207,7 +208,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
<div className="card-body row g-3">
<div className="col-md-4">
<label className="form-label" htmlFor="sl-name">
Name
{t("Name")}
</label>
<input id="sl-name" className="form-control" required maxLength={100} placeholder="e.g. Gitea answers" value={draft.name} onChange={(e) => set("name", e.target.value)} />
</div>
@@ -266,7 +267,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
{busy ? "Saving…" : "Save"}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
+6 -5
View File
@@ -1,6 +1,7 @@
import { useMemo, useState, type CSSProperties } from "react";
import { Link, NavLink, Outlet } from "react-router-dom";
import { searchSettings } from "../utils/settingsIndex";
import { t } from "../i18n";
const SUB_NAV = [
{ to: "/settings/notifications", label: "Notifications" },
@@ -22,16 +23,16 @@ function SettingsSearch() {
<input
type="search"
className="form-control"
placeholder="Find a setting…"
aria-label="Find a setting"
placeholder={t("Find a setting…")}
aria-label={t("Find a setting")}
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => e.key === "Escape" && setQuery("")}
/>
{query.trim() !== "" && (
<div className="list-group position-absolute w-100 shadow" style={{ zIndex: 20, top: "100%" }} role="listbox" aria-label="Matching settings">
<div className="list-group position-absolute w-100 shadow" style={{ zIndex: 20, top: "100%" }} role="listbox" aria-label={t("Matching settings")}>
{results.length === 0 ? (
<div className="list-group-item text-secondary">No setting matches that.</div>
<div className="list-group-item text-secondary">{t("No setting matches that.")}</div>
) : (
results.map((r) => (
<Link key={r.title + r.to} to={r.to} className="list-group-item list-group-item-action" role="option" aria-selected={false} onClick={() => setQuery("")}>
@@ -49,7 +50,7 @@ function SettingsSearch() {
export default function Settings() {
return (
<>
<h2 className="page-title mb-3">Settings</h2>
<h2 className="page-title mb-3">{t("Settings")}</h2>
<SettingsSearch />
<div className="row">
<div className="col-12 col-md-3 col-lg-2 mb-3 mb-md-0">
+6 -5
View File
@@ -11,13 +11,14 @@ import { ErrorNotice } from "../components/Notice";
import { useChartRange } from "../utils/chartRanges";
import { readableError } from "../utils/errors";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (s.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (s.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">{t("In order")}</span>;
}
/** Bits per second as the line is sold: decimal megabits. */
@@ -133,7 +134,7 @@ function Card({ s, canRead, onRead }: { s: SpeedtestInfo; canRead: boolean; onRe
) : null}
{dl === null && ul === null ? (
<>
Tell the integration what you pay for (<em>download you pay for</em>, <em>upload you pay for</em> under <Link to={`/integrations?editId=${s.id}`}>Integrations</Link>) and a slow line becomes an alert; until then only failing tests are.
Tell the integration what you pay for (<em>download you pay for</em>, <em>upload you pay for</em> under <Link to={`/integrations?editId=${s.id}`}>{t("Integrations")}</Link>) and a slow line becomes an alert; until then only failing tests are.
</>
) : (
<>An alert is raised when the middle of the last three is under {s.expected.minPercent}% of what you pay for.</>
@@ -170,7 +171,7 @@ 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">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">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>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} />}
+8 -7
View File
@@ -16,10 +16,11 @@ import { downloadCsv } from "../utils/csv";
import IntegrationPageTitle from "../components/IntegrationPageTitle";
import { ErrorNotice } from "../components/Notice";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
function healthBadge(status: string) {
return status === "normal" ? (
<span className="badge bg-green-lt text-green">Normal</span>
<span className="badge bg-green-lt text-green">{t("Normal")}</span>
) : (
<span className="badge bg-red-lt text-red">{status}</span>
);
@@ -195,7 +196,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
) : (
<div className="row g-3">
<div className="col-6 col-md-3">
<div className="text-secondary">Hostname</div>
<div className="text-secondary">{t("Hostname")}</div>
<div>{system?.hostname ?? "—"}</div>
</div>
<div className="col-6 col-md-3">
@@ -207,7 +208,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
<div>{formatUptime(system?.uptime ?? null)}</div>
</div>
<div className="col-6 col-md-3">
<div className="text-secondary">IP addresses</div>
<div className="text-secondary">{t("IP addresses")}</div>
<div>{system?.ipAddresses.length ? system.ipAddresses.join(", ") : "—"}</div>
</div>
<div className="col-6 col-md-3">
@@ -254,7 +255,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
onClick={exportVolumesCsv}
disabled={!sortedVolumes || sortedVolumes.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -285,7 +286,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
onSort={requestVolumeSort}
/>
<SortableTh<SynologyVolume>
label="Status"
label={t("Status")}
sortKeyName="status"
activeKey={volumeSortKey}
direction={volumeSortDir}
@@ -325,7 +326,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
onClick={exportDisksCsv}
disabled={!sortedDisks || sortedDisks.length === 0}
>
Export CSV
{t("Export CSV")}
</button>
</div>
</div>
@@ -356,7 +357,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
onSort={requestDiskSort}
/>
<SortableTh<SynologyDisk>
label="Status"
label={t("Status")}
sortKeyName="status"
activeKey={diskSortKey}
direction={diskSortDir}
+9 -8
View File
@@ -23,6 +23,7 @@ import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
const KEY_EXPIRY_WARN_DAYS = 30;
@@ -220,7 +221,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
<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}>
Export CSV
{t("Export CSV")}
</button>
<button
className="btn btn-sm btn-outline-secondary"
@@ -241,7 +242,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
Deauthorize
</button>
<button className="btn btn-sm btn-outline-danger" onClick={bulkRemove} disabled={bulkActing}>
Remove
{t("Remove")}
</button>
<button className="btn btn-sm btn-link" onClick={selection.clear}>
Clear selection
@@ -271,9 +272,9 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
onSort={requestSort}
/>
<SortableTh<TailscaleDevice> label="OS" sortKeyName="os" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<TailscaleDevice> label="Status" sortKeyName="online" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<TailscaleDevice> label={t("Status")} sortKeyName="online" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<TailscaleDevice>
label="Last seen"
label={t("Last seen")}
sortKeyName="lastSeen"
activeKey={sortKey}
direction={sortDir}
@@ -286,7 +287,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
direction={sortDir}
onSort={requestSort}
/>
{canEdit && <th className="w-1">Actions</th>}
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -310,9 +311,9 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
<td>{d.os || "—"}</td>
<td>
{d.online ? (
<span className="badge bg-green-lt text-green me-1">Online</span>
<span className="badge bg-green-lt text-green me-1">{t("Online")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary me-1">Offline</span>
<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>}
</td>
@@ -331,7 +332,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
</button>
)}
<button className="btn btn-sm btn-outline-danger" onClick={() => removeDevice(d)}>
Remove
{t("Remove")}
</button>
</div>
</td>
+9 -8
View File
@@ -10,14 +10,15 @@ import { formatAgo } from "../utils/duration";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
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.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</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&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
if (a.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">{t("In order")}</span>;
}
function Tile({ label, value, sub, tone }: { label: string; value: string; sub?: string | null; tone?: "bad" | "warn" }) {
@@ -89,7 +90,7 @@ function ClusterSection({ cluster }: { cluster: NonNullable<TechnitiumInstance["
<th>Role</th>
<th>State</th>
<th>Version</th>
<th>Last seen</th>
<th>{t("Last seen")}</th>
</tr>
</thead>
<tbody>
@@ -170,7 +171,7 @@ function Card({ a, canRead, onRead }: { a: TechnitiumInstance; canRead: boolean;
<>
<div className="row g-3 mb-3">
<Tile
label="DNS answers"
label={t("DNS answers")}
value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "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}
@@ -319,8 +320,8 @@ export default function TechnitiumDns({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">Technitium DNS</h2>
<PageIntro>
Read every two minutes (see <Link to="/integrations">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>,{" "}
<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">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.
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>,{" "}
<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} />
{!data && !error && <BlockSkeleton lines={4} />}
+45 -44
View File
@@ -12,6 +12,7 @@ import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { removeWithUndo } from "../utils/undoable";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
type Person = { id: number; name: string; role: string };
type Place = { type: "server" | "device"; id: number; name: string };
@@ -46,22 +47,22 @@ function JobForm({ initial, people, places, busy, submitLabel, onSubmit, onCance
<div className="row g-3">
<div className="col-12">
<label className="form-label" htmlFor="todo-title">
What is to be done
{t("What is to be done")}
</label>
<input id="todo-title" className="form-control" maxLength={160} required value={title} onChange={(e) => setTitle(e.target.value)} placeholder="e.g. Replace the UPS battery" autoFocus />
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="todo-due">
By <span className="text-secondary">(optional)</span>
By <span className="text-secondary">{t("(optional)")}</span>
</label>
<input id="todo-due" type="date" className="form-control" value={due} onChange={(e) => setDue(e.target.value)} />
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="todo-who">
For <span className="text-secondary">(optional)</span>
For <span className="text-secondary">{t("(optional)")}</span>
</label>
<select id="todo-who" className="form-select" value={who} onChange={(e) => setWho(e.target.value)}>
<option value="">Nobody in particular</option>
<option value="">{t("Nobody in particular")}</option>
{people.map((p) => (
<option key={p.id} value={p.id}>
{p.name}
@@ -71,11 +72,11 @@ function JobForm({ initial, people, places, busy, submitLabel, onSubmit, onCance
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="todo-about">
About <span className="text-secondary">(optional)</span>
{t("About")} <span className="text-secondary">{t("(optional)")}</span>
</label>
<select id="todo-about" className="form-select" value={about} onChange={(e) => setAbout(e.target.value)}>
<option value="">Nothing in particular</option>
<optgroup label="Servers">
<option value="">{t("Nothing in particular")}</option>
<optgroup label={t("Servers")}>
{places.filter((p) => p.type === "server").map((p) => (
<option key={`s${p.id}`} value={`server:${p.id}`}>
{p.name}
@@ -83,7 +84,7 @@ function JobForm({ initial, people, places, busy, submitLabel, onSubmit, onCance
))}
</optgroup>
{places.some((p) => p.type === "device") && (
<optgroup label="Network devices">
<optgroup label={t("Network devices")}>
{places.filter((p) => p.type === "device").map((p) => (
<option key={`d${p.id}`} value={`device:${p.id}`}>
{p.name}
@@ -95,7 +96,7 @@ function JobForm({ initial, people, places, busy, submitLabel, onSubmit, onCance
</div>
<div className="col-12">
<label className="form-label" htmlFor="todo-detail">
Details <span className="text-secondary">(optional)</span>
{t("Details")} <span className="text-secondary">{t("(optional)")}</span>
</label>
<textarea id="todo-detail" className="form-control" rows={3} maxLength={2000} value={detail} onChange={(e) => setDetail(e.target.value)} />
</div>
@@ -106,7 +107,7 @@ function JobForm({ initial, people, places, busy, submitLabel, onSubmit, onCance
</button>
{onCancel && (
<button type="button" className="btn" onClick={onCancel}>
Cancel
{t("Cancel")}
</button>
)}
</div>
@@ -157,7 +158,7 @@ export default function Todo({ user }: { user: CurrentUser }) {
setError(null);
try {
await api.todos.create(v);
toast.success("Added.");
toast.success(t("Added."));
load();
} catch (err) {
setError(readableError(err));
@@ -166,12 +167,12 @@ export default function Todo({ user }: { user: CurrentUser }) {
}
}
async function save(t: TodoItem, v: TodoInput) {
async function save(todo: TodoItem, v: TodoInput) {
setBusy(true);
try {
await api.todos.update(t.id, v);
await api.todos.update(todo.id, v);
setEditing(null);
toast.success("Saved.");
toast.success(t("Saved."));
load();
} catch (err) {
toast.error(readableError(err));
@@ -180,15 +181,15 @@ export default function Todo({ user }: { user: CurrentUser }) {
}
}
async function tick(t: TodoItem, finished: boolean) {
async function tick(todo: TodoItem, finished: boolean) {
try {
await api.todos.update(t.id, { done: finished });
await api.todos.update(todo.id, { done: finished });
if (finished) {
toast.success(`Done: ${t.title}`, {
toast.success(`Done: ${todo.title}`, {
label: "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 {
@@ -203,39 +204,39 @@ export default function Todo({ user }: { user: CurrentUser }) {
}
}
async function remove(t: TodoItem) {
async function remove(todo: TodoItem) {
setEditing(null);
await removeWithUndo({
remove: () => api.todos.remove(t.id),
restore: () => api.todos.create({ title: t.title, detail: t.detail, dueDate: t.dueDate, assigneeId: t.assignee?.id ?? null, targetType: t.target?.type ?? null, targetId: t.target?.id ?? null }).then((r) => (t.doneAt ? api.todos.update(r.todo.id, { done: true }) : r)),
message: `Removed "${t.title}".`,
remove: () => api.todos.remove(todo.id),
restore: () => api.todos.create({ title: todo.title, detail: todo.detail, dueDate: todo.dueDate, assigneeId: todo.assignee?.id ?? null, targetType: todo.target?.type ?? null, targetId: todo.target?.id ?? null }).then((r) => (todo.doneAt ? api.todos.update(r.todo.id, { done: true }) : r)),
message: `Removed "${todo.title}".`,
reload: load,
});
}
const row = (t: TodoItem) => {
const due = dueWords(t);
const row = (todo: TodoItem) => {
const due = dueWords(todo);
return (
<li key={t.id} className="list-group-item d-flex gap-3 align-items-start">
<input type="checkbox" className="form-check-input mt-1" aria-label={t.doneAt ? `Bring back: ${t.title}` : `Done: ${t.title}`} checked={!!t.doneAt} disabled={!canEdit} onChange={() => void tick(t, !t.doneAt)} />
<li key={todo.id} className="list-group-item d-flex gap-3 align-items-start">
<input type="checkbox" className="form-check-input mt-1" aria-label={todo.doneAt ? `Bring back: ${todo.title}` : `Done: ${todo.title}`} checked={!!todo.doneAt} disabled={!canEdit} onChange={() => void tick(todo, !todo.doneAt)} />
<div className="me-auto">
<div className={t.doneAt ? "text-decoration-line-through text-secondary" : "fw-bold"}>{t.title}</div>
{t.detail && <div className="text-secondary small" style={{ whiteSpace: "pre-wrap" }}>{t.detail}</div>}
<div className={todo.doneAt ? "text-decoration-line-through text-secondary" : "fw-bold"}>{todo.title}</div>
{todo.detail && <div className="text-secondary small" style={{ whiteSpace: "pre-wrap" }}>{todo.detail}</div>}
<div className="small d-flex flex-wrap gap-2 mt-1">
{due && <span className={due.className}>{due.text}</span>}
{t.assignee && <span className="badge bg-blue-lt text-blue">{t.assignee.name}</span>}
{t.target && <Link to={t.target.type === "server" ? `/servers/${t.target.id}` : "/network/devices"}>{t.target.name}</Link>}
{t.doneAt && (
{todo.assignee && <span className="badge bg-blue-lt text-blue">{todo.assignee.name}</span>}
{todo.target && <Link to={todo.target.type === "server" ? `/servers/${todo.target.id}` : "/network/devices"}>{todo.target.name}</Link>}
{todo.doneAt && (
<span className="text-secondary">
done <TimeAgo value={t.doneAt} />
{t.doneBy ? ` by ${t.doneBy}` : ""}
done <TimeAgo value={todo.doneAt} />
{todo.doneBy ? ` by ${todo.doneBy}` : ""}
</span>
)}
</div>
</div>
{canEdit && (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setEditing(t)}>
Edit
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setEditing(todo)}>
{t("Edit")}
</button>
)}
</li>
@@ -245,25 +246,25 @@ export default function Todo({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">To do</h2>
<div className="ms-auto btn-group btn-group-sm" role="group" aria-label="Whose jobs">
<h2 className="page-title mb-0">{t("To do")}</h2>
<div className="ms-auto btn-group btn-group-sm" role="group" aria-label={t("Whose jobs")}>
<button type="button" className={`btn ${!mineOnly ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={!mineOnly} onClick={() => setParams({})}>
Everyone&rsquo;s
</button>
<button type="button" className={`btn ${mineOnly ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={mineOnly} onClick={() => setParams({ who: "me" })}>
Handed to me
{t("Handed to me")}
</button>
</div>
</div>
<PageIntro>
The small jobs: replace the battery, move the NAS to the new switch. A job with a day is in <Link to="/coming-up?kinds=todo">Coming up</Link>; one handed to somebody is in their <Link to="/my-work">My work</Link>.
The small jobs: replace the battery, move the NAS to the new switch. A job with a day is in <Link to="/coming-up?kinds=todo">{t("Coming up")}</Link>; one handed to somebody is in their <Link to="/my-work">{t("My work")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
{canEdit && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Add a job</h3>
<h3 className="card-title">{t("Add a job")}</h3>
</div>
<div className="card-body">
<JobForm key={list?.length ?? 0} initial={{ title: "" }} people={people} places={places} busy={busy} submitLabel="Add" onSubmit={(v) => void create(v)} />
@@ -274,7 +275,7 @@ export default function Todo({ user }: { user: CurrentUser }) {
{list === null && !error && <BlockSkeleton lines={3} />}
{list !== null && open.length === 0 && (
<div className="card mb-3">
<EmptyState title={mineOnly ? "Nothing is handed to you" : "Nothing to do"} hint={canEdit ? "Add a job above, and give it a day if it has one." : "Nothing has been written down."} />
<EmptyState title={mineOnly ? t("Nothing is handed to you") : t("Nothing to do")} hint={canEdit ? t("Add a job above, and give it a day if it has one.") : t("Nothing has been written down.")} />
</div>
)}
{open.length > 0 && (
@@ -291,7 +292,7 @@ export default function Todo({ user }: { user: CurrentUser }) {
<h3 className="card-title">Done ({done.length})</h3>
<div className="card-actions">
<button type="button" className="btn btn-sm" onClick={() => setShowDone((v) => !v)}>
{showDone ? "Hide" : "Show"}
{showDone ? t("Hide") : t("Show")}
</button>
</div>
</div>
@@ -300,7 +301,7 @@ export default function Todo({ user }: { user: CurrentUser }) {
)}
{editing && (
<DetailDrawer title="Edit the job" subtitle={editing.title} onClose={() => setEditing(null)}>
<DetailDrawer title={t("Edit the job")} subtitle={editing.title} onClose={() => setEditing(null)}>
<JobForm
initial={{ title: editing.title, detail: editing.detail, dueDate: editing.dueDate, assigneeId: editing.assignee?.id ?? null, targetType: editing.target?.type ?? null, targetId: editing.target?.id ?? null }}
people={people}
@@ -312,7 +313,7 @@ export default function Todo({ user }: { user: CurrentUser }) {
/>
<hr />
<button type="button" className="btn btn-outline-danger" onClick={() => void remove(editing)}>
Remove it
{t("Remove it")}
</button>
</DetailDrawer>
)}
+38 -37
View File
@@ -18,6 +18,7 @@ import UpdateRunsCard from "../components/UpdateRunsCard";
import ViewTabs from "../components/ViewTabs";
import PatchPlans from "../components/PatchPlans";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
interface Row {
id: number;
@@ -60,10 +61,10 @@ const DAY_MS = 86_400_000;
*/
const updateTabs = (view: "waiting" | "plans") => (
<ViewTabs
label="Updates view"
label={t("Updates view")}
tabs={[
{ to: "/updates", label: "Waiting now", active: view === "waiting" },
{ to: "/updates?view=plans", label: "Patch plans", active: view === "plans" },
{ to: "/updates", label: t("Waiting now"), active: view === "waiting" },
{ to: "/updates?view=plans", label: t("Patch plans"), active: view === "plans" },
]}
/>
);
@@ -75,7 +76,7 @@ export default function Updates({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex align-items-center mb-2">
<h2 className="page-title mb-0">Updates</h2>
<h2 className="page-title mb-0">{t("Updates")}</h2>
</div>
{updateTabs("plans")}
<PatchPlans user={user} />
@@ -174,17 +175,17 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
}
const cards: { label: string; value: string | number; note?: string; color: string }[] = [
{ label: "Servers with updates waiting", value: servers ? `${waiting.length} of ${reporting}` : "…", note: notReporting > 0 ? `${notReporting} haven't reported updates` : undefined, color: waiting.length > 0 ? "text-yellow" : "text-green" },
{ label: "Security updates waiting", value: servers ? securityTotal : "…", color: securityTotal > 0 ? "text-red" : "text-green" },
{ label: "Need a restart", value: servers ? restarts : "…", color: restarts > 0 ? "text-orange" : "text-green" },
{ label: "Agents to update", value: servers ? behind : "…", note: behind > 0 ? "run their install command again" : undefined, color: behind > 0 ? "text-yellow" : "text-green" },
{ label: "Longest wait", value: oldest ? `${Math.max(1, Math.floor((Date.now() - Date.parse(oldest)) / DAY_MS))} d` : servers ? "—" : "…", color: "text-secondary" },
{ label: t("Servers with updates waiting"), value: servers ? t("{shown} of {total}", { shown: waiting.length, total: reporting }) : "…", note: notReporting > 0 ? t("{n} haven't reported updates", { n: notReporting }) : undefined, color: waiting.length > 0 ? "text-yellow" : "text-green" },
{ label: t("Security updates waiting"), value: servers ? securityTotal : "…", color: securityTotal > 0 ? "text-red" : "text-green" },
{ label: t("Need a restart"), value: servers ? restarts : "…", color: restarts > 0 ? "text-orange" : "text-green" },
{ label: t("Agents to update"), value: servers ? behind : "…", note: behind > 0 ? t("run their install command again") : undefined, color: behind > 0 ? "text-yellow" : "text-green" },
{ label: t("Longest wait"), value: oldest ? `${Math.max(1, Math.floor((Date.now() - Date.parse(oldest)) / DAY_MS))} d` : servers ? "—" : "…", color: "text-secondary" },
];
return (
<>
<div className="d-flex align-items-center mb-2">
<h2 className="page-title mb-0">Updates</h2>
<h2 className="page-title mb-0">{t("Updates")}</h2>
</div>
{tabs}
<p className="text-secondary">
@@ -212,11 +213,11 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<TableToolbar
search={tableSearch.query}
onSearch={tableSearch.setQuery}
placeholder="Search servers…"
placeholder={t("Search servers…")}
filters={
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={onlyWaiting} onChange={(e) => setOnlyWaiting(e.target.checked)} />
<span className="form-check-label">Only those with updates</span>
<span className="form-check-label">{t("Only those with updates")}</span>
</label>
}
shown={sorted?.length}
@@ -228,13 +229,13 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Row> label="Server" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Updates" sortKeyName="count" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Security" sortKeyName="security" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Waiting since" sortKeyName="since" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Reported" sortKeyName="reportedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Agent" sortKeyName="agentVersion" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{canRun && <th className="w-1">Actions</th>}
<SortableTh<Row> label={t("Server")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Updates")} sortKeyName="count" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Security")} sortKeyName="security" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Waiting since")} sortKeyName="since" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Reported")} sortKeyName="reportedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Agent")} sortKeyName="agentVersion" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{canRun && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
<tbody>
@@ -253,26 +254,26 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<td>
<UpdatesBadge updates={r.server.updates} />
</td>
<td className="stack-label" data-label="Security">{r.security === null ? <span className="text-secondary">—</span> : r.security}</td>
<td className="text-secondary stack-label" data-label="Waiting since">{r.since ? <TimeAgo value={r.since} /> : "—"}</td>
<td className="text-secondary stack-label" data-label="Reported">{r.reportedAt ? <TimeAgo value={r.reportedAt} /> : "—"}</td>
<td className="stack-label" data-label="Agent">
<td className="stack-label" data-label={t("Security")}>{r.security === null ? <span className="text-secondary">—</span> : r.security}</td>
<td className="text-secondary stack-label" data-label={t("Waiting since")}>{r.since ? <TimeAgo value={r.since} /> : "—"}</td>
<td className="text-secondary stack-label" data-label={t("Reported")}>{r.reportedAt ? <TimeAgo value={r.reportedAt} /> : "—"}</td>
<td className="stack-label" data-label={t("Agent")}>
{agentVersionWords(r.agentVersion)}{" "}
{agentState(r.server, agentLatest) === "behind" && (
<span className="badge bg-yellow-lt text-yellow" title="Older than the agent this Homelab Manager would install now.">
behind
<span className="badge bg-yellow-lt text-yellow" title={t("Older than the agent this Homelab Manager would install now.")}>
{t("behind")}
</span>
)}
</td>
{canRun && (
<td className="stack-wide">
<div className="btn-list flex-nowrap">
<button type="button" className="btn btn-sm btn-outline-primary" disabled={r.count === null || r.count === 0 || r.server.lastSeenAt === null} title={r.count ? "Apply this server's updates through a Semaphore playbook" : "Nothing is waiting, or the agent hasn't said"} onClick={() => setUpdating({ server: r.server, mode: "update" })}>
Update…
<button type="button" className="btn btn-sm btn-outline-primary" disabled={r.count === null || r.count === 0 || r.server.lastSeenAt === null} title={r.count ? t("Apply this server's updates through a Semaphore playbook") : t("Nothing is waiting, or the agent hasn't said")} onClick={() => setUpdating({ server: r.server, mode: "update" })}>
{t("Update…")}
</button>
{r.restart && (
<button type="button" className="btn btn-sm btn-outline-warning" disabled={r.server.lastSeenAt === null} title="This server says a restart is due: restart it through a Semaphore playbook" onClick={() => setUpdating({ server: r.server, mode: "restart" })}>
Restart…
<button type="button" className="btn btn-sm btn-outline-warning" disabled={r.server.lastSeenAt === null} title={t("This server says a restart is due: restart it through a Semaphore playbook")} onClick={() => setUpdating({ server: r.server, mode: "restart" })}>
{t("Restart…")}
</button>
)}
</div>
@@ -281,7 +282,7 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</tr>
))}
{servers !== null && sorted?.length === 0 && (
<EmptyRow colSpan={canRun ? 7 : 6} {...(tableSearch.active || onlyWaiting ? { filtered: () => { tableSearch.setQuery(""); setOnlyWaiting(false); } } : { title: "No server has reported yet", hint: "Waiting updates are read by each server's agent. Install or update the agent and its figures appear here.", action: { label: "Go to Servers", to: "/servers" } })} />
<EmptyRow colSpan={canRun ? 7 : 6} {...(tableSearch.active || onlyWaiting ? { filtered: () => { tableSearch.setQuery(""); setOnlyWaiting(false); } } : { title: t("No server has reported yet"), hint: t("Waiting updates are read by each server's agent. Install or update the agent and its figures appear here."), action: { label: t("Go to Servers"), to: "/servers" } })} />
)}
</tbody>
</table>
@@ -296,7 +297,7 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
{containers !== null && (
<div className="card">
<div className="card-header">
<h3 className="card-title">Docker containers with a newer image</h3>
<h3 className="card-title">{t("Docker containers with a newer image")}</h3>
<div className="card-actions">
<ExportTableButton filename="docker-newer-images" />
</div>
@@ -305,11 +306,11 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Container</th>
<th>Image</th>
<th>Newer version</th>
<th>Where</th>
<th>Checked</th>
<th>{t("Container")}</th>
<th>{t("Image")}</th>
<th>{t("Newer version")}</th>
<th>{t("Where")}</th>
<th>{t("Checked")}</th>
</tr>
</thead>
<tbody>
@@ -329,7 +330,7 @@ function WaitingNow({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
{containers.length === 0 && (
<tr>
<td colSpan={5} className="text-secondary text-center">
Every container is on its latest image, as far as the last check could tell.
{t("Every container is on its latest image, as far as the last check could tell.")}
</td>
</tr>
)}
+4 -3
View File
@@ -10,6 +10,7 @@ import { ErrorNotice } from "../components/Notice";
import { useChartRange } from "../utils/chartRanges";
import { readableError } from "../utils/errors";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const minutes = (seconds: number) => {
const m = Math.max(0, Math.round(seconds / 60));
@@ -19,7 +20,7 @@ const lasting = (fromIso: string, toIso: string) => minutes((Date.parse(toIso) -
function Badge({ u }: { u: UpsInfo }) {
const s = u.state;
if (!s) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
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&rsquo;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>;
@@ -82,7 +83,7 @@ function History({ id, name }: { id: number; name: string }) {
return (
<div>
<div className="d-flex align-items-center mb-2">
<h4 className="mb-0">History</h4>
<h4 className="mb-0">{t("History")}</h4>
<div className="ms-auto">
<RangeSelect value={shown} onChange={setDays} only={[1, 7, 30]} />
</div>
@@ -140,7 +141,7 @@ function UpsCard({ u }: { u: UpsInfo }) {
</h3>
{s && (s.model || s.manufacturer) && <div className="text-secondary small">{[s.manufacturer, s.model].filter(Boolean).join(" ")} · read over {u.protocol === "snmp" ? "SNMP" : "NUT"}</div>}
</div>
{!u.enabled && <span className="badge bg-secondary-lt text-secondary ms-auto">Switched off</span>}
{!u.enabled && <span className="badge bg-secondary-lt text-secondary ms-auto">{t("Switched off")}</span>}
</div>
<div className="card-body">
{u.status && !u.status.ok && (
+6 -5
View File
@@ -14,6 +14,7 @@ import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
import { t } from "../i18n";
function statusBadge(monitor: UptimeKumaMonitor) {
switch (monitor.status) {
@@ -24,7 +25,7 @@ function statusBadge(monitor: UptimeKumaMonitor) {
case "pending":
return <span className="badge bg-yellow-lt text-yellow">Pending</span>;
case "maintenance":
return <span className="badge bg-blue-lt text-blue">Maintenance</span>;
return <span className="badge bg-blue-lt text-blue">{t("Maintenance")}</span>;
default:
return <span className="badge bg-secondary-lt text-secondary">Unknown</span>;
}
@@ -149,7 +150,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
<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}>
Export CSV
{t("Export CSV")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={() => selected && loadMonitors(selected.id)} disabled={loading}>
{loading ? "Refreshing…" : "Refresh"}
@@ -161,9 +162,9 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
<thead>
<tr>
<SortableTh<UptimeKumaMonitor> label="Monitor" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<UptimeKumaMonitor> label="Target" sortKeyName="target" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>Server</th>
<SortableTh<UptimeKumaMonitor> label="Status" sortKeyName="status" 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"
sortKeyName="responseTimeMs"
+5 -4
View File
@@ -12,6 +12,7 @@ import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import Avatar from "../components/Avatar";
import { t } from "../i18n";
const ROLES: UserRole[] = ["viewer", "operator", "admin"];
@@ -32,7 +33,7 @@ export default function Users() {
return (
<>
<div className="d-flex align-items-center mb-2">
<h2 className="page-title mb-0">Users</h2>
<h2 className="page-title mb-0">{t("Users")}</h2>
</div>
{userTabs("sessions")}
<SessionsView />
@@ -89,9 +90,9 @@ function People({ tabs }: { tabs: ReactNode }) {
return (
<>
<div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Users</h2>
<h2 className="page-title mb-0">{t("Users")}</h2>
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
Export CSV
{t("Export CSV")}
</button>
</div>
{tabs}
@@ -110,7 +111,7 @@ function People({ tabs }: { tabs: ReactNode }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<UserRecord> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<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>
+4 -3
View File
@@ -8,6 +8,7 @@ import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
type Row = AppVersions["rows"][number];
@@ -70,9 +71,9 @@ export default function Versions({ user }: { user: CurrentUser }) {
const behind = rows.filter((r) => r.lag === "patch" || r.lag === "minor" || r.lag === "major").length;
return (
<>
<h2 className="page-title">App versions</h2>
<h2 className="page-title">{t("App versions")}</h2>
<PageIntro>
The version each connected application runs — as it was last read (see <Link to="/integrations">Integrations</Link>) — against the newest release of it. It looks the newest ones up on GitHub once a day; <strong>that is the only thing this app asks of an address that is not yours</strong>, so it is switched
The version each connected application runs — as it was last read (see <Link to="/integrations">{t("Integrations")}</Link>) — against the newest release of it. It looks the newest ones up on GitHub once a day; <strong>that is the only thing this app asks of an address that is not yours</strong>, so it is switched
off until you switch it on. Proxmox, Synology and the rest, which have no release to compare with, are not listed.
</PageIntro>
<ErrorNotice error={error} />
@@ -110,7 +111,7 @@ export default function Versions({ user }: { user: CurrentUser }) {
)}
</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">Alerts</Link> only with a number of days above 0.
{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.
</div>
</div>
</div>
@@ -6,6 +6,7 @@ import { formatAgo } from "../../utils/duration";
import { readableError } from "../../utils/errors";
import { ErrorNotice, SuccessNotice } from "../../components/Notice";
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" },
@@ -149,7 +150,7 @@ export default function AlertTicketSettings() {
<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{" "}
<Link to="/integrations">Integrations</Link>.
<Link to="/integrations">{t("Integrations")}</Link>.
</div>
</div>
@@ -157,7 +158,7 @@ export default function AlertTicketSettings() {
<div className="col-md-6">
<label className="form-label">osTicket integration</label>
<select className="form-select" value={draft.integrationId ?? ""} onChange={(e) => set({ integrationId: e.target.value === "" ? null : Number(e.target.value) })}>
<option value="">Choose…</option>
<option value="">{t("Choose…")}</option>
{overview.integrations.map((i) => (
<option key={i.id} value={i.id} disabled={!i.ticketApiReady}>
{i.name}
@@ -217,7 +218,7 @@ export default function AlertTicketSettings() {
<div className="card-body">
<div className="row g-4">
<div className="col-md-6">
<div className="form-label">Severity</div>
<div className="form-label">{t("Severity")}</div>
{SEVERITIES.map((s) => (
<label className="form-check" key={s.value}>
<input type="checkbox" className="form-check-input" checked={draft.severities.includes(s.value)} onChange={() => set({ severities: toggle(draft.severities, s.value) })} />
@@ -231,7 +232,7 @@ export default function AlertTicketSettings() {
<div className="form-label">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">All kinds</span>
<span className="form-check-label">{t("All kinds")}</span>
</label>
{draft.categories.length > 0 && (
<div className="ms-3">
@@ -257,7 +258,7 @@ export default function AlertTicketSettings() {
<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">Many at once</label>
<label className="form-label">{t("Many at once")}</label>
<div className="input-group">
<span className="input-group-text">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)) })} />
+20 -19
View File
@@ -9,6 +9,7 @@ import { toast } from "../../utils/toast";
import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../../components/EmptyState";
import WebhookDeliveries from "./WebhookDeliveries";
import { t } from "../../i18n";
const EVENT_WORDS: Record<WebhookEventName, string> = {
"alert.opened": "A problem begins",
@@ -74,10 +75,10 @@ export default function ApiSettings() {
}
}
async function removeToken(t: MetricsToken) {
if (!(await confirmDialog({ title: "Remove metrics token", message: `Remove "${t.label}"? Whatever scrapes with it stops working at once.`, confirmLabel: "Remove", danger: true }))) return;
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;
try {
await api.metricsTokens.remove(t.id);
await api.metricsTokens.remove(item_.id);
load();
} catch (err) {
setError(readableError(err));
@@ -179,7 +180,7 @@ export default function ApiSettings() {
- targets: ["${window.location.host}"]`}
</pre>
<button className="btn btn-sm" onClick={() => setNewSecret(null)}>
Done
{t("Done")}
</button>
</div>
)}
@@ -193,25 +194,25 @@ export default function ApiSettings() {
<table className="table table-vcenter">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Made</th>
<th>Last used</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
{tokens?.map((t) => (
<tr key={t.id}>
{tokens?.map((item_) => (
<tr key={item_.id}>
<td>
{t.label} <span className="text-secondary small">{t.tokenPrefix}…</span>
{item_.label} <span className="text-secondary small">{item_.tokenPrefix}…</span>
</td>
<td className="text-secondary">
{t.createdBy ?? "—"}, <TimeAgo value={t.createdAt} fromDb />
{item_.createdBy ?? "—"}, <TimeAgo value={item_.createdAt} fromDb />
</td>
<td className="text-secondary">{t.lastUsedAt ? <TimeAgo value={t.lastUsedAt} /> : "Never"}</td>
<td className="text-secondary">{item_.lastUsedAt ? <TimeAgo value={item_.lastUsedAt} /> : "Never"}</td>
<td>
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeToken(t)}>
Remove
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeToken(item_)}>
{t("Remove")}
</button>
</td>
</tr>
@@ -248,7 +249,7 @@ export default function ApiSettings() {
<div className="row g-3">
<div className="col-md-4">
<label className="form-label" htmlFor="wh-label">
Name
{t("Name")}
</label>
<input id="wh-label" className="form-control" required maxLength={60} placeholder="Home Assistant" value={hookLabel} onChange={(e) => setHookLabel(e.target.value)} />
</div>
@@ -293,7 +294,7 @@ export default function ApiSettings() {
{busy ? "Adding…" : "Add"}
</button>
<button type="button" className="btn" onClick={() => setAdding(false)}>
Cancel
{t("Cancel")}
</button>
</div>
</form>
@@ -302,10 +303,10 @@ export default function ApiSettings() {
<table className="table table-vcenter">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Sends</th>
<th>Last</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -336,7 +337,7 @@ export default function ApiSettings() {
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm btn-outline-secondary" onClick={() => void testHook(h)}>
Test
{t("Test")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={() => setLogOf(h)}>
Sent
@@ -345,7 +346,7 @@ export default function ApiSettings() {
{h.enabled ? "Turn off" : "Turn on"}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeHook(h)}>
Remove
{t("Remove")}
</button>
</div>
</td>
+12 -11
View File
@@ -8,6 +8,7 @@ import { PAGE_KINDS, unusedPages } from "../../utils/navVisibility";
import { NAV, isGroup } from "../../layout/nav";
import { ErrorNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import { t } from "../../i18n";
const DATE_FORMAT_OPTIONS: { value: DateFormat; label: string; example: string }[] = [
{ value: "ymd", label: "Year-Month-Day", example: "2026-09-15" },
@@ -83,7 +84,7 @@ export default function DisplaySettings() {
{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 ? t("Saving…") : t("Save Settings")}
</button>
</div>
</div>
@@ -94,7 +95,7 @@ export default function DisplaySettings() {
<div className="col-md-7">
<div className="card h-100">
<div className="card-header">
<h3 className="card-title">Date &amp; time format</h3>
<h3 className="card-title">{t("Date & time format")}</h3>
</div>
<div className="card-body">
<p className="text-secondary">
@@ -103,7 +104,7 @@ export default function DisplaySettings() {
</p>
<div className="row g-3">
<div className="col-md-6">
<label className="form-label">Date format</label>
<label className="form-label">{t("Date format")}</label>
<select className="form-select" value={dateFormat} onChange={(e) => setDateFormatState(e.target.value as DateFormat)}>
{DATE_FORMAT_OPTIONS.map((opt) => (
<option key={opt.value} value={opt.value}>
@@ -135,14 +136,14 @@ export default function DisplaySettings() {
<div className="col-md-5">
<div className="card h-100">
<div className="card-header">
<h3 className="card-title">Table pagination</h3>
<h3 className="card-title">{t("Table pagination")}</h3>
</div>
<div className="card-body">
<p className="text-secondary">
How many rows a paginated table (Secrets, IP Addresses, DNS records, Servers, Audit Log, and each
integration's device/guest/repo/template list) shows per page.
</p>
<label className="form-label">Rows per page</label>
<label className="form-label">{t("Rows per page")}</label>
<input
type="number"
className="form-control"
@@ -151,7 +152,7 @@ export default function DisplaySettings() {
value={pageSize}
onChange={(e) => setPageSizeState(Number(e.target.value))}
/>
<div className="form-hint">Between 5 and 500.</div>
<div className="form-hint">{t("Between 5 and 500.")}</div>
</div>
</div>
</div>
@@ -172,12 +173,12 @@ export default function DisplaySettings() {
setMenuIconsState(e.target.checked);
}}
/>
<span className="form-check-label">Show an icon before each page in the menu</span>
<span className="form-hint d-block">The logo of the system for an integration&rsquo;s page, the page&rsquo;s own icon for the rest. Only for this browser, and it applies at once.</span>
<span className="form-check-label">{t("Show an icon before each page in the menu")}</span>
<span className="form-hint d-block">{t("The logo of the system for an integration’s page, the page’s own icon for the rest. Only for this browser, and it applies at once.")}</span>
</label>
<label className="form-check">
<input type="checkbox" className="form-check-input" checked={hideUnusedPages} onChange={(e) => setHideUnusedPages(e.target.checked)} />
<span className="form-check-label">Hide the pages of integrations I have not added</span>
<span className="form-check-label">{t("Hide the pages of integrations I have not added")}</span>
</label>
<div className="form-hint mt-1">
A page for something that is not in your homelab (Jellyfin, Gitea, n8n …) is left out of the menu, the command palette and the keyboard shortcuts until you add that integration under
@@ -186,10 +187,10 @@ export default function DisplaySettings() {
{wouldHide !== null && (
<div className="mt-3 small" aria-live="polite">
{wouldHide.length === 0 ? (
<span className="text-secondary">With what you have added, there is nothing to leave out.</span>
<span className="text-secondary">{t("With what you have added, there is nothing to leave out.")}</span>
) : (
<>
<span className="text-secondary">{hideUnusedPages ? "Left out now" : "Would leave out"} ({wouldHide.length}): </span>
<span className="text-secondary">{hideUnusedPages ? t("Left out now") : t("Would leave out")} ({wouldHide.length}): </span>
{wouldHide.join(", ")}
</>
)}
+2 -1
View File
@@ -6,6 +6,7 @@ import { readableError } from "../../utils/errors";
import { parseNames } from "../../utils/nameLists";
import { ErrorNotice, SuccessNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import { t } from "../../i18n";
/** One list as it's being edited. The names are kept as the text in the box, so typing stays natural. */
interface Draft {
@@ -362,7 +363,7 @@ export default function NameSettings() {
Replace this list
</button>
<button className="btn btn-link btn-sm" onClick={() => setPreview(null)}>
Cancel
{t("Cancel")}
</button>
</div>
</div>
@@ -25,6 +25,7 @@ import { ErrorNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import PushDevices from "../../components/PushDevices";
import RoutingEditor from "../../components/RoutingEditor";
import { t } from "../../i18n";
const TIMEZONES = [
"UTC",
@@ -743,7 +744,7 @@ export default function NotificationSettings() {
<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={0}>Normal</option>
<option value={0}>{t("Normal")}</option>
<option value={1}>High — ignores quiet hours</option>
<option value={2}>Emergency — repeats every minute for an hour, until acknowledged</option>
</select>
@@ -1182,7 +1183,7 @@ export default function NotificationSettings() {
</label>
<div className="row g-2 mb-2">
<div className="col-6">
<label className="form-label">Start</label>
<label className="form-label">{t("Start")}</label>
<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">
@@ -1225,7 +1226,7 @@ export default function NotificationSettings() {
<div className="card-body">
<p className="text-secondary">
One message a month with last month in numbers: how available the servers and endpoints were, the incidents and how long they took, updates applied (by hand and by patch plans),
restore tests, and what was renewed. The same report is on the <a href="/reports">Reports</a> page, to read and print. Quiet hours hold it like any other notification.
restore tests, and what was renewed. The same report is on the <a href="/reports">{t("Reports")}</a> page, to read and print. Quiet hours hold it like any other notification.
</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 }))} />
+7 -6
View File
@@ -11,6 +11,7 @@ import { readableError } from "../../utils/errors";
import { toast } from "../../utils/toast";
import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow } from "../../components/EmptyState";
import { t } from "../../i18n";
const LASTS: { days: number | null; label: string }[] = [
{ days: null, label: "Until I remove it" },
@@ -103,7 +104,7 @@ export default function ShareSettings() {
</div>
<div className="card-footer">
<button className="btn" onClick={() => setCreated(null)}>
Done
{t("Done")}
</button>
</div>
</div>
@@ -155,13 +156,13 @@ export default function ShareSettings() {
<>
<div className="col-md-6">
<label className="form-label" htmlFor="share-title">
Heading <span className="text-secondary">(optional)</span>
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)} />
</div>
<div className="col-md-6">
<label className="form-label" htmlFor="share-message">
Message <span className="text-secondary">(optional)</span>
Message <span className="text-secondary">{t("(optional)")}</span>
</label>
<input id="share-message" className="form-control" maxLength={300} placeholder="e.g. Movies are being updated tonight" value={message} onChange={(e) => setMessage(e.target.value)} />
</div>
@@ -206,12 +207,12 @@ export default function ShareSettings() {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Name</th>
<th>{t("Name")}</th>
<th>Shows</th>
<th>Made</th>
<th>Works until</th>
<th>Last opened</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
@@ -234,7 +235,7 @@ export default function ShareSettings() {
</button>
)}
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(l)}>
Remove
{t("Remove")}
</button>
</div>
</td>
+2 -1
View File
@@ -5,6 +5,7 @@ import TimeAgo from "../../components/TimeAgo";
import { ErrorNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import { readableError } from "../../utils/errors";
import { t } from "../../i18n";
export function formatBytes(bytes: number | null): string {
if (bytes === null) return "—";
@@ -116,7 +117,7 @@ export default function StorageSettings() {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Table</th>
<th>{t("Table")}</th>
<th className="text-end">Size</th>
<th className="text-end">Rows</th>
<th className="text-end">Added a day</th>
+37 -36
View File
@@ -6,6 +6,7 @@ import { confirmDialog, promptDialog } from "../../utils/dialogs";
import { ErrorNotice, SuccessNotice } from "../../components/Notice";
import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../../components/EmptyState";
import { t } from "../../i18n";
const DEFAULT_PICK = "#3b82f6";
@@ -63,37 +64,37 @@ export default function TagSettings() {
});
}
async function saveColor(t: TagEntry, color: string | null) {
if (await run(() => api.tags.setColor(t.name, color))) setDraft(t.name, null);
async function saveColor(item_: TagEntry, color: string | null) {
if (await run(() => api.tags.setColor(item_.name, color))) setDraft(item_.name, null);
}
async function rename(t: TagEntry) {
const input = await promptDialog({ title: "Rename tag", message: `Rename “${t.name}” to:`, defaultValue: t.name, confirmLabel: "Rename", required: true });
async function rename(item_: TagEntry) {
const input = await promptDialog({ title: "Rename tag", message: `Rename “${item_.name}” to:`, defaultValue: item_.name, confirmLabel: "Rename", required: true });
if (input === null) return;
const to = normalizeTagInput(input);
if (!to || to === t.name) return;
if (!to || to === item_.name) return;
const target = tags?.find((x) => x.name === to);
if (
target &&
!(await confirmDialog({
title: "Merge tags",
message: `“${to}” already exists. Merge “${t.name}” into it? Every server tagged “${t.name}” will get “${to}” instead.`,
message: `“${to}” already exists. Merge “${item_.name}” into it? Every server tagged “${item_.name}” will get “${to}” instead.`,
confirmLabel: "Merge",
}))
)
return;
await run(
() => api.tags.rename(t.name, to),
(res) => `${res.merged ? "Merged" : "Renamed"} “${t.name}” ${res.merged ? "into" : "to"} “${to}” — ${res.updatedServers} server${res.updatedServers === 1 ? "" : "s"} updated.`,
() => 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.`,
);
}
async function remove(t: TagEntry) {
const used = t.count > 0 ? ` It's on ${t.count} server${t.count === 1 ? "" : "s"} and will be removed from ${t.count === 1 ? "it" : "them"}.` : "";
if (!(await confirmDialog({ title: "Delete tag", message: `Delete the tag “${t.name}”?${used}`, confirmLabel: "Delete", danger: true }))) return;
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;
await run(
() => api.tags.remove(t.name),
(res) => `Deleted “${t.name}”${res.updatedServers > 0 ? ` and removed it from ${res.updatedServers} server${res.updatedServers === 1 ? "" : "s"}` : ""}.`,
() => api.tags.remove(item_.name),
(res) => `Deleted “${item_.name}”${res.updatedServers > 0 ? ` and removed it from ${res.updatedServers} server${res.updatedServers === 1 ? "" : "s"}` : ""}.`,
);
}
@@ -156,24 +157,24 @@ export default function TagSettings() {
<thead>
<tr>
<th>Tag</th>
<th>Servers</th>
<th>{t("Servers")}</th>
<th>Colour</th>
<th className="w-1">Actions</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
<tbody>
{tags?.map((t) => {
const draft = drafts[t.name];
const shown = draft ?? t.color;
const badge = tagBadge(t.name, shown ? { [t.name]: shown } : {});
{tags?.map((item_) => {
const draft = drafts[item_.name];
const shown = draft ?? item_.color;
const badge = tagBadge(item_.name, shown ? { [item_.name]: shown } : {});
return (
<tr key={t.name}>
<tr key={item_.name}>
<td>
<span className={badge.className} style={badge.style}>
{t.name}
{item_.name}
</span>
</td>
<td className="text-secondary">{t.count === 0 ? "not used yet" : t.count}</td>
<td className="text-secondary">{item_.count === 0 ? "not used yet" : item_.count}</td>
<td>
<div className="d-flex align-items-center gap-2 flex-wrap">
{shown ? (
@@ -181,29 +182,29 @@ export default function TagSettings() {
type="color"
className="form-control form-control-color"
value={shown}
aria-label={`Colour for ${t.name}`}
onChange={(e) => setDraft(t.name, e.target.value)}
aria-label={`Colour for ${item_.name}`}
onChange={(e) => setDraft(item_.name, e.target.value)}
/>
) : (
<>
<span className="text-secondary small">Automatic</span>
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(t.name, DEFAULT_PICK)}>
Choose…
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(item_.name, DEFAULT_PICK)}>
{t("Choose…")}
</button>
</>
)}
{draft && draft !== t.color && (
{draft && draft !== item_.color && (
<>
<button className="btn btn-sm btn-primary" onClick={() => void saveColor(t, draft)} disabled={busy}>
Save
<button className="btn btn-sm btn-primary" onClick={() => void saveColor(item_, draft)} disabled={busy}>
{t("Save")}
</button>
<button className="btn btn-sm" onClick={() => setDraft(t.name, null)} disabled={busy}>
Cancel
<button className="btn btn-sm" onClick={() => setDraft(item_.name, null)} disabled={busy}>
{t("Cancel")}
</button>
</>
)}
{t.color && !(draft && draft !== t.color) && (
<button className="btn btn-sm btn-link p-0" onClick={() => void saveColor(t, null)} disabled={busy}>
{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
</button>
)}
@@ -211,11 +212,11 @@ export default function TagSettings() {
</td>
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm btn-outline-secondary" onClick={() => void rename(t)} disabled={busy}>
<button className="btn btn-sm btn-outline-secondary" onClick={() => void rename(item_)} disabled={busy}>
Rename
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(t)} disabled={busy}>
Delete
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(item_)} disabled={busy}>
{t("Delete")}
</button>
</div>
</td>