Swedish interface: labels and short texts across every page

About 1,600 more headings, buttons, table columns, status words, placeholders and short messages are translated. Tables of words built when the app loads are now read when they are drawn, so they follow the language, and a test fails if text is translated at load time.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-16 20:16:39 +01:00
1 parent 25183c0320
commit 6e39430a1f
173 files changed
+3922 -2245

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ function RequireRole({
}) {
if (roleRank[user.role] < roleRank[minRole]) {
return (
<div className="alert alert-danger">You don't have permission to view this page.</div>
<div className="alert alert-danger">{t("You don't have permission to view this page.")}</div>
);
}
return <>{children}</>;
+8 -8
View File
@@ -9,7 +9,7 @@ import TimeAgo from "./TimeAgo";
import { t } from "../i18n";
const LENGTHS: { hours: number | null; label: string }[] = [
{ hours: null, label: "Until the alert is gone" },
{ hours: null, get label() { return t("Until the alert is gone"); } },
{ hours: 1, label: "1 hour" },
{ hours: 4, label: "4 hours" },
{ hours: 24, label: "1 day" },
@@ -52,7 +52,7 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
setError(null);
try {
await api.alerts.ack({ alertId: alert.id, note: note.trim(), assigneeId: assignee === "" ? null : Number(assignee), hours: hours === "" ? null : Number(hours) });
toast.success(assignee && Number(assignee) !== me.id ? "Acknowledged and handed over." : "Acknowledged.");
toast.success(assignee && Number(assignee) !== me.id ? t("Acknowledged and handed over.") : t("Acknowledged."));
onSaved();
onClose();
} catch (err) {
@@ -77,13 +77,13 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
}
return (
<DetailDrawer title={existing ? "Acknowledgement" : "Acknowledge this alert"} subtitle={alert.source} onClose={onClose}>
<DetailDrawer title={existing ? t("Acknowledgement") : t("Acknowledge this alert")} subtitle={alert.source} onClose={onClose}>
<div className="mb-3">{alert.message}</div>
{existing && (
<div className="alert alert-info">
<div>
<strong>{existing.active ? ackWords(existing) : "Its acknowledgement has run out"}</strong>
<strong>{existing.active ? ackWords(existing) : t("Its acknowledgement has run out")}</strong>
<div className="small">
Acknowledged by {existing.ackedBy} <TimeAgo value={existing.ackedAt} />.
</div>
@@ -99,7 +99,7 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
</div>
<div className="mb-3">
<label className="form-label" htmlFor="ack-assignee">
Who has it
{t("Who has it")}
</label>
<select id="ack-assignee" className="form-select" value={assignee} onChange={(e) => setAssignee(e.target.value)}>
<option value="">{t("Nobody in particular")}</option>
@@ -112,7 +112,7 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
</div>
<div className="mb-3">
<label className="form-label" htmlFor="ack-hours">
Leave it alone for
{t("Leave it alone for")}
</label>
<select id="ack-hours" className="form-select" value={hours} onChange={(e) => setHours(e.target.value)}>
{LENGTHS.map((l) => (
@@ -126,11 +126,11 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
<ErrorNotice error={error} />
<div className="d-flex gap-2">
<button type="button" className="btn btn-primary" disabled={busy} onClick={() => void save()}>
{busy ? "Saving…" : existing ? "Save" : "Acknowledge"}
{busy ? t("Saving…") : existing ? "Save" : t("Acknowledge")}
</button>
{existing && (
<button type="button" className="btn btn-outline-secondary" disabled={busy} onClick={() => void takeBack()}>
Take it back
{t("Take it back")}
</button>
)}
</div>
+2 -2
View File
@@ -31,7 +31,7 @@ export default function AlertKindRunbookEntry({ kind, canEdit, offerAdd = true }
onClick={() => setOpen(true)}
>
<IconBook size={14} aria-hidden="true" />
{here ? "What to do" : "Add what to do"}
{here ? "What to do" : t("Add what to do")}
</button>
{open && (
<DetailDrawer title={t("What to do")} subtitle={kindWords(kind)} onClose={() => setOpen(false)}>
@@ -139,7 +139,7 @@ function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: Al
{error && <div className="text-danger small mb-2">{error}</div>}
<div className="btn-list">
<button type="submit" className="btn btn-primary" disabled={busy || title.trim() === "" || (body.trim() === "" && url.trim() === "")}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" onClick={() => (existing ? setEditing(false) : onDone())}>
{t("Cancel")}
+16 -16
View File
@@ -18,7 +18,7 @@ import { t } from "../i18n";
const PERIODS = [
{ days: 7, label: "Last 7 days" },
{ days: 30, label: "Last 30 days" },
{ days: 30, get label() { return t("Last 30 days"); } },
{ days: 90, label: "Last 90 days" },
{ days: 180, label: "Last 180 days" },
];
@@ -58,10 +58,10 @@ export default function AlertNoise() {
const cards = useMemo(
() => [
{ label: "Alerts raised", value: report ? report.incidents : "…", note: report ? `${report.distinctAlerts} different` : "" },
{ label: "Raised more than once", value: report ? report.repeating : "…", note: "", color: report && report.repeating > 0 ? "text-yellow" : "" },
{ label: "Flapped", value: report ? report.flapped : "…", note: "three or more times within an hour", color: report && report.flapped > 0 ? "text-red" : "" },
{ label: "Time spent alerting", value: report ? minutesWords(report.totalMinutes) : "…", note: "" },
{ label: t("Alerts raised"), value: report ? report.incidents : "…", note: report ? `${report.distinctAlerts} different` : "" },
{ label: t("Raised more than once"), value: report ? report.repeating : "…", note: "", color: report && report.repeating > 0 ? "text-yellow" : "" },
{ label: t("Flapped"), value: report ? report.flapped : "…", note: "three or more times within an hour", color: report && report.flapped > 0 ? "text-red" : "" },
{ label: t("Time spent alerting"), value: report ? minutesWords(report.totalMinutes) : "…", note: "" },
],
[report],
);
@@ -83,7 +83,7 @@ export default function AlertNoise() {
<ErrorNotice error={error} />
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<select className="form-select w-auto" aria-label="Period" value={days} onChange={(e) => setDays(Number(e.target.value))}>
<select className="form-select w-auto" aria-label={t("Period")} value={days} onChange={(e) => setDays(Number(e.target.value))}>
{PERIODS.map((p) => (
<option key={p.days} value={p.days}>
{p.label}
@@ -129,13 +129,13 @@ export default function AlertNoise() {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<NoiseRow> label="Alert" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label="Raised" sortKeyName="fired" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Alert")} sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Raised")} sortKeyName="fired" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Time in total")} sortKeyName="totalMinutes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label="Average" sortKeyName="averageMinutes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label="Longest" sortKeyName="longestMinutes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Average")} sortKeyName="averageMinutes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Longest")} sortKeyName="longestMinutes" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Most in an hour")} sortKeyName="mostInAnHour" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label="Last" sortKeyName="lastAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<NoiseRow> label={t("Last")} sortKeyName="lastAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
</tr>
</thead>
<tbody>
@@ -166,18 +166,18 @@ export default function AlertNoise() {
</div>
<div className="text-secondary small">{r.hint}</div>
</td>
<td className="stack-label" data-label="Raised">{r.fired}×</td>
<td className="stack-label" data-label={t("Raised")}>{r.fired}×</td>
<td className="stack-label text-nowrap" data-label={t("Time in total")}>
{minutesWords(r.totalMinutes)}
</td>
<td className="stack-label text-nowrap" data-label="Average">
<td className="stack-label text-nowrap" data-label={t("Average")}>
{minutesWords(r.averageMinutes)}
</td>
<td className="stack-label text-nowrap" data-label="Longest">
<td className="stack-label text-nowrap" data-label={t("Longest")}>
{minutesWords(r.longestMinutes)}
</td>
<td className="stack-label" data-label={t("Most in an hour")}>{r.mostInAnHour}</td>
<td className="stack-label text-nowrap" data-label="Last">
<td className="stack-label text-nowrap" data-label={t("Last")}>
<TimeAgo value={r.lastAt} />
</td>
</tr>
@@ -187,7 +187,7 @@ export default function AlertNoise() {
colSpan={7}
{...(tableSearch.active
? { filtered: () => tableSearch.setQuery("") }
: { title: "Nothing keeps coming back", hint: "No alert was raised more than once in this period. That is how it should look." })}
: { title: t("Nothing keeps coming back"), hint: t("No alert was raised more than once in this period. That is how it should look.") })}
/>
)}
</tbody>
+4 -4
View File
@@ -56,11 +56,11 @@ export default function AuthentikEditUser({ p, groups, groupsError, busy, onSave
</div>
</div>
<div className="form-label">Groups</div>
<div className="form-label">{t("Groups")}</div>
{p.groups === null && <div className="text-secondary small mb-3">Authentik did not say which groups this user is in, so only the name and email can be changed here.</div>}
{p.groups !== null && groupsError && <div className="text-yellow small mb-3">The groups could not be read: {groupsError}. The name and email can still be changed.</div>}
{p.groups !== null && !groupsError && groups === null && <div className="text-secondary small mb-3">Reading the groups…</div>}
{canEditGroups && groups!.length === 0 && <div className="text-secondary small mb-3">There are no groups.</div>}
{p.groups !== null && !groupsError && groups === null && <div className="text-secondary small mb-3">{t("Reading the groups…")}</div>}
{canEditGroups && groups!.length === 0 && <div className="text-secondary small mb-3">{t("There are no groups.")}</div>}
{canEditGroups && groups!.length > 0 && (
<div className="mb-3">
{groups!.map((g) => (
@@ -77,7 +77,7 @@ export default function AuthentikEditUser({ p, groups, groupsError, busy, onSave
<div className="d-flex gap-2">
<button type="submit" className="btn btn-sm btn-primary" disabled={busy}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={onCancel} disabled={busy}>
{t("Cancel")}
+19 -19
View File
@@ -38,14 +38,14 @@ function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGr
</label>
<input id={`ak-group-name-${g.id}`} className="form-control form-control-sm mb-3" style={{ maxWidth: 360 }} required maxLength={200} autoComplete="off" value={name} onChange={(e) => setName(e.target.value)} />
<div className="form-label">Members</div>
<div className="form-label">{t("Members")}</div>
{!canEditMembers ? (
<div className="text-secondary small mb-3">Authentik did not say who is in this group, so only its name can be changed here.</div>
) : (
<>
<input className="form-control form-control-sm mb-2" style={{ maxWidth: 360 }} placeholder="Find a user" aria-label="Find a user" value={filter} onChange={(e) => setFilter(e.target.value)} />
<input className="form-control form-control-sm mb-2" style={{ maxWidth: 360 }} placeholder={t("Find a user")} aria-label={t("Find a user")} value={filter} onChange={(e) => setFilter(e.target.value)} />
<div className="border rounded p-2 mb-1" style={{ maxHeight: 240, overflowY: "auto" }}>
{shown.length === 0 && <div className="text-secondary small">No user matches.</div>}
{shown.length === 0 && <div className="text-secondary small">{t("No user matches.")}</div>}
{shown.map((p) => (
<label key={p.pk} className="form-check">
<input type="checkbox" className="form-check-input" checked={members.includes(p.pk)} disabled={p.pk === self} onChange={() => toggle(p.pk)} />
@@ -64,7 +64,7 @@ function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGr
<div className="d-flex gap-2 mt-2">
<button type="submit" className="btn btn-sm btn-primary" disabled={busy}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={onCancel} disabled={busy}>
{t("Cancel")}
@@ -138,10 +138,10 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
const members = g.members === null ? "" : g.members.length === 0 ? " It has no members." : ` Its ${g.members.length} member${g.members.length === 1 ? "" : "s"} stay${g.members.length === 1 ? "s" : ""}, just not in it.`;
const roles = g.decidesRole ? ` It decides who is ${g.decidesRole === "admin" ? "an administrator" : "an operator"} in this app (Settings → Sign-in): people in it lose that role here at their next sign-in.` : "";
const typed = await promptDialog({
title: "Delete group",
title: t("Delete group"),
message: `This deletes the group "${g.name}" in ${a.name} for good. It cannot be undone.${members}${roles} Type the name of the group to confirm.`,
label: "Group name",
confirmLabel: "Delete",
label: t("Group name"),
confirmLabel: t("Delete"),
required: true,
});
if (typed === null) return;
@@ -165,9 +165,9 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
async function save(g: AuthentikGroupDetail, name: string, add: number[], remove: number[]) {
if (g.decidesRole) {
const ok = await confirmDialog({
title: "Change a group that decides roles",
title: t("Change a group that decides roles"),
message: `"${g.name}" decides who is ${g.decidesRole === "admin" ? "an administrator" : "an operator"} in this app. Changing its name or its members changes people's roles here at their next sign-in. Go on?`,
confirmLabel: "Save",
confirmLabel: t("Save"),
danger: true,
});
if (!ok) return;
@@ -178,7 +178,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
try {
const r = await api.authentik.updateGroup(a.id, g.id, { name: name !== g.name ? name : undefined, membersAdd: add, membersRemove: remove });
setEditing(null);
setNotice(r.changed.length === 0 ? "Nothing was different." : `Saved "${name}"${r.added + r.removed > 0 ? ` — ${r.added} put in, ${r.removed} taken out` : ""}.`);
setNotice(r.changed.length === 0 ? t("Nothing was different.") : `Saved "${name}"${r.added + r.removed > 0 ? ` — ${r.added} put in, ${r.removed} taken out` : ""}.`);
await load();
} catch (err) {
setError(readableError(err));
@@ -188,20 +188,20 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
return (
<div className="mt-3">
<h4>Groups</h4>
<h4>{t("Groups")}</h4>
<ErrorNotice error={error} />
<SuccessNotice notice={notice} />
{creating ? (
<form onSubmit={create} className="card card-sm mb-2">
<div className="card-body">
<label className="form-label" htmlFor={`ak-new-group-${a.id}`}>
Name of the new group
{t("Name of the new group")}
</label>
<input id={`ak-new-group-${a.id}`} className="form-control form-control-sm mb-2" style={{ maxWidth: 360 }} required maxLength={200} autoComplete="off" autoFocus value={newName} onChange={(e) => setNewName(e.target.value)} />
<div className="text-secondary small mb-2">It starts with no members — put them in with Edit — and it does not make its members administrators of Authentik; that is decided in Authentik.</div>
<div className="d-flex gap-2">
<button type="submit" className="btn btn-sm btn-primary" disabled={busy !== null || newName.trim() === ""}>
{busy === "new" ? "Making…" : "Make group"}
{busy === "new" ? t("Making…") : t("Make group")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={() => { setCreating(false); setNewName(""); }} disabled={busy === "new"}>
{t("Cancel")}
@@ -211,24 +211,24 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
</form>
) : (
<button type="button" className="btn btn-sm btn-primary me-2 mb-2" onClick={() => { setCreating(true); setNotice(null); setError(null); }} disabled={busy !== null}>
New group…
{t("New group…")}
</button>
)}
{groups === null ? (
<button type="button" className="btn btn-sm btn-outline-secondary mb-2" onClick={() => void load()} disabled={busy !== null}>
{busy === "list" ? "Reading…" : error ? "Try again" : "Show groups"}
{busy === "list" ? t("Reading…") : error ? "Try again" : t("Show groups")}
</button>
) : (
<>
{groups.length === 0 ? (
<div className="text-secondary mb-2">There are no groups.</div>
<div className="text-secondary mb-2">{t("There are no groups.")}</div>
) : (
<div className="table-responsive">
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Group</th>
<th className="text-end">Members</th>
<th>{t("Group")}</th>
<th className="text-end">{t("Members")}</th>
<th className="text-end">&nbsp;</th>
</tr>
</thead>
@@ -270,7 +270,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
</div>
)}
<button type="button" className="btn btn-sm btn-link text-secondary px-0" onClick={() => { setGroups(null); setEditing(null); }}>
Hide groups
{t("Hide groups")}
</button>
</>
)}
+11 -11
View File
@@ -69,7 +69,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
}
async function stopAllowing() {
if (!(await confirmDialog({ title: "Stop managing users", message: `Remove the token for making and managing users from "${a.name}"? Reading it carries on. You can add one again under Integrations.`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Stop managing users"), message: `Remove the token for making and managing users from "${a.name}"? Reading it carries on. You can add one again under Integrations.`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.authentik.removeWriteToken(a.id);
close();
@@ -83,14 +83,14 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
return (
<div className="mt-3">
<h4>New user</h4>
<h4>{t("New user")}</h4>
{!open && (
<div className="d-flex flex-wrap align-items-center gap-2">
<button type="button" className="btn btn-sm btn-primary" onClick={() => void show()}>
New user…
{t("New user…")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={() => void stopAllowing()}>
Stop allowing this
{t("Stop allowing this")}
</button>
</div>
)}
@@ -104,7 +104,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
{made.link ? (
<>
<div className="input-group mb-2">
<input className="form-control" readOnly value={made.link} aria-label="Recovery link" onFocus={(e) => e.currentTarget.select()} />
<input className="form-control" readOnly value={made.link} aria-label={t("Recovery link")} onFocus={(e) => e.currentTarget.select()} />
<CopyButton text={made.link} />
</div>
<div className="text-secondary small mb-3">
@@ -118,7 +118,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
</div>
)}
<button type="button" className="btn btn-sm btn-outline-secondary me-2" onClick={() => void show()}>
Make another
{t("Make another")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={close}>
{t("Done")}
@@ -134,7 +134,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
<div className="row g-2 mb-3">
<div className="col-md-4">
<label className="form-label" htmlFor={`ak-user-${a.id}`}>
User name
{t("User name")}
</label>
<input id={`ak-user-${a.id}`} className="form-control" required maxLength={150} autoComplete="off" value={fields.username} onChange={(e) => setFields({ ...fields, username: e.target.value })} />
</div>
@@ -152,10 +152,10 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
</div>
</div>
<div className="form-label">Groups</div>
{groups === null && <div className="text-secondary small mb-3">Reading the groups…</div>}
<div className="form-label">{t("Groups")}</div>
{groups === null && <div className="text-secondary small mb-3">{t("Reading the groups…")}</div>}
{groupsError && <div className="text-yellow small mb-2">The groups could not be read: {groupsError}. The user can still be made, without groups.</div>}
{groups && groups.length === 0 && !groupsError && <div className="text-secondary small mb-3">There are no groups.</div>}
{groups && groups.length === 0 && !groupsError && <div className="text-secondary small mb-3">{t("There are no groups.")}</div>}
{groups && groups.length > 0 && (
<div className="mb-3">
{groups.map((g) => (
@@ -172,7 +172,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
<div className="d-flex flex-wrap align-items-center gap-2">
<button type="submit" className="btn btn-primary" disabled={busy || groups === null}>
{busy ? "Making…" : "Make user and link"}
{busy ? "Making…" : t("Make user and link")}
</button>
<button type="button" className="btn btn-link text-secondary" onClick={close} disabled={busy}>
{t("Cancel")}
+14 -14
View File
@@ -79,9 +79,9 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
async function switchTo(p: AuthentikPerson, on: boolean) {
if (!on) {
const ok = await confirmDialog({
title: "Switch off user",
title: t("Switch off user"),
message: `Switch off "${p.username}" in ${a.name}? They can no longer sign in to anything behind Authentik. Nothing of theirs is lost, and switching on again brings it all back. A session they already have in this app is not ended by this — end it under Users → Signed in now.`,
confirmLabel: "Switch off",
confirmLabel: t("Switch off"),
danger: true,
});
if (!ok) return;
@@ -99,10 +99,10 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
async function remove(p: AuthentikPerson) {
const typed = await promptDialog({
title: "Delete user",
title: t("Delete user"),
message: `This deletes "${p.username}" in ${a.name} for good, with their account there. It cannot be undone — switching them off is the way back. Type the user name to confirm.`,
label: "User name",
confirmLabel: "Delete",
label: t("User name"),
confirmLabel: t("Delete"),
required: true,
});
if (typed === null) return;
@@ -127,14 +127,14 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
<ErrorNotice error={error} />
{people === null ? (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void load()} disabled={busy !== null}>
{busy === "list" ? "Reading…" : error ? "Try again" : "Show users"}
{busy === "list" ? t("Reading…") : error ? "Try again" : t("Show users")}
</button>
) : (
<>
<form onSubmit={find} className="input-group input-group-sm mb-2" style={{ maxWidth: 360 }}>
<input className="form-control" placeholder="Search by name or email" aria-label="Search users" maxLength={100} value={search} onChange={(e) => setSearch(e.target.value)} />
<input className="form-control" placeholder={t("Search by name or email")} aria-label={t("Search users")} maxLength={100} value={search} onChange={(e) => setSearch(e.target.value)} />
<button type="submit" className="btn btn-outline-secondary" disabled={busy !== null}>
Search
{t("Search")}
</button>
</form>
{people.length === 0 ? (
@@ -144,9 +144,9 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>User</th>
<th>{t("User")}</th>
<th>{t("Status")}</th>
<th>Last sign-in</th>
<th>{t("Last sign-in")}</th>
<th className="text-end">&nbsp;</th>
</tr>
</thead>
@@ -166,7 +166,7 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
{p.email && <div className="small text-secondary">{p.email}</div>}
</td>
<td>
{p.active ? <span className="badge bg-green-lt text-green">On</span> : <span className="badge bg-secondary-lt text-secondary">Off</span>}
{p.active ? <span className="badge bg-green-lt text-green">{t("On")}</span> : <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>}
{p.admin && <span className="badge bg-yellow-lt text-yellow ms-1">administrator</span>}
</td>
<td className="text-secondary">{p.lastLogin ? <TimeAgo value={p.lastLogin} /> : "never"}</td>
@@ -181,7 +181,7 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
{t("Edit")}
</button>
<button type="button" className="btn btn-sm btn-outline-secondary me-1" disabled={busy !== null} onClick={() => void switchTo(p, !p.active)}>
{p.active ? "Switch off" : "Switch on"}
{p.active ? t("Switch off") : t("Switch on")}
</button>
<button type="button" className="btn btn-sm btn-outline-danger" disabled={busy !== null} onClick={() => void remove(p)}>
{t("Delete")}
@@ -196,9 +196,9 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
</table>
</div>
)}
{more && <div className="text-secondary small mb-2">Only the first 200 are shown — search to find the others.</div>}
{more && <div className="text-secondary small mb-2">{t("Only the first 200 are shown — search to find the others.")}</div>}
<button type="button" className="btn btn-sm btn-link text-secondary px-0" onClick={() => setPeople(null)}>
Hide users
{t("Hide users")}
</button>
</>
)}
+2 -1
View File
@@ -1,4 +1,5 @@
import type { ReactNode } from "react";
import { t } from "../i18n";
/**
* The bar at the foot of a list that appears when some rows are picked: how many, what can be done to all of them, and a way to let go. It sits over the bottom of the
@@ -12,7 +13,7 @@ export default function BulkBar({ count, noun, onClear, children }: { count: num
</strong>
<div className="d-flex flex-wrap gap-2">{children}</div>
<button type="button" className="btn btn-sm ms-auto" onClick={onClear}>
Let go
{t("Let go")}
</button>
</div>
);
+18 -18
View File
@@ -17,7 +17,7 @@ function Shell({ title, subtitle, onClose, onSubmit, submitLabel, busy, disabled
{children}
<div className="d-flex gap-2 mt-3">
<button type="submit" className="btn btn-primary" disabled={busy || disabled}>
{busy ? "Working…" : submitLabel}
{busy ? t("Working…") : submitLabel}
</button>
<button type="button" className="btn" onClick={onClose}>
{t("Cancel")}
@@ -46,7 +46,7 @@ export function SilenceBulkDrawer({ noun, count, canSilenceDependents, onSubmit,
const [busy, setBusy] = useState(false);
return (
<Shell
title="Put under maintenance"
title={t("Put under maintenance")}
subtitle={`${count} ${noun}`}
onClose={onClose}
busy={busy}
@@ -59,7 +59,7 @@ export function SilenceBulkDrawer({ noun, count, canSilenceDependents, onSubmit,
>
<p className="text-secondary">Alerts about each are held back for this long; anything still wrong when it ends alerts then. One already under maintenance has its time restarted.</p>
<label className="form-label" htmlFor="bulk-min">
For
{t("For")}
</label>
<select id="bulk-min" className="form-select mb-3" value={minutes} onChange={(e) => setMinutes(Number(e.target.value))}>
{MINUTES.map((m) => (
@@ -83,7 +83,7 @@ export function SilenceBulkDrawer({ noun, count, canSilenceDependents, onSubmit,
}
const LENGTHS: { hours: number | null; label: string }[] = [
{ hours: null, label: "Until the alert is gone" },
{ hours: null, get label() { return t("Until the alert is gone"); } },
{ hours: 1, label: "1 hour" },
{ hours: 4, label: "4 hours" },
{ hours: 24, label: "1 day" },
@@ -110,7 +110,7 @@ export function AckBulkDrawer({ count, onSubmit, onClose }: { count: number; onS
}, []);
return (
<Shell
title="Acknowledge"
title={t("Acknowledge")}
subtitle={`${count} alert${count === 1 ? "" : "s"}`}
onClose={onClose}
busy={busy}
@@ -127,7 +127,7 @@ export function AckBulkDrawer({ count, onSubmit, onClose }: { count: number; onS
</label>
<textarea id="bulk-note" className="form-control mb-3" rows={3} maxLength={500} value={note} onChange={(e) => setNote(e.target.value)} placeholder="e.g. The UPS is being swapped on Saturday" />
<label className="form-label" htmlFor="bulk-assignee">
Who has them
{t("Who has them")}
</label>
<select id="bulk-assignee" className="form-select mb-3" value={assignee} onChange={(e) => setAssignee(e.target.value)}>
<option value="">{t("Nobody in particular")}</option>
@@ -138,7 +138,7 @@ export function AckBulkDrawer({ count, onSubmit, onClose }: { count: number; onS
))}
</select>
<label className="form-label" htmlFor="bulk-hours">
For how long
{t("For how long")}
</label>
<select id="bulk-hours" className="form-select" value={hours} onChange={(e) => setHours(e.target.value)}>
{LENGTHS.map((l) => (
@@ -163,7 +163,7 @@ export function TagBulkDrawer({ count, tags, onSubmit, onClose }: { count: numbe
onClose={onClose}
busy={busy}
disabled={tag.trim() === ""}
submitLabel={mode === "add" ? "Add the tag" : "Take the tag off"}
submitLabel={mode === "add" ? t("Add the tag") : t("Take the tag off")}
onSubmit={async () => {
setBusy(true);
await onSubmit({ mode, tag: tag.trim() });
@@ -172,14 +172,14 @@ export function TagBulkDrawer({ count, tags, onSubmit, onClose }: { count: numbe
>
<div className="btn-group mb-3" role="group" aria-label="Add or take off">
<button type="button" className={`btn ${mode === "add" ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={mode === "add"} onClick={() => setMode("add")}>
Add a tag
{t("Add a tag")}
</button>
<button type="button" className={`btn ${mode === "remove" ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={mode === "remove"} onClick={() => setMode("remove")}>
Take a tag off
{t("Take a tag off")}
</button>
</div>
<label className="form-label" htmlFor="bulk-tag">
Tag
{t("Tag")}
</label>
<input id="bulk-tag" className="form-control" list="bulk-tags" maxLength={30} value={tag} onChange={(e) => setTag(e.target.value)} placeholder="e.g. lab" autoFocus />
<datalist id="bulk-tags">
@@ -212,7 +212,7 @@ export function RunsOnBulkDrawer({ count, servers, onSubmit, onClose }: { count:
>
<p className="text-secondary">When the server they run on is down, their own offline alerts are folded under its alert instead of adding to the noise. A change that would make a loop is left out.</p>
<label className="form-label" htmlFor="bulk-parent">
They run on
{t("They run on")}
</label>
<select id="bulk-parent" className="form-select" value={choice} onChange={(e) => setChoice(e.target.value)}>
<option value="">{t("Choose…")}</option>
@@ -238,8 +238,8 @@ function FieldChange({ id, label, type, value, onChange }: { id: string; label:
</label>
<div className="d-flex gap-2">
<select aria-label={`${label}: what to do`} className="form-select w-auto" value={value.mode} onChange={(e) => onChange({ ...value, mode: e.target.value as Field["mode"] })}>
<option value="keep">Leave as it is</option>
<option value="set">Set to…</option>
<option value="keep">{t("Leave as it is")}</option>
<option value="set">{t("Set to…")}</option>
<option value="clear">{t("Clear")}</option>
</select>
{value.mode === "set" && <input id={id} type={type} className="form-control" maxLength={120} value={value.value} onChange={(e) => onChange({ ...value, value: e.target.value })} required />}
@@ -258,7 +258,7 @@ export function HardwareBulkDrawer({ count, onSubmit, onClose }: { count: number
const nothing = location.mode === "keep" && warranty.mode === "keep" && support.mode === "keep";
return (
<Shell
title="Change hardware"
title={t("Change hardware")}
subtitle={`${count} piece${count === 1 ? "" : "s"}`}
onClose={onClose}
busy={busy}
@@ -278,9 +278,9 @@ export function HardwareBulkDrawer({ count, onSubmit, onClose }: { count: number
}}
>
<p className="text-secondary">Whatever is left as it is stays the way each one has it.</p>
<FieldChange id="bulk-location" label="Where it is" type="text" value={location} onChange={setLocation} />
<FieldChange id="bulk-warranty" label="Warranty until" type="date" value={warranty} onChange={setWarranty} />
<FieldChange id="bulk-support" label="End of support" type="date" value={support} onChange={setSupport} />
<FieldChange id="bulk-location" label={t("Where it is")} type="text" value={location} onChange={setLocation} />
<FieldChange id="bulk-warranty" label={t("Warranty until")} type="date" value={warranty} onChange={setWarranty} />
<FieldChange id="bulk-support" label={t("End of support")} type="date" value={support} onChange={setSupport} />
</Shell>
);
}
+7 -7
View File
@@ -37,14 +37,14 @@ export default function CloseDrawer({ alert, onClose, onSaved }: { alert: AlertI
}
return (
<DetailDrawer title="Close this alert" subtitle={alert.message} onClose={onClose}>
<DetailDrawer title={t("Close this alert")} subtitle={alert.message} onClose={onClose}>
<div className="text-secondary mb-3">
Hide it, with no end. It comes back only if it <strong>gets worse</strong> than {alert.severity}, or if the problem goes away for half an hour and then returns. Until then it is not counted and nothing is sent about it. The reason you give goes on its
incident. Nothing about the thing itself is promised — use <em>{t("Silence")}</em> for planned work.
</div>
<ErrorNotice error={error} />
<label className="form-label" htmlFor="close-note">
Why? (optional)
{t("Why? (optional)")}
</label>
<textarea id="close-note" className="form-control mb-3" rows={3} maxLength={500} value={note} onChange={(e) => setNote(e.target.value)} placeholder="Fixed outside the app · accepted · the disk is being replaced on Friday…" autoFocus />
{ticket && ticket.number && (
@@ -70,7 +70,7 @@ export default function CloseDrawer({ alert, onClose, onSaved }: { alert: AlertI
)}
<div className="d-flex gap-2">
<button type="button" className="btn btn-primary" disabled={busy} onClick={() => void close()}>
{busy ? "Closing…" : "Close the alert"}
{busy ? "Closing…" : t("Close the alert")}
</button>
<button type="button" className="btn" disabled={busy} onClick={onClose}>
{t("Cancel")}
@@ -96,7 +96,7 @@ export function CloseBulkDrawer({ count, tickets, onSubmit, onClose }: { count:
incident. Nothing about the things themselves is promised — use <em>{t("Silence")}</em> for planned work.
</div>
<label className="form-label" htmlFor="close-bulk-note">
Why? (optional)
{t("Why? (optional)")}
</label>
<textarea id="close-bulk-note" className="form-control mb-3" rows={3} maxLength={500} value={note} onChange={(e) => setNote(e.target.value)} placeholder="All retired with the old host · accepted · fixed outside the app…" autoFocus />
{tickets.closable.length > 0 && (
@@ -106,7 +106,7 @@ export function CloseBulkDrawer({ count, tickets, onSubmit, onClose }: { count:
<span className="form-check-label">
Also close {tickets.closable.length === 1 ? "osTicket ticket" : `${tickets.closable.length} osTicket tickets`} <strong>{shown}</strong>
<span className="d-block text-secondary small">
Each is set to Closed in osTicket, with a note in its thread saying who closed it from here and why (your reason above). <strong>Undo opens the alerts again but cannot reopen the tickets.</strong>
Each is set to Closed in osTicket, with a note in its thread saying who closed it from here and why (your reason above). <strong>{t("Undo opens the alerts again but cannot reopen the tickets.")}</strong>
</span>
</span>
</label>
@@ -114,7 +114,7 @@ export function CloseBulkDrawer({ count, tickets, onSubmit, onClose }: { count:
)}
{tickets.other > 0 && (
<div className="text-secondary small mb-3">
{tickets.other === 1 ? "One more has a ticket that stays open" : `${tickets.other} more have tickets that stay open`}: a summary ticket that covers several alerts, or an osTicket with no login for closing tickets (an administrator adds one under Integrations).
{tickets.other === 1 ? t("One more has a ticket that stays open") : `${tickets.other} more have tickets that stay open`}: a summary ticket that covers several alerts, or an osTicket with no login for closing tickets (an administrator adds one under Integrations).
</div>
)}
<div className="d-flex gap-2">
@@ -127,7 +127,7 @@ export function CloseBulkDrawer({ count, tickets, onSubmit, onClose }: { count:
void onSubmit(note.trim() === "" ? null : note.trim(), closeTickets && tickets.closable.length > 0).finally(() => setBusy(false));
}}
>
{busy ? "Closing…" : `Close ${count === 1 ? "the alert" : `all ${count}`}`}
{busy ? t("Closing…") : `Close ${count === 1 ? "the alert" : `all ${count}`}`}
</button>
<button type="button" className="btn" disabled={busy} onClick={onClose}>
{t("Cancel")}
+14 -14
View File
@@ -224,7 +224,7 @@ export default function CommandPalette({
if (isGroup(entry)) entry.items.forEach((i) => pages.push({ to: i.to, label: t(i.label), group: t(entry.label) }));
else pages.push({ to: entry.to, label: t(entry.label), group: "" });
}
pages.push({ to: "/wall", label: "Wall display", group: "" });
pages.push({ to: "/wall", label: t("Wall display"), group: "" });
for (const p of pages) {
items.push({ key: `page-${p.to}`, category: "Go to", title: p.label, subtitle: p.group, hint: shortcutHintFor(p.to) ?? undefined, path: p.to, keywords: "go open page" });
}
@@ -247,14 +247,14 @@ export default function CommandPalette({
keywords: "favourite favorite pin star bookmark",
});
}
items.push({ key: "act-theme", category: "Actions", title: "Switch between light and dark mode", subtitle: "", run: onToggleTheme, keywords: "theme dark light mode appearance" });
items.push({ key: "act-theme", category: "Actions", title: t("Switch between light and dark mode"), subtitle: "", run: onToggleTheme, keywords: "theme dark light mode appearance" });
for (const d of DENSITIES) {
items.push({ key: `act-density-${d.value}`, category: "Actions", title: `Density: ${d.label}`, subtitle: "How tightly pages are packed", run: () => onSetDensity(d.value), keywords: "density compact roomy spacing size" });
items.push({ key: `act-density-${d.value}`, category: "Actions", title: `Density: ${d.label}`, subtitle: t("How tightly pages are packed"), run: () => onSetDensity(d.value), keywords: "density compact roomy spacing size" });
}
items.push({
key: "act-refresh-alerts",
category: "Actions",
title: "Check alerts again",
title: t("Check alerts again"),
subtitle: "",
run: () => {
window.dispatchEvent(new Event("maintenance-changed"));
@@ -280,7 +280,7 @@ export default function CommandPalette({
items.push({ key: "ack-all", category: "Alerts", title: `Acknowledge all ${alertsToAck.length} alerts nobody is on`, subtitle: "for 4 hours, handed to you", run: () => ack(alertsToAck), keywords: "acknowledge ack alerts all" });
}
}
items.push({ key: "go-alerts-open", category: "Alerts", title: "Show the alerts nobody is on", subtitle: "", path: "/alerts", keywords: "alerts unacknowledged attention" });
items.push({ key: "go-alerts-open", category: "Alerts", title: t("Show the alerts nobody is on"), subtitle: "", path: "/alerts", keywords: "alerts unacknowledged attention" });
// Update a server straight from here: opens the update drawer for it, which asks before it does anything.
if (canAct) {
@@ -297,7 +297,7 @@ export default function CommandPalette({
}
// Hardware: open it, or print its label.
items.push({ key: "inv-labels", category: "Inventory", title: "Print inventory labels", subtitle: "a sheet of QR stickers", path: "/inventory/labels", keywords: "label labels qr print sticker" });
items.push({ key: "inv-labels", category: "Inventory", title: t("Print inventory labels"), subtitle: "a sheet of QR stickers", path: "/inventory/labels", keywords: "label labels qr print sticker" });
for (const a of assets) {
items.push({ key: `inv-open-${a.id}`, category: "Inventory", title: `Open ${a.name} in the inventory`, subtitle: [a.manufacturer, a.model].filter(Boolean).join(" "), path: `/inventory?asset=${a.id}`, keywords: "hardware asset inventory serial" });
items.push({ key: `inv-label-${a.id}`, category: "Inventory", title: `Print the label for ${a.name}`, subtitle: a.rackUnit ?? a.location ?? "", path: `/inventory/labels?only=${a.id}`, keywords: "label qr print sticker" });
@@ -313,7 +313,7 @@ export default function CommandPalette({
}
}
items.push({ key: "act-tokens", category: "Actions", title: "API tokens", subtitle: "Read-only access for scripts and Home Assistant", path: "/api-tokens", keywords: "api token key read home assistant script bearer" });
items.push({ key: "act-shortcuts", category: "Actions", title: "Show keyboard shortcuts", subtitle: "", hint: "?", run: () => void window.dispatchEvent(new Event(SHOW_SHORTCUTS_EVENT)), keywords: "keys help" });
items.push({ key: "act-shortcuts", category: "Actions", title: t("Show keyboard shortcuts"), subtitle: "", hint: "?", run: () => void window.dispatchEvent(new Event(SHOW_SHORTCUTS_EVENT)), keywords: "keys help" });
if (user.role === "admin") {
// Each setting, so "quiet hours" or "flapping" finds the place it is set.
for (const [i, s] of SETTINGS_INDEX.entries()) {
@@ -322,7 +322,7 @@ export default function CommandPalette({
items.push({
key: "act-setup",
category: "Actions",
title: "Show the getting started guide",
title: t("Show the getting started guide"),
subtitle: "on the dashboard",
run: () => {
window.dispatchEvent(new Event(SHOW_SETUP_EVENT));
@@ -331,7 +331,7 @@ export default function CommandPalette({
keywords: "setup onboarding checklist first run",
});
}
items.push({ key: "act-signout", category: "Actions", title: "Sign out", subtitle: "", run: () => void (window.location.href = "/auth/logout"), keywords: "log out logout" });
items.push({ key: "act-signout", category: "Actions", title: t("Sign out"), subtitle: "", run: () => void (window.location.href = "/auth/logout"), keywords: "log out logout" });
if (canAct && targets) {
const start = (type: MaintenanceTargetType, id: number, name: string, minutes: number, words: string) => async () => {
@@ -472,7 +472,7 @@ export default function CommandPalette({
aria-keyshortcuts="Control+K Meta+K"
>
<IconSearch size={16} />
<span className="palette-text">Search</span>
<span className="palette-text">{t("Search")}</span>
<kbd className="ms-auto palette-text">Ctrl K</kbd>
</button>
);
@@ -506,16 +506,16 @@ export default function CommandPalette({
aria-controls="palette-list"
aria-activedescendant={items[activeIndex] ? `palette-opt-${activeIndex}` : undefined}
aria-autocomplete="list"
aria-label="Search, or type a command"
aria-label={t("Search, or type a command")}
className="form-control form-control-lg border-0"
placeholder="Search, or type a command: acknowledge, update, label…"
placeholder={t("Search, or type a command: acknowledge, update, label…")}
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={handleInputKeyDown}
/>
</div>
</div>
<div id="palette-list" role="listbox" aria-label="Results" style={{ maxHeight: "60vh", overflowY: "auto" }}>
<div id="palette-list" role="listbox" aria-label={t("Results")} style={{ maxHeight: "60vh", overflowY: "auto" }}>
{items.map((item, index) => {
const showHeader = item.category !== lastCategory;
lastCategory = item.category;
@@ -546,7 +546,7 @@ export default function CommandPalette({
})}
</div>
<div className="px-3 py-2 border-top text-secondary small" role="status" aria-live="polite">
{searching ? "Searching…" : empty ? "No matches." : terms.length === 0 ? "Type to search servers, DNS, secrets and more — or a command." : `${items.length} result${items.length === 1 ? "" : "s"}`}
{searching ? t("Searching…") : empty ? t("No matches.") : terms.length === 0 ? t("Type to search servers, DNS, secrets and more — or a command.") : `${items.length} result${items.length === 1 ? "" : "s"}`}
</div>
</div>
</div>
+1 -1
View File
@@ -28,7 +28,7 @@ export default function ConnectedThrough({ serverId }: { serverId: number }) {
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Connected through</h3>
<h3 className="card-title">{t("Connected through")}</h3>
<div className="card-actions">
<Link to="/network/devices" className="small">
{t("Network devices")}
+2 -1
View File
@@ -1,4 +1,5 @@
import { useState } from "react";
import { t } from "../i18n";
export default function CopyButton({ text, label = "Copy" }: { text: string; label?: string }) {
const [copied, setCopied] = useState(false);
@@ -15,7 +16,7 @@ export default function CopyButton({ text, label = "Copy" }: { text: string; lab
return (
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={handleCopy}>
{copied ? "Copied!" : label}
{copied ? t("Copied!") : label}
</button>
);
}
+12 -12
View File
@@ -46,7 +46,7 @@ export default function CostHistory({ refreshKey }: { refreshKey: unknown }) {
<div className="card-header flex-wrap gap-2">
<h3 className="card-title me-auto">{t("History")}</h3>
{data.series.length > 1 && (
<div className="btn-group btn-group-sm" role="group" aria-label="Currency">
<div className="btn-group btn-group-sm" role="group" aria-label={t("Currency")}>
{data.series.map((s) => (
<button key={s.currency} type="button" className={`btn ${s.currency === series.currency ? "btn-primary" : ""}`} onClick={() => setCurrency(s.currency)}>
{s.currency}
@@ -54,11 +54,11 @@ export default function CostHistory({ refreshKey }: { refreshKey: unknown }) {
))}
</div>
)}
<select className="form-select form-select-sm w-auto" value={months} onChange={(e) => setMonths(Number(e.target.value))} aria-label="How far back">
<option value={6}>6 months</option>
<option value={12}>12 months</option>
<option value={24}>24 months</option>
<option value={36}>36 months</option>
<select className="form-select form-select-sm w-auto" value={months} onChange={(e) => setMonths(Number(e.target.value))} aria-label={t("How far back")}>
<option value={6}>{t("6 months")}</option>
<option value={12}>{t("12 months")}</option>
<option value={24}>{t("24 months")}</option>
<option value={36}>{t("36 months")}</option>
</select>
</div>
<div className="card-body">
@@ -86,9 +86,9 @@ export default function CostHistory({ refreshKey }: { refreshKey: unknown }) {
<table className="table table-sm table-vcenter">
<thead>
<tr>
<th>Month</th>
<th className="text-end">A month</th>
<th className="text-end">Change</th>
<th>{t("Month")}</th>
<th className="text-end">{t("A month")}</th>
<th className="text-end">{t("Change")}</th>
</tr>
</thead>
<tbody>
@@ -107,9 +107,9 @@ export default function CostHistory({ refreshKey }: { refreshKey: unknown }) {
</table>
</div>
<h4>What changed</h4>
<h4>{t("What changed")}</h4>
{events.length === 0 ? (
<div className="text-secondary small">Nothing yet.</div>
<div className="text-secondary small">{t("Nothing yet.")}</div>
) : (
<ul className="list-unstyled mb-0">
{events.slice(0, allEvents ? undefined : SHOWN_EVENTS).map((e, i) => (
@@ -122,7 +122,7 @@ export default function CostHistory({ refreshKey }: { refreshKey: unknown }) {
)}
{events.length > SHOWN_EVENTS && (
<button className="btn btn-sm mt-2" onClick={() => setAllEvents(!allEvents)}>
{allEvents ? "Show fewer" : `Show all ${events.length}`}
{allEvents ? t("Show fewer") : `Show all ${events.length}`}
</button>
)}
<div className="text-secondary small mt-3">
+6 -6
View File
@@ -54,14 +54,14 @@ export default function DashboardTodos({ canEdit }: { canEdit: boolean }) {
}
}
async function tick(t: TodoItem) {
async function tick(todo: TodoItem) {
try {
await api.todos.update(t.id, { done: true });
toast.success(`Done: ${t.title}`, {
label: "Undo",
await api.todos.update(todo.id, { done: true });
toast.success(`Done: ${todo.title}`, {
label: t("Undo"),
onClick: async () => {
try {
await api.todos.update(t.id, { done: false });
await api.todos.update(todo.id, { done: false });
} catch (err) {
toast.error(readableError(err));
} finally {
@@ -93,7 +93,7 @@ export default function DashboardTodos({ canEdit }: { canEdit: boolean }) {
<BlockSkeleton lines={3} />
</div>
) : jobs.length === 0 ? (
<div className="card-body text-secondary">{t("Nothing to do.")}{canEdit ? " Add a job below." : ""}</div>
<div className="card-body text-secondary">{t("Nothing to do.")}{canEdit ? ` ${t("Add a job below.")}` : ""}</div>
) : (
<ul className="list-group list-group-flush">
{jobs.map((t) => {
+26 -26
View File
@@ -10,9 +10,9 @@ import TimeAgo from "./TimeAgo";
import { t } from "../i18n";
const KIND_WORDS: Record<DbSnapshot["kind"], { label: string; badge: string; hint: string }> = {
scheduled: { label: "daily", badge: "bg-blue-lt text-blue", hint: "Taken by the daily schedule" },
manual: { label: "made by hand", badge: "bg-secondary-lt text-secondary", hint: "Taken with Back up now" },
"pre-restore": { label: "before a restore", badge: "bg-yellow-lt text-yellow", hint: "The database that was in use when a restore took effect — restore this to undo it" },
scheduled: { label: "daily", badge: "bg-blue-lt text-blue", get hint() { return t("Taken by the daily schedule"); } },
manual: { label: "made by hand", badge: "bg-secondary-lt text-secondary", get hint() { return t("Taken with Back up now"); } },
"pre-restore": { label: "before a restore", badge: "bg-yellow-lt text-yellow", get hint() { return t("The database that was in use when a restore took effect — restore this to undo it"); } },
uploaded: { label: "uploaded", badge: "bg-cyan-lt text-cyan", hint: "A file somebody uploaded" },
};
@@ -72,9 +72,9 @@ export default function DatabaseBackups() {
async function restore(s: DbSnapshot) {
const ok = await confirmDialog({
title: "Restore this backup?",
title: t("Restore this backup?"),
message: `The database becomes the one in ${s.name}, taken ${formatDateTime(new Date(s.at))}, the next time Homelab Manager starts. Anything changed since then — users, edits, the audit log — is replaced by what that backup has. The database in use now is kept as a "before a restore" backup, so this can be undone. Nothing changes until it is restarted.`,
confirmLabel: "Stage the restore",
confirmLabel: t("Stage the restore"),
danger: true,
});
if (!ok) return;
@@ -82,7 +82,7 @@ export default function DatabaseBackups() {
}
async function remove(s: DbSnapshot) {
if (!(await confirmDialog({ title: "Delete this backup?", message: `${s.name} is deleted for good.`, confirmLabel: "Delete", danger: true }))) return;
if (!(await confirmDialog({ title: t("Delete this backup?"), message: `${s.name} is deleted for good.`, confirmLabel: t("Delete"), danger: true }))) return;
await run(`delete:${s.name}`, () => api.dbBackups.remove(s.name), () => "Deleted.");
}
@@ -100,14 +100,14 @@ export default function DatabaseBackups() {
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Database backups</h3>
<h3 className="card-title">{t("Database backups")}</h3>
<div className="card-actions btn-list">
<input ref={fileRef} type="file" accept=".sqlite,.db,application/octet-stream" className="d-none" onChange={(e) => e.target.files?.[0] && void upload(e.target.files[0])} />
<button type="button" className="btn btn-sm btn-outline-secondary" disabled={busy !== null} onClick={() => fileRef.current?.click()}>
{busy === "upload" ? "Uploading…" : "Upload a backup…"}
{busy === "upload" ? t("Uploading…") : t("Upload a backup…")}
</button>
<button type="button" className="btn btn-sm btn-primary" disabled={busy !== null} onClick={() => void run("create", () => api.dbBackups.create(), (r) => `Backed up: ${r.snapshot.name}`)}>
{busy === "create" ? "Backing up…" : "Back up now"}
{busy === "create" ? t("Backing up…") : t("Back up now")}
</button>
</div>
</div>
@@ -123,7 +123,7 @@ export default function DatabaseBackups() {
{failing && (
<div className="alert alert-danger">
<div>
<strong>The last backup didn't work</strong> (<TimeAgo value={data.lastAttempt!.at} />): {data.lastAttempt!.error}
<strong>{t("The last backup didn't work")}</strong> (<TimeAgo value={data.lastAttempt!.at} />): {data.lastAttempt!.error}
</div>
</div>
)}
@@ -132,10 +132,10 @@ export default function DatabaseBackups() {
<div className="alert alert-warning">
<div className="d-flex flex-wrap align-items-center gap-2 w-100">
<div className="flex-fill">
<strong>A restore is waiting.</strong> The database becomes <code>{data.staged.from}</code> the next time Homelab Manager starts — restart it to finish (with the standard Docker setup: <code>docker compose restart homelab-manager</code>). The database in use now is kept as a backup.
<strong>{t("A restore is waiting.")}</strong> {t("The database becomes")} <code>{data.staged.from}</code> the next time Homelab Manager starts — restart it to finish (with the standard Docker setup: <code>docker compose restart homelab-manager</code>). The database in use now is kept as a backup.
</div>
<button type="button" className="btn btn-sm btn-outline-secondary" disabled={busy !== null} onClick={() => void run("cancel", () => api.dbBackups.cancelRestore(), () => "The restore was cancelled.")}>
Cancel the restore
{t("Cancel the restore")}
</button>
</div>
</div>
@@ -145,7 +145,7 @@ export default function DatabaseBackups() {
<div className="alert alert-success">
<div className="d-flex flex-wrap align-items-center gap-2 w-100">
<div className="flex-fill">
<strong>The database was restored</strong> from <code>{data.lastRestore.from}</code> <TimeAgo value={data.lastRestore.restoredAt} />
<strong>{t("The database was restored")}</strong> from <code>{data.lastRestore.from}</code> <TimeAgo value={data.lastRestore.restoredAt} />
{data.lastRestore.by ? ` (staged by ${data.lastRestore.by})` : ""}.
{data.lastRestore.keptAs && (
<>
@@ -164,15 +164,15 @@ export default function DatabaseBackups() {
<div className="row g-3 mb-3">
<div className="col-md-4">
<div className="text-secondary small">Newest backup</div>
<div className="text-secondary small">{t("Newest backup")}</div>
<div>{newest ? <><TimeAgo value={newest.at} /> <span className="text-secondary">({size(newest.sizeBytes)})</span></> : <span className="text-warning">none yet</span>}</div>
</div>
<div className="col-md-4">
<div className="text-secondary small">Next one</div>
<div className="text-secondary small">{t("Next one")}</div>
<div>{data.nextRun ? formatDateTime(new Date(data.nextRun)) : <span className="text-secondary">daily backups are off</span>}</div>
</div>
<div className="col-md-4">
<div className="text-secondary small">Kept</div>
<div className="text-secondary small">{t("Kept")}</div>
<div>{data.snapshots.length} {data.snapshots.length === 1 ? "file" : "files"}</div>
</div>
</div>
@@ -187,7 +187,7 @@ export default function DatabaseBackups() {
<div className="col-auto">
<label className="form-check form-switch mb-2">
<input className="form-check-input" type="checkbox" checked={draft.enabled} onChange={(e) => setDraft({ ...draft, enabled: e.target.checked })} />
<span className="form-check-label">Back up every day</span>
<span className="form-check-label">{t("Back up every day")}</span>
</label>
</div>
<div className="col-auto">
@@ -198,7 +198,7 @@ export default function DatabaseBackups() {
</div>
<div className="col-auto">
<label className="form-label small mb-1" htmlFor="db-backup-keep">
Keep the newest
{t("Keep the newest")}
</label>
<input id="db-backup-keep" type="number" min={1} max={90} className="form-control form-control-sm" style={{ width: 90 }} disabled={!draft.enabled} value={draft.keep} onChange={(e) => setDraft({ ...draft, keep: Number(e.target.value) })} />
</div>
@@ -211,16 +211,16 @@ export default function DatabaseBackups() {
</form>
{data.snapshots.length === 0 ? (
<div className="text-secondary">No backups yet. Press Back up now to make the first.</div>
<div className="text-secondary">{t("No backups yet. Press Back up now to make the first.")}</div>
) : (
<div className="table-responsive">
<table className="table table-sm table-vcenter mb-0">
<thead>
<tr>
<th>Backup</th>
<th>Kind</th>
<th>Taken</th>
<th>Size</th>
<th>{t("Backup")}</th>
<th>{t("Kind")}</th>
<th>{t("Taken")}</th>
<th>{t("Size")}</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
@@ -243,13 +243,13 @@ export default function DatabaseBackups() {
<td>
<div className="btn-list flex-nowrap">
<a className="btn btn-sm btn-outline-secondary" href={api.dbBackups.downloadUrl(s.name)} download>
Download
{t("Download")}
</a>
<button type="button" className="btn btn-sm btn-outline-secondary" disabled={busy !== null} onClick={() => void run(`check:${s.name}`, () => api.dbBackups.check(s.name).then((r) => setChecks((c) => ({ ...c, [s.name]: r.check }))))}>
{busy === `check:${s.name}` ? "Checking…" : "Check"}
{busy === `check:${s.name}` ? t("Checking…") : t("Check")}
</button>
<button type="button" className="btn btn-sm btn-outline-warning" disabled={busy !== null || data.staged !== null} onClick={() => void restore(s)}>
Restore…
{t("Restore…")}
</button>
<button type="button" className="btn btn-sm btn-outline-danger" disabled={busy !== null} onClick={() => void remove(s)}>
{t("Delete")}
+4 -3
View File
@@ -6,6 +6,7 @@ import { PageSkeleton } from "./Skeleton";
import { readableError } from "../utils/errors";
import MapLinesToggle, { useMapLineStyle } from "../components/MapLinesToggle";
import { edgePath } from "../utils/mapLines";
import { t } from "../i18n";
const NODE_W = 200;
const NODE_H = 46;
@@ -186,14 +187,14 @@ export default function DependencyMap() {
{selected !== active && <span className="text-secondary small ms-2">(click to keep this)</span>}
</div>
<div className={sets.down.size ? "text-red" : "text-secondary"}>
{sets.down.size ? `If it goes down, ${sets.down.size} ${sets.down.size === 1 ? "thing goes" : "things go"} with it: ${names(graph, sets.down).join(", ")}.` : "Nothing depends on it."}
{sets.down.size ? `If it goes down, ${sets.down.size} ${sets.down.size === 1 ? "thing goes" : "things go"} with it: ${names(graph, sets.down).join(", ")}.` : t("Nothing depends on it.")}
</div>
<div className="text-secondary">{sets.up.size ? `It relies on ${names(graph, sets.up).join(", ")}.` : "It relies on nothing here."}</div>
<div className="text-secondary">{sets.up.size ? `It relies on ${names(graph, sets.up).join(", ")}.` : t("It relies on nothing here.")}</div>
</div>
) : (
<div className="text-secondary small d-flex flex-wrap gap-3">
<span>Lines run from what is needed (left) to what needs it (right). Dashed: &ldquo;runs on&rdquo;, set on the server.</span>
<span className="ms-auto">Pick a box to see what would go down with it.</span>
<span className="ms-auto">{t("Pick a box to see what would go down with it.")}</span>
</div>
)}
</div>
+1 -1
View File
@@ -94,7 +94,7 @@ const ISO_DATE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
function formatValue(key: string, value: unknown): ReactNode {
if (value === null || value === undefined || value === "") return <span className="text-secondary">—</span>;
if (typeof value === "boolean") return value ? "Yes" : "No";
if (typeof value === "boolean") return value ? t("Yes") : t("No");
if (typeof value === "number") return /bytes?$/i.test(key) ? `${formatBytes(value)} (${value.toLocaleString()} bytes)` : value.toLocaleString();
if (typeof value === "string") {
if (ISO_DATE.test(value) && !Number.isNaN(Date.parse(value))) return formatDateTime(new Date(value));
+10 -10
View File
@@ -8,9 +8,9 @@ type Kind = NewDnsZoneInput["type"];
type Protocol = "Udp" | "Tcp" | "Tls" | "Https" | "Quic";
const KINDS: { value: Kind; label: string; hint: string }[] = [
{ value: "Primary", label: "Primary zone", hint: "This server holds the zone: its records are made and changed here. It starts with the records Technitium makes for it; the rest are added under Records." },
{ value: "Secondary", label: "Secondary zone", hint: "A copy of a zone another server holds. This server fetches it from there and keeps it up to date; it can only be read here." },
{ value: "Forwarder", label: "Forwarder zone", hint: "Questions about this name (and under it) are passed on to another DNS server — for a domain another server answers, such as a company network." },
{ value: "Primary", get label() { return t("Primary zone"); }, hint: "This server holds the zone: its records are made and changed here. It starts with the records Technitium makes for it; the rest are added under Records." },
{ value: "Secondary", get label() { return t("Secondary zone"); }, hint: "A copy of a zone another server holds. This server fetches it from there and keeps it up to date; it can only be read here." },
{ value: "Forwarder", get label() { return t("Forwarder zone"); }, hint: "Questions about this name (and under it) are passed on to another DNS server — for a domain another server answers, such as a company network." },
];
/** The servers a person typed, one to a line or separated by commas or spaces. */
@@ -51,7 +51,7 @@ export default function DnsNewZone({ providerId, providerName, onCreated, onCanc
<ErrorNotice error={error} />
<div className="mb-2">
<label className="form-label" htmlFor="newzone-kind">
Kind
{t("Kind")}
</label>
<select id="newzone-kind" className="form-select form-select-sm" value={kind} onChange={(e) => setKind(e.target.value as Kind)}>
{KINDS.map((k) => (
@@ -72,23 +72,23 @@ export default function DnsNewZone({ providerId, providerName, onCreated, onCanc
{kind === "Secondary" && (
<div className="mb-2">
<label className="form-label" htmlFor="newzone-primaries">
Servers that hold it
{t("Servers that hold it")}
</label>
<input id="newzone-primaries" className="form-control form-control-sm" required maxLength={600} autoComplete="off" placeholder="10.0.0.2, ns1.example.lan" value={primaries} onChange={(e) => setPrimaries(e.target.value)} />
<div className="text-secondary small mt-1">Addresses or host names, separated by commas.</div>
<div className="text-secondary small mt-1">{t("Addresses or host names, separated by commas.")}</div>
</div>
)}
{kind === "Forwarder" && (
<div className="row g-2 mb-2">
<div className="col-md-6">
<label className="form-label" htmlFor="newzone-forwarder">
Pass questions to
{t("Pass questions to")}
</label>
<input id="newzone-forwarder" className="form-control form-control-sm" required maxLength={255} autoComplete="off" placeholder="10.1.1.1 — or this-server" value={forwarder} onChange={(e) => setForwarder(e.target.value)} />
</div>
<div className="col-md-3">
<label className="form-label" htmlFor="newzone-protocol">
Protocol
{t("Protocol")}
</label>
<select id="newzone-protocol" className="form-select form-select-sm" value={protocol} onChange={(e) => setProtocol(e.target.value as Protocol)}>
{(["Udp", "Tcp", "Tls", "Https", "Quic"] as Protocol[]).map((p) => (
@@ -101,14 +101,14 @@ export default function DnsNewZone({ providerId, providerName, onCreated, onCanc
<div className="col-md-3 d-flex align-items-end">
<label className="form-check mb-1">
<input type="checkbox" className="form-check-input" checked={dnssec} onChange={(e) => setDnssec(e.target.checked)} />
<span className="form-check-label">Check DNSSEC</span>
<span className="form-check-label">{t("Check DNSSEC")}</span>
</label>
</div>
</div>
)}
<div className="d-flex gap-2 mt-3">
<button type="submit" className="btn btn-sm btn-primary" disabled={busy || name.trim() === ""}>
{busy ? "Making…" : "Make zone"}
{busy ? "Making…" : t("Make zone")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={onCancel} disabled={busy}>
{t("Cancel")}
+5 -5
View File
@@ -72,7 +72,7 @@ export default function DnsProviderForm({
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Add a DNS provider</h3>
<h3 className="card-title">{t("Add a DNS provider")}</h3>
</div>
<form onSubmit={submit}>
<div className="card-body row g-3">
@@ -82,7 +82,7 @@ export default function DnsProviderForm({
</div>
)}
<div className="col-md-4">
<label className="form-label">Provider</label>
<label className="form-label">{t("Provider")}</label>
<select
className="form-select"
value={providerType}
@@ -96,7 +96,7 @@ export default function DnsProviderForm({
</select>
</div>
<div className="col-md-4">
<label className="form-label">Display name</label>
<label className="form-label">{t("Display name")}</label>
<input
className="form-control"
required
@@ -148,10 +148,10 @@ export default function DnsProviderForm({
</div>
<div className="card-footer d-flex gap-2">
<button type="button" className="btn btn-outline-secondary" onClick={testConnection} disabled={testing}>
{testing ? "Testing…" : "Test connection"}
{testing ? "Testing…" : t("Test connection")}
</button>
<button type="submit" className="btn btn-primary" disabled={saving}>
Add provider
{t("Add provider")}
</button>
<button type="button" className="btn" onClick={onCancel}>
{t("Cancel")}
+17 -17
View File
@@ -70,12 +70,12 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
const fill = (o: DnsZoneOptionsInfo) => {
setOptions(o);
setQueryAccess(o.queryAccess ?? "Allow");
setQueryAccess(o.queryAccess ?? t("Allow"));
setQueryAcl(o.queryAccessNetworkACL.join("\n"));
setTransfer(o.zoneTransfer ?? "Deny");
setTransfer(o.zoneTransfer ?? t("Deny"));
setTransferAcl(o.zoneTransferNetworkACL.join("\n"));
setKeys(o.zoneTransferTsigKeyNames);
setNotify(o.notify ?? "None");
setNotify(o.notify ?? t("None"));
setNotifyServers(o.notifyNameServers.join("\n"));
};
@@ -95,7 +95,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
async function switchTo(on: boolean) {
if (!options) return;
if (!on && !(await confirmDialog({ title: "Switch off zone", message: `Switch off "${zone.name}"? The server stops answering for it. Its records stay, and switching it on again brings it all back.`, confirmLabel: "Switch off", danger: true }))) return;
if (!on && !(await confirmDialog({ title: t("Switch off zone"), message: `Switch off "${zone.name}"? The server stops answering for it. Its records stay, and switching it on again brings it all back.`, confirmLabel: t("Switch off"), danger: true }))) return;
setBusy(true);
setError(null);
try {
@@ -132,7 +132,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
const r = await api.dns.zones.updateOptions(providerId, zone.id, change);
if (r.options) fill(r.options);
setUnexpected(r.unexpected);
toast.success(r.changed.length === 0 ? "Nothing was different." : `Saved: ${r.changed.map((c) => NAMES[c] ?? c).join(", ")}.`);
toast.success(r.changed.length === 0 ? t("Nothing was different.") : `Saved: ${r.changed.map((c) => NAMES[c] ?? c).join(", ")}.`);
} catch (err) {
setError(readableError(err));
} finally {
@@ -149,7 +149,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
</button>
</div>
<ErrorNotice error={error} />
{!options && !error && <div className="text-secondary small">Reading how the zone is set…</div>}
{!options && !error && <div className="text-secondary small">{t("Reading how the zone is set…")}</div>}
{options && (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
@@ -158,22 +158,22 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
{options.disabled ? <span className="text-yellow">switched off: the server does not answer for it.</span> : "on."}
</span>
<button type="button" className={`btn btn-sm ${options.disabled ? "btn-primary" : "btn-outline-secondary"}`} disabled={busy} onClick={() => void switchTo(options.disabled)}>
{options.disabled ? "Switch on" : "Switch off"}
{options.disabled ? t("Switch on") : t("Switch off")}
</button>
</div>
{!hasQuery && !hasTransferAndNotify ? (
<div className="text-secondary small">There are no options to edit on this kind of zone from here.</div>
<div className="text-secondary small">{t("There are no options to edit on this kind of zone from here.")}</div>
) : (
<form onSubmit={save}>
{hasQuery && (
<fieldset className="mb-3">
<legend className="fs-5">Who may ask this zone</legend>
<Choice id="zopt-query" label="Questions about it are answered for" value={queryAccess} options={QUERY_ACCESS} onChange={setQueryAccess} />
<legend className="fs-5">{t("Who may ask this zone")}</legend>
<Choice id="zopt-query" label={t("Questions about it are answered for")} value={queryAccess} options={QUERY_ACCESS} onChange={setQueryAccess} />
{usesAcl(queryAccess) && (
<div className="mb-2">
<label className="form-label" htmlFor="zopt-query-acl">
Networks
{t("Networks")}
</label>
<textarea id="zopt-query-acl" className="form-control form-control-sm" rows={3} placeholder={"192.168.1.0/24\n!192.168.1.66"} value={queryAcl} onChange={(e) => setQueryAcl(e.target.value)} />
<div className="text-secondary small">One to a line, in order: an address or a network, with ! in front to refuse it. Anyone not listed is refused.</div>
@@ -184,12 +184,12 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
{hasTransferAndNotify && (
<>
<fieldset className="mb-3">
<legend className="fs-5">Who may copy this zone</legend>
<legend className="fs-5">{t("Who may copy this zone")}</legend>
<Choice id="zopt-transfer" label="A zone transfer is given to" value={transfer} options={ZONE_TRANSFER} onChange={setTransfer} />
{usesAcl(transfer) && (
<div className="mb-2">
<label className="form-label" htmlFor="zopt-transfer-acl">
Networks
{t("Networks")}
</label>
<textarea id="zopt-transfer-acl" className="form-control form-control-sm" rows={3} value={transferAcl} onChange={(e) => setTransferAcl(e.target.value)} />
</div>
@@ -197,7 +197,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
<div className="mb-1">
<div className="form-label">Only with one of these TSIG keys</div>
{options.availableTsigKeyNames.length === 0 ? (
<div className="text-secondary small">The server has no TSIG keys, so a transfer is not limited by one.</div>
<div className="text-secondary small">{t("The server has no TSIG keys, so a transfer is not limited by one.")}</div>
) : (
options.availableTsigKeyNames.map((k) => (
<label key={k} className="form-check form-check-inline">
@@ -209,7 +209,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
</div>
</fieldset>
<fieldset className="mb-3">
<legend className="fs-5">Who is told when it changes</legend>
<legend className="fs-5">{t("Who is told when it changes")}</legend>
<Choice id="zopt-notify" label="A notification goes to" value={notify} options={NOTIFY} onChange={setNotify} />
{usesServers(notify) && (
<div className="mb-2">
@@ -217,7 +217,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
{t("Servers")}
</label>
<textarea id="zopt-notify-servers" className="form-control form-control-sm" rows={2} placeholder="10.0.0.2" value={notifyServers} onChange={(e) => setNotifyServers(e.target.value)} />
<div className="text-secondary small">Addresses, one to a line.</div>
<div className="text-secondary small">{t("Addresses, one to a line.")}</div>
</div>
)}
</fieldset>
@@ -229,7 +229,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
</div>
)}
<button type="submit" className="btn btn-sm btn-primary" disabled={busy}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
</form>
)}
+4 -3
View File
@@ -7,6 +7,7 @@ import { BlockSkeleton } from "./Skeleton";
import { ErrorNotice } from "./Notice";
import { CHART_RANGES, useChartRange } from "../utils/chartRanges";
import { readableError } from "../utils/errors";
import { t } from "../i18n";
const SOURCE_WORDS: Record<History["source"], string> = {
results: "each answer",
@@ -80,17 +81,17 @@ export default function EndpointHistory({ checkId, name, onClose }: { checkId: n
</div>
<div className="mb-3">
<TimeChart series={readings} from={Math.max(from, to - history.values.days * 86_400_000)} to={to} unit="value" format={(v) => `${+v.toPrecision(4)}${history.values?.unit ? ` ${history.values.unit}` : ""}`} label={`${name}: the value read over the last ${Math.min(days, 14)} days`} empty="Nothing read in this stretch yet." />
{days > 14 && <div className="text-secondary small mt-1">Values are kept 14 days, so this reaches back no further.</div>}
{days > 14 && <div className="text-secondary small mt-1">{t("Values are kept 14 days, so this reaches back no further.")}</div>}
</div>
</>
)}
<h4 className="mb-1">Availability</h4>
<h4 className="mb-1">{t("Availability")}</h4>
<div className="mb-3">
<TimeChart series={availability} from={from} to={to} label={`${name}: availability over the last ${rangeLabel}`} bars={history.points.length <= 120} barColor={(v) => (v >= 99.9 ? "#2fb344" : v >= 90 ? "#f59f00" : "#f03e3e")} empty="No checks in this stretch yet." />
</div>
<h4 className="mb-1">Answer time</h4>
<h4 className="mb-1">{t("Answer time")}</h4>
<TimeChart series={answer} from={from} to={to} unit="ms" label={`${name}: answer time over the last ${rangeLabel}`} empty="No timed answers in this stretch yet." />
<div className="text-secondary small mt-2">
Drawn from {SOURCE_WORDS[history.source]}.
+7 -6
View File
@@ -3,6 +3,7 @@ import { Link } from "react-router-dom";
import { api, type EndpointSuggestion } from "../api/client";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { t } from "../i18n";
/**
* Checks the app could set up for you, from what it already knows: a web port a server is listening on (with the name DNS gives it), an app recognised from its container
@@ -71,17 +72,17 @@ export default function EndpointSuggestions({ onAdded }: { onAdded: () => void }
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">
{offered.length > 0 ? `Suggested checks (${offered.length})` : "No suggestions right now"}
{offered.length > 0 ? `Suggested checks (${offered.length})` : t("No suggestions right now")}
</h3>
<div className="card-actions d-flex gap-2">
{offered.length > 1 && open && (
<button className="btn btn-sm btn-primary" disabled={busy !== null} onClick={() => void add(offered.map((s) => s.key), "all")}>
{busy === "all" ? "Adding…" : `Add all ${offered.length}`}
{busy === "all" ? t("Adding…") : `Add all ${offered.length}`}
</button>
)}
{offered.length > 0 && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => setOpen((o) => !o)} aria-expanded={open}>
{open ? "Hide" : "Show"}
{open ? "Hide" : t("Show")}
</button>
)}
</div>
@@ -98,7 +99,7 @@ export default function EndpointSuggestions({ onAdded }: { onAdded: () => void }
<div className="row align-items-center g-2">
<div className="col" style={{ minWidth: 0 }}>
<div className="text-break">
<strong>{s.name}</strong> <span className="badge bg-secondary-lt text-secondary">{s.kind === "http" ? "Web address" : "Certificate"}</span>
<strong>{s.name}</strong> <span className="badge bg-secondary-lt text-secondary">{s.kind === "http" ? t("Web address") : t("Certificate")}</span>
</div>
<div className="text-secondary small text-break">
{s.target}
@@ -118,10 +119,10 @@ export default function EndpointSuggestions({ onAdded }: { onAdded: () => void }
<div className="col-auto">
<div className="btn-list flex-nowrap">
<button className="btn btn-sm btn-primary" disabled={busy !== null} onClick={() => void add([s.key], s.key)}>
{busy === s.key ? "Adding…" : "Add"}
{busy === s.key ? t("Adding…") : t("Add")}
</button>
<button className="btn btn-sm btn-outline-secondary" disabled={busy !== null} onClick={() => void dismiss([s.key], s.key)}>
Not for me
{t("Not for me")}
</button>
</div>
</div>
+1 -1
View File
@@ -53,7 +53,7 @@ export default function FigureHistory({ integrationId, name }: { integrationId:
return (
<div className="mt-3">
<button type="button" className="btn btn-sm btn-outline-secondary" aria-expanded={open} onClick={() => setOpen((o) => !o)}>
{open ? "Hide the history" : "Show the history"}
{open ? "Hide the history" : t("Show the history")}
</button>
{open && (
<div className="mt-3">
+2 -2
View File
@@ -47,7 +47,7 @@ export default function HetznerServerCard({ serverId }: { serverId: number }) {
{s.rescueEnabled && <span className="badge bg-yellow-lt text-yellow ms-1">rescue on</span>}
</div>
<div className="col-6 col-lg-3">
<div className="text-secondary small">Type and place</div>
<div className="text-secondary small">{t("Type and place")}</div>
{s.type ?? "—"} · {s.location ?? "?"}
</div>
<div className="col-6 col-lg-3">
@@ -56,7 +56,7 @@ export default function HetznerServerCard({ serverId }: { serverId: number }) {
{match.snapshots > 0 && <span className="text-secondary small"> · {match.snapshots} snapshot{match.snapshots === 1 ? "" : "s"}</span>}
</div>
<div className="col-6 col-lg-3">
<div className="text-secondary small">Traffic this month</div>
<div className="text-secondary small">{t("Traffic this month")}</div>
<TrafficBar used={s.outgoingTraffic} included={s.includedTraffic} />
<ForecastText forecast={match.forecast} included={s.includedTraffic} />
</div>
+2 -1
View File
@@ -1,6 +1,7 @@
import type { ReactNode } from "react";
import { IconEye, IconEyeOff } from "@tabler/icons-react";
import { setCardHidden, useDashboardLayout } from "../utils/dashboardLayout";
import { t } from "../i18n";
/** Whether the person has hidden a dashboard card, whether they are arranging the dashboard, and so whether the card is to be drawn (hidden ones are drawn, dimmed, while arranging). */
export function useCardState(label: string): { hidden: boolean; editing: boolean; shown: boolean } {
@@ -16,7 +17,7 @@ export function HideBar({ label, hidden }: { label: string; hidden: boolean }) {
<span className="small text-secondary">{label}</span>
<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 ? "Show" : t("Hide")}
<span className="visually-hidden"> {label}</span>
</button>
</div>
+18 -17
View File
@@ -1,6 +1,7 @@
import { useState } from "react";
import type { HostHealth } from "../api/client";
import TimeAgo from "./TimeAgo";
import { t } from "../i18n";
/** The degraded states of a ZFS pool are all "not fine", but only ONLINE is quite fine. */
const poolFine = (health: string) => health.toUpperCase() === "ONLINE";
@@ -43,7 +44,7 @@ export default function HostHealthCard({
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Host health</h3>
<h3 className="card-title">{t("Host health")}</h3>
{health?.reportedAt && (
<div className="card-actions text-secondary small">
reported <TimeAgo value={health.reportedAt} />
@@ -53,7 +54,7 @@ export default function HostHealthCard({
<div className="card-body">
{failedUnits !== undefined && (
<div className={hasSmart || hasZfs ? "mb-3" : ""}>
<div className="text-secondary small mb-1">Services</div>
<div className="text-secondary small mb-1">{t("Services")}</div>
{failedUnits.filter((u) => !u.ignored).length === 0 ? (
<span className="badge bg-green-lt text-green">none have failed</span>
) : null}
@@ -65,8 +66,8 @@ export default function HostHealthCard({
<code>{u.unit}</code>
{u.description && <span className="text-secondary small ms-2">{u.description}</span>}
{onIgnoredChange && !u.ignored && (
<button type="button" className="btn btn-link btn-sm p-0 ms-2 align-baseline" disabled={busy} title="Stop counting this service as failed on this server" onClick={() => void change([...ignored, u.unit])}>
Ignore
<button type="button" className="btn btn-link btn-sm p-0 ms-2 align-baseline" disabled={busy} title={t("Stop counting this service as failed on this server")} onClick={() => void change([...ignored, u.unit])}>
{t("Ignore")}
</button>
)}
</li>
@@ -78,7 +79,7 @@ export default function HostHealthCard({
{(ignored.length > 0 || onIgnoredChange) && (
<div className={hasSmart || hasZfs ? "mb-3" : ""}>
<div className="text-secondary small mb-1">Services this server ignores</div>
<div className="text-secondary small mb-1">{t("Services this server ignores")}</div>
{ignored.length === 0 && <div className="text-secondary small mb-1">None. A service that always fails here (an updater, say) can be ignored, so it stops raising an alert.</div>}
<div className="d-flex flex-wrap gap-2 mb-1">
{ignored.map((p) => (
@@ -99,9 +100,9 @@ export default function HostHealthCard({
if (p && !ignored.includes(p)) void change([...ignored, p]);
}}
>
<input className="form-control form-control-sm" style={{ maxWidth: "18rem" }} aria-label="A service name or pattern to ignore" placeholder="a name, or a pattern like gupdate*" maxLength={100} value={pattern} onChange={(e) => setPattern(e.target.value)} />
<input className="form-control form-control-sm" style={{ maxWidth: "18rem" }} aria-label={t("A service name or pattern to ignore")} placeholder="a name, or a pattern like gupdate*" maxLength={100} value={pattern} onChange={(e) => setPattern(e.target.value)} />
<button type="submit" className="btn btn-sm" disabled={busy || pattern.trim() === ""}>
Ignore
{t("Ignore")}
</button>
</form>
)}
@@ -110,16 +111,16 @@ export default function HostHealthCard({
{hasSmart && (
<div className={hasZfs ? "mb-3" : ""}>
<div className="text-secondary small mb-1">Disks (SMART)</div>
<div className="text-secondary small mb-1">{t("Disks (SMART)")}</div>
<div className="table-responsive">
<table className="table table-sm table-vcenter mb-0">
<thead>
<tr>
<th>Disk</th>
<th>Model</th>
<th>Verdict</th>
<th>Temperature</th>
<th>Life used</th>
<th>{t("Disk")}</th>
<th>{t("Model")}</th>
<th>{t("Verdict")}</th>
<th>{t("Temperature")}</th>
<th>{t("Life used")}</th>
</tr>
</thead>
<tbody>
@@ -150,14 +151,14 @@ export default function HostHealthCard({
{hasZfs && (
<div>
<div className="text-secondary small mb-1">Storage pools (ZFS or Storage Spaces)</div>
<div className="text-secondary small mb-1">{t("Storage pools (ZFS or Storage Spaces)")}</div>
<div className="table-responsive">
<table className="table table-sm table-vcenter mb-0">
<thead>
<tr>
<th>Pool</th>
<th>State</th>
<th>Used</th>
<th>{t("Pool")}</th>
<th>{t("State")}</th>
<th>{t("Used")}</th>
</tr>
</thead>
<tbody>
+2 -1
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type DependentImpactItem } from "../api/client";
import { t } from "../i18n";
export interface ImpactTarget {
type: string;
@@ -58,7 +59,7 @@ export default function ImpactNote({
</div>
<div className="mb-1">
{shown.map((d) => (
<span key={d.key} className="badge bg-yellow-lt text-yellow me-1" title={d.distance > 1 ? "Through something else that needs it" : "Needs it directly"}>
<span key={d.key} className="badge bg-yellow-lt text-yellow me-1" title={d.distance > 1 ? t("Through something else that needs it") : t("Needs it directly")}>
{d.name}
{d.silenced ? " · already silenced" : ""}
</span>
+13 -13
View File
@@ -90,9 +90,9 @@ export default function IncidentHistory() {
}
const cards: { label: string; value: string | number; note?: string; color: string }[] = [
{ label: "Open now", value: incidents ? open : "…", color: open > 0 ? "text-red" : "text-green" },
{ label: "Began in the last week", value: incidents ? week : "…", color: "" },
{ label: "Longest so far", value: longest ? durationWords(longest.durationMs) : incidents ? "—" : "…", note: longest?.message, color: "text-secondary" },
{ label: t("Open now"), value: incidents ? open : "…", color: open > 0 ? "text-red" : "text-green" },
{ label: t("Began in the last week"), value: incidents ? week : "…", color: "" },
{ label: t("Longest so far"), value: longest ? durationWords(longest.durationMs) : incidents ? "—" : "…", note: longest?.message, color: "text-secondary" },
];
return (
@@ -121,12 +121,12 @@ export default function IncidentHistory() {
<TableToolbar
search={tableSearch.query}
onSearch={tableSearch.setQuery}
placeholder="Search incidents…"
placeholder={t("Search incidents…")}
filters={
<select className="form-select form-select-sm w-auto" aria-label={t("Show")} value={status} onChange={(e) => setStatus(e.target.value as typeof status)}>
<option value="all">Open and resolved</option>
<option value="all">{t("Open and resolved")}</option>
<option value="open">{t("Open")}</option>
<option value="resolved">Resolved</option>
<option value="resolved">{t("Resolved")}</option>
</select>
}
shown={sorted?.length}
@@ -138,13 +138,13 @@ export default function IncidentHistory() {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<Row> label="Began" sortKeyName="openedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="State" sortKeyName="openFirst" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Lasted" sortKeyName="durationMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Worst" sortKeyName="peakSeverity" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Kind" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Began")} sortKeyName="openedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("State")} sortKeyName="openFirst" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Lasted")} sortKeyName="durationMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Worst")} sortKeyName="peakSeverity" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Kind")} sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Where")} sortKeyName="where" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="What" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("What")} sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
</tr>
</thead>
<tbody>
@@ -179,7 +179,7 @@ export default function IncidentHistory() {
</tr>
))}
{incidents !== null && (sorted ?? []).length === 0 && (
<EmptyRow colSpan={7} {...(tableSearch.active || status !== "all" ? { filtered: () => { tableSearch.setQuery(""); setStatus("all"); } } : { title: "No incidents yet", hint: "An incident is recorded each time an alert is raised and later goes away, so the first one appears when something goes wrong." })} />
<EmptyRow colSpan={7} {...(tableSearch.active || status !== "all" ? { filtered: () => { tableSearch.setQuery(""); setStatus("all"); } } : { title: t("No incidents yet"), hint: t("An incident is recorded each time an alert is raised and later goes away, so the first one appears when something goes wrong.") })} />
)}
</tbody>
</table>
+4 -4
View File
@@ -106,7 +106,7 @@ export default function IntegrationEditForm({
</div>
)}
<div className="col-md-4">
<label className="form-label">Display name</label>
<label className="form-label">{t("Display name")}</label>
<input className="form-control" required value={name} onChange={(e) => setName(e.target.value)} />
</div>
@@ -128,7 +128,7 @@ export default function IntegrationEditForm({
<input
type={field.type === "password" ? "password" : "text"}
className="form-control"
placeholder={field.secret ? "Leave blank to keep the current value" : field.placeholder}
placeholder={field.secret ? t("Leave blank to keep the current value") : field.placeholder}
required={!field.secret && !field.optional}
value={(values[field.key] as string) ?? ""}
onChange={(e) => setField(field.key, e.target.value)}
@@ -152,10 +152,10 @@ export default function IntegrationEditForm({
</div>
<div className="card-footer d-flex gap-2">
<button type="button" className="btn btn-outline-secondary" onClick={testConnection} disabled={testing}>
{testing ? "Testing…" : "Test connection"}
{testing ? "Testing…" : t("Test connection")}
</button>
<button type="submit" className="btn btn-primary" disabled={saving}>
{saving ? "Saving…" : "Save changes"}
{saving ? "Saving…" : t("Save changes")}
</button>
<button type="button" className="btn" onClick={onCancel}>
{t("Cancel")}
+4 -4
View File
@@ -67,7 +67,7 @@ export default function IntegrationForm({ onCreated, onCancel }: { onCreated: ()
return (
<div className="card mb-3">
<div className="card-body text-secondary">
No integration types are implemented yet.
{t("No integration types are implemented yet.")}
</div>
</div>
);
@@ -76,7 +76,7 @@ export default function IntegrationForm({ onCreated, onCancel }: { onCreated: ()
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Add an integration</h3>
<h3 className="card-title">{t("Add an integration")}</h3>
</div>
<form onSubmit={submit}>
<div className="card-body row g-3">
@@ -89,7 +89,7 @@ export default function IntegrationForm({ onCreated, onCancel }: { onCreated: ()
<IntegrationTypePicker available={availableTypes} value={type} onChange={setType} />
</div>
<div className="col-md-4">
<label className="form-label">Display name</label>
<label className="form-label">{t("Display name")}</label>
<input
className="form-control"
required
@@ -141,7 +141,7 @@ export default function IntegrationForm({ onCreated, onCancel }: { onCreated: ()
</div>
<div className="card-footer d-flex gap-2">
<button type="button" className="btn btn-outline-secondary" onClick={testConnection} disabled={testing || !type}>
{testing ? "Testing…" : "Test connection"}
{testing ? "Testing…" : t("Test connection")}
</button>
<button type="submit" className="btn btn-primary" disabled={saving || !type}>
{t("Add integration")}
+8 -7
View File
@@ -6,6 +6,7 @@ import { toast } from "../utils/toast";
import { TYPE_LABELS } from "../utils/integrationTypes";
import DetailDrawer from "./DetailDrawer";
import { BlockSkeleton } from "./Skeleton";
import { t } from "../i18n";
const EMPTY_WORDS: Record<IntegrationInspection["empty"][number]["what"], string> = {
null: "is empty (null)",
@@ -51,7 +52,7 @@ export default function IntegrationInspector({ integration, onClose }: { integra
}, [integration.id, run]);
return (
<DetailDrawer title="Check what can be read" subtitle={`${TYPE_LABELS[integration.type]} · ${integration.name}`} onClose={onClose}>
<DetailDrawer title={t("Check what can be read")} subtitle={`${TYPE_LABELS[integration.type]} · ${integration.name}`} onClose={onClose}>
<p className="text-secondary small">
Reads it once, now, as the app does every few minutes, and shows what each request got back. Only the <strong>names and kinds</strong> of the values are shown — never the values — so the report can be copied into a message. Nothing is stored or changed.
</p>
@@ -60,11 +61,11 @@ export default function IntegrationInspector({ integration, onClose }: { integra
{report && (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
{report.ok ? <span className="badge bg-green-lt text-green">The read worked</span> : <span className="badge bg-red-lt text-red">The read failed</span>}
{report.ok ? <span className="badge bg-green-lt text-green">{t("The read worked")}</span> : <span className="badge bg-red-lt text-red">{t("The read failed")}</span>}
<span className="text-secondary small">{report.ms} ms · {report.calls.length} {report.calls.length === 1 ? "request" : "requests"}</span>
<span className="ms-auto btn-list flex-nowrap">
<button type="button" className="btn btn-sm" onClick={() => setRun((n) => n + 1)}>
Again
{t("Again")}
</button>
<button
type="button"
@@ -82,7 +83,7 @@ export default function IntegrationInspector({ integration, onClose }: { integra
</div>
{report.error && <div className="text-red mb-3">{report.error}</div>}
<h4>What was asked</h4>
<h4>{t("What was asked")}</h4>
{report.calls.length === 0 && <div className="text-secondary small mb-3">No request was made through the shared helper.</div>}
{report.calls.map((c, i) => (
<div key={i} className="border rounded p-2 mb-2">
@@ -101,14 +102,14 @@ export default function IntegrationInspector({ integration, onClose }: { integra
</div>
))}
<h4 className="mt-3">What the reader made of it</h4>
<h4 className="mt-3">{t("What the reader made of it")}</h4>
{report.resultShape ? (
<pre className="small text-secondary" style={{ whiteSpace: "pre-wrap", wordBreak: "break-word" }}>{report.resultShape}</pre>
) : (
<div className="text-secondary small">Nothing — the read failed.</div>
<div className="text-secondary small">{t("Nothing — the read failed.")}</div>
)}
<h4 className="mt-3">Empty in it</h4>
<h4 className="mt-3">{t("Empty in it")}</h4>
{report.empty.length === 0 ? (
<div className="text-secondary small">Nothing: every field it reads has something in it.</div>
) : (
+5 -4
View File
@@ -2,6 +2,7 @@ import { useState } from "react";
import type { IntegrationType } from "../api/client";
import { groupTypes, TYPE_LABELS } from "../utils/integrationTypes";
import BrandIcon from "./BrandIcon";
import { t } from "../i18n";
/**
* Chooses a kind of integration: the kinds in groups, as the sidebar groups their pages, with a box that narrows them by name or group ("net" finds NetBox and the Network group's).
@@ -17,21 +18,21 @@ export default function IntegrationTypePicker({ available, value, onChange }: {
<div>
<div className="d-flex align-items-center gap-2 mb-2">
<label className="form-label mb-0" htmlFor="integration-type-search">
Integration
{t("Integration")}
</label>
<input
id="integration-type-search"
type="search"
className="form-control form-control-sm"
style={{ maxWidth: 240 }}
placeholder="Search kinds…"
placeholder={t("Search kinds…")}
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
{value && <span className="text-secondary small ms-auto">Chosen: {TYPE_LABELS[value]}</span>}
</div>
{groups.length === 0 && available.length > 0 && <div className="text-secondary small">No kind of integration matches that.</div>}
<div role="radiogroup" aria-label="Kind of integration">
{groups.length === 0 && available.length > 0 && <div className="text-secondary small">{t("No kind of integration matches that.")}</div>}
<div role="radiogroup" aria-label={t("Kind of integration")}>
{groups.map((g) => (
<div key={g.id} className="mb-2">
<div className="text-secondary small text-uppercase fw-bold mb-1">{g.label}</div>
+2 -2
View File
@@ -75,7 +75,7 @@ export default function MaintenanceTimeline({ windows, now }: { windows: Mainten
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Timeline</h3>
<h3 className="card-title">{t("Timeline")}</h3>
<div className="card-actions">
<div className="btn-group btn-group-sm" role="group" aria-label={t("Time range")}>
{RANGES.map((r) => (
@@ -104,7 +104,7 @@ export default function MaintenanceTimeline({ windows, now }: { windows: Mainten
</div>
</div>
<div className="timeline-row timeline-union">
<div className="timeline-label fw-bold">Anything</div>
<div className="timeline-label fw-bold">{t("Anything")}</div>
<div className="timeline-track">
{ticks.map((t) => (
<span key={t} className="timeline-grid" style={{ left: `${pct(t)}%` }} />
+2 -1
View File
@@ -1,5 +1,6 @@
import { useMemo } from "react";
import type { NetworkDevice } from "../api/client";
import { t } from "../i18n";
const KIND_WORDS: Record<NetworkDevice["kind"], string> = { gateway: "Gateway", switch: "Switch", access_point: "Access point", other: "Device" };
const STATE_COLOR: Record<NetworkDevice["state"], string> = { online: "#2fb344", offline: "#f03e3e", updating: "#f59f00", pending: "#4299e1", other: "#8896ab" };
@@ -92,7 +93,7 @@ export default function NetworkDiagram({ devices }: { devices: NetworkDevice[] }
return { all, width, height };
}, [devices]);
if (devices.length === 0) return <div className="text-secondary">No devices to draw yet.</div>;
if (devices.length === 0) return <div className="text-secondary">{t("No devices to draw yet.")}</div>;
return (
<div className="card">
+11 -11
View File
@@ -25,7 +25,7 @@ function Viewer({ photos, index, canEdit, onMove, onClose, onChanged }: { photos
if (!photo) return null;
async function caption() {
const value = await promptDialog({ title: "Caption", message: "What is in the picture?", defaultValue: photo.caption ?? "", confirmLabel: "Save" });
const value = await promptDialog({ title: t("Caption"), message: t("What is in the picture?"), defaultValue: photo.caption ?? "", confirmLabel: t("Save") });
if (value === null) return;
try {
await api.notePhotos.setCaption(photo.id, value.trim() === "" ? null : value);
@@ -35,7 +35,7 @@ function Viewer({ photos, index, canEdit, onMove, onClose, onChanged }: { photos
}
}
async function remove() {
if (!(await confirmDialog({ title: "Remove the photo", message: "Remove this photo from the note?", confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove the photo"), message: t("Remove this photo from the note?"), confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.notePhotos.remove(photo.id);
onChanged();
@@ -47,7 +47,7 @@ function Viewer({ photos, index, canEdit, onMove, onClose, onChanged }: { photos
}
return (
<div className="modal modal-blur d-block" role="dialog" aria-modal="true" aria-label="Photo" style={{ background: "rgba(0,0,0,0.78)" }} onClick={onClose}>
<div className="modal modal-blur d-block" role="dialog" aria-modal="true" aria-label={t("Photo")} style={{ background: "rgba(0,0,0,0.78)" }} onClick={onClose}>
<div className="modal-dialog modal-xl modal-dialog-centered" onClick={(e) => e.stopPropagation()}>
<div className="modal-content">
<div className="modal-body text-center">
@@ -61,16 +61,16 @@ function Viewer({ photos, index, canEdit, onMove, onClose, onChanged }: { photos
</div>
</div>
<div className="modal-footer">
<button type="button" className="btn" disabled={index === 0} onClick={() => onMove(index - 1)} aria-label="Previous photo">
<button type="button" className="btn" disabled={index === 0} onClick={() => onMove(index - 1)} aria-label={t("Previous photo")}>
‹
</button>
<button type="button" className="btn" disabled={index >= photos.length - 1} onClick={() => onMove(index + 1)} aria-label="Next photo">
<button type="button" className="btn" disabled={index >= photos.length - 1} onClick={() => onMove(index + 1)} aria-label={t("Next photo")}>
›
</button>
{canEdit && (
<>
<button type="button" className="btn" onClick={() => void caption()}>
Caption…
{t("Caption…")}
</button>
<button type="button" className="btn btn-outline-danger" onClick={() => void remove()}>
{t("Remove")}
@@ -126,7 +126,7 @@ export default function NotePhotos({ targetType, targetId, canEdit }: { targetTy
toast.error(readableError(err));
}
}
if (added > 0) toast.success(added === 1 ? "Photo added." : `${added} photos added.`);
if (added > 0) toast.success(added === 1 ? t("Photo added.") : `${added} photos added.`);
} finally {
if (input.current) input.current.value = "";
setBusy(false);
@@ -142,19 +142,19 @@ export default function NotePhotos({ targetType, targetId, canEdit }: { targetTy
<div className="text-secondary small fw-bold">Photos{photos.length > 0 ? ` (${photos.length})` : ""}</div>
{canEdit && (
<>
<input ref={input} type="file" accept="image/*" multiple className="d-none" onChange={(e) => void add(e.target.files)} aria-label="Choose photos to add" />
<input ref={input} type="file" accept="image/*" multiple className="d-none" onChange={(e) => void add(e.target.files)} aria-label={t("Choose photos to add")} />
<button type="button" className="btn btn-sm ms-auto" disabled={busy || photos.length >= MAX_PHOTOS} onClick={() => input.current?.click()}>
{busy ? "Adding…" : "Add photo"}
{busy ? "Adding…" : t("Add photo")}
</button>
</>
)}
</div>
{photos.length === 0 ? (
<div className="text-secondary small">None yet — add a picture of the rack or of a label.</div>
<div className="text-secondary small">{t("None yet — add a picture of the rack or of a label.")}</div>
) : (
<div className="d-flex flex-wrap gap-2">
{photos.map((p, i) => (
<button key={p.id} type="button" className="btn p-0 border-0 text-start" style={{ width: 112 }} onClick={() => setOpen(i)} aria-label={p.caption ? `Open the photo: ${p.caption}` : "Open the photo"}>
<button key={p.id} type="button" className="btn p-0 border-0 text-start" style={{ width: 112 }} onClick={() => setOpen(i)} aria-label={p.caption ? `Open the photo: ${p.caption}` : t("Open the photo")}>
<img src={api.notePhotos.imageUrl(p.id)} alt={p.caption ?? ""} loading="lazy" width={112} height={112} style={{ width: 112, height: 112, objectFit: "cover", borderRadius: 4, display: "block" }} />
{p.caption && (
<div className="text-secondary small text-truncate" style={{ maxWidth: 112 }}>
+4 -4
View File
@@ -38,7 +38,7 @@ export default function NotesCard({ targetType, targetId, canEdit, bare = false
const res = await api.notes.save(targetType, targetId, draft);
setNote(res.note);
setDraft(null);
toast.success(res.note ? "Saved." : "Note removed.");
toast.success(res.note ? t("Saved.") : t("Note removed."));
} catch (err) {
toast.error(readableError(err));
} finally {
@@ -52,10 +52,10 @@ export default function NotesCard({ targetType, targetId, canEdit, bare = false
<BlockSkeleton lines={2} />
) : draft !== null ? (
<>
<textarea className="form-control mb-2" rows={8} maxLength={8000} value={draft} onChange={(e) => setDraft(e.target.value)} aria-label="The note" placeholder={"What is it, where does it sit, what was done to it last time?\n\n- lists, **bold**, `code` and links work"} autoFocus />
<textarea className="form-control mb-2" rows={8} maxLength={8000} value={draft} onChange={(e) => setDraft(e.target.value)} aria-label={t("The note")} placeholder={"What is it, where does it sit, what was done to it last time?\n\n- lists, **bold**, `code` and links work"} autoFocus />
<div className="d-flex gap-2">
<button type="button" className="btn btn-primary" disabled={busy} onClick={() => void save()}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" disabled={busy} onClick={() => setDraft(null)}>
{t("Cancel")}
@@ -77,7 +77,7 @@ export default function NotesCard({ targetType, targetId, canEdit, bare = false
const edit =
canEdit && draft === null && note !== undefined && !failed ? (
<button type="button" className="btn btn-sm btn-primary" onClick={() => setDraft(note?.body ?? "")}>
{note ? "Edit" : "Write a note"}
{note ? "Edit" : t("Write a note")}
</button>
) : null;
+2 -1
View File
@@ -1,6 +1,7 @@
import { useId, useLayoutEffect, useRef, useState, type ReactNode } from "react";
import { useLocation } from "react-router-dom";
import { isIntroOpen, rememberIntroOpen } from "../utils/pageIntro";
import { t } from "../i18n";
/**
* The few lines under a page's title that say what the page is. Short ones show as they are; one that runs to more than two lines is folded to two with a "Show more" under it, so the page's
@@ -46,7 +47,7 @@ export default function PageIntro({ children, className = "mb-3" }: { children:
setOpen(!open);
}}
>
{open ? "Show less" : "Show more"}
{open ? "Show less" : t("Show more")}
</button>
)}
</div>
+26 -26
View File
@@ -12,28 +12,28 @@ import { toast } from "../utils/toast";
import { t } from "../i18n";
const WEEK: { day: number; label: string }[] = [
{ day: 1, label: "Mon" },
{ day: 2, label: "Tue" },
{ day: 3, label: "Wed" },
{ day: 4, label: "Thu" },
{ day: 5, label: "Fri" },
{ day: 6, label: "Sat" },
{ day: 0, label: "Sun" },
{ day: 1, get label() { return t("Mon"); } },
{ day: 2, get label() { return t("Tue"); } },
{ day: 3, get label() { return t("Wed"); } },
{ day: 4, get label() { return t("Thu"); } },
{ day: 5, get label() { return t("Fri"); } },
{ day: 6, get label() { return t("Sat"); } },
{ day: 0, get label() { return t("Sun"); } },
];
const LONG_DAY = ["Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays"];
const ITEM_BADGE: Record<PatchPlanItemStatus, { label: string; badge: string }> = {
pending: { label: "Waiting its turn", badge: "bg-secondary-lt text-secondary" },
running: { label: "Updating", badge: "bg-blue-lt text-blue" },
done: { label: "Updated", badge: "bg-green-lt text-green" },
failed: { label: "Failed", badge: "bg-red-lt text-red" },
skipped: { label: "Left alone", badge: "bg-secondary-lt text-secondary" },
pending: { get label() { return t("Waiting its turn"); }, badge: "bg-secondary-lt text-secondary" },
running: { get label() { return t("Updating"); }, badge: "bg-blue-lt text-blue" },
done: { get label() { return t("Updated"); }, badge: "bg-green-lt text-green" },
failed: { get label() { return t("Failed"); }, badge: "bg-red-lt text-red" },
skipped: { get label() { return t("Left alone"); }, badge: "bg-secondary-lt text-secondary" },
};
const RUN_BADGE: Record<PatchPlanRun["status"], { label: string; badge: string }> = {
running: { label: "Running", badge: "bg-blue-lt text-blue" },
done: { label: "Finished", badge: "bg-green-lt text-green" },
running: { get label() { return t("Running"); }, badge: "bg-blue-lt text-blue" },
done: { get label() { return t("Finished"); }, badge: "bg-green-lt text-green" },
failed: { label: "Didn't finish cleanly", badge: "bg-red-lt text-red" },
cancelled: { label: "Stopped", badge: "bg-secondary-lt text-secondary" },
cancelled: { get label() { return t("Stopped"); }, badge: "bg-secondary-lt text-secondary" },
};
/** "Sundays at 02:00", "Mondays to Fridays at 03:30" is too clever — the days are just listed. */
@@ -221,7 +221,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
try {
if (draft.id === null) await api.patchPlans.create(input);
else await api.patchPlans.update(draft.id, input);
toast.success(draft.id === null ? `Added ${draft.name}.` : "Saved.");
toast.success(draft.id === null ? `Added ${draft.name}.` : t("Saved."));
setDraft(null);
load();
} catch (err) {
@@ -233,7 +233,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
async function runNow(p: PatchPlan) {
const names = p.servers.map((s) => s.name);
if (!(await confirmDialog({ title: `Run ${p.name} now?`, message: `It updates ${names.length === 1 ? names[0] : `${names.length} servers (${names.slice(0, 5).join(", ")}${names.length > 5 ? " …" : ""})`}, one at a time${p.stopOnFailure ? ", and stops at the first failure" : ""}. ${p.onlyWithUpdates ? "Servers with nothing waiting are left alone. " : ""}Each is put under maintenance while it is updated${p.restartTemplateName ? `, and restarted (with "${p.restartTemplateName}") if it says a restart is due` : " and may restart"}.`, confirmLabel: "Run it now" }))) return;
if (!(await confirmDialog({ title: `Run ${p.name} now?`, message: `It updates ${names.length === 1 ? names[0] : `${names.length} servers (${names.slice(0, 5).join(", ")}${names.length > 5 ? " …" : ""})`}, one at a time${p.stopOnFailure ? ", and stops at the first failure" : ""}. ${p.onlyWithUpdates ? "Servers with nothing waiting are left alone. " : ""}Each is put under maintenance while it is updated${p.restartTemplateName ? `, and restarted (with "${p.restartTemplateName}") if it says a restart is due` : " and may restart"}.`, confirmLabel: t("Run it now") }))) return;
try {
await api.patchPlans.run(p.id);
toast.success(`Started ${p.name}.`);
@@ -244,7 +244,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
}
async function stop(run: PatchPlanRun) {
if (!(await confirmDialog({ title: "Stop this run?", message: "The servers not yet started are left alone. A playbook that has already started keeps running in Semaphore; the app only stops following it.", confirmLabel: "Stop", danger: true }))) return;
if (!(await confirmDialog({ title: t("Stop this run?"), message: "The servers not yet started are left alone. A playbook that has already started keeps running in Semaphore; the app only stops following it.", confirmLabel: t("Stop"), danger: true }))) return;
try {
await api.patchPlans.cancel(run.id);
load();
@@ -254,7 +254,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
}
async function remove(p: PatchPlan) {
if (!(await confirmDialog({ title: "Remove a plan", message: `Remove "${p.name}" and its history?`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove a plan"), message: `Remove "${p.name}" and its history?`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.patchPlans.remove(p.id);
load();
@@ -290,7 +290,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
{draft && data && (
<form className="card mb-3" onSubmit={save}>
<div className="card-header">
<h3 className="card-title">{draft.id === null ? "Make a patch plan" : `Edit ${draft.name || "the plan"}`}</h3>
<h3 className="card-title">{draft.id === null ? t("Make a patch plan") : `Edit ${draft.name || "the plan"}`}</h3>
</div>
<div className="card-body row g-3">
<div className="col-md-5">
@@ -367,7 +367,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
))}
</div>
</details>
<div className="form-hint mt-2">{covered.length === 0 ? "No server is covered yet." : <>It would update {covered.length} server{covered.length === 1 ? "" : "s"}, by name: {covered.map((s) => s.name).join(", ")}.</>}</div>
<div className="form-hint mt-2">{covered.length === 0 ? t("No server is covered yet.") : <>It would update {covered.length} server{covered.length === 1 ? "" : "s"}, by name: {covered.map((s) => s.name).join(", ")}.</>}</div>
</div>
<div className="col-md-8">
@@ -444,7 +444,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === "" || draft.days.length === 0 || (draft.tags.length === 0 && draft.serverIds.length === 0)}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
{t("Cancel")}
@@ -455,7 +455,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
<div className="card">
<div className="card-header">
<h3 className="card-title">Plans</h3>
<h3 className="card-title">{t("Plans")}</h3>
{isAdmin && !draft && (
<div className="card-actions">
<button className="btn btn-primary" onClick={() => setDraft({ ...EMPTY, timezone: browserZone() })}>
@@ -469,7 +469,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
<EmptyState
title={t("No patch plans yet")}
hint={t("A plan updates a group of servers on a schedule, one at a time, and stops if one fails. Tag the servers (for example “lab”), then make a plan for that tag.")}
action={isAdmin ? { label: "Make a plan", onClick: () => setDraft({ ...EMPTY, timezone: browserZone() }) } : undefined}
action={isAdmin ? { label: t("Make a plan"), onClick: () => setDraft({ ...EMPTY, timezone: browserZone() }) } : undefined}
/>
)}
{data && data.plans.length > 0 && (
@@ -477,7 +477,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Plan</th>
<th>{t("Plan")}</th>
<th>{t("When")}</th>
<th>{t("Servers")}</th>
<th>{t("Next")}</th>
@@ -488,7 +488,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
{data.plans.map((p) => (
<tr key={p.id}>
<td className="stack-wide">
<strong>{p.name}</strong> {!p.enabled && <span className="badge bg-secondary-lt text-secondary">{t("Switched off")}</span>} {p.running && <span className="badge bg-blue-lt text-blue">Running</span>}
<strong>{p.name}</strong> {!p.enabled && <span className="badge bg-secondary-lt text-secondary">{t("Switched off")}</span>} {p.running && <span className="badge bg-blue-lt text-blue">{t("Running")}</span>}
<div className="text-secondary small">
{p.templateName}
{p.restartTemplateName ? ` · restarts with ${p.restartTemplateName} if one is due` : ""} · {p.stopOnFailure ? "stops at the first failure" : "carries on after a failure"}
+19 -19
View File
@@ -76,9 +76,9 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
const open = hosts.reduce((n, r) => n + r.open.length, 0);
if (
!(await confirmDialog({
title: "Name the open ports",
title: t("Name the open ports"),
message: `Write the names from "${preset.name}" on the ${open} open ${open === 1 ? "port" : "ports"} found on ${hosts.length} ${hosts.length === 1 ? "host" : "hosts"}. A port with a name counts as noted, so the new-port alert stays quiet for it.${overwrite ? " Names somebody wrote are replaced." : " Names somebody wrote are kept."}`,
confirmLabel: "Write the names",
confirmLabel: t("Write the names"),
}))
)
return;
@@ -108,7 +108,7 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
<div>
<ErrorNotice error={error} />
{tcp.length === 0 ? (
<div className="text-secondary">This preset has no TCP ports, and a scan only looks at TCP.</div>
<div className="text-secondary">{t("This preset has no TCP ports, and a scan only looks at TCP.")}</div>
) : (
<>
<p className="text-secondary small">
@@ -116,23 +116,23 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
reachable from here, not what is blocked by a firewall; only private addresses are scanned.
</p>
<div className="d-flex flex-wrap align-items-center gap-2 mb-2">
<input className="form-control form-control-sm" style={{ maxWidth: 240 }} placeholder="Filter hosts" value={filter} onChange={(e) => setFilter(e.target.value)} />
<input className="form-control form-control-sm" style={{ maxWidth: 240 }} placeholder={t("Filter hosts")} value={filter} onChange={(e) => setFilter(e.target.value)} />
<button className="btn btn-sm" onClick={() => setPicked(new Set([...picked, ...shown.map((s) => s.id)]))}>
Pick the {shown.length} shown
</button>
<button className="btn btn-sm" onClick={() => setPicked(new Set())} disabled={picked.size === 0}>
None
{t("None")}
</button>
<span className="text-secondary small">{picked.size} picked</span>
{canEdit && (
<button className="btn btn-primary btn-sm ms-auto" onClick={() => void scan()} disabled={busy || picked.size === 0}>
{busy && !result ? "Scanning…" : `Scan ${picked.size || ""} ${picked.size === 1 ? "host" : "hosts"}`}
{busy && !result ? t("Scanning…") : `Scan ${picked.size || ""} ${picked.size === 1 ? "host" : "hosts"}`}
</button>
)}
</div>
<div className="border rounded p-2 mb-3" style={{ maxHeight: 220, overflowY: "auto" }}>
{servers === null && <div className="text-secondary small">{t("Loading…")}</div>}
{servers !== null && shown.length === 0 && <div className="text-secondary small">No host matches.</div>}
{servers !== null && shown.length === 0 && <div className="text-secondary small">{t("No host matches.")}</div>}
<div className="row">
{shown.map((s) => (
<div key={s.id} className="col-sm-6 col-lg-4">
@@ -156,8 +156,8 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Host</th>
<th>Address</th>
<th>{t("Host")}</th>
<th>{t("Address")}</th>
{result.ports.map((p) => (
<th key={p} className="text-center">
{p}
@@ -174,7 +174,7 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
{r.state === "scanned" ? (
result.ports.map((p) => (
<td key={p} className="text-center">
{r.open.includes(p) ? <span className="badge bg-green-lt text-green">open</span> : r.closed.includes(p) ? <span className="text-secondary">–</span> : <span className="text-secondary" title="Never answered: a firewall may be dropping it">?</span>}
{r.open.includes(p) ? <span className="badge bg-green-lt text-green">open</span> : r.closed.includes(p) ? <span className="text-secondary">–</span> : <span className="text-secondary" title={t("Never answered: a firewall may be dropping it")}>?</span>}
</td>
))
) : (
@@ -194,11 +194,11 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
{canEdit && scanned.some((r) => r.open.length > 0) && (
<div className="d-flex flex-wrap align-items-center gap-3">
<button className="btn btn-outline-primary" onClick={() => void apply()} disabled={busy}>
Name the open ports on these hosts
{t("Name the open ports on these hosts")}
</button>
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={overwrite} onChange={(e) => setOverwrite(e.target.checked)} />
<span className="form-check-label">Replace names somebody wrote</span>
<span className="form-check-label">{t("Replace names somebody wrote")}</span>
</label>
</div>
)}
@@ -264,18 +264,18 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
<>
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Port presets</h3>
<h3 className="card-title">{t("Port presets")}</h3>
<div className="card-actions">
{canEdit && !form && (
<button className="btn btn-primary btn-sm" onClick={() => { setForm({ id: null, name: "", text: "" }); setFormErrors([]); }}>
Add a preset
{t("Add a preset")}
</button>
)}
</div>
</div>
<div className="card-body">
<p className="text-secondary small">
A preset is a named list of ports — <em>Remote access</em>: SSH, RDP, VNC; <em>Databases</em>: MySQL, PostgreSQL … — written once. A port in any preset is <strong>named</strong> wherever it shows (3389 → RDP, on the Ports cards and here) without a label typed for each host; you can <strong>check a preset on several hosts</strong> at
A preset is a named list of ports — <em>{t("Remote access")}</em>: SSH, RDP, VNC; <em>{t("Databases")}</em>: MySQL, PostgreSQL … — written once. A port in any preset is <strong>named</strong> wherever it shows (3389 → RDP, on the Ports cards and here) without a label typed for each host; you can <strong>check a preset on several hosts</strong> at
once and see which have which port open; and <strong>name the open ports on all of them</strong> in one go. The ready-made ones are ordinary presets: change or delete them.
</p>
<ErrorNotice error={error} />
@@ -290,7 +290,7 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
</span>
<span className="ms-auto btn-list flex-nowrap">
<button className={`btn btn-sm ${checking === p.id ? "btn-primary" : ""}`} onClick={() => setChecking(checking === p.id ? null : p.id)}>
Check hosts
{t("Check hosts")}
</button>
{canEdit && (
<>
@@ -315,11 +315,11 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
<label className="form-label" htmlFor="pp-name">
{t("Name")}
</label>
<input id="pp-name" className="form-control" required maxLength={60} placeholder="Remote access" value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} autoFocus />
<input id="pp-name" className="form-control" required maxLength={60} placeholder={t("Remote access")} value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} autoFocus />
</div>
<div className="mb-2">
<label className="form-label" htmlFor="pp-ports">
Ports, one to a line
{t("Ports, one to a line")}
</label>
<textarea id="pp-ports" className="form-control font-monospace" rows={8} required placeholder={"22 SSH\n3389 RDP\n5900 VNC\n53/udp DNS"} value={form.text} onChange={(e) => setForm({ ...form, text: e.target.value })} />
<div className="form-hint">
@@ -335,7 +335,7 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
)}
<div className="btn-list">
<button className="btn btn-primary" disabled={saving || form.name.trim() === ""}>
{saving ? "Saving…" : "Save"}
{saving ? t("Saving…") : t("Save")}
</button>
<button type="button" className="btn" onClick={() => setForm(null)}>
{t("Cancel")}
+13 -13
View File
@@ -74,14 +74,14 @@ export default function ProxmoxSnapshots({ integrationId, guest, canTake, canRol
const ok = await confirmDialog({
title: `Roll back ${guest.name}`,
message: `Roll back ${kind} "${guest.name}" to "${s.name}"? Everything it has done since ${s.takenAt ? new Date(s.takenAt).toLocaleString() : "then"} is lost${s.withRam ? "" : guest.type === "qemu" ? ", and it comes back stopped (this snapshot kept no memory)" : ""}. Snapshots taken after "${s.name}" are removed by Proxmox.`,
confirmLabel: "Roll back",
confirmLabel: t("Roll back"),
danger: true,
});
if (ok) await run(`roll:${s.name}`, () => api.integrations.proxmox.rollbackSnapshot(integrationId, guest.node, guest.type, guest.vmid, s.name), `Rolled ${guest.name} back to ${s.name}.`);
}
async function remove(s: ProxmoxSnapshot) {
const ok = await confirmDialog({ title: "Delete a snapshot", message: `Delete the snapshot "${s.name}" of ${kind} "${guest.name}"? The guest itself is not touched, but you can no longer roll back to it.`, confirmLabel: "Delete", danger: true });
const ok = await confirmDialog({ title: t("Delete a snapshot"), message: `Delete the snapshot "${s.name}" of ${kind} "${guest.name}"? The guest itself is not touched, but you can no longer roll back to it.`, confirmLabel: t("Delete"), danger: true });
if (ok) await run(`del:${s.name}`, () => api.integrations.proxmox.deleteSnapshot(integrationId, guest.node, guest.type, guest.vmid, s.name), `Deleted ${s.name}.`);
}
@@ -89,38 +89,38 @@ export default function ProxmoxSnapshots({ integrationId, guest, canTake, canRol
return (
<div className="mt-4">
<h4>Snapshots</h4>
<h4>{t("Snapshots")}</h4>
<ErrorNotice error={error} />
{canTake && (
<form className="row g-2 mb-3" onSubmit={(e) => void take(e)}>
<div className="col-sm-5">
<input className="form-control form-control-sm" aria-label="Snapshot name" placeholder="Name (leave empty for one from the time)" maxLength={40} pattern="[A-Za-z][A-Za-z0-9_\-]{0,39}" title="Starts with a letter, then letters, digits, - and _" value={name} onChange={(e) => setName(e.target.value)} />
<input className="form-control form-control-sm" aria-label={t("Snapshot name")} placeholder={t("Name (leave empty for one from the time)")} maxLength={40} pattern="[A-Za-z][A-Za-z0-9_\-]{0,39}" title="Starts with a letter, then letters, digits, - and _" value={name} onChange={(e) => setName(e.target.value)} />
</div>
<div className="col-sm-7">
<input className="form-control form-control-sm" aria-label={t("Description")} placeholder="Why (optional)" maxLength={200} value={description} onChange={(e) => setDescription(e.target.value)} />
<input className="form-control form-control-sm" aria-label={t("Description")} placeholder={t("Why (optional)")} maxLength={200} value={description} onChange={(e) => setDescription(e.target.value)} />
</div>
<div className="col-12 d-flex flex-wrap align-items-center gap-3">
{guest.type === "qemu" && guest.status === "running" && (
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={includeRam} onChange={(e) => setIncludeRam(e.target.checked)} />
<span className="form-check-label">Keep its memory too (a rollback then brings it back running)</span>
<span className="form-check-label">{t("Keep its memory too (a rollback then brings it back running)")}</span>
</label>
)}
<button className="btn btn-sm btn-primary ms-auto" disabled={busy !== null}>
{busy === "take" ? "Taking it…" : "Take a snapshot"}
{busy === "take" ? t("Taking it…") : t("Take a snapshot")}
</button>
</div>
</form>
)}
{snapshots === null && !error && <div className="text-secondary small">Reading them…</div>}
{snapshots?.length === 0 && <div className="text-secondary small">None has been taken.</div>}
{snapshots === null && !error && <div className="text-secondary small">{t("Reading them…")}</div>}
{snapshots?.length === 0 && <div className="text-secondary small">{t("None has been taken.")}</div>}
{snapshots && snapshots.length > 0 && (
<div className="table-responsive">
<table className="table table-sm table-vcenter mb-0">
<thead>
<tr>
<th>Snapshot</th>
<th>Taken</th>
<th>{t("Snapshot")}</th>
<th>{t("Taken")}</th>
{canRoll && <th className="w-1" />}
</tr>
</thead>
@@ -138,10 +138,10 @@ export default function ProxmoxSnapshots({ integrationId, guest, canTake, canRol
<td>
<div className="btn-list flex-nowrap">
<button className="btn btn-sm" disabled={busy !== null} onClick={() => void rollBack(s)}>
Roll back…
{t("Roll back…")}
</button>
<button className="btn btn-sm btn-outline-danger" disabled={busy !== null} onClick={() => void remove(s)}>
Delete…
{t("Delete…")}
</button>
</div>
</td>
+9 -9
View File
@@ -85,14 +85,14 @@ export default function ProxyHostForm({ integrationId, integrationName, certific
return (
<form onSubmit={submit} className="card mb-3">
<div className="card-header">
<h3 className="card-title">{host ? `Change ${host.domains[0]}` : "New proxy host"}</h3>
<h3 className="card-title">{host ? `Change ${host.domains[0]}` : t("New proxy host")}</h3>
<div className="card-actions text-secondary small">{integrationName}</div>
</div>
<div className="card-body">
<ErrorNotice error={error} />
<div className="mb-3">
<label className="form-label" htmlFor="ph-names">
Names
{t("Names")}
</label>
<textarea id="ph-names" className="form-control" rows={2} required autoFocus placeholder={"app.example.com\nwww.app.example.com"} value={names} onChange={(e) => setNames(e.target.value)} />
<div className="text-secondary small">The names people type, one to a line. Written in lower case; a name another host has is refused by NPM.</div>
@@ -100,7 +100,7 @@ export default function ProxyHostForm({ integrationId, integrationName, certific
<div className="row g-2 mb-3">
<div className="col-md-2">
<label className="form-label" htmlFor="ph-scheme">
Forwards by
{t("Forwards by")}
</label>
<select id="ph-scheme" className="form-select" value={scheme} onChange={(e) => setScheme(e.target.value as "http" | "https")}>
<option value="http">http</option>
@@ -109,23 +109,23 @@ export default function ProxyHostForm({ integrationId, integrationName, certific
</div>
<div className="col-md-7">
<label className="form-label" htmlFor="ph-host">
To host or address
{t("To host or address")}
</label>
<input id="ph-host" className="form-control" required maxLength={255} autoComplete="off" placeholder="10.0.0.5" value={target} onChange={(e) => setTarget(e.target.value)} />
</div>
<div className="col-md-3">
<label className="form-label" htmlFor="ph-port">
Port
{t("Port")}
</label>
<input id="ph-port" className="form-control" type="number" min={1} max={65535} required value={port} onChange={(e) => setPort(e.target.value)} />
</div>
</div>
<div className="mb-3">
<label className="form-label" htmlFor="ph-cert">
Certificate
{t("Certificate")}
</label>
<select id="ph-cert" className="form-select" value={certificateId === null ? "" : String(certificateId)} onChange={(e) => pickCertificate(e.target.value)}>
<option value="">None (plain HTTP)</option>
<option value="">{t("None (plain HTTP)")}</option>
{certificates.map((c) => (
<option key={c.id} value={c.id}>
{certLabel(c)}
@@ -140,7 +140,7 @@ export default function ProxyHostForm({ integrationId, integrationName, certific
{check("ph-http2", "HTTP/2", http2 && hasCert, setHttp2, hasCert)}
{check("ph-hsts", "HSTS", hsts && ssl, (v) => { setHsts(v); if (!v) setHstsSubdomains(false); }, ssl)}
{check("ph-hsts-sub", "HSTS for subdomains", hstsSubdomains && hstsOn, setHstsSubdomains, hstsOn)}
{!hasCert && <div className="text-secondary small mb-2">These need a certificate.</div>}
{!hasCert && <div className="text-secondary small mb-2">{t("These need a certificate.")}</div>}
</div>
<div className="col-md-6">
{check("ph-block", "Block common exploits", blockExploits, setBlockExploits)}
@@ -151,7 +151,7 @@ export default function ProxyHostForm({ integrationId, integrationName, certific
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={busy || names.trim() === "" || target.trim() === ""}>
{busy ? "Saving…" : host ? "Save" : "Make proxy host"}
{busy ? "Saving…" : host ? t("Save") : t("Make proxy host")}
</button>
<button type="button" className="btn btn-link text-secondary" onClick={onCancel} disabled={busy}>
{t("Cancel")}
+10 -10
View File
@@ -66,7 +66,7 @@ function Wishes({ device, onSaved, onError }: { device: PushDevice; onSaved: ()
</div>
{dirty && (
<button type="button" className="btn btn-sm btn-primary" onClick={() => void save()} disabled={busy}>
Save what this browser gets
{t("Save what this browser gets")}
</button>
)}
</div>
@@ -76,7 +76,7 @@ function Wishes({ device, onSaved, onError }: { device: PushDevice; onSaved: ()
/** A short name for this browser, to tell the devices apart in the list. */
function browserLabel(): string {
const ua = navigator.userAgent;
const browser = /Edg\//.test(ua) ? "Edge" : /Firefox\//.test(ua) ? "Firefox" : /Chrome\//.test(ua) ? "Chrome" : /Safari\//.test(ua) ? "Safari" : "Browser";
const browser = /Edg\//.test(ua) ? t("Edge") : /Firefox\//.test(ua) ? "Firefox" : /Chrome\//.test(ua) ? "Chrome" : /Safari\//.test(ua) ? "Safari" : t("Browser");
const os = /Android/.test(ua) ? "Android" : /iPhone|iPad/.test(ua) ? "iOS" : /Windows/.test(ua) ? "Windows" : /Mac OS/.test(ua) ? "macOS" : /Linux/.test(ua) ? "Linux" : "";
return os ? `${browser} on ${os}` : browser;
}
@@ -138,7 +138,7 @@ export default function PushDevices({ serverEnabled }: { serverEnabled: boolean
}
async function remove(d: PushDevice) {
if (!(await confirmDialog({ title: "Stop notifying a browser", message: `Stop sending notifications to ${d.label || d.host}?`, confirmLabel: "Stop", danger: true }))) return;
if (!(await confirmDialog({ title: t("Stop notifying a browser"), message: `Stop sending notifications to ${d.label || d.host}?`, confirmLabel: t("Stop"), danger: true }))) return;
try {
await api.push.remove(d.id);
if (d.endpoint === thisEndpoint && supported) {
@@ -175,28 +175,28 @@ export default function PushDevices({ serverEnabled }: { serverEnabled: boolean
return (
<div>
<div className="fw-bold mb-1">Your browsers</div>
<div className="fw-bold mb-1">{t("Your browsers")}</div>
{!supported || !secure ? (
<div className="alert alert-warning py-2">
This browser can&rsquo;t receive push notifications here. {secure ? "It doesn't support them." : "They need the page to be opened over https (or from localhost)."}
This browser can&rsquo;t receive push notifications here. {secure ? t("It doesn't support them.") : "They need the page to be opened over https (or from localhost)."}
</div>
) : (
<div className="d-flex gap-2 mb-2 flex-wrap">
{!thisSubscribed && (
<button type="button" className="btn btn-primary" onClick={() => void subscribe()} disabled={busy || permission === "denied"}>
{busy ? "Working…" : "Notify this browser"}
{busy ? "Working…" : t("Notify this browser")}
</button>
)}
{(devices?.length ?? 0) > 0 && (
<button type="button" className="btn btn-outline-secondary" onClick={() => void test()} disabled={busy}>
Send a test to my browsers
{t("Send a test to my browsers")}
</button>
)}
{permission === "denied" && <span className="text-secondary small align-self-center">Notifications are blocked for this site in the browser.</span>}
{permission === "denied" && <span className="text-secondary small align-self-center">{t("Notifications are blocked for this site in the browser.")}</span>}
</div>
)}
{error && <div className="text-danger small mb-2">{error}</div>}
{devices && devices.length === 0 && <div className="text-secondary small">None yet.</div>}
{devices && devices.length === 0 && <div className="text-secondary small">{t("None yet.")}</div>}
{devices && devices.length > 0 && (
<ul className="list-unstyled mb-0">
{devices.map((d) => (
@@ -208,7 +208,7 @@ export default function PushDevices({ serverEnabled }: { serverEnabled: boolean
{t("Remove")}
</button>
<div className="w-100 text-secondary small">
{d.minSeverity || d.categories ? `Gets ${d.minSeverity === "critical" ? "critical alerts" : d.minSeverity === "warning" ? "warnings and worse" : "alerts of any severity"}${d.categories ? (d.categories.length > KINDS.length / 2 ? ` about everything except ${KINDS.filter((k) => !d.categories!.includes(k)).map((c) => CATEGORY_LABELS[c].toLowerCase()).join(", ")}` : ` about ${d.categories.map((c) => CATEGORY_LABELS[c].toLowerCase()).join(", ")}`) : ""}.` : "Gets every alert."}
{d.minSeverity || d.categories ? `Gets ${d.minSeverity === "critical" ? "critical alerts" : d.minSeverity === "warning" ? "warnings and worse" : "alerts of any severity"}${d.categories ? (d.categories.length > KINDS.length / 2 ? ` about everything except ${KINDS.filter((k) => !d.categories!.includes(k)).map((c) => CATEGORY_LABELS[c].toLowerCase()).join(", ")}` : ` about ${d.categories.map((c) => CATEGORY_LABELS[c].toLowerCase()).join(", ")}`) : ""}.` : t("Gets every alert.")}
</div>
<Wishes device={d} onSaved={() => void load()} onError={setError} />
</li>
+3 -2
View File
@@ -3,6 +3,7 @@ import { IconRefresh } from "@tabler/icons-react";
import { api } from "../api/client";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { t } from "../i18n";
/**
* "Read now": reads one integration at once instead of at its next turn, then says how it went and — if the page that holds the button has something to refresh — asks it to (`onDone`). For
@@ -25,9 +26,9 @@ export default function ReadNowButton({ integrationId, name, onDone, className =
}
}
return (
<button type="button" className={className} onClick={() => void readNow()} disabled={busy} title="Read it now, instead of waiting for its next turn">
<button type="button" className={className} onClick={() => void readNow()} disabled={busy} title={t("Read it now, instead of waiting for its next turn")}>
<IconRefresh size={14} className="me-1" />
{busy ? "Reading…" : "Read now"}
{busy ? "Reading…" : t("Read now")}
</button>
);
}
+8 -8
View File
@@ -86,10 +86,10 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
const key = (type: MaintenanceTargetType, id: number) => `${type}:${id}`;
const groups: { label: string; type: MaintenanceTargetType; items: { id: number; name: string }[] }[] = [
{ label: "Servers", type: "server", items: targets?.servers ?? [] },
{ label: "Integrations", type: "integration", items: targets?.integrations ?? [] },
{ label: "Network devices", type: "device", items: targets?.devices ?? [] },
{ label: "DNS providers", type: "dns_provider", items: targets?.dnsProviders ?? [] },
{ label: t("Servers"), type: "server", items: targets?.servers ?? [] },
{ label: t("Integrations"), type: "integration", items: targets?.integrations ?? [] },
{ label: t("Network devices"), type: "device", items: targets?.devices ?? [] },
{ label: t("DNS providers"), type: "dns_provider", items: targets?.dnsProviders ?? [] },
];
function toggleGroup(type: MaintenanceTargetType, items: { id: number }[]) {
@@ -159,7 +159,7 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
}
async function remove(s: MaintenanceSchedule) {
if (!(await confirmDialog({ title: t("Remove recurring maintenance"), message: `Remove "${s.name}"? Windows it made that haven't begun are taken back; one already under way ends on its own.`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove recurring maintenance"), message: `Remove "${s.name}"? Windows it made that haven't begun are taken back; one already under way ends on its own.`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.maintenance.schedules.remove(s.id);
toast.success(`Removed ${s.name}.`);
@@ -290,7 +290,7 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={busy || picked.size === 0 || days.length === 0 || name.trim() === ""}>
{busy ? "Saving…" : editingId === null ? t("Save") : t("Save changes")}
{busy ? t("Saving…") : editingId === null ? t("Save") : t("Save changes")}
</button>
<button type="button" className="btn" onClick={closeForm}>
{t("Cancel")}
@@ -305,7 +305,7 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
<thead>
<tr>
<th>{t("Name")}</th>
<th>Covers</th>
<th>{t("Covers")}</th>
<th>{t("When")}</th>
<th>{t("Next")}</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
@@ -344,7 +344,7 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
))}
{schedules === null && <LoadingRow colSpan={canEdit ? 5 : 4} />}
{schedules?.length === 0 && (
<EmptyRow colSpan={canEdit ? 5 : 4} title={t("No recurring maintenance")} hint={t("Add one for the night you patch, and its windows appear a week ahead, so alerts stay quiet without anyone remembering to.")} action={canEdit ? { label: "Add recurring maintenance", onClick: () => { setError(null); setAdding(true); } } : undefined} />
<EmptyRow colSpan={canEdit ? 5 : 4} title={t("No recurring maintenance")} hint={t("Add one for the night you patch, and its windows appear a week ahead, so alerts stay quiet without anyone remembering to.")} action={canEdit ? { label: t("Add recurring maintenance"), onClick: () => { setError(null); setAdding(true); } } : undefined} />
)}
</tbody>
</table>
+17 -17
View File
@@ -92,7 +92,7 @@ export default function RoutingEditor({
<>
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Routing rules</h3>
<h3 className="card-title">{t("Routing rules")}</h3>
<div className="card-actions">
<button
type="button"
@@ -100,7 +100,7 @@ export default function RoutingEditor({
disabled={routing.rules.length >= 30}
onClick={() => onRouting({ rules: [...routing.rules, { id: newId(), name: `Rule ${routing.rules.length + 1}`, enabled: true, categories: [], minSeverity: null, tags: [], channels: [] }] })}
>
Add a rule
{t("Add a rule")}
</button>
</div>
</div>
@@ -110,7 +110,7 @@ export default function RoutingEditor({
rule with no channels tells nobody — the Alerts page still shows the problem. Only problems and recoveries about servers, services and the like carry a kind and a severity; a rule that asks about
something a notification doesn&rsquo;t say doesn&rsquo;t match it.
</p>
{routing.rules.length === 0 && <div className="text-secondary">No rules: everything goes everywhere.</div>}
{routing.rules.length === 0 && <div className="text-secondary">{t("No rules: everything goes everywhere.")}</div>}
{routing.rules.map((r, i) => (
<div key={r.id} className="border rounded p-3 mb-3">
<div className="d-flex align-items-center gap-2 mb-3">
@@ -118,7 +118,7 @@ export default function RoutingEditor({
<input type="checkbox" className="form-check-input" checked={r.enabled} onChange={(e) => setRule(i, { enabled: e.target.checked })} />
<span className="visually-hidden">Rule {r.name} is on</span>
</label>
<input className="form-control" style={{ maxWidth: "20rem" }} aria-label="Name of the rule" maxLength={60} value={r.name} onChange={(e) => setRule(i, { name: e.target.value })} />
<input className="form-control" style={{ maxWidth: "20rem" }} aria-label={t("Name of the rule")} maxLength={60} value={r.name} onChange={(e) => setRule(i, { name: e.target.value })} />
<span className="text-secondary small">#{i + 1}</span>
<div className="btn-list ms-auto flex-nowrap">
<button type="button" className="btn btn-sm" aria-label={`Move ${r.name} up`} disabled={i === 0} onClick={() => move(i, -1)}>
@@ -154,9 +154,9 @@ export default function RoutingEditor({
At least this bad
</label>
<select id={`rule-sev-${r.id}`} className="form-select" value={r.minSeverity ?? ""} onChange={(e) => setRule(i, { minSeverity: e.target.value === "" ? null : (e.target.value as "warning" | "critical") })}>
<option value="">Any severity</option>
<option value="warning">Warning or worse</option>
<option value="critical">Critical only</option>
<option value="">{t("Any severity")}</option>
<option value="warning">{t("Warning or worse")}</option>
<option value="critical">{t("Critical only")}</option>
</select>
</div>
<div className="col-md-8">
@@ -166,9 +166,9 @@ export default function RoutingEditor({
<TagsInput id={`rule-tags-${r.id}`} value={r.tags} onChange={(tags) => setRule(i, { tags })} />
</div>
<div className="col-12">
<div className="form-label">Tell</div>
<div className="form-label">{t("Tell")}</div>
<ChannelChecks value={r.channels} onChange={(channels) => setRule(i, { channels })} enabled={channelsOn} idPrefix={`rule-${r.id}`} />
{r.channels.length === 0 && <div className="text-warning small mt-1">No channel ticked: nobody is told. The Alerts page still shows it.</div>}
{r.channels.length === 0 && <div className="text-warning small mt-1">{t("No channel ticked: nobody is told. The Alerts page still shows it.")}</div>}
</div>
</div>
</div>
@@ -179,11 +179,11 @@ export default function RoutingEditor({
<div className="card">
<div className="card-header">
<h3 className="card-title">Escalation</h3>
<h3 className="card-title">{t("Escalation")}</h3>
<div className="card-actions">
<label className="form-check form-switch mb-0">
<input type="checkbox" className="form-check-input" checked={escalation.enabled} onChange={(e) => onEscalation({ ...escalation, enabled: e.target.checked })} />
<span className="form-check-label">On</span>
<span className="form-check-label">{t("On")}</span>
</label>
</div>
</div>
@@ -192,7 +192,7 @@ export default function RoutingEditor({
When an alert has been raised for a while and nobody has acknowledged it, tell again — through a louder channel, and perhaps someone else. Each step is sent once per alert, in order, and an acknowledgement stops the
rest. Problems under maintenance, or held back because something they depend on is down, never escalate.
</p>
{escalation.steps.length === 0 && <div className="text-secondary mb-2">No steps yet.</div>}
{escalation.steps.length === 0 && <div className="text-secondary mb-2">{t("No steps yet.")}</div>}
{escalation.steps.map((s, i) => (
<div key={i} className="border rounded p-3 mb-3">
<div className="d-flex align-items-center mb-3">
@@ -216,8 +216,8 @@ export default function RoutingEditor({
For alerts that are
</label>
<select id={`esc-sev-${i}`} className="form-select" value={s.minSeverity} onChange={(e) => setStep(i, { minSeverity: e.target.value as "warning" | "critical" })}>
<option value="warning">Warning or worse</option>
<option value="critical">Critical only</option>
<option value="warning">{t("Warning or worse")}</option>
<option value="critical">{t("Critical only")}</option>
</select>
</div>
<div className="col-md-4">
@@ -227,13 +227,13 @@ export default function RoutingEditor({
<input id={`esc-mail-${i}`} type="email" className="form-control" placeholder="neighbour@example.com" value={s.extraEmail} onChange={(e) => setStep(i, { extraEmail: e.target.value })} />
</div>
<div className="col-12">
<div className="form-label">Tell</div>
<div className="form-label">{t("Tell")}</div>
<ChannelChecks value={s.channels} onChange={(channels) => setStep(i, { channels })} enabled={channelsOn} idPrefix={`esc-${i}`} />
</div>
<div className="col-12">
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={s.evenInQuietHours} onChange={(e) => setStep(i, { evenInQuietHours: e.target.checked })} />
<span className="form-check-label">Send even during quiet hours, and while away</span>
<span className="form-check-label">{t("Send even during quiet hours, and while away")}</span>
</label>
</div>
</div>
@@ -251,7 +251,7 @@ export default function RoutingEditor({
});
}}
>
Add a step
{t("Add a step")}
</button>
<div className="text-secondary small mt-2">Looked at every five minutes, so a step can come up to five minutes after its time.</div>
</div>
+13 -13
View File
@@ -15,16 +15,16 @@ interface Loaded {
}
const STATUS_WORDS: Record<SemaphoreTask["status"], { label: string; badge: string }> = {
waiting: { label: "Waiting to start", badge: "bg-secondary-lt text-secondary" },
starting: { label: "Starting", badge: "bg-blue-lt text-blue" },
running: { label: "Running", badge: "bg-blue-lt text-blue" },
waiting_confirmation: { label: "Waiting for approval in Semaphore", badge: "bg-yellow-lt text-yellow" },
confirmed: { label: "Approved", badge: "bg-blue-lt text-blue" },
rejected: { label: "Rejected in Semaphore", badge: "bg-red-lt text-red" },
stopping: { label: "Stopping", badge: "bg-yellow-lt text-yellow" },
stopped: { label: "Stopped", badge: "bg-secondary-lt text-secondary" },
success: { label: "Finished — success", badge: "bg-green-lt text-green" },
error: { label: "Finished — failed", badge: "bg-red-lt text-red" },
waiting: { get label() { return t("Waiting to start"); }, badge: "bg-secondary-lt text-secondary" },
starting: { get label() { return t("Starting"); }, badge: "bg-blue-lt text-blue" },
running: { get label() { return t("Running"); }, badge: "bg-blue-lt text-blue" },
waiting_confirmation: { get label() { return t("Waiting for approval in Semaphore"); }, badge: "bg-yellow-lt text-yellow" },
confirmed: { get label() { return t("Approved"); }, badge: "bg-blue-lt text-blue" },
rejected: { get label() { return t("Rejected in Semaphore"); }, badge: "bg-red-lt text-red" },
stopping: { get label() { return t("Stopping"); }, badge: "bg-yellow-lt text-yellow" },
stopped: { get label() { return t("Stopped"); }, badge: "bg-secondary-lt text-secondary" },
success: { get label() { return t("Finished — success"); }, badge: "bg-green-lt text-green" },
error: { get label() { return t("Finished — failed"); }, badge: "bg-red-lt text-red" },
};
const FINISHED = new Set<SemaphoreTask["status"]>(["success", "error", "stopped", "rejected"]);
@@ -97,7 +97,7 @@ export default function RunPlaybook({ serverName, defaultLimit }: { serverName:
!(await confirmDialog({
title: `Run ${picked.template.name}?`,
message: `This starts "${picked.template.name}" in ${picked.integration.name} ${where}.`,
confirmLabel: "Run it",
confirmLabel: t("Run it"),
danger: !limitText,
}))
)
@@ -133,7 +133,7 @@ export default function RunPlaybook({ serverName, defaultLimit }: { serverName:
<>
<div className="mb-3">
<label className="form-label" htmlFor="run-template">
Template
{t("Template")}
</label>
<select id="run-template" className="form-select" value={choice} onChange={(e) => setChoice(e.target.value)}>
<option value="">{t("Choose a template…")}</option>
@@ -171,7 +171,7 @@ export default function RunPlaybook({ serverName, defaultLimit }: { serverName:
)}
</div>
<button type="button" className="btn btn-primary" disabled={!picked || busy || (limitOn && limit.trim() === "")} onClick={() => void start()}>
{busy ? "Starting…" : "Run"}
{busy ? "Starting…" : t("Run")}
</button>
</>
)}
+1 -1
View File
@@ -9,7 +9,7 @@ export default function RunPlaybookButton({ serverName }: { serverName: string }
return (
<>
<button type="button" className="btn btn-sm btn-outline-secondary" title={`Run a Semaphore playbook on ${serverName}`} onClick={() => setOpen(true)}>
Run…
{t("Run…")}
</button>
{open && (
<DetailDrawer title={t("Run a playbook")} subtitle={`On ${serverName}`} onClose={() => setOpen(false)}>
+3 -2
View File
@@ -4,6 +4,7 @@ import type { AlertCategory, MaintenanceTargetType } from "../api/client";
import { useRunbookSummary } from "../hooks/useRunbooks";
import DetailDrawer from "./DetailDrawer";
import RunbookPanel from "./RunbookPanel";
import { t } from "../i18n";
/**
* A small "Runbook" link that opens what is written down about a server, integration or DNS provider in a side panel. Shown where there is
@@ -40,10 +41,10 @@ export default function RunbookEntry({
onClick={() => setOpen(true)}
>
<IconBook size={14} aria-hidden="true" />
{fitting.length > 0 ? (fitting.length === 1 ? "Runbook" : `Runbooks (${fitting.length})`) : "Add a runbook"}
{fitting.length > 0 ? (fitting.length === 1 ? t("Runbook") : `Runbooks (${fitting.length})`) : t("Add a runbook")}
</button>
{open && (
<DetailDrawer title="Runbook" subtitle={targetName} onClose={() => setOpen(false)}>
<DetailDrawer title={t("Runbook")} subtitle={targetName} onClose={() => setOpen(false)}>
<RunbookPanel targetType={targetType} targetId={targetId} targetName={targetName} canEdit={canEdit} forCategory={forCategory} />
</DetailDrawer>
)}
+4 -4
View File
@@ -98,7 +98,7 @@ export default function RunbookPanel({
});
}
if (failed) return <div className="text-secondary">Couldn't load the runbooks.</div>;
if (failed) return <div className="text-secondary">{t("Couldn't load the runbooks.")}</div>;
if (notes === null) return <BlockSkeleton lines={3} />;
return (
@@ -149,7 +149,7 @@ export default function RunbookPanel({
</div>
<div className="mb-3">
<label className="form-label" htmlFor="rb-for">
For
{t("For")}
</label>
<select id="rb-for" className="form-select" value={draft.category} onChange={(e) => setDraft({ ...draft, category: e.target.value as AlertCategory | "" })}>
<option value="">Anything about it</option>
@@ -172,7 +172,7 @@ export default function RunbookPanel({
{error && <div className="text-danger small mb-2">{error}</div>}
<div className="btn-list">
<button type="submit" className="btn btn-primary" disabled={busy || draft.title.trim() === ""}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
{t("Cancel")}
@@ -182,7 +182,7 @@ export default function RunbookPanel({
) : (
canEdit && (
<button type="button" className="btn btn-outline-secondary" onClick={() => setDraft({ id: null, title: "", body: "", category: forCategory ?? "" })}>
Add a runbook
{t("Add a runbook")}
</button>
)
)}
+4 -3
View File
@@ -3,6 +3,7 @@ import { Link } from "react-router-dom";
import { api, type ServerRecord, type ServerRelation } from "../api/client";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { t } from "../i18n";
/**
* Which server this one runs on (a virtual machine on its host). When the host stops reporting, this server's own "offline" alert is
@@ -28,7 +29,7 @@ export default function RunsOn({ serverId, parent, noParent, canEdit, onChanged
setBusy(true);
try {
await api.servers.update(serverId, value === NONE ? { noParent: true } : { parentServerId: value === "" ? null : Number(value) });
toast.success(value === "" ? "Back to working it out from the Proxmox node." : value === NONE ? "It runs on nothing, so its alerts always stand alone." : "Saved.");
toast.success(value === "" ? t("Back to working it out from the Proxmox node.") : value === NONE ? t("It runs on nothing, so its alerts always stand alone.") : t("Saved."));
onChanged();
} catch (err) {
toast.error(readableError(err));
@@ -42,9 +43,9 @@ export default function RunsOn({ serverId, parent, noParent, canEdit, onChanged
}
return (
<div>
<select className="form-select form-select-sm" aria-label="The server this one runs on" value={noParent ? NONE : parent && !parent.auto ? String(parent.id) : ""} disabled={busy || servers === null} onChange={(e) => void change(e.target.value)}>
<select className="form-select form-select-sm" aria-label={t("The server this one runs on")} value={noParent ? NONE : parent && !parent.auto ? String(parent.id) : ""} disabled={busy || servers === null} onChange={(e) => void change(e.target.value)}>
<option value="">{parent?.auto ? `Automatic: ${parent.name}` : "Automatic (none found)"}</option>
<option value={NONE}>Nothing — it runs on its own</option>
<option value={NONE}>{t("Nothing — it runs on its own")}</option>
{(servers ?? [])
.filter((s) => s.id !== serverId)
.map((s) => (
+3 -2
View File
@@ -3,6 +3,7 @@ import { useLocation } from "react-router-dom";
import { toggleFavorite, useFavorites } from "../utils/favorites";
import { MAX_VIEW_QUERY, canonicalSearch, describeView, hasViewParams } from "../utils/savedViews";
import { toast } from "../utils/toast";
import { t } from "../i18n";
/**
* Pins the page as it is now — with its search words, status, tag and sort — to the top of the menu. It appears once something
@@ -16,7 +17,7 @@ export default function SaveViewButton() {
const view = canonicalSearch(search);
const path = `${pathname}${view}`;
const on = favorites.includes(path);
const label = on ? "Remove this view from favourites" : "Save this view to favourites";
const label = on ? t("Remove this view from favourites") : t("Save this view to favourites");
return (
<button
@@ -33,7 +34,7 @@ export default function SaveViewButton() {
}}
>
{on ? <IconStarFilled size={16} aria-hidden="true" /> : <IconStar size={16} aria-hidden="true" />}
<span>{on ? "Saved view" : "Save view"}</span>
<span>{on ? "Saved view" : t("Save view")}</span>
</button>
);
}
+1 -1
View File
@@ -40,7 +40,7 @@ export default function ServerActivity({ serverId }: { serverId: number }) {
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Activity</h3>
<h3 className="card-title">{t("Activity")}</h3>
<div className="card-actions">
<Link to={`/changes?serverId=${serverId}&days=90`} className="small">
{t("Everything about this server in the change log")}
+2 -2
View File
@@ -51,7 +51,7 @@ export default function ServerBlock({ id, label, at, noFold = false, className =
{!noFold && (
<button type="button" className="btn btn-sm d-inline-flex align-items-center gap-1" aria-pressed={folded} onClick={() => void toggleFolded(id)}>
{folded ? <IconFoldDown size={16} aria-hidden="true" /> : <IconFoldUp size={16} aria-hidden="true" />}
{folded ? "Unfold" : "Fold"}
{folded ? "Unfold" : t("Fold")}
</button>
)}
</div>
@@ -73,7 +73,7 @@ export function ArrangeBar() {
</button>
)}
<button type="button" className={`btn btn-sm ${editing ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={editing} onClick={() => setEditingServerPage(!editing)} title={t("Fold the cards you do not need and put the others in the order you like — for every server")}>
{editing ? "Done" : "Arrange cards"}
{editing ? "Done" : t("Arrange cards")}
</button>
</div>
);
+3 -3
View File
@@ -62,7 +62,7 @@ export default function ServerHostname({ server, isAdmin, onChanged }: { server:
<div className="text-secondary small mb-1">A host name or an address. It is kept even if the agent reports another.</div>
<div className="d-flex gap-2">
<button type="submit" className="btn btn-sm btn-primary" disabled={busy || value.trim() === ""}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={() => setEditing(false)} disabled={busy}>
{t("Cancel")}
@@ -79,7 +79,7 @@ export default function ServerHostname({ server, isAdmin, onChanged }: { server:
)}
{isAdmin && (
<button type="button" className="btn btn-sm btn-link py-0" onClick={start}>
Change
{t("Change")}
</button>
)}
{differs && (
@@ -90,7 +90,7 @@ export default function ServerHostname({ server, isAdmin, onChanged }: { server:
{isAdmin && server.hostnamePinned && (
<div>
<button type="button" className="btn btn-sm btn-link px-0 py-0" onClick={() => void giveUp()} disabled={busy}>
{server.reportedHostname ? "Use what the agent reports" : "Stop keeping it by hand"}
{server.reportedHostname ? t("Use what the agent reports") : t("Stop keeping it by hand")}
</button>
</div>
)}
+18 -18
View File
@@ -18,7 +18,7 @@ const PRESETS: { key: string; label: string; from: number; to: number }[] = [
{ key: "high1", label: "10001–30000", from: 10001, to: 30000 },
{ key: "high2", label: "30001–50000", from: 30001, to: 50000 },
{ key: "high3", label: "50001–65535", from: 50001, to: 65535 },
{ key: "custom", label: "Custom range…", from: 8000, to: 8999 },
{ key: "custom", get label() { return t("Custom range…"); }, from: 8000, to: 8999 },
];
const MAX_SHOWN_RANGES = 24;
@@ -36,7 +36,7 @@ function rangeText([from, to]: [number, number]) {
}
function StatusBadges({ entry }: { entry: PortEntry }) {
if (entry.state === "reserved") return <span className="badge bg-secondary-lt text-secondary">Reserved</span>;
if (entry.state === "reserved") return <span className="badge bg-secondary-lt text-secondary">{t("Reserved")}</span>;
return (
<div className="d-flex flex-wrap gap-1">
{entry.isNew && (
@@ -198,7 +198,7 @@ export default function ServerPorts({
async function markExpected(entry: PortEntry) {
setError(null);
try {
const res = await api.servers.ports.save(serverId, { port: entry.port, protocol: entry.protocol, label: "Expected", comment: "" });
const res = await api.servers.ports.save(serverId, { port: entry.port, protocol: entry.protocol, label: t("Expected"), comment: "" });
setData((prev) => (prev ? { ...prev, ports: res.ports } : prev));
} catch (err) {
setError(readableError(err));
@@ -209,7 +209,7 @@ export default function ServerPorts({
if (entry.id === null) return;
const what = entry.state === "reserved" ? `Remove the reservation for ${entry.protocol}/${entry.port}?` : `Clear the note on ${entry.protocol}/${entry.port}?`;
const reserved = entry.state === "reserved";
if (!(await confirmDialog({ title: reserved ? "Remove reservation" : "Clear note", message: what, confirmLabel: reserved ? "Remove" : "Clear", danger: true }))) return;
if (!(await confirmDialog({ title: reserved ? t("Remove reservation") : t("Clear note"), message: what, confirmLabel: reserved ? t("Remove") : t("Clear"), danger: true }))) return;
try {
await api.servers.ports.remove(serverId, entry.id);
setData(await api.servers.ports.list(serverId));
@@ -332,7 +332,7 @@ export default function ServerPorts({
)}
<div className="col-md-2">
<button type="submit" className="btn btn-primary w-100" disabled={scanning || !address.trim()}>
{scanning ? "Scanning…" : "Scan"}
{scanning ? t("Scanning…") : t("Scan")}
</button>
</div>
<div className="col-12 text-secondary small">
@@ -378,7 +378,7 @@ export default function ServerPorts({
))}
{result.freeRanges.length > MAX_SHOWN_RANGES && (
<button type="button" className="btn btn-link btn-sm" onClick={() => setShowAllRanges((s) => !s)}>
{showAllRanges ? "Show fewer" : `Show all ${result.freeRanges.length} ranges`}
{showAllRanges ? t("Show fewer") : `Show all ${result.freeRanges.length} ranges`}
</button>
)}
</div>
@@ -396,7 +396,7 @@ export default function ServerPorts({
{canEdit && note && (
<form onSubmit={saveNote} className="row g-2 align-items-end border rounded p-3 mb-3">
<div className="col-md-2">
<label className="form-label">Port</label>
<label className="form-label">{t("Port")}</label>
<input
type="number"
className="form-control"
@@ -409,7 +409,7 @@ export default function ServerPorts({
/>
</div>
<div className="col-md-2">
<label className="form-label">Protocol</label>
<label className="form-label">{t("Protocol")}</label>
<select
className="form-select"
disabled={editing}
@@ -421,7 +421,7 @@ export default function ServerPorts({
</select>
</div>
<div className="col-md-3">
<label className="form-label">Service</label>
<label className="form-label">{t("Service")}</label>
<input
className="form-control"
maxLength={100}
@@ -431,7 +431,7 @@ export default function ServerPorts({
/>
</div>
<div className="col-md-5">
<label className="form-label">Comment</label>
<label className="form-label">{t("Comment")}</label>
<input
className="form-control"
maxLength={500}
@@ -442,7 +442,7 @@ export default function ServerPorts({
</div>
<div className="col-12 d-flex gap-2">
<button type="submit" className="btn btn-primary btn-sm" disabled={savingNote}>
{editing ? "Save" : "Add"}
{editing ? "Save" : t("Add")}
</button>
<button type="button" className="btn btn-sm" onClick={() => setNote(null)}>
{t("Cancel")}
@@ -465,7 +465,7 @@ export default function ServerPorts({
{data && data.ports.length === 0 && (
<div className="card-body pt-0 text-secondary">
No ports recorded yet. {canEdit ? "Run a scan to find what's open, or add a note to reserve a port." : ""}
No ports recorded yet. {canEdit ? t("Run a scan to find what's open, or add a note to reserve a port.") : ""}
</div>
)}
@@ -474,11 +474,11 @@ export default function ServerPorts({
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<PortEntry> label="Port" sortKeyName="port" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label="Proto" sortKeyName="protocol" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label={t("Port")} sortKeyName="port" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label={t("Proto")} sortKeyName="protocol" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label={t("Status")} sortKeyName="state" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label="Service" sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label="Comment" sortKeyName="comment" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label={t("Service")} sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<PortEntry> label={t("Comment")} sortKeyName="comment" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
@@ -506,11 +506,11 @@ export default function ServerPorts({
</button>
)}
<button className="btn btn-sm btn-outline-secondary" onClick={() => editEntry(p)}>
{p.label || p.comment ? "Edit" : "Add note"}
{p.label || p.comment ? t("Edit") : t("Add note")}
</button>
{(p.label || p.comment) && (
<button className="btn btn-sm btn-outline-danger" onClick={() => removeNote(p)}>
{p.state === "reserved" ? "Remove" : "Clear"}
{p.state === "reserved" ? t("Remove") : t("Clear")}
</button>
)}
</div>
+1 -1
View File
@@ -91,7 +91,7 @@ export default function ServerTags({
<TagBadges tags={tags} linked />
{canEdit && (
<button className="btn btn-link btn-sm p-0 ms-1" onClick={startEditing}>
{tags.length === 0 ? "+ Add tags" : "Edit tags"}
{tags.length === 0 ? "+ Add tags" : t("Edit tags")}
</button>
)}
</div>
+5 -5
View File
@@ -113,14 +113,14 @@ export default function ServerTaskTable({
<tr>
<SortableTh<TaskRecord> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<TaskRecord>
label="Command"
label={t("Command")}
sortKeyName="command"
activeKey={sortKey}
direction={sortDir}
onSort={requestSort}
/>
<SortableTh<TaskRecord>
label="Schedule"
label={t("Schedule")}
sortKeyName="scheduleExpression"
activeKey={sortKey}
direction={sortDir}
@@ -159,7 +159,7 @@ export default function ServerTaskTable({
<span
title={
nextRun.estimated
? "Estimated from the cron expression in your browser's timezone — the server may run in a different timezone"
? t("Estimated from the cron expression in your browser's timezone — the server may run in a different timezone")
: undefined
}
>
@@ -172,13 +172,13 @@ export default function ServerTaskTable({
</td>
<td>
{task.isStale ? (
<span className="badge bg-red-lt text-red me-1">Missing</span>
<span className="badge bg-red-lt text-red me-1">{t("Missing")}</span>
) : task.enabled ? (
<span className="badge bg-green-lt text-green me-1">{t("Enabled")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary me-1">{t("Disabled")}</span>
)}
{task.origin === "manual" && <span className="badge bg-blue-lt">Manual</span>}
{task.origin === "manual" && <span className="badge bg-blue-lt">{t("Manual")}</span>}
</td>
{canEditTasks && (
<td>
+7 -7
View File
@@ -8,10 +8,10 @@ import { t } from "../i18n";
type Field = "serverOfflineMinutes" | "diskUsagePercent" | "diskForecastDays" | "backupStaleHours";
const FIELDS: { key: Field; label: string; unit: string; min: number; max: number; hint: string; onlyForGuests?: boolean }[] = [
{ key: "serverOfflineMinutes", label: "Offline after", unit: "min", min: 15, max: 10080, hint: "How long without a report before this server counts as offline — longer for a laptop that is off at night." },
{ key: "diskUsagePercent", label: "Disk usage alert at", unit: "%", min: 50, max: 99, hint: "For every disk on this server that has no limit of its own below." },
{ key: "diskForecastDays", label: "Warn when a disk will fill within", unit: "days", min: 0, max: 90, hint: "0 turns the forecast off for this server." },
{ key: "backupStaleHours", label: "Its backup is too old after", unit: "hours", min: 0, max: 2160, hint: "For the Proxmox guest this server is. 0 means it is never called stale.", onlyForGuests: true },
{ key: "serverOfflineMinutes", get label() { return t("Offline after"); }, unit: "min", min: 15, max: 10080, get hint() { return t("How long without a report before this server counts as offline — longer for a laptop that is off at night."); } },
{ key: "diskUsagePercent", get label() { return t("Disk usage alert at"); }, unit: "%", min: 50, max: 99, get hint() { return t("For every disk on this server that has no limit of its own below."); } },
{ key: "diskForecastDays", get label() { return t("Warn when a disk will fill within"); }, unit: "days", min: 0, max: 90, hint: "0 turns the forecast off for this server." },
{ key: "backupStaleHours", get label() { return t("Its backup is too old after"); }, unit: "hours", min: 0, max: 2160, hint: "For the Proxmox guest this server is. 0 means it is never called stale.", onlyForGuests: true },
];
const has = (t: Thresholds | null) => !!t && (Object.keys(t).some((k) => k !== "mounts" && k !== "ignoreServices") || Object.keys(t.mounts ?? {}).length > 0);
@@ -141,12 +141,12 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
{mountNames.length > 0 && (
<div className="mt-3">
<div className="form-label">Disks</div>
<div className="form-label">{t("Disks")}</div>
<div className="table-responsive">
<table className="table table-sm table-vcenter mb-0">
<thead>
<tr>
<th>Disk</th>
<th>{t("Disk")}</th>
<th style={{ width: 180 }}>{t("Alert at (%)")}</th>
<th>{t("Leave it alone")}</th>
</tr>
@@ -195,7 +195,7 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={busy}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
{has(own) && (
<button type="button" className="btn" disabled={busy} onClick={() => void save(own?.ignoreServices?.length ? { ignoreServices: own.ignoreServices } : null)}>
+1 -1
View File
@@ -94,7 +94,7 @@ export default function ServerTrends({ serverId }: { serverId: number }) {
return (
<div className="card mb-3">
<div className="card-header d-flex flex-wrap gap-2">
<h3 className="card-title me-auto">Trends</h3>
<h3 className="card-title me-auto">{t("Trends")}</h3>
<RangeSelect value={days} onChange={setDays} />
</div>
<div className="card-body">
+1 -1
View File
@@ -65,7 +65,7 @@ export default function SetupGuide({ steps }: { steps: SetupStep[] }) {
{t("Getting started")}
</h3>
<div className="text-secondary small">
{done} of {steps.length} done
{t("{done} of {total} done", { done, total: steps.length })}
</div>
</div>
<div className="card-actions">
+2 -2
View File
@@ -48,7 +48,7 @@ export default function ShortcutHelp() {
<div className="modal-content">
<div className="modal-header">
<h3 className="modal-title" id={titleId}>
Keyboard shortcuts
{t("Keyboard shortcuts")}
</h3>
<button ref={closeRef} type="button" className="btn-close" aria-label={t("Close")} onClick={() => setOpen(false)} />
</div>
@@ -64,7 +64,7 @@ export default function ShortcutHelp() {
</div>
))}
</dl>
<div className="fw-bold mb-2">Anywhere</div>
<div className="fw-bold mb-2">{t("Anywhere")}</div>
<dl className="shortcut-list mb-0">
{OTHER_SHORTCUTS.map((s) => (
<div key={s.keys}>
+4 -3
View File
@@ -5,6 +5,7 @@ import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import DetailDrawer from "./DetailDrawer";
import { ErrorNotice } from "./Notice";
import { t } from "../i18n";
/** The next time it is `hour` o'clock, `daysAhead` days from today, in the browser's own time. */
function at(daysAhead: number, hour = 9): Date {
@@ -52,12 +53,12 @@ function SnoozeChoices({ intro, busy, error, onPick }: { intro: string; busy: bo
))}
</div>
<label className="form-label" htmlFor="snooze-custom">
Or a time of your own
{t("Or a time of your own")}
</label>
<div className="d-flex gap-2">
<input id="snooze-custom" type="datetime-local" className="form-control" value={custom} onChange={(e) => setCustom(e.target.value)} />
<button type="button" className="btn btn-primary" disabled={busy || Number.isNaN(customDate.getTime())} onClick={() => onPick(customDate)}>
Snooze
{t("Snooze")}
</button>
</div>
</>
@@ -88,7 +89,7 @@ export default function SnoozeDrawer({ alert, onClose, onSaved }: { alert: Alert
}
return (
<DetailDrawer title="Snooze" subtitle={alert.message} onClose={onClose}>
<DetailDrawer title={t("Snooze")} subtitle={alert.message} onClose={onClose}>
<SnoozeChoices intro="Hide this until then. It is announced again at that time if it is still there; if it goes away before, it is just gone. Snoozing is not maintenance: nothing is promised about the thing." busy={busy} error={error} onPick={(when) => void snooze(when)} />
</DetailDrawer>
);
+11 -11
View File
@@ -107,7 +107,7 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
const groups = [...new Set(candidates.map((c) => c.group))];
return (
<DetailDrawer title="Status page" subtitle={linkLabel} onClose={onClose}>
<DetailDrawer title={t("Status page")} subtitle={linkLabel} onClose={onClose}>
{!loaded && !error ? (
<BlockSkeleton lines={5} />
) : (
@@ -126,9 +126,9 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
<textarea id="sp-message" className="form-control" rows={2} maxLength={300} placeholder="e.g. Movies are being updated tonight, back by 18:00" value={message} onChange={(e) => setMessage(e.target.value)} />
</div>
<div className="form-label">What it shows</div>
<div className="form-label">{t("What it shows")}</div>
{items.length === 0 ? (
<div className="text-secondary mb-3">Nothing yet. Add the things people ask about.</div>
<div className="text-secondary mb-3">{t("Nothing yet. Add the things people ask about.")}</div>
) : (
<ul className="list-group mb-3">
{items.map((it, i) => (
@@ -159,24 +159,24 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
{items.length < maxItems && (
<div className="border rounded p-3 mb-3">
<div className="form-label">Add something</div>
<div className="form-label">{t("Add something")}</div>
<div className="d-flex gap-2 mb-2">
<select
className="form-select w-auto"
aria-label="What kind of thing"
aria-label={t("What kind of thing")}
value={kind}
onChange={(e) => {
setKind(e.target.value as StatusItemKind);
setPick("");
}}
>
<option value="server">A server</option>
<option value="server">{t("A server")}</option>
<option value="integration">An integration</option>
<option value="monitor">An Uptime Kuma monitor</option>
</select>
<select
className="form-select"
aria-label="Which one"
aria-label={t("Which one")}
value={pick}
onChange={(e) => {
setPick(e.target.value);
@@ -184,7 +184,7 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
if (c && label.trim() === "") setLabel(c.name);
}}
>
<option value="">{candidates.length === 0 ? "None to choose from" : "Choose…"}</option>
<option value="">{candidates.length === 0 ? t("None to choose from") : t("Choose…")}</option>
{groups.map((g) => (
<optgroup key={g} label={g}>
{candidates
@@ -199,9 +199,9 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
</select>
</div>
<div className="d-flex gap-2">
<input className="form-control" aria-label="What to call it on the page" maxLength={60} placeholder="What to call it, e.g. Movies" value={label} onChange={(e) => setLabel(e.target.value)} />
<input className="form-control" aria-label={t("What to call it on the page")} maxLength={60} placeholder={t("What to call it, e.g. Movies")} value={label} onChange={(e) => setLabel(e.target.value)} />
<button type="button" className="btn btn-outline-primary" disabled={!picked || label.trim() === ""} onClick={add}>
Add
{t("Add")}
</button>
</div>
</div>
@@ -209,7 +209,7 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
<ErrorNotice error={error} />
<button type="button" className="btn btn-primary" disabled={busy || items.some((i) => i.label.trim() === "")} onClick={() => void save()}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
</>
)}
+3 -3
View File
@@ -22,7 +22,7 @@ export default function StatusStrip() {
<div>{failed ? "Couldn't load the alert status." : "Checking status…"}</div>
{failed && (
<button type="button" className="btn btn-sm ms-auto" onClick={reload}>
Try again
{t("Try again")}
</button>
)}
</div>
@@ -73,7 +73,7 @@ export default function StatusStrip() {
</div>
{sum.roots.length > 0 && (
<div className="mt-1">
<strong>Root cause:</strong>{" "}
<strong>{t("Root cause:")}</strong>{" "}
{sum.roots.slice(0, 3).map((r, i) => (
<span key={r.alertId}>
{i > 0 && ", "}
@@ -84,7 +84,7 @@ export default function StatusStrip() {
)}
{notes.length > 0 && <div className="text-secondary mt-1">{notes.join(" · ")}</div>}
{sum.byCategory.length > 0 && (
<div className="d-flex flex-wrap gap-2 mt-2" aria-label="What is wrong, by kind">
<div className="d-flex flex-wrap gap-2 mt-2" aria-label={t("What is wrong, by kind")}>
{sum.byCategory.map((c) => (
<Link key={c.category} to={`/alerts?category=${c.category}`} className={`badge ${c.worst === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>
{CATEGORY_LABELS[c.category]} · {c.count}
+10 -9
View File
@@ -7,6 +7,7 @@ import { BlockSkeleton } from "./Skeleton";
import { ErrorNotice } from "./Notice";
import { useChartRange } from "../utils/chartRanges";
import { readableError } from "../utils/errors";
import { t } from "../i18n";
/** The pools Proxmox and Synology report, with how fast each is filling — read once, by the page that shows them. Empty until something has been written down. */
export function useStoragePools(): { pools: StoragePool[]; forecastDays: number } {
@@ -32,17 +33,17 @@ export const proxmoxKeys = {
export const synologyKey = (volumeId: string) => `volume:${volumeId}`;
function words(p: StoragePool, forecastDays: number): { text: string; className: string; title: string } | null {
const t = p.trend;
if (!t) return { text: "collecting history", className: "text-secondary", title: "A forecast needs a few days of readings; one is kept an hour." };
const tr = p.trend;
if (!tr) return { text: "collecting history", className: "text-secondary", title: "A forecast needs a few days of readings; one is kept an hour." };
// Not rising at all: a flat line is as good a forecast as there is, whatever its "fit".
if (t.daysToFull === null && t.spanDays >= 3 && t.perDay < 0.05) return { text: "not filling", className: "text-green", title: `Changing by ${t.perDay} points a day over the last ${t.spanDays} days.` };
if (!p.steady) return { text: "no steady trend", className: "text-secondary", title: "It is not growing in a straight enough line to forecast." };
if (t.daysToFull === null) return { text: "not filling", className: "text-green", title: `Changing by ${t.perDay} points a day over the last ${t.spanDays} days.` };
const soon = t.daysToFull <= forecastDays;
if (tr.daysToFull === null && tr.spanDays >= 3 && tr.perDay < 0.05) return { text: "not filling", className: "text-green", title: `Changing by ${tr.perDay} points a day over the last ${tr.spanDays} days.` };
if (!p.steady) return { text: "no steady trend", className: "text-secondary", title: t("It is not growing in a straight enough line to forecast.") };
if (tr.daysToFull === null) return { text: "not filling", className: "text-green", title: `Changing by ${tr.perDay} points a day over the last ${tr.spanDays} days.` };
const soon = tr.daysToFull <= forecastDays;
return {
text: `full in about ${t.daysToFull} ${t.daysToFull === 1 ? "day" : "days"}`,
className: t.daysToFull <= 3 ? "text-red" : soon ? "text-yellow" : "text-secondary",
title: `Filling by about ${t.perDay} points a day, from ${t.spanDays} days of readings.${soon ? "" : ` That is further off than the ${forecastDays} days that raise an alert.`}`,
text: `full in about ${tr.daysToFull} ${tr.daysToFull === 1 ? "day" : "days"}`,
className: tr.daysToFull <= 3 ? "text-red" : soon ? "text-yellow" : "text-secondary",
title: `Filling by about ${tr.perDay} points a day, from ${tr.spanDays} days of readings.${soon ? "" : ` That is further off than the ${forecastDays} days that raise an alert.`}`,
};
}
+5 -5
View File
@@ -51,14 +51,14 @@ export default function TodosCard({ targetType, targetId, canEdit, bare = false
}
}
async function tick(t: TodoItem) {
async function tick(todo: TodoItem) {
try {
await api.todos.update(t.id, { done: true });
toast.success(`Done: ${t.title}`, {
label: "Undo",
await api.todos.update(todo.id, { done: true });
toast.success(`Done: ${todo.title}`, {
label: t("Undo"),
onClick: async () => {
try {
await api.todos.update(t.id, { done: false });
await api.todos.update(todo.id, { done: false });
} catch (err) {
toast.error(readableError(err));
} finally {
+7 -7
View File
@@ -102,15 +102,15 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
? {
title: `Restart ${server.name} now?`,
message: `${lead}This silences alerts for ${server.name} for up to ${windowWords}, runs "${picked.template.name}" in ${picked.integration.name} limited to ${limit.trim()} — which restarts it — and waits for the server to report again, then checks that it did start again. What runs on it, and what depends on it, will be down for a while.`,
confirmLabel: watching ? "Restart anyway" : "Restart it",
confirmLabel: watching ? t("Restart anyway") : t("Restart it"),
danger: true,
}
: {
title: `Update ${server.name} now?`,
message: `${lead}This silences alerts for ${server.name} for up to ${windowWords}, runs "${picked.template.name}" in ${picked.integration.name} limited to ${limit.trim()}, and waits for the server to report again. ${
restartPicked ? `If it then says a restart is due, "${restartPicked.template.name}" restarts it — the machine will be down for a while — and Homelab Manager checks that it came back.` : "The playbook may restart it."
restartPicked ? `If it then says a restart is due, "${restartPicked.template.name}" restarts it — the machine will be down for a while — and Homelab Manager checks that it came back.` : t("The playbook may restart it.")
}`,
confirmLabel: watching ? "Update anyway" : restartPicked ? "Start the update and restart" : "Start the update",
confirmLabel: watching ? t("Update anyway") : restartPicked ? t("Start the update and restart") : t("Start the update"),
},
);
if (!ok) return;
@@ -139,7 +139,7 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
}
return (
<DetailDrawer title={`${restartOnly ? "Restart" : "Update"} ${server.name}`} subtitle={server.osType === "windows" ? "Windows" : "Linux"} onClose={onClose}>
<DetailDrawer title={`${restartOnly ? t("Restart") : t("Update")} ${server.name}`} subtitle={server.osType === "windows" ? "Windows" : "Linux"} onClose={onClose}>
<div className="mb-3">
<UpdatesBadge updates={server.updates} />
{count !== null && count > 0 && server.updates && server.updates.security !== null && <span className="text-secondary small ms-2">{server.updates.security} of them security</span>}
@@ -163,7 +163,7 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
{watching && (
<div className="alert alert-warning" role="status">
<strong>{t("Somebody is watching.")}</strong> {watching[0].toUpperCase()}
{watching.slice(1)}. {restartOnly ? "The restart will cut them off" : "The update may restart this machine"}; you will be asked once more.
{watching.slice(1)}. {restartOnly ? t("The restart will cut them off") : t("The update may restart this machine")}; you will be asked once more.
</div>
)}
<ol className="text-secondary small ps-3 mb-3">
@@ -181,7 +181,7 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
</ol>
<div className="mb-3">
<label className="form-label" htmlFor="ur-template">
{restartOnly ? "Playbook that restarts the server" : "Playbook that applies updates"}
{restartOnly ? t("Playbook that restarts the server") : t("Playbook that applies updates")}
</label>
<select id="ur-template" className="form-select" value={choice} onChange={(e) => setChoice(e.target.value)}>
<option value="">{t("Choose a template…")}</option>
@@ -229,7 +229,7 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
<div className="form-hint text-secondary small mt-1">The window ends sooner, as soon as the run does.{restartPicked ? " If a restart follows, the quiet is kept up for it as well." : ""}</div>
</div>
<button type="button" className={`btn ${restartOnly ? "btn-warning" : "btn-primary"}`} disabled={!picked || busy || limit.trim() === ""} onClick={() => void start()}>
{busy ? "Starting…" : restartOnly ? "Restart now" : restartPicked ? "Update and restart" : "Update now"}
{busy ? t("Starting…") : restartOnly ? t("Restart now") : restartPicked ? t("Update and restart") : t("Update now")}
</button>
</>
)}
+2 -2
View File
@@ -51,12 +51,12 @@ export default function UptimeHistory({ kind, id, name }: { kind: "servers" | "i
return (
<div className="card mb-3">
<div className="card-header d-flex flex-wrap gap-2">
<h3 className="card-title me-auto">Availability</h3>
<h3 className="card-title me-auto">{t("Availability")}</h3>
<RangeSelect value={days} onChange={setDays} only={[30, 90, 365]} />
</div>
<div className="card-body">
{failed ? (
<div className="text-secondary">Couldn't load the record.</div>
<div className="text-secondary">{t("Couldn't load the record.")}</div>
) : !report ? (
<BlockSkeleton lines={3} />
) : !series ? (
+12 -12
View File
@@ -69,7 +69,7 @@ export interface WallData {
/** The headline in words for how many things need a look, or why there is no answer yet. */
export function wallHeadline(level: WallLevel, count: number, state: { loaded: boolean; failed: boolean }): string {
if (level === "critical" || level === "warning") return `${count} ${count === 1 ? "thing needs" : "things need"} attention`;
if (level === "unsure") return state.loaded ? "No alerts — but some checks couldn't run" : state.failed ? "Can't reach the server" : "Checking…";
if (level === "unsure") return state.loaded ? t("No alerts — but some checks couldn't run") : state.failed ? "Can't reach the server" : "Checking…";
return "All clear";
}
@@ -182,7 +182,7 @@ export default function WallView({
<header className="wall-header">
<img src="/logo.webp" alt="Homelab Manager" width={901} height={460} className="wall-logo" />
{data.environmentName && <span className="badge env-badge">{data.environmentName}</span>}
<div className="wall-clock" aria-label="Time">
<div className="wall-clock" aria-label={t("Time")}>
<div className="wall-time">{formatTime(now, false)}</div>
<div className="wall-date">
{now.toLocaleDateString([], { weekday: "long" })} {formatDate(now)}
@@ -197,7 +197,7 @@ export default function WallView({
<span>{data.headline}</span>
</section>
<section className="wall-tiles" aria-label="Summary">
<section className="wall-tiles" aria-label={t("Summary")}>
<div className={`wall-tile ${offline > 0 ? "wall-tile-bad" : ""}`}>
<div className="wall-tile-figure">{data.servers ? (data.servers.total === 0 ? "—" : `${data.servers.online}/${data.servers.total}`) : "…"}</div>
<div className="wall-tile-label">servers online</div>
@@ -226,7 +226,7 @@ export default function WallView({
{page.kind === "group" && <GroupPage data={data} groupId={page.groupId ?? ""} label={page.label} />}
{page.kind === "overview" && (data.groups ?? []).length > 0 && (
<section className="wall-groups" aria-label="By area">
<section className="wall-groups" aria-label={t("By area")}>
{(data.groups ?? []).map((g) => {
const alerts = g.alerts.critical + g.alerts.warning;
const level = g.failing > 0 || g.alerts.critical > 0 ? "bad" : alerts > 0 ? "warn" : "ok";
@@ -248,7 +248,7 @@ export default function WallView({
<>
<h2 className="wall-heading">{t("Needs attention")}</h2>
{data.problems.length === 0 ? (
<div className="wall-empty">Nothing right now.</div>
<div className="wall-empty">{t("Nothing right now.")}</div>
) : (
<ul className="wall-list">
{data.problems.slice(0, 7).map((a) => (
@@ -264,7 +264,7 @@ export default function WallView({
)}
{data.windows && data.windows.length > 0 && (
<>
<h2 className="wall-heading mt-4">In maintenance</h2>
<h2 className="wall-heading mt-4">{t("In maintenance")}</h2>
<ul className="wall-list wall-list-small">
{data.windows.slice(0, 8).map((w) => (
<li key={w.id}>
@@ -281,7 +281,7 @@ export default function WallView({
<>
<h2 className="wall-heading">{t("Integrations")}</h2>
{data.integrations.length === 0 ? (
<div className="wall-empty">None connected.</div>
<div className="wall-empty">{t("None connected.")}</div>
) : (
<ul className="wall-list wall-list-small">
{data.integrations.map((i) => (
@@ -300,14 +300,14 @@ export default function WallView({
</section>
) : (
<section className="wall-columns">
<div className="wall-empty">This board shows the numbers only.</div>
<div className="wall-empty">{t("This board shows the numbers only.")}</div>
</section>
)}
<footer className="wall-footer">
<span>
{display?.name && <strong>{display.name} · </strong>}
{data.updatedAt ? `Updated ${formatTime(data.updatedAt)}` : "Loading…"} · refreshes every {REFRESH_MS / 1000} s
{data.updatedAt ? `Updated ${formatTime(data.updatedAt)}` : t("Loading…")} · refreshes every {REFRESH_MS / 1000} s
{rotating && pages.length > 1 && (
<span className="wall-pager" aria-label={`Page ${pages.findIndex((p) => p.id === page.id) + 1} of ${pages.length}: ${page.label}`}>
{" "}
@@ -326,7 +326,7 @@ export default function WallView({
<label className="wall-rotate">
Rotate{" "}
<select
aria-label="Rotate through the pages every"
aria-label={t("Rotate through the pages every")}
value={rotation.seconds === null ? "off" : String(rotation.seconds)}
onChange={(e) => {
setPaused(false);
@@ -346,7 +346,7 @@ export default function WallView({
</label>
{rotating && pages.length > 1 && (
<button type="button" className="wall-link" onClick={() => setPaused((p) => !p)} aria-pressed={paused}>
{paused ? "Resume" : "Pause"}
{paused ? t("Resume") : t("Pause")}
</button>
)}
</>
@@ -377,7 +377,7 @@ function AlertsPage({ data, now }: { data: WallData; now: Date }) {
</ul>
{data.windows && data.windows.length > 0 && (
<>
<h2 className="wall-heading mt-4">In maintenance</h2>
<h2 className="wall-heading mt-4">{t("In maintenance")}</h2>
<ul className="wall-list wall-list-small wall-list-cols">
{data.windows.slice(0, 8).map((w) => (
<li key={w.id}>
+1 -1
View File
@@ -59,7 +59,7 @@ export default function WhatChanged({ role }: { role: UserRole }) {
<div className="card-header">
<div>
<h3 className="card-title">{t("Since you last looked")}</h3>
<div className="text-secondary small">{summary.firstTime ? "In the last day" : <>Since <TimeAgo value={summary.since} /></>}</div>
<div className="text-secondary small">{summary.firstTime ? t("In the last day") : <>{t("Since")} <TimeAgo value={summary.since} /></>}</div>
</div>
<div className="card-actions">
<button type="button" className="btn btn-sm btn-primary" onClick={gotIt} disabled={busy}>
+7 -6
View File
@@ -5,6 +5,7 @@ import { BlockSkeleton } from "./Skeleton";
import { ErrorNotice } from "./Notice";
import { formatDateTime } from "../utils/date";
import { readableError } from "../utils/errors";
import { t } from "../i18n";
const RANGES = [
{ minutes: 30, label: "30 min" },
@@ -14,9 +15,9 @@ const RANGES = [
];
const CONFIDENCE: Record<BeforeSuspect["confidence"], { label: string; className: string; title: string }> = {
likely: { label: "Likely", className: "bg-red-lt text-red", title: "Close in time and closely related" },
possible: { label: "Possible", className: "bg-yellow-lt text-yellow", title: "Either close in time or closely related" },
background: { label: "Background", className: "bg-secondary-lt text-secondary", title: "Happened in the window, but little to link it" },
likely: { get label() { return t("Likely"); }, className: "bg-red-lt text-red", get title() { return t("Close in time and closely related"); } },
possible: { get label() { return t("Possible"); }, className: "bg-yellow-lt text-yellow", get title() { return t("Either close in time or closely related"); } },
background: { get label() { return t("Background"); }, className: "bg-secondary-lt text-secondary", get title() { return t("Happened in the window, but little to link it"); } },
};
const KIND: Record<BeforeSuspect["kind"], string> = {
@@ -65,11 +66,11 @@ export default function WhatChangedBefore({ incidentId, openedAt }: { incidentId
<div className="card mb-3">
<div className="card-header">
<div>
<h3 className="card-title">What changed before this?</h3>
<h3 className="card-title">{t("What changed before this?")}</h3>
<div className="text-secondary small">Before it began, {formatDateTime(new Date(openedAt))}</div>
</div>
<div className="card-actions">
<div className="btn-group btn-group-sm" role="group" aria-label="How far back to look">
<div className="btn-group btn-group-sm" role="group" aria-label={t("How far back to look")}>
{RANGES.map((r) => (
<button key={r.minutes} type="button" className={`btn ${minutes === r.minutes ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={minutes === r.minutes} onClick={() => setMinutes(r.minutes)}>
{r.label}
@@ -122,7 +123,7 @@ export default function WhatChangedBefore({ incidentId, openedAt }: { incidentId
{report && background.length > 0 && strong.length > 0 && (
<div className="card-footer">
<button type="button" className="btn btn-sm btn-ghost-secondary" onClick={() => setShowBackground((v) => !v)}>
{showBackground ? "Hide" : "Show"} {background.length} less likely {background.length === 1 ? "one" : "ones"}
{showBackground ? t("Hide") : t("Show")} {background.length} less likely {background.length === 1 ? "one" : "ones"}
</button>
</div>
)}
+1618
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -150,7 +150,7 @@ export default function SidebarNav({
{pinned.length > 0 && (
<li className="nav-item nav-favourites">
<div className="nav-heading" id="nav-favourites-heading">
Favourites
{t("Favourites")}
</div>
<ul className="navbar-nav" aria-labelledby="nav-favourites-heading">
{pinned.map((p) => (p.search ? viewRow(p.leaf, p.path, p.search) : leafRow(p.leaf, `fav-${p.leaf.to}`)))}
+11 -11
View File
@@ -13,7 +13,7 @@ import FigureHistory from "../components/FigureHistory";
import { t } from "../i18n";
function Badge({ a }: { a: AdguardInstance }) {
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
@@ -89,24 +89,24 @@ function Card({ a, canRead, onRead }: { a: AdguardInstance; canRead: boolean; on
<div className="row g-3 mb-3">
<Tile
label={t("DNS answers")}
value={!s.running ? "Not running" : s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"}
value={!s.running ? t("Not running") : s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : t("No")}
sub={s.probe ? (s.probe.ok ? `a question about ${s.probe.name}, asked ${s.probe.host}:${s.dnsPort}` : `${s.probe.error ?? "no answer"} (${s.probe.host}:${s.dnsPort})`) : "no test yet"}
tone={!s.running || (s.probe && !s.probe.ok) ? "bad" : undefined}
/>
<Tile label="Protection" value={s.protectionEnabled ? "On" : "Off"} sub={s.protectionEnabled ? null : s.protectionOffSince ? `since ${formatAgo(s.protectionOffSince)} — nothing is being blocked` : "nothing is being blocked"} tone={s.protectionEnabled ? undefined : "warn"} />
<Tile label={t("Protection")} value={s.protectionEnabled ? t("On") : t("Off")} sub={s.protectionEnabled ? null : s.protectionOffSince ? `since ${formatAgo(s.protectionOffSince)} — nothing is being blocked` : "nothing is being blocked"} tone={s.protectionEnabled ? undefined : "warn"} />
<Tile label={`Queries${st?.periodHours ? `, last ${st.periodHours >= 48 ? `${Math.round(st.periodHours / 24)} days` : `${st.periodHours} h`}` : ""}`} value={st ? st.queries.toLocaleString() : "—"} sub={st && st.avgMs !== null ? `${st.avgMs} ms on average` : st ? null : "could not be read"} />
<Tile label="Blocked" value={st ? st.blocked.toLocaleString() : "—"} sub={st ? (st.blockedPercent === null ? null : `${st.blockedPercent}% of the queries`) : "could not be read"} />
<Tile label={t("Blocked")} value={st ? st.blocked.toLocaleString() : "—"} sub={st ? (st.blockedPercent === null ? null : `${st.blockedPercent}% of the queries`) : "could not be read"} />
</div>
{st && (st.topBlocked.length > 0 || st.topClients.length > 0 || st.topQueried.length > 0) && (
<div className="row g-3 mb-3">
<Counted title="Blocked most" items={st.topBlocked} empty="Nothing blocked." />
<Counted title="Asked about most" items={st.topQueried} empty="No queries." />
<Counted title="Asking most" items={st.topClients} empty="No clients." />
<Counted title={t("Blocked most")} items={st.topBlocked} empty="Nothing blocked." />
<Counted title={t("Asked about most")} items={st.topQueried} empty="No queries." />
<Counted title={t("Asking most")} items={st.topClients} empty="No clients." />
</div>
)}
<h4>Filter lists</h4>
<h4>{t("Filter lists")}</h4>
{s.filters === null ? (
<div className="text-secondary small">They could not be read.</div>
<div className="text-secondary small">{t("They could not be read.")}</div>
) : (
<>
<div className="text-secondary small mb-2">
@@ -171,7 +171,7 @@ export default function AdguardHome({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">AdGuard Home</h2>
<PageIntro>
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web interface can be up while DNS is not. Nothing is changed. <strong>DNS that stops answering</strong>, <strong>a DNS server that is not running</strong>,{" "}
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web interface can be up while DNS is not. Nothing is changed. <strong>{t("DNS that stops answering")}</strong>, <strong>a DNS server that is not running</strong>,{" "}
<strong>protection left off for an hour</strong> and <strong>filter lists that stopped updating</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
@@ -179,7 +179,7 @@ export default function AdguardHome({ user }: { user: CurrentUser }) {
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No AdGuard Home connected" hint="Add one under Integrations with its address and, if it has a sign-in, a user name and password." />
<EmptyState title={t("No AdGuard Home connected")} hint="Add one under Integrations with its address and, if it has a sign-in, a user name and password." />
</div>
</div>
)}
+9 -9
View File
@@ -163,7 +163,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
{canEdit && showForm && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">{editing ? `Edit "${editing.label}"` : "Add an admin link"}</h3>
<h3 className="card-title">{editing ? `Edit "${editing.label}"` : t("Add an admin link")}</h3>
</div>
<form onSubmit={submit}>
<div className="card-body row g-3">
@@ -177,7 +177,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
onChange={(e) => setForm({ ...form, serverId: e.target.value ? Number(e.target.value) : "" })}
>
<option value="" disabled>
— choose a server —
{t("— choose a server —")}
</option>
{(servers ?? []).map((s) => (
<option key={s.id} value={s.id}>
@@ -185,10 +185,10 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
</option>
))}
</select>
{editing && <div className="form-hint">Remove and re-add to move it to a different server.</div>}
{editing && <div className="form-hint">{t("Remove and re-add to move it to a different server.")}</div>}
</div>
<div className="col-md-3">
<label className="form-label">Label</label>
<label className="form-label">{t("Label")}</label>
<input
className="form-control"
required
@@ -221,7 +221,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
>
<option value="">
{loadingPorts
? "Loading this server's ports…"
? t("Loading this server's ports…")
: portOptions?.length
? "— pick a port to fill in the URL above —"
: "No known ports for this server yet"}
@@ -243,7 +243,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={saving}>
{editing ? "Save changes" : "Add link"}
{editing ? t("Save changes") : t("Add link")}
</button>
<button type="button" className="btn" onClick={cancelForm}>
{t("Cancel")}
@@ -257,7 +257,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
<TableToolbar
search={search}
onSearch={setSearch}
placeholder="Search server, label, URL…"
placeholder={t("Search server, label, URL…")}
shown={filtered.length}
total={links?.length}
actions={
@@ -275,7 +275,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
<thead>
<tr>
<SortableTh<AdminLink> label={t("Server")} sortKeyName="serverName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<AdminLink> label="Label" sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<AdminLink> label={t("Label")} sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>URL</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
@@ -309,7 +309,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
))}
{links === null && <LoadingRow colSpan={canEdit ? 4 : 3} />}
{links !== null && links.length === 0 && (
<EmptyRow colSpan={canEdit ? 4 : 3} title="No admin links yet" hint="Shortcuts to the management pages of your equipment — a router, a NAS, a hypervisor — kept in one place." action={canEdit ? { label: "Add a link", onClick: startAdd } : undefined} />
<EmptyRow colSpan={canEdit ? 4 : 3} title={t("No admin links yet")} hint="Shortcuts to the management pages of your equipment — a router, a NAS, a hypervisor — kept in one place." action={canEdit ? { label: t("Add a link"), onClick: startAdd } : undefined} />
)}
{links !== null && links.length > 0 && (sorted ?? []).length === 0 && (
<EmptyRow colSpan={canEdit ? 4 : 3} filtered={() => setSearch("")} />
+32 -32
View File
@@ -12,10 +12,10 @@ import { removeWithUndo } from "../utils/undoable";
import { t } from "../i18n";
const METRICS: { value: AlertRuleMetric; label: string; unit: string; hint: string }[] = [
{ value: "cpu", label: "CPU load", unit: "%", hint: "As each agent reports it (load average over cores)." },
{ value: "mem", label: "Memory in use", unit: "%", hint: "The share of memory in use." },
{ value: "disk", label: "Disk use", unit: "%", hint: "How full a disk is — every disk, or the one you name." },
{ value: "disk_temp", label: "Disk temperature", unit: "°C", hint: "From the disk's own report (SMART); judged as of the last report." },
{ value: "cpu", get label() { return t("CPU load"); }, unit: "%", hint: "As each agent reports it (load average over cores)." },
{ value: "mem", get label() { return t("Memory in use"); }, unit: "%", get hint() { return t("The share of memory in use."); } },
{ value: "disk", get label() { return t("Disk use"); }, unit: "%", get hint() { return t("How full a disk is — every disk, or the one you name."); } },
{ value: "disk_temp", get label() { return t("Disk temperature"); }, unit: "°C", hint: "From the disk's own report (SMART); judged as of the last report." },
];
const metricOf = (m: AlertRuleMetric) => METRICS.find((x) => x.value === m)!;
@@ -105,7 +105,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
try {
if (initial.id) await api.alertRules.update(initial.id, b);
else await api.alertRules.create(b);
toast.success(initial.id ? "Saved." : "Rule added.");
toast.success(initial.id ? t("Saved.") : t("Rule added."));
onSaved();
onClose();
} catch (err) {
@@ -116,7 +116,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
}
return (
<DetailDrawer title={initial.id ? "Change the rule" : "Add a rule"} subtitle={initial.id ? initial.name : "A limit of your own"} onClose={onClose}>
<DetailDrawer title={initial.id ? t("Change the rule") : t("Add a rule")} subtitle={initial.id ? initial.name : "A limit of your own"} onClose={onClose}>
<ErrorNotice error={error} />
<div className="mb-3">
<label className="form-label" htmlFor="rule-name">
@@ -127,7 +127,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
</div>
<div className="mb-3">
<label className="form-label" htmlFor="rule-metric">
Watch
{t("Watch")}
</label>
<select id="rule-metric" className="form-select" value={metric} onChange={(e) => { setMetric(e.target.value as AlertRuleMetric); setTried(null); }}>
{METRICS.map((x) => (
@@ -149,7 +149,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
<div className="row g-2 mb-3">
<div className="col-6">
<label className="form-label" htmlFor="rule-operator">
Alert when
{t("Alert when")}
</label>
<select id="rule-operator" className="form-select" value={operator} onChange={(e) => setOperator(e.target.value as "above" | "below")}>
<option value="above">above</option>
@@ -181,7 +181,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
<div className="row g-2 mb-3">
<div className="col-6">
<label className="form-label" htmlFor="rule-severity">
How serious
{t("How serious")}
</label>
<select id="rule-severity" className="form-select" value={severity} onChange={(e) => setSeverity(e.target.value as "warning" | "critical")}>
<option value="warning">{t("Warning")}</option>
@@ -190,20 +190,20 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
</div>
<div className="col-6">
<label className="form-label" htmlFor="rule-scope">
For
{t("For")}
</label>
<select id="rule-scope" className="form-select" value={scope} onChange={(e) => { setScope(e.target.value as typeof scope); setTried(null); }}>
<option value="all">{t("Every server")}</option>
<option value="server">One server</option>
<option value="server">{t("One server")}</option>
<option value="tag" disabled={tags.length === 0}>
Servers with a tag
{t("Servers with a tag")}
</option>
</select>
</div>
</div>
{scope === "server" && (
<select className="form-select mb-3" aria-label="Which server" value={serverId} onChange={(e) => { setServerId(e.target.value); setTried(null); }}>
<option value="">Choose a server…</option>
<select className="form-select mb-3" aria-label={t("Which server")} value={serverId} onChange={(e) => { setServerId(e.target.value); setTried(null); }}>
<option value="">{t("Choose a server…")}</option>
{servers.map((s) => (
<option key={s.id} value={s.id}>
{s.name}
@@ -212,8 +212,8 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
</select>
)}
{scope === "tag" && (
<select className="form-select mb-3" aria-label="Which tag" value={tag} onChange={(e) => { setTag(e.target.value); setTried(null); }}>
<option value="">Choose a tag…</option>
<select className="form-select mb-3" aria-label={t("Which tag")} value={tag} onChange={(e) => { setTag(e.target.value); setTried(null); }}>
<option value="">{t("Choose a tag…")}</option>
{tags.map((t) => (
<option key={t} value={t}>
{t}
@@ -238,10 +238,10 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
)}
<div className="d-flex gap-2">
<button type="button" className="btn btn-primary" disabled={busy || name.trim() === ""} onClick={() => void save()}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" disabled={busy} onClick={() => void tryIt()}>
Try it now
{t("Try it now")}
</button>
</div>
</DetailDrawer>
@@ -279,7 +279,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
try {
const { id, ...rest } = asInput(r);
await api.alertRules.update(id, { ...rest, enabled: !r.enabled });
toast.success(r.enabled ? "Switched off." : "Switched on.");
toast.success(r.enabled ? t("Switched off.") : t("Switched on."));
await load();
} catch (err) {
toast.error(readableError(err));
@@ -299,27 +299,27 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h3 className="mb-0">Alert rules</h3>
<h3 className="mb-0">{t("Alert rules")}</h3>
{canEdit && (
<div className="ms-auto">
<button className="btn btn-primary" onClick={() => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" })}>
Add a rule
{t("Add a rule")}
</button>
</div>
)}
</div>
<div className="text-secondary mb-3">
Limits of your own, on top of the built-in checks: &ldquo;CPU above 90% for 15 minutes&rdquo;, &ldquo;memory above 85%&rdquo;, &ldquo;a disk warmer than 55 °C&rdquo;. What a rule finds is an ordinary alert on the{" "}
<Link to="/alerts">Alerts page</Link> — raised and cleared with a message, held back by maintenance, routed by the notification rules. A server that is not reporting is not judged; its own offline alert says that.
<Link to="/alerts">{t("Alerts page")}</Link> — raised and cleared with a message, held back by maintenance, routed by the notification rules. A server that is not reporting is not judged; its own offline alert says that.
</div>
<ErrorNotice error={error} />
{data === null && !error && <BlockSkeleton lines={3} />}
{data && data.rules.length === 0 && (
<div className="card">
<EmptyState
title="No rules of your own yet"
hint={canEdit ? "Start from one of these, or add your own." : "An administrator can add them."}
action={canEdit ? { label: "Add a rule", onClick: () => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" }) } : undefined}
title={t("No rules of your own yet")}
hint={canEdit ? t("Start from one of these, or add your own.") : t("An administrator can add them.")}
action={canEdit ? { label: t("Add a rule"), onClick: () => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" }) } : undefined}
/>
{canEdit && (
<div className="d-flex flex-wrap justify-content-center gap-2 pb-4">
@@ -338,9 +338,9 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Rule</th>
<th>{t("Rule")}</th>
<th>{t("Severity")}</th>
<th>Right now</th>
<th>{t("Right now")}</th>
{canEdit && (
<th className="w-1">
<span className="visually-hidden">{t("Actions")}</span>
@@ -357,13 +357,13 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
<div className="text-secondary small">{sentence(r)}</div>
</td>
<td className="stack-label" data-label={t("Severity")}>
<span className={`badge ${r.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{r.severity === "critical" ? "Critical" : "Warning"}</span>
<span className={`badge ${r.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{r.severity === "critical" ? t("Critical") : t("Warning")}</span>
</td>
<td className="stack-label" data-label="Right now">
<td className="stack-label" data-label={t("Right now")}>
{!r.enabled ? (
<span className="text-secondary">—</span>
) : r.firing.length === 0 ? (
<span className="text-green">Not raised</span>
<span className="text-green">{t("Not raised")}</span>
) : (
<div>
{r.firing.slice(0, 4).map((f, i) => (
@@ -387,10 +387,10 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
<td className="text-nowrap stack-wide">
<div className="btn-list flex-nowrap">
<button className="btn btn-sm btn-outline-secondary" onClick={() => setEditing(asInput(r))}>
Change
{t("Change")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={() => void toggle(r)}>
{r.enabled ? "Switch off" : "Switch on"}
{r.enabled ? t("Switch off") : t("Switch on")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(r)} aria-label={`Remove ${r.name}`}>
{t("Remove")}
+4 -4
View File
@@ -20,9 +20,9 @@ export default function AlertSettings({ user }: { user: CurrentUser }) {
const asked = params.get("view");
const view: View = asked === "levels" ? "levels" : isAdmin && asked === "tickets" ? "tickets" : "rules";
const tabs = [
{ to: "/alert-settings", label: "Alert rules", active: view === "rules" },
{ to: "/alert-settings?view=levels", label: "Service levels", active: view === "levels" },
...(isAdmin ? [{ to: "/alert-settings?view=tickets", label: "Alert tickets", active: view === "tickets" }] : []),
{ to: "/alert-settings", label: t("Alert rules"), active: view === "rules" },
{ to: "/alert-settings?view=levels", label: t("Service levels"), active: view === "levels" },
...(isAdmin ? [{ to: "/alert-settings?view=tickets", label: t("Alert tickets"), active: view === "tickets" }] : []),
];
return (
<>
@@ -30,7 +30,7 @@ export default function AlertSettings({ user }: { user: CurrentUser }) {
<h2 className="page-title mb-0">{t("Alert settings")}</h2>
{isAdmin && (
<Link to="/settings/notifications" className="ms-auto">
Notification settings: channels, what is sent, quiet hours →
{t("Notification settings: channels, what is sent, quiet hours →")}
</Link>
)}
</div>
+18 -18
View File
@@ -34,9 +34,9 @@ import { doBulk, plural } from "../utils/bulk";
import { t, tn } from "../i18n";
const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = {
critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 },
warning: { label: "Warning", badge: "bg-yellow-lt text-yellow", rank: 1 },
info: { label: "Info", badge: "bg-blue-lt text-blue", rank: 2 },
critical: { get label() { return t("Critical"); }, badge: "bg-red-lt text-red", rank: 0 },
warning: { get label() { return t("Warning"); }, badge: "bg-yellow-lt text-yellow", rank: 1 },
info: { get label() { return t("Info"); }, badge: "bg-blue-lt text-blue", rank: 2 },
};
const CATEGORY_LABELS: Record<AlertCategory, string> = {
@@ -59,9 +59,9 @@ const alertTabs = (view: "now" | "history" | "noise") => (
<ViewTabs
label={t("Alerts view")}
tabs={[
{ to: "/alerts", label: "Now", active: view === "now" },
{ to: "/alerts?view=history", label: "History", active: view === "history" },
{ to: "/alerts?view=noise", label: "Noise", active: view === "noise" },
{ to: "/alerts", label: t("Now"), active: view === "now" },
{ to: "/alerts?view=history", label: t("History"), active: view === "history" },
{ to: "/alerts?view=noise", label: t("Noise"), active: view === "noise" },
]}
/>
);
@@ -385,12 +385,12 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
const counts = report?.counts;
const nothingFound = report !== null && report.alerts.length === 0;
const cards: { label: string; value: number | undefined; color: string }[] = [
{ label: "Critical", value: counts?.attention?.critical ?? counts?.critical, color: "text-red" },
{ label: "Warnings", value: counts?.attention?.warning ?? counts?.warning, color: "text-yellow" },
...((counts?.acknowledged ?? 0) > 0 ? [{ label: "Acknowledged", value: counts?.acknowledged, color: "text-blue" }] : []),
{ label: "Info", value: counts?.info, color: "text-blue" },
{ label: t("Critical"), value: counts?.attention?.critical ?? counts?.critical, color: "text-red" },
{ label: t("Warnings"), value: counts?.attention?.warning ?? counts?.warning, color: "text-yellow" },
...((counts?.acknowledged ?? 0) > 0 ? [{ label: t("Acknowledged"), value: counts?.acknowledged, color: "text-blue" }] : []),
{ label: t("Info"), value: counts?.info, color: "text-blue" },
{ label: "Silenced (maintenance)", value: counts?.silenced, color: "text-secondary" },
...((counts?.grouped ?? 0) > 0 ? [{ label: "Grouped under another", value: counts?.grouped, color: "text-secondary" }] : []),
...((counts?.grouped ?? 0) > 0 ? [{ label: t("Grouped under another"), value: counts?.grouped, color: "text-secondary" }] : []),
];
return (
@@ -435,7 +435,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<div className="card-body py-3">
<div className="h3 mb-1">
{headline.standing - headline.acknowledged === 0
? "Nothing needs attention"
? t("Nothing needs attention")
: `${headline.standing - headline.acknowledged} ${headline.standing - headline.acknowledged === 1 ? "problem needs" : "problems need"} attention`}
{headline.acknowledged > 0 && <span className="text-secondary fw-normal fs-4"> · {headline.acknowledged} acknowledged</span>}
</div>
@@ -520,7 +520,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<option value="warning">{t("Warning")}</option>
<option value="info">{t("Info")}</option>
</select>
<select className="form-select form-select-sm w-auto" value={groupBy} aria-label="Grouping" onChange={(e) => chooseGroupBy(e.target.value as GroupBy)}>
<select className="form-select form-select-sm w-auto" value={groupBy} aria-label={t("Grouping")} onChange={(e) => chooseGroupBy(e.target.value as GroupBy)}>
{(Object.keys(GROUP_BY_LABELS) as GroupBy[]).map((g) => (
<option key={g} value={g}>
{GROUP_BY_LABELS[g]}
@@ -583,9 +583,9 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<thead>
<tr>
<SortableTh<Row> label={t("Severity")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Kind" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Kind")} sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Source")} sortKeyName="source" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Alert" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Alert")} sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{canSilence && (
<th className="w-1">
<span className="visually-hidden">{t("Actions")}</span>
@@ -655,7 +655,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
)}
{a.incidentId != null && (
<div className="small">
<Link to={incidentPath(a.incidentId)}>Timeline</Link>
<Link to={incidentPath(a.incidentId)}>{t("Timeline")}</Link>
</div>
)}
{(a.target || a.kind) && (
@@ -688,8 +688,8 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
)}
{a.ticket &&
(() => {
const label = a.ticket.number ? `Ticket #${a.ticket.number}${a.ticket.closedAt ? " (closed)" : ""}` : "Ticket opened";
const title = a.ticket.closedAt ? "This ticket was closed in osTicket from here" : a.ticket.grouped ? "Part of one ticket that covers several problems that appeared together" : "A ticket was opened for this in osTicket";
const label = a.ticket.number ? `Ticket #${a.ticket.number}${a.ticket.closedAt ? " (closed)" : ""}` : t("Ticket opened");
const title = a.ticket.closedAt ? t("This ticket was closed in osTicket from here") : a.ticket.grouped ? t("Part of one ticket that covers several problems that appeared together") : "A ticket was opened for this in osTicket";
return a.ticket.url ? (
<a className="badge bg-blue-lt text-blue ms-2" href={a.ticket.url} target="_blank" rel="noopener noreferrer" title={title}>
{label}
+17 -17
View File
@@ -16,7 +16,7 @@ const EXPIRY = [
{ value: "90", label: "90 days" },
{ value: "30", label: "30 days" },
{ value: "365", label: "1 year" },
{ value: "", label: "No end — until I remove it" },
{ value: "", get label() { return t("No end — until I remove it"); } },
];
const READS = [
@@ -72,7 +72,7 @@ export default function ApiTokens() {
async function remove(item_: ApiToken) {
// Not undoable: the secret is not kept, so a token cannot be made again the same.
if (!(await confirmDialog({ title: "Remove a token", message: `Remove "${item_.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove a token"), message: `Remove "${item_.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.apiTokens.remove(item_.id);
toast.success(`Removed "${item_.label}".`);
@@ -102,10 +102,10 @@ export default function ApiTokens() {
<code className="text-break">{fresh.secret}</code>
<CopyButton text={fresh.secret} />
</div>
<div className="small">Send it in a header, never in the address:</div>
<div className="small">{t("Send it in a header, never in the address:")}</div>
<pre className="mb-2 mt-1 small">{`curl -H "Authorization: Bearer ${fresh.secret}" ${origin}/api/v1/alerts`}</pre>
<button type="button" className="btn btn-sm" onClick={() => setFresh(null)}>
I have copied it
{t("I have copied it")}
</button>
</div>
</div>
@@ -113,18 +113,18 @@ export default function ApiTokens() {
<form className="card mb-3" onSubmit={make}>
<div className="card-header">
<h3 className="card-title">Make a token</h3>
<h3 className="card-title">{t("Make a token")}</h3>
</div>
<div className="card-body row g-3 align-items-end">
<div className="col-md-5">
<label className="form-label" htmlFor="tok-label">
What it is for
{t("What it is for")}
</label>
<input id="tok-label" className="form-control" maxLength={60} required placeholder="e.g. Home Assistant" value={label} onChange={(e) => setLabel(e.target.value)} />
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="tok-exp">
Works for
{t("Works for")}
</label>
<select id="tok-exp" className="form-select" value={expiry} onChange={(e) => setExpiry(e.target.value)}>
{EXPIRY.map((o) => (
@@ -136,7 +136,7 @@ export default function ApiTokens() {
</div>
<div className="col-md-3">
<button type="submit" className="btn btn-primary w-100" disabled={busy || label.trim() === "" || (tokens?.length ?? 0) >= max}>
{busy ? "Making…" : "Make the token"}
{busy ? "Making…" : t("Make the token")}
</button>
</div>
{(tokens?.length ?? 0) >= max && <div className="col-12 text-secondary small">You have {max} tokens, the most there can be. Remove one you do not use.</div>}
@@ -152,9 +152,9 @@ export default function ApiTokens() {
<thead>
<tr>
<th>{t("Name")}</th>
<th>Starts with</th>
<th>Made</th>
<th>Last used</th>
<th>{t("Starts with")}</th>
<th>{t("Made")}</th>
<th>{t("Last used")}</th>
<th>{t("Ends")}</th>
<th className="w-1">
<span className="visually-hidden">{t("Actions")}</span>
@@ -175,13 +175,13 @@ export default function ApiTokens() {
<strong>{item_.label}</strong>
{item_.expired && <span className="badge bg-red-lt text-red ms-2">expired</span>}
</td>
<td className="stack-label font-monospace" data-label="Starts with">
<td className="stack-label font-monospace" data-label={t("Starts with")}>
{item_.tokenPrefix}…
</td>
<td className="stack-label" data-label="Made">
<td className="stack-label" data-label={t("Made")}>
<TimeAgo value={item_.createdAt} fromDb />
</td>
<td className="stack-label" data-label="Last used">
<td className="stack-label" data-label={t("Last used")}>
{item_.lastUsedAt ? <TimeAgo value={item_.lastUsedAt} /> : <span className="text-secondary">never</span>}
</td>
<td className="stack-label" data-label={t("Ends")}>
@@ -194,7 +194,7 @@ export default function ApiTokens() {
</td>
</tr>
))}
{tokens !== null && tokens.length === 0 && <EmptyRow colSpan={6} title="No tokens yet" hint="Make one above, and copy it when it is shown: that is the only time it is." />}
{tokens !== null && tokens.length === 0 && <EmptyRow colSpan={6} title={t("No tokens yet")} hint="Make one above, and copy it when it is shown: that is the only time it is." />}
</tbody>
</table>
</div>
@@ -202,7 +202,7 @@ export default function ApiTokens() {
<div className="card">
<div className="card-header">
<h3 className="card-title">What it can read</h3>
<h3 className="card-title">{t("What it can read")}</h3>
</div>
<div className="card-body">
<p className="text-secondary">
@@ -215,7 +215,7 @@ export default function ApiTokens() {
</li>
))}
</ul>
<div className="text-secondary small">The full list, with an example of each answer, is in docs/API.md.</div>
<div className="text-secondary small">{t("The full list, with an example of each answer, is in docs/API.md.")}</div>
</div>
</div>
</>
+18 -18
View File
@@ -15,7 +15,7 @@ import FigureHistory from "../components/FigureHistory";
import { t } from "../i18n";
function Badge({ a }: { a: AuthentikInfo }) {
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
@@ -60,17 +60,17 @@ function Card({ a }: { a: AuthentikInfo }) {
<h4>Outposts</h4>
{s.outposts.length === 0 ? (
<div className="text-secondary mb-3">None.</div>
<div className="text-secondary mb-3">{t("None.")}</div>
) : (
<div className="table-responsive mb-3">
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Outpost</th>
<th>Type</th>
<th className="text-end">Serves</th>
<th>{t("Type")}</th>
<th className="text-end">{t("Serves")}</th>
<th>{t("Reporting")}</th>
<th>Last heard</th>
<th>{t("Last heard")}</th>
</tr>
</thead>
<tbody>
@@ -99,7 +99,7 @@ function Card({ a }: { a: AuthentikInfo }) {
</div>
)}
<h4>Certificates</h4>
<h4>{t("Certificates")}</h4>
{s.certificates.length === 0 ? (
<div className="text-secondary mb-3">None that Authentik doesn&rsquo;t renew itself.</div>
) : (
@@ -114,18 +114,18 @@ function Card({ a }: { a: AuthentikInfo }) {
<h4>API tokens and app passwords that expire</h4>
{s.tokens.length === 0 ? (
<div className="text-secondary mb-3">None.</div>
<div className="text-secondary mb-3">{t("None.")}</div>
) : (
<ul className="mb-3">
{s.tokens.map((t) => (
<li key={t.identifier}>
{t.identifier}
{s.tokens.map((tok) => (
<li key={tok.identifier}>
{tok.identifier}
<span className="text-secondary">
{" "}
({t.intent === "app_password" ? "app password" : "API token"}
{t.user ? `, ${t.user}` : ""})
({tok.intent === "app_password" ? "app password" : t("API token")}
{tok.user ? `, ${tok.user}` : ""})
</span>{" "}
— <Left days={t.days} warn={7} critical={2} />
— <Left days={tok.days} warn={7} critical={2} />
</li>
))}
</ul>
@@ -192,19 +192,19 @@ export default function Authentik({ user }: { user: CurrentUser }) {
<ViewTabs
label="Authentik view"
tabs={[
{ to: "/authentik", label: "Status", active: view === "status" },
{ to: "/authentik?view=users", label: "Users and groups", active: view === "users" },
{ to: "/authentik", label: t("Status"), active: view === "status" },
{ to: "/authentik?view=users", label: t("Users and groups"), active: view === "users" },
]}
/>
)}
{view === "status" ? (
<PageIntro>
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
<strong>{t("API token")}</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
{isAdmin && (
<>
{" "}
Making users and looking after users and groups is under <Link to="/authentik?view=users">Users and groups</Link>.
Making users and looking after users and groups is under <Link to="/authentik?view=users">{t("Users and groups")}</Link>.
</>
)}
</PageIntro>
@@ -219,7 +219,7 @@ export default function Authentik({ user }: { user: CurrentUser }) {
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No Authentik connected" hint="Add one under Integrations with its address and an API token (Authentik → Directory → Tokens and App passwords → Create, intent API Token)." />
<EmptyState title={t("No Authentik connected")} hint="Add one under Integrations with its address and an API token (Authentik → Directory → Tokens and App passwords → Create, intent API Token)." />
</div>
</div>
)}
+47 -47
View File
@@ -26,22 +26,22 @@ interface Row extends CoverageGuest {
const RANK: Record<CoverageStatus, number> = { failed: 0, none: 1, stale: 2, unknown: 3, ok: 4 };
const STATUS: Record<CoverageStatus, { label: string; badge: string; hint: string }> = {
ok: { label: "Recent backup", badge: "bg-green-lt text-green", hint: "Backed up within the limit, and nothing failed." },
stale: { label: "Stale", badge: "bg-yellow-lt text-yellow", hint: "Its newest backup is older than the limit." },
failed: { label: "Failed", badge: "bg-red-lt text-red", hint: "The latest backup didn't succeed, or the newest snapshot failed verification." },
none: { label: "No backup", badge: "bg-red-lt text-red", hint: "No backup found, and no backup job covers it." },
unknown: { label: "Unknown", badge: "bg-secondary-lt text-secondary", hint: "A backup job covers it, but nothing here says when it last ran — typical when backups go somewhere other than a Backup Server." },
ok: { get label() { return t("Recent backup"); }, badge: "bg-green-lt text-green", get hint() { return t("Backed up within the limit, and nothing failed."); } },
stale: { get label() { return t("Stale"); }, badge: "bg-yellow-lt text-yellow", get hint() { return t("Its newest backup is older than the limit."); } },
failed: { get label() { return t("Failed"); }, badge: "bg-red-lt text-red", get hint() { return t("The latest backup didn't succeed, or the newest snapshot failed verification."); } },
none: { get label() { return t("No backup"); }, badge: "bg-red-lt text-red", get hint() { return t("No backup found, and no backup job covers it."); } },
unknown: { get label() { return t("Unknown"); }, badge: "bg-secondary-lt text-secondary", hint: "A backup job covers it, but nothing here says when it last ran — typical when backups go somewhere other than a Backup Server." },
};
const STALE_CHOICES = [1, 2, 3, 7, 14];
const RESTORE: Record<RestoreStatus, { label: string; badge: string }> = {
never: { label: "Never tested", badge: "bg-secondary-lt text-secondary" },
ok: { label: "Restored fine", badge: "bg-green-lt text-green" },
partial: { label: "Partly worked", badge: "bg-yellow-lt text-yellow" },
failed: { label: "Restore failed", badge: "bg-red-lt text-red" },
stale: { label: "Test is old", badge: "bg-yellow-lt text-yellow" },
not_needed: { label: "No need to test", badge: "bg-secondary-lt text-secondary" },
never: { get label() { return t("Never tested"); }, badge: "bg-secondary-lt text-secondary" },
ok: { get label() { return t("Restored fine"); }, badge: "bg-green-lt text-green" },
partial: { get label() { return t("Partly worked"); }, badge: "bg-yellow-lt text-yellow" },
failed: { get label() { return t("Restore failed"); }, badge: "bg-red-lt text-red" },
stale: { get label() { return t("Test is old"); }, badge: "bg-yellow-lt text-yellow" },
not_needed: { get label() { return t("No need to test"); }, badge: "bg-secondary-lt text-secondary" },
};
const RESULT_WORDS: Record<RestoreResult, string> = { ok: "It restored and worked", partial: "It restored, but not everything worked", failed: "It failed", not_needed: "No need to test this one" };
@@ -159,25 +159,25 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
downloadCsv(
"backup-coverage.csv",
["Guest", "Type", "ID", "Node", "Cluster", "In a backup job", "Last backup", "Source", "Status", "Problem", "Restore test", "Tested on"],
sorted.map((r) => [r.name, r.type === "qemu" ? "VM" : "Container", r.vmid, r.node, r.integrationName, r.inJob ? "yes" : "no", r.lastBackupAt ?? "", r.lastSource === "pbs" ? "Backup Server" : r.lastSource === "task" ? "Proxmox task" : "", STATUS[r.status].label, r.failure ?? "", r.restoreTest ? RESTORE[r.restoreTest.status].label : "", r.restoreTest?.testedAt ?? ""]),
sorted.map((r) => [r.name, r.type === "qemu" ? "VM" : "Container", r.vmid, r.node, r.integrationName, r.inJob ? "yes" : "no", r.lastBackupAt ?? "", r.lastSource === "pbs" ? t("Backup Server") : r.lastSource === "task" ? t("Proxmox task") : "", STATUS[r.status].label, r.failure ?? "", r.restoreTest ? RESTORE[r.restoreTest.status].label : "", r.restoreTest?.testedAt ?? ""]),
);
}
const cards: { label: string; value: string | number; color: string; note?: string }[] = [
{ label: "Guests", value: report ? (c?.total ?? 0) : "…", color: "" },
{ label: "Recent backup", value: report ? (c?.ok ?? 0) : "…", color: "text-green" },
{ label: "Failed", value: report ? (c?.failed ?? 0) : "…", color: (c?.failed ?? 0) > 0 ? "text-red" : "" },
{ label: "No backup", value: report ? (c?.none ?? 0) : "…", color: (c?.none ?? 0) > 0 ? "text-red" : "" },
{ label: "Stale", value: report ? (c?.stale ?? 0) : "…", color: (c?.stale ?? 0) > 0 ? "text-yellow" : "", note: `older than ${staleDays} ${staleDays === 1 ? "day" : "days"}` },
{ label: "Unknown", value: report ? (c?.unknown ?? 0) : "…", color: "text-secondary", note: (c?.unknown ?? 0) > 0 ? "in a job, last run not visible" : undefined },
{ label: t("Guests"), value: report ? (c?.total ?? 0) : "…", color: "" },
{ label: t("Recent backup"), value: report ? (c?.ok ?? 0) : "…", color: "text-green" },
{ label: t("Failed"), value: report ? (c?.failed ?? 0) : "…", color: (c?.failed ?? 0) > 0 ? "text-red" : "" },
{ label: t("No backup"), value: report ? (c?.none ?? 0) : "…", color: (c?.none ?? 0) > 0 ? "text-red" : "" },
{ label: t("Stale"), value: report ? (c?.stale ?? 0) : "…", color: (c?.stale ?? 0) > 0 ? "text-yellow" : "", note: `older than ${staleDays} ${staleDays === 1 ? "day" : "days"}` },
{ label: t("Unknown"), value: report ? (c?.unknown ?? 0) : "…", color: "text-secondary", note: (c?.unknown ?? 0) > 0 ? "in a job, last run not visible" : undefined },
];
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
<h2 className="page-title mb-0">Backup coverage</h2>
<h2 className="page-title mb-0">{t("Backup coverage")}</h2>
<button className="btn btn-outline-secondary ms-auto" onClick={() => load(true)} disabled={checking}>
{checking ? "Checking…" : "Check now"}
{checking ? t("Checking…") : t("Check now")}
</button>
</div>
{tabs}
@@ -188,7 +188,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
{badSources.length > 0 && (
<div className="alert alert-warning">
Couldn't read everything — what is missing below isn't necessarily wrong:{" "}
{badSources.map((s) => `${s.kind === "pbs" ? "Backup Server" : "Proxmox"} “${s.name}” (${s.error})`).join("; ")}.
{badSources.map((s) => `${s.kind === "pbs" ? t("Backup Server") : "Proxmox"} “${s.name}” (${s.error})`).join("; ")}.
</div>
)}
@@ -210,19 +210,19 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
<TableToolbar
search={tableSearch.query}
onSearch={tableSearch.setQuery}
placeholder="Search guests…"
placeholder={t("Search guests…")}
filters={
<>
<select className="form-select form-select-sm w-auto" aria-label="Show guests that are" value={status} onChange={(e) => setParam("status", e.target.value)}>
<option value="">All guests</option>
<option value="attention">Needing attention</option>
<select className="form-select form-select-sm w-auto" aria-label={t("Show guests that are")} value={status} onChange={(e) => setParam("status", e.target.value)}>
<option value="">{t("All guests")}</option>
<option value="attention">{t("Needing attention")}</option>
{(Object.keys(RANK) as CoverageStatus[]).map((s) => (
<option key={s} value={s}>
{STATUS[s].label}
</option>
))}
</select>
<select className="form-select form-select-sm w-auto" aria-label="Stale after" value={staleDays} onChange={(e) => setParam("stale", e.target.value === "2" ? null : e.target.value)}>
<select className="form-select form-select-sm w-auto" aria-label={t("Stale after")} value={staleDays} onChange={(e) => setParam("stale", e.target.value === "2" ? null : e.target.value)}>
{STALE_CHOICES.map((d) => (
<option key={d} value={d}>
Stale after {d} {d === 1 ? "day" : "days"}
@@ -240,11 +240,11 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<Row> label="Guest" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="In a job" sortKeyName="inJob" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Last backup" sortKeyName="lastBackupAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Guest")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("In a job")} sortKeyName="inJob" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Last backup")} sortKeyName="lastBackupAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>Restore test</th>
<th>{t("Restore test")}</th>
</tr>
</thead>
<tbody>
@@ -274,7 +274,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
{r.lastBackupAt ? (
<>
<TimeAgo value={r.lastBackupAt} />
<div className="text-secondary small">{r.lastSource === "pbs" ? "Backup Server" : "Proxmox task"}</div>
<div className="text-secondary small">{r.lastSource === "pbs" ? t("Backup Server") : t("Proxmox task")}</div>
</>
) : (
<span className="text-secondary">—</span>
@@ -298,7 +298,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
{canRecord && r.restoreKey && (
<div>
<button type="button" className="btn btn-link btn-sm p-0" onClick={() => setDraft({ key: r.restoreKey!, label: r.name, testedAt: todayIso(), result: "ok", note: "" })}>
Record a test
{t("Record a test")}
</button>
</div>
)}
@@ -306,7 +306,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
</tr>
))}
{report !== null && sorted?.length === 0 && (
<EmptyRow colSpan={5} {...(rows.length === 0 ? { title: "No Proxmox guests to show", hint: "Connect a Proxmox integration and its virtual machines and containers appear here, with when each was last backed up.", action: { label: "Connect Proxmox", to: "/integrations" } } : { filtered: () => { tableSearch.setQuery(""); setParam("status", null); } })} />
<EmptyRow colSpan={5} {...(rows.length === 0 ? { title: t("No Proxmox guests to show"), hint: t("Connect a Proxmox integration and its virtual machines and containers appear here, with when each was last backed up."), action: { label: t("Connect Proxmox"), to: "/integrations" } } : { filtered: () => { tableSearch.setQuery(""); setParam("status", null); } })} />
)}
</tbody>
</table>
@@ -327,20 +327,20 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
{draft.key === null && (
<div className="col-md-5">
<label className="form-label" htmlFor="rt-label">
What was restored
{t("What was restored")}
</label>
<input id="rt-label" className="form-control" required maxLength={120} placeholder="e.g. Photos share, Gitea database" value={draft.label} onChange={(e) => setDraft({ ...draft, label: e.target.value })} />
</div>
)}
<div className="col-md-3">
<label className="form-label" htmlFor="rt-date">
On
{t("On")}
</label>
<input id="rt-date" type="date" className="form-control" required max={todayIso()} value={draft.testedAt} onChange={(e) => setDraft({ ...draft, testedAt: e.target.value })} />
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="rt-result">
How it went
{t("How it went")}
</label>
<select id="rt-result" className="form-select" value={draft.result} onChange={(e) => setDraft({ ...draft, result: e.target.value as RestoreResult })}>
{(Object.keys(RESULT_WORDS) as RestoreResult[]).map((r) => (
@@ -352,14 +352,14 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
</div>
<div className="col-12">
<label className="form-label" htmlFor="rt-note">
Note (optional)
{t("Note (optional)")}
</label>
<input id="rt-note" className="form-control" maxLength={500} placeholder="e.g. restored to a scratch VM, booted, the database was there" value={draft.note} onChange={(e) => setDraft({ ...draft, note: e.target.value })} />
</div>
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={saving || draft.label.trim() === ""}>
{saving ? "Saving…" : "Record it"}
{saving ? "Saving…" : t("Record it")}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
{t("Cancel")}
@@ -370,11 +370,11 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
<div className="card mt-3">
<div className="card-header">
<h3 className="card-title">Restore tests</h3>
<h3 className="card-title">{t("Restore tests")}</h3>
{canRecord && !draft && (
<div className="card-actions">
<button className="btn btn-sm" onClick={() => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" })}>
Record a test of something else
{t("Record a test of something else")}
</button>
</div>
)}
@@ -385,7 +385,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
</div>
{custom.length > 0 && (
<div className="card-body pb-0">
<div className="text-secondary small mb-1">Other things being tracked</div>
<div className="text-secondary small mb-1">{t("Other things being tracked")}</div>
<div className="d-flex flex-wrap gap-2">
{custom.map((c) => (
<span key={c.key} className={`badge ${RESTORE[c.status].badge}`}>
@@ -399,10 +399,10 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Date</th>
<th>What</th>
<th>Result</th>
<th>Note</th>
<th>{t("Date")}</th>
<th>{t("What")}</th>
<th>{t("Result")}</th>
<th>{t("Note")}</th>
{isAdmin && <th className="w-1">{t("Actions")}</th>}
</tr>
</thead>
@@ -416,7 +416,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
)}
{tests?.map((item_) => (
<tr key={item_.id}>
<td className="stack-label" data-label="Date">{item_.testedAt}</td>
<td className="stack-label" data-label={t("Date")}>{item_.testedAt}</td>
<td>{item_.label}</td>
<td>
<span className={`badge ${RESTORE[item_.result].badge}`}>{RESTORE[item_.result].label}</span>
@@ -435,7 +435,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
</tr>
))}
{tests !== null && tests.length === 0 && (
<EmptyRow colSpan={isAdmin ? 5 : 4} title="No restore recorded yet" hint="A backup nobody has restored is a hope, not a backup. Try restoring one — to a scratch machine is fine — and record how it went." action={canRecord ? { label: "Record a test", onClick: () => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" }) } : undefined} />
<EmptyRow colSpan={isAdmin ? 5 : 4} title={t("No restore recorded yet")} hint="A backup nobody has restored is a hope, not a backup. Try restoring one — to a scratch machine is fine — and record how it went." action={canRecord ? { label: t("Record a test"), onClick: () => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" }) } : undefined} />
)}
</tbody>
</table>
+2 -1
View File
@@ -3,6 +3,7 @@ import type { CurrentUser } from "../api/client";
import ViewTabs from "../components/ViewTabs";
import Backups from "./Backups";
import PbsBackup from "./PbsBackup";
import { t } from "../i18n";
/**
* The Proxmox backups, on one page with a tab for each view: **Backup coverage** (is every guest in a backup job, and when was it last backed up) and **Proxmox Backup Server** (its datastores,
@@ -15,7 +16,7 @@ export default function BackupsHub({ user }: { user: CurrentUser }) {
<ViewTabs
label="Backup view"
tabs={[
{ to: "/backups", label: "Backup coverage", active: view === "coverage" },
{ to: "/backups", label: t("Backup coverage"), active: view === "coverage" },
{ to: "/backups?view=pbs", label: "Proxmox Backup Server", active: view === "pbs" },
]}
/>
+11 -11
View File
@@ -16,9 +16,9 @@ const TONE_DOT: Record<ChangeEntry["tone"], string> = { good: "#2fb344", bad: "#
const RANGES: { days: number; label: string }[] = [
{ days: 1, label: "Last 24 hours" },
{ days: 7, label: "Last 7 days" },
{ days: 30, label: "Last 30 days" },
{ days: 30, get label() { return t("Last 30 days"); } },
{ days: 90, label: "Last 90 days" },
{ days: 400, label: "Everything kept" },
{ days: 400, get label() { return t("Everything kept"); } },
];
const PAGE = 100;
@@ -29,10 +29,10 @@ const PAGE = 100;
*/
const changeTabs = (view: "changes" | "audit") => (
<ViewTabs
label="Change log view"
label={t("Change log view")}
tabs={[
{ to: "/changes", label: "Readable", active: view === "changes" },
{ to: "/changes?view=audit", label: "Raw audit log", active: view === "audit" },
{ to: "/changes", label: t("Readable"), active: view === "changes" },
{ to: "/changes?view=audit", label: t("Raw audit log"), active: view === "audit" },
]}
/>
);
@@ -158,8 +158,8 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
<div className="card mb-3">
<div className="card-body d-flex flex-wrap gap-2 align-items-center">
<input className="form-control w-auto flex-grow-1" style={{ maxWidth: "22rem" }} type="search" aria-label="Search the change log" placeholder="Search: a server, a person, a word…" value={text} onChange={(e) => setText(e.target.value)} />
<select className="form-select w-auto" aria-label="Kind of change" value={kind} onChange={(e) => setParam("kind", e.target.value || null)}>
<input className="form-control w-auto flex-grow-1" style={{ maxWidth: "22rem" }} type="search" aria-label={t("Search the change log")} placeholder={t("Search: a server, a person, a word…")} value={text} onChange={(e) => setText(e.target.value)} />
<select className="form-select w-auto" aria-label={t("Kind of change")} value={kind} onChange={(e) => setParam("kind", e.target.value || null)}>
<option value="">{t("All kinds")}</option>
{kinds.map((k) => (
<option key={k.id} value={k.id}>
@@ -175,7 +175,7 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
</option>
))}
</select>
<select className="form-select w-auto" aria-label="How far back" value={days} onChange={(e) => setParam("days", e.target.value === "7" ? null : e.target.value)}>
<select className="form-select w-auto" aria-label={t("How far back")} value={days} onChange={(e) => setParam("days", e.target.value === "7" ? null : e.target.value)}>
{RANGES.map((r) => (
<option key={r.days} value={r.days}>
{r.label}
@@ -193,10 +193,10 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
filtered
title={t("Nothing matches that")}
hint={`Nothing in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()} fits what is searched for. Try a wider range, or fewer filters.`}
action={{ label: "Clear the search and filters", onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }}
action={{ label: t("Clear the search and filters"), onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }}
/>
) : (
<EmptyState title="Nothing has changed" hint={`No change was recorded in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()}. Try a wider range.`} action={days < 400 ? { label: "Show everything kept", onClick: () => setParam("days", "400") } : undefined} />
<EmptyState title={t("Nothing has changed")} hint={`No change was recorded in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()}. Try a wider range.`} action={days < 400 ? { label: t("Show everything kept"), onClick: () => setParam("days", "400") } : undefined} />
)}
</div>
)}
@@ -237,7 +237,7 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
{more && (
<div className="text-center mb-3">
<button className="btn" onClick={() => void older()} disabled={loadingMore}>
{loadingMore ? "Loading…" : "Show older"}
{loadingMore ? t("Loading…") : t("Show older")}
</button>
</div>
)}
+15 -15
View File
@@ -11,17 +11,17 @@ import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const KINDS: { id: AgendaKind; label: string }[] = [
{ id: "secret", label: "Secrets" },
{ id: "certificate", label: "Certificates" },
{ id: "domain", label: "Domains" },
{ id: "tailscale", label: "Tailscale keys" },
{ id: "warranty", label: "Warranties" },
{ id: "support", label: "End of support" },
{ id: "maintenance", label: "Maintenance" },
{ id: "restore", label: "Restore tests" },
{ id: "updates", label: "Updates waiting" },
{ id: "todo", label: "To do" },
{ id: "renewal", label: "Renewals" },
{ id: "secret", get label() { return t("Secrets"); } },
{ id: "certificate", get label() { return t("Certificates"); } },
{ id: "domain", get label() { return t("Domains"); } },
{ id: "tailscale", get label() { return t("Tailscale keys"); } },
{ id: "warranty", get label() { return t("Warranties"); } },
{ id: "support", get label() { return t("End of support"); } },
{ id: "maintenance", get label() { return t("Maintenance"); } },
{ id: "restore", get label() { return t("Restore tests"); } },
{ id: "updates", get label() { return t("Updates waiting"); } },
{ id: "todo", get label() { return t("To do"); } },
{ id: "renewal", get label() { return t("Renewals"); } },
];
const KIND_LABEL = Object.fromEntries(KINDS.map((k) => [k.id, k.label])) as Record<AgendaKind, string>;
@@ -29,7 +29,7 @@ const RANGES: { days: number; label: string }[] = [
{ days: 30, label: "Next 30 days" },
{ days: 90, label: "Next 3 months" },
{ days: 180, label: "Next 6 months" },
{ days: 400, label: "Next year" },
{ days: 400, get label() { return t("Next year"); } },
];
/** "today", "tomorrow", "in 5 days", "3 days ago". */
@@ -176,9 +176,9 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
const needNow = inRange.filter((i) => i.daysLeft < 0 && i.kind !== "updates").length;
const thisWeek = inRange.filter((i) => i.daysLeft >= 0 && i.daysLeft <= 7 && i.kind !== "updates").length;
const cards = [
{ label: "Past their date", value: agenda ? String(needNow) : "…", color: needNow > 0 ? "text-red" : "text-green" },
{ label: t("Past their date"), value: agenda ? String(needNow) : "…", color: needNow > 0 ? "text-red" : "text-green" },
{ label: "In the next 7 days", value: agenda ? String(thisWeek) : "…", color: thisWeek > 0 ? "text-yellow" : "" },
{ label: "In the list", value: agenda ? String(shown.length) : "…", color: "" },
{ label: t("In the list"), value: agenda ? String(shown.length) : "…", color: "" },
];
function exportCsv() {
@@ -278,7 +278,7 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
{agenda !== null && sections.length === 0 && (
<div className="card">
{filtered ? (
<EmptyState filtered title={t("Nothing matches that")} hint={t("Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters.")} action={{ label: "Clear filters", onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
<EmptyState filtered title={t("Nothing matches that")} hint={t("Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters.")} action={{ label: t("Clear filters"), onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
) : (
<EmptyState title={t("Nothing is coming up")} hint={`Nothing expires, ends or is planned in the next ${days} days. Dates come from Secrets, Domains, Inventory (warranty and end of support), Maintenance and the endpoint checks' certificates.`} />
)}
+19 -19
View File
@@ -12,11 +12,11 @@ import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const KINDS: { kind: ConsistencyKind; title: string; blurb: string }[] = [
{ kind: "ip_conflict", title: "Address conflicts", blurb: "The same address reported by more than one server." },
{ kind: "ip_conflict", get title() { return t("Address conflicts"); }, blurb: "The same address reported by more than one server." },
{ kind: "dns_stale", title: "DNS out of date", blurb: "A DNS record named after a server that points at an address the server doesn't have." },
{ kind: "ipam_stale", title: "IPAM out of date", blurb: "An IPAM entry labelled with a server's name at an address the server doesn't have." },
{ kind: "not_in_ipam", title: "Not in IPAM", blurb: "Addresses in use — reported by a server or pointed at by DNS — that IPAM doesn't list." },
{ kind: "no_dns", title: "No DNS record", blurb: "Server addresses on your LAN that no DNS record points at." },
{ kind: "not_in_ipam", get title() { return t("Not in IPAM"); }, blurb: "Addresses in use — reported by a server or pointed at by DNS — that IPAM doesn't list." },
{ kind: "no_dns", get title() { return t("No DNS record"); }, blurb: "Server addresses on your LAN that no DNS record points at." },
];
const SEVERITY_BADGE: Record<ConsistencySeverity, string> = {
@@ -78,10 +78,10 @@ export default function Consistency({ user }: { user: CurrentUser }) {
async function ignore(f: ConsistencyFinding) {
const reason = await promptDialog({
title: "Ignore this finding",
title: t("Ignore this finding"),
message: "Why is this fine? (optional — shown in the Ignored list)",
placeholder: "e.g. intentional, or a test machine",
confirmLabel: "Ignore",
confirmLabel: t("Ignore"),
});
if (reason === null) return; // cancelled
setBusyKey(f.key);
@@ -124,11 +124,11 @@ export default function Consistency({ user }: { user: CurrentUser }) {
if (!report || !f.ip) return;
const suggestion = f.ip.includes(":") ? `${f.ip}/64` : `${f.ip.split(".").slice(0, 3).join(".")}.0/24`;
const range = await promptDialog({
title: "Exclude a range",
message: "Leave this range out of the report entirely — every address in it, from servers, IPAM and DNS alike.",
title: t("Exclude a range"),
message: t("Leave this range out of the report entirely — every address in it, from servers, IPAM and DNS alike."),
label: "Range (a network like 192.168.16.0/20, or a single address)",
defaultValue: suggestion,
confirmLabel: "Exclude",
confirmLabel: t("Exclude"),
required: true,
});
if (range === null || !range.trim()) return;
@@ -165,7 +165,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
{t("Export CSV")}
</button>
<button className="btn btn-outline-secondary" onClick={() => void load()} disabled={loading}>
{loading ? "Checking…" : "Refresh"}
{loading ? "Checking…" : t("Refresh")}
</button>
</div>
</div>
@@ -202,7 +202,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
{report && (
<div className="card mb-3">
<div className="card-body">
<div className="fw-bold">Excluded ranges</div>
<div className="fw-bold">{t("Excluded ranges")}</div>
<div className="text-secondary small mb-2">
Addresses in these ranges are left out of the report completely — servers, IPAM and DNS alike. Meant for networks that
aren't part of your LAN, like Docker's, which repeat the same subnet on many hosts.
@@ -214,7 +214,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
)}
</div>
<div className="d-flex flex-wrap gap-1 mb-2">
{report.excludedRanges.length === 0 && <span className="text-secondary small">Nothing excluded.</span>}
{report.excludedRanges.length === 0 && <span className="text-secondary small">{t("Nothing excluded.")}</span>}
{report.excludedRanges.map((r) => (
<span key={r} className="badge bg-secondary-lt text-secondary d-inline-flex align-items-center">
<code className="bg-transparent p-0">{r}</code>
@@ -240,7 +240,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
onChange={(e) => setNewRange(e.target.value)}
/>
<button type="submit" className="btn btn-sm btn-primary" disabled={savingRanges || !newRange.trim()}>
Exclude
{t("Exclude")}
</button>
</form>
)}
@@ -311,16 +311,16 @@ export default function Consistency({ user }: { user: CurrentUser }) {
<div className="btn-list flex-nowrap">
{f.kind === "not_in_ipam" && f.ip && (
<button className="btn btn-sm btn-outline-primary" onClick={() => void addToIpam(f)} disabled={busyKey === f.key}>
Add to IPAM
{t("Add to IPAM")}
</button>
)}
{f.ip && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => void excludeAround(f)} disabled={savingRanges} title="Leave a whole range out of the report">
Exclude range
<button className="btn btn-sm btn-outline-secondary" onClick={() => void excludeAround(f)} disabled={savingRanges} title={t("Leave a whole range out of the report")}>
{t("Exclude range")}
</button>
)}
<button className="btn btn-sm btn-outline-secondary" onClick={() => void ignore(f)} disabled={busyKey === f.key}>
Ignore
{t("Ignore")}
</button>
</div>
)}
@@ -341,7 +341,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
})
}
>
{expanded.has(kind) ? "Show fewer" : `Show all ${items.length}`}
{expanded.has(kind) ? t("Show fewer") : `Show all ${items.length}`}
</button>
</div>
)}
@@ -355,7 +355,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
<h3 className="card-title">Ignored ({report.ignored.length})</h3>
<div className="card-actions">
<button className="btn btn-link btn-sm p-0" onClick={() => setShowIgnored((s) => !s)}>
{showIgnored ? "Hide" : "Show"}
{showIgnored ? t("Hide") : t("Show")}
</button>
</div>
</div>
@@ -374,7 +374,7 @@ export default function Consistency({ user }: { user: CurrentUser }) {
</div>
{canEdit && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => void restore(i.id)}>
Stop ignoring
{t("Stop ignoring")}
</button>
)}
</div>
+30 -30
View File
@@ -40,10 +40,10 @@ function ElectricityCard({ e }: { e: Electricity }) {
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Electricity</h3>
<h3 className="card-title">{t("Electricity")}</h3>
<div className="card-actions">
<Link to="/inventory" className="btn btn-sm">
Open the Inventory
{t("Open the Inventory")}
</Link>
</div>
</div>
@@ -53,22 +53,22 @@ function ElectricityCard({ e }: { e: Electricity }) {
) : (
<div className="row g-3 mb-3">
<div className="col-6 col-md-3">
<div className="text-secondary small">Typical draw</div>
<div className="text-secondary small">{t("Typical draw")}</div>
<div className="h2 mb-0">{e.watts.toLocaleString()} W</div>
<div className="text-secondary small">{e.kwhPerMonth?.toLocaleString(undefined, { maximumFractionDigits: 0 })} kWh a month</div>
</div>
<div className="col-6 col-md-3">
<div className="text-secondary small">Per month</div>
<div className="text-secondary small">{t("Per month")}</div>
<div className="h2 mb-0">{e.monthly !== null ? moneyIn(e.monthly, e.currencyLabel, e.currency) : "—"}</div>
<div className="text-secondary small">{e.pricePerKwh !== null ? `at ${e.pricePerKwh} per kWh` : "no price set"}</div>
</div>
<div className="col-6 col-md-3">
<div className="text-secondary small">Per year</div>
<div className="text-secondary small">{t("Per year")}</div>
<div className="h2 mb-0">{e.yearly !== null ? moneyIn(e.yearly, e.currencyLabel, e.currency) : "—"}</div>
</div>
<div className="col-6 col-md-3">
<div className="text-secondary small">In the totals</div>
<div className="h2 mb-0">{e.includedInTotals ? "Yes" : "No"}</div>
<div className="text-secondary small">{t("In the totals")}</div>
<div className="h2 mb-0">{e.includedInTotals ? t("Yes") : t("No")}</div>
<div className="text-secondary small">{e.includedInTotals ? "under Electricity" : "see below"}</div>
</div>
</div>
@@ -79,10 +79,10 @@ function ElectricityCard({ e }: { e: Electricity }) {
<table className="table table-sm table-vcenter mb-0">
<thead>
<tr>
<th>Hardware</th>
<th className="text-end">Draw</th>
<th className="text-end">Per month</th>
<th style={{ minWidth: 140 }}>Share</th>
<th>{t("Hardware")}</th>
<th className="text-end">{t("Draw")}</th>
<th className="text-end">{t("Per month")}</th>
<th style={{ minWidth: 140 }}>{t("Share")}</th>
</tr>
</thead>
<tbody>
@@ -131,15 +131,15 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
}}
>
<div className="col-md-3">
<label className="form-label">What</label>
<label className="form-label">{t("What")}</label>
<input className="form-control" required maxLength={100} placeholder="e.g. tooweb.se domain, VPN, Plex pass" value={v.name} onChange={(e) => setV({ ...v, name: e.target.value })} autoFocus />
</div>
<div className="col-6 col-md-2">
<label className="form-label">Amount</label>
<label className="form-label">{t("Amount")}</label>
<input className="form-control" required inputMode="decimal" placeholder="9.99" value={amount} onChange={(e) => setAmount(e.target.value)} />
</div>
<div className="col-6 col-md-1">
<label className="form-label">Currency</label>
<label className="form-label">{t("Currency")}</label>
<input className="form-control text-uppercase" required maxLength={3} list="cost-currencies" value={v.currency} onChange={(e) => setV({ ...v, currency: e.target.value })} />
<datalist id="cost-currencies">
{currencies.map((c) => (
@@ -148,14 +148,14 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
</datalist>
</div>
<div className="col-6 col-md-2">
<label className="form-label">Paid</label>
<label className="form-label">{t("Paid")}</label>
<select className="form-select" value={v.period} onChange={(e) => setV({ ...v, period: e.target.value as CostInput["period"] })}>
<option value="month">every month</option>
<option value="year">every year</option>
</select>
</div>
<div className="col-6 col-md-2">
<label className="form-label">Kind</label>
<label className="form-label">{t("Kind")}</label>
<input className="form-control" maxLength={40} list="cost-categories" value={v.category} onChange={(e) => setV({ ...v, category: e.target.value })} />
<datalist id="cost-categories">
{categories.map((c) => (
@@ -164,16 +164,16 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
</datalist>
</div>
<div className="col-md-2">
<label className="form-label">A day it is billed (optional)</label>
<label className="form-label">{t("A day it is billed (optional)")}</label>
<input type="date" className="form-control" value={v.renewsOn ?? ""} onChange={(e) => setV({ ...v, renewsOn: e.target.value === "" ? null : e.target.value })} />
</div>
<div className="col-md-8">
<label className="form-label">Note (optional)</label>
<label className="form-label">{t("Note (optional)")}</label>
<input className="form-control" maxLength={300} placeholder="where it is paid, what it covers, when to cancel…" value={v.note ?? ""} onChange={(e) => setV({ ...v, note: e.target.value })} />
</div>
<div className="col-md-4 d-flex gap-2">
<button className="btn btn-primary" disabled={!valid || saving}>
{saving ? "Saving…" : "Save"}
{saving ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" disabled={saving} onClick={onCancel}>
{t("Cancel")}
@@ -210,7 +210,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
try {
if (form?.id != null) await api.costs.update(form.id, value);
else await api.costs.create(value);
toast.success(form?.id != null ? "Saved." : "Added.");
toast.success(form?.id != null ? t("Saved.") : t("Added."));
setForm(null);
load();
} catch (err) {
@@ -221,7 +221,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
}
async function remove(i: CostItem) {
if (!(await confirmDialog({ title: "Remove from costs", message: `Remove "${i.name}"?`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove from costs"), message: `Remove "${i.name}"?`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.costs.remove(i.id);
toast.success("Removed.");
@@ -243,7 +243,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
</div>
{isAdmin && !form && (
<button className="btn btn-primary ms-auto flex-shrink-0" onClick={() => setForm({ id: null, value: blank(defaultCurrency) })}>
Add something you pay for
{t("Add something you pay for")}
</button>
)}
</div>
@@ -284,7 +284,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
{form && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">{form.id != null ? "Change it" : "Add something you pay for"}</h3>
<h3 className="card-title">{form.id != null ? t("Change it") : t("Add something you pay for")}</h3>
</div>
<div className="card-body">
<ItemForm initial={form.value} categories={report?.categories ?? []} currencies={currencies} saving={saving} onSave={(v) => void save(v)} onCancel={() => setForm(null)} />
@@ -296,7 +296,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
{empty && (
<div className="card">
<div className="card-body">
<EmptyState title="Nothing added yet" hint={isAdmin ? "Add the domains, VPN, licences and subscriptions you pay for; a Hetzner project's estimate is added by itself." : "An administrator adds what is paid for."} />
<EmptyState title={t("Nothing added yet")} hint={isAdmin ? "Add the domains, VPN, licences and subscriptions you pay for; a Hetzner project's estimate is added by itself." : "An administrator adds what is paid for."} />
</div>
</div>
)}
@@ -307,11 +307,11 @@ export default function Costs({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>What</th>
<th>Kind</th>
<th>Paid</th>
<th>Per month</th>
<th>Billed next</th>
<th>{t("What")}</th>
<th>{t("Kind")}</th>
<th>{t("Paid")}</th>
<th>{t("Per month")}</th>
<th>{t("Billed next")}</th>
<th />
</tr>
</thead>
@@ -322,7 +322,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
<strong>{a.name}</strong> <span className="badge bg-blue-lt text-blue">read from {a.source}</span>
<div className="text-secondary small text-break">{a.detail}{a.stale ? " — not read lately, so this may be out of date" : ""}</div>
</td>
<td className="text-secondary">{a.category ?? "Hosting"}</td>
<td className="text-secondary">{a.category ?? t("Hosting")}</td>
<td className="text-secondary">estimate</td>
<td>{money(a.monthly, a.currency)}</td>
<td className="text-secondary">—</td>
+38 -38
View File
@@ -293,13 +293,13 @@ function TechnitiumBody({ enabled, instance, loading }: { enabled: boolean; inst
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label={t("DNS answers")} value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
<MiniStat label={t("DNS answers")} value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : t("No")} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
</div>
<div className="col-4">
<MiniStat label={t("Queries, 24 h")} value={st ? st.queries.toLocaleString() : "—"} />
</div>
<div className="col-4">
<MiniStat label="Blocked" value={st?.blockedPercent != null ? `${st.blockedPercent}%` : "—"} accent={!s.blockingEnabled && s.settings.blockLists.count > 0 ? "#f59e0b" : undefined} />
<MiniStat label={t("Blocked")} value={st?.blockedPercent != null ? `${st.blockedPercent}%` : "—"} accent={!s.blockingEnabled && s.settings.blockLists.count > 0 ? "#f59e0b" : undefined} />
</div>
</div>
{how.length > 0 && <BreakdownBar data={how} colors={TECHNITIUM_HOW_COLORS} compact />}
@@ -788,11 +788,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
// What has nothing set up yet. These get one list at the bottom instead of a grey "Not configured" card each.
const notSetUp: { label: string; to: string; what: string }[] = [];
if (dnsStats?.totalProviders === 0) notSetUp.push({ label: "DNS", to: "/dns", what: t("connect a DNS provider to see zones and records") });
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: "Secrets", to: "/secrets", what: t("track when a token, certificate or password expires") });
if (serverSummary?.total === 0) notSetUp.push({ label: "Servers", to: "/servers", what: "add a server and install its agent" });
if (heartbeatList !== null && heartbeatList.length === 0) notSetUp.push({ label: "Heartbeats", to: "/heartbeats", what: "have a backup or cron job report in, so you hear when it doesn't run" });
if (endpointChecks !== null && endpointChecks.length === 0) notSetUp.push({ label: "Endpoints", to: "/endpoints", what: "ask a web address, a port or a certificate whether it is fine" });
if (domainList !== null && domains.length === 0) notSetUp.push({ label: "Domains", to: "/dns?view=domains", what: "appear after a DNS zone is added and the daily check has run" });
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: t("Secrets"), to: "/secrets", what: t("track when a token, certificate or password expires") });
if (serverSummary?.total === 0) notSetUp.push({ label: t("Servers"), to: "/servers", what: "add a server and install its agent" });
if (heartbeatList !== null && heartbeatList.length === 0) notSetUp.push({ label: t("Heartbeats"), to: "/heartbeats", what: "have a backup or cron job report in, so you hear when it doesn't run" });
if (endpointChecks !== null && endpointChecks.length === 0) notSetUp.push({ label: t("Endpoints"), to: "/endpoints", what: "ask a web address, a port or a certificate whether it is fine" });
if (domainList !== null && domains.length === 0) notSetUp.push({ label: t("Domains"), to: "/dns?view=domains", what: "appear after a DNS zone is added and the daily check has run" });
if (integrations !== null) {
for (const { type, label } of WIDGETS) {
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: t("connect it under Integrations") });
@@ -905,7 +905,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<MiniStat label={t("Records")} value={dnsStats.totalRecords} />
</div>
<div className="col-4">
<MiniStat label="Providers" value={`${dnsStats.enabledProviders}/${dnsStats.totalProviders}`} />
<MiniStat label={t("Providers")} value={`${dnsStats.enabledProviders}/${dnsStats.totalProviders}`} />
</div>
</div>
{dnsStats.perProvider.some((p) => p.error) && (
@@ -948,13 +948,13 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Monitored" value={totalSecrets} />
<MiniStat label={t("Monitored")} value={totalSecrets} />
</div>
<div className="col-4">
<MiniStat label="Expiring" value={expiringSecrets} accent={expiringSecrets > 0 ? "#f59e0b" : undefined} />
<MiniStat label={t("Expiring")} value={expiringSecrets} accent={expiringSecrets > 0 ? "#f59e0b" : undefined} />
</div>
<div className="col-4">
<MiniStat label="Expired" value={expiredSecrets} accent={expiredSecrets > 0 ? "#ef4444" : undefined} />
<MiniStat label={t("Expired")} value={expiredSecrets} accent={expiredSecrets > 0 ? "#ef4444" : undefined} />
</div>
</div>
<BreakdownBar data={secretsByType} colors={SECRET_TYPE_COLORS} compact />
@@ -1012,7 +1012,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
data={[
{ label: t("Online"), count: serverSummary.online },
{ label: t("Offline"), count: serverSummary.offline.length },
{ label: "No data", count: serverSummary.noData },
{ label: t("No data"), count: serverSummary.noData },
].filter((d) => d.count > 0)}
colors={SERVER_STATE_COLORS}
compact
@@ -1090,21 +1090,21 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Tracked" value={<Link to="/dns?view=domains" className="text-reset text-decoration-none">{domains.length}</Link>} />
<MiniStat label={t("Tracked")} value={<Link to="/dns?view=domains" className="text-reset text-decoration-none">{domains.length}</Link>} />
</div>
<div className="col-4">
<MiniStat label="Expiring" value={expiringDomains.length} accent={expiringDomains.length > 0 ? "#f59e0b" : undefined} />
<MiniStat label={t("Expiring")} value={expiringDomains.length} accent={expiringDomains.length > 0 ? "#f59e0b" : undefined} />
</div>
<div className="col-4">
<MiniStat label="Expired" value={expiredDomains.length} accent={expiredDomains.length > 0 ? "#ef4444" : undefined} />
<MiniStat label={t("Expired")} value={expiredDomains.length} accent={expiredDomains.length > 0 ? "#ef4444" : undefined} />
</div>
</div>
<BreakdownBar
data={[
{ label: "OK", count: okDomains },
{ label: "Expiring", count: expiringDomains.length },
{ label: "Expired", count: expiredDomains.length },
{ label: "No date", count: undatedDomains },
{ label: t("Expiring"), count: expiringDomains.length },
{ label: t("Expired"), count: expiredDomains.length },
{ label: t("No date"), count: undatedDomains },
].filter((d) => d.count > 0)}
colors={DOMAIN_STATE_COLORS}
compact
@@ -1172,13 +1172,13 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Checks" value={endpointChecks.filter((c) => c.enabled).length} />
<MiniStat label={t("Checks")} value={endpointChecks.filter((c) => c.enabled).length} />
</div>
<div className="col-4">
<MiniStat label="Up" value={endpointChecks.filter((c) => c.enabled && c.lastOk === true).length} />
<MiniStat label={t("Up")} value={endpointChecks.filter((c) => c.enabled && c.lastOk === true).length} />
</div>
<div className="col-4">
<MiniStat label="Down" value={endpointsDown.length} accent={endpointsDown.length > 0 ? "#ef4444" : undefined} />
<MiniStat label={t("Down")} value={endpointsDown.length} accent={endpointsDown.length > 0 ? "#ef4444" : undefined} />
</div>
</div>
{endpointsDown.slice(0, 3).map((c) => (
@@ -1246,7 +1246,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Jobs" value={heartbeatList.filter((h) => h.enabled).length} />
<MiniStat label={t("Jobs")} value={heartbeatList.filter((h) => h.enabled).length} />
</div>
<div className="col-4">
<MiniStat label={t("On time")} value={heartbeatList.filter((h) => h.state === "up" || h.state === "running").length} />
@@ -1270,7 +1270,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{TYPE_GROUPS.filter((group) => integrations?.some((i) => group.types.includes(i.type))).map((group) => (
<Fragment key={group.id}>
<SectionHeader title={group.label} hint={GROUP_HINTS[group.id]} />
<SectionHeader title={t(group.label)} hint={t(GROUP_HINTS[group.id])} />
<div className="row row-cards">
{WIDGETS.filter(({ type }) => group.types.includes(type)).map(({ type, label }) => {
const integration = integrations?.find((i) => i.type === type && i.enabled);
@@ -1301,7 +1301,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
hide={integrations === null || !integrations.some((i) => i.type === type)}
badge={
isLive ? (
<span className="badge bg-green-lt text-green">Connected</span>
<span className="badge bg-green-lt text-green">{t("Connected")}</span>
) : integration ? (
<span className="badge bg-yellow-lt text-yellow">{t("Connecting…")}</span>
) : (
@@ -1317,7 +1317,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<div className="col-4">
<MiniStat
label="Unauthorized"
label={t("Unauthorized")}
value={tailscaleSummary!.unauthorized}
accent={tailscaleSummary!.unauthorized > 0 ? "#f59e0b" : undefined}
/>
@@ -1342,10 +1342,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Repositories" value={giteaSummary!.repoCount} />
<MiniStat label={t("Repositories")} value={giteaSummary!.repoCount} />
</div>
<div className="col-4">
<MiniStat label="Private" value={giteaSummary!.privateCount} />
<MiniStat label={t("Private")} value={giteaSummary!.privateCount} />
</div>
<div className="col-4">
<MiniStat
@@ -1366,7 +1366,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<MiniStat label={t("Running / Total")} value={`${dockhandSummary!.running}/${dockhandSummary!.total}`} />
</div>
<div className="col-4">
<MiniStat label="Hosts" value={dockhandSummary!.hostCount} />
<MiniStat label={t("Hosts")} value={dockhandSummary!.hostCount} />
</div>
<div className="col-4">
<MiniStat
@@ -1423,11 +1423,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Volumes" value={synologySummary!.volumeCount} />
<MiniStat label={t("Volumes")} value={synologySummary!.volumeCount} />
</div>
<div className="col-4">
<MiniStat
label="Unhealthy"
label={t("Unhealthy")}
value={synologySummary!.volumesNotNormal + synologySummary!.disksNotNormal}
accent={synologySummary!.volumesNotNormal + synologySummary!.disksNotNormal > 0 ? "#ef4444" : undefined}
/>
@@ -1456,10 +1456,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<>
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Monitors" value={uptimeKumaSummary!.total} />
<MiniStat label={t("Monitors")} value={uptimeKumaSummary!.total} />
</div>
<div className="col-4">
<MiniStat label="Down" value={uptimeKumaSummary!.down} accent={uptimeKumaSummary!.down > 0 ? "#ef4444" : undefined} />
<MiniStat label={t("Down")} value={uptimeKumaSummary!.down} accent={uptimeKumaSummary!.down > 0 ? "#ef4444" : undefined} />
</div>
<div className="col-4">
<MiniStat label={t("Matched to a server")} value={`${uptimeKumaSummary!.matched}/${uptimeKumaSummary!.total}`} />
@@ -1472,18 +1472,18 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
) : isLivePbs ? (
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Datastores" value={pbsSummary!.datastoreCount} />
<MiniStat label={t("Datastores")} value={pbsSummary!.datastoreCount} />
</div>
<div className="col-4">
<MiniStat
label="Failed"
label={t("Failed")}
value={pbsSummary!.failedSnapshotCount}
accent={pbsSummary!.failedSnapshotCount > 0 ? "#ef4444" : undefined}
/>
</div>
<div className="col-4">
<MiniStat
label="Unverified"
label={t("Unverified")}
value={pbsSummary!.unverifiedSnapshotCount}
accent={pbsSummary!.unverifiedSnapshotCount > 0 ? "#f59e0b" : undefined}
/>
@@ -1496,7 +1496,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
</div>
<div className="col-4">
<MiniStat
label="Overdue"
label={t("Overdue")}
value={osTicketSummary!.overdue}
accent={osTicketSummary!.overdue > 0 ? "#ef4444" : undefined}
/>
@@ -1537,7 +1537,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
) : alerts ? (
<span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>
) : i.health?.status === "ok" ? (
<span className="badge bg-green-lt text-green">Working</span>
<span className="badge bg-green-lt text-green">{t("Working")}</span>
) : (
<span className="badge bg-secondary-lt text-secondary">{t("Not checked yet")}</span>
);
@@ -1549,7 +1549,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
: alerts
? `${alerts.count} open ${alerts.count === 1 ? "alert" : "alerts"}.`
: i.enabled
? "Nothing open."
? t("Nothing open.")
: "Switched off under Integrations."}
</div>
{i.enabled && (
+30 -30
View File
@@ -42,10 +42,10 @@ const emptyRecordForm: DnsRecordInput = { type: "A", name: "", content: "", ttl:
const dnsTabs = (view: "records" | "domains") => (
<ViewTabs
label="DNS view"
label={t("DNS view")}
tabs={[
{ to: "/dns", label: "Zones and records", active: view === "records" },
{ to: "/dns?view=domains", label: "Domain names", active: view === "domains" },
{ to: "/dns", label: t("Zones and records"), active: view === "records" },
{ to: "/dns?view=domains", label: t("Domain names"), active: view === "domains" },
]}
/>
);
@@ -233,7 +233,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
async function removeRecord(r: DnsRecord) {
if (!selectedProviderId || !selectedZone) return;
if (!(await confirmDialog({ title: "Delete DNS record", message: `Delete ${r.type} record "${r.name}"?`, confirmLabel: "Delete", danger: true }))) return;
if (!(await confirmDialog({ title: t("Delete DNS record"), message: `Delete ${r.type} record "${r.name}"?`, confirmLabel: t("Delete"), danger: true }))) return;
setError(null);
try {
await api.dns.records.remove(selectedProviderId, selectedZone.id, r.id);
@@ -259,10 +259,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
const zone = selectedZone;
const cached = zone.recordCount > 0 ? ` (${zone.recordCount} record${zone.recordCount === 1 ? " is" : "s are"} cached here)` : "";
const typed = await promptDialog({
title: "Delete zone",
title: t("Delete zone"),
message: `This deletes the zone "${zone.name}" on ${selectedProvider.name}, and every record in it${cached}, for good. It cannot be undone, and what uses this server stops finding the names in it. Type the name of the zone to confirm.`,
label: "Zone name",
confirmLabel: "Delete",
label: t("Zone name"),
confirmLabel: t("Delete"),
required: true,
});
if (typed === null) return;
@@ -280,7 +280,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
}
async function removeProvider(p: DnsProviderSummary) {
if (!(await confirmDialog({ title: "Delete DNS provider", message: `Delete provider "${p.name}"? This removes its cached zones and records too.`, confirmLabel: "Delete", danger: true }))) return;
if (!(await confirmDialog({ title: t("Delete DNS provider"), message: `Delete provider "${p.name}"? This removes its cached zones and records too.`, confirmLabel: t("Delete"), danger: true }))) return;
try {
await api.dns.providers.remove(p.id);
if (selectedProviderId === p.id) setSelectedProviderId(null);
@@ -312,7 +312,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
downloadCsv(
"dns-providers.csv",
["Name", "Provider", "Status"],
sortedProviders.map((p) => [p.name, PROVIDER_LABELS[p.providerType], p.enabled ? "Enabled" : "Disabled"]),
sortedProviders.map((p) => [p.name, PROVIDER_LABELS[p.providerType], p.enabled ? t("Enabled") : t("Disabled")]),
);
}
@@ -343,7 +343,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
className="btn btn-outline-secondary ms-auto"
onClick={() => setManagingProviders((v) => !v)}
>
{managingProviders ? "Back to browsing" : "Manage providers"}
{managingProviders ? t("Back to browsing") : t("Manage providers")}
</button>
)}
</div>
@@ -380,7 +380,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onSort={requestProviderSort}
/>
<SortableTh<DnsProviderSummary>
label="Provider"
label={t("Provider")}
sortKeyName="providerType"
activeKey={providerSortKey}
direction={providerSortDir}
@@ -408,7 +408,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
className={`badge ${p.enabled ? "bg-green-lt text-green" : "bg-secondary-lt text-secondary"} border-0`}
onClick={() => toggleProviderEnabled(p)}
>
{p.enabled ? "Enabled" : "Disabled"}
{p.enabled ? t("Enabled") : t("Disabled")}
</button>
</td>
<td>
@@ -420,7 +420,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
))}
{providers === null && <LoadingRow colSpan={4} />}
{sortedProviders?.length === 0 && (
<EmptyRow colSpan={4} title="No DNS providers yet" hint="Connect Cloudflare, Loopia, Pi-hole, Azure DNS, cPanel or Technitium to see its zones and records here, and to have names matched to your servers." />
<EmptyRow colSpan={4} title={t("No DNS providers yet")} hint="Connect Cloudflare, Loopia, Pi-hole, Azure DNS, cPanel or Technitium to see its zones and records here, and to have names matched to your servers." />
)}
</tbody>
</table>
@@ -464,11 +464,11 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<div className="col-md-5">
<div className="card">
<div className="card-header">
<h3 className="card-title">Zones</h3>
<h3 className="card-title">{t("Zones")}</h3>
<div className="card-actions">
{isAdmin && selectedProvider?.canCreateZones && selectedProvider.enabled && (
<button className="btn btn-sm btn-primary me-2" onClick={() => setCreatingZone((v) => !v)} aria-expanded={creatingZone}>
New zone
{t("New zone")}
</button>
)}
<button
@@ -508,7 +508,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
onSort={requestZoneSort}
/>
<SortableTh<DnsZone>
label="Synced"
label={t("Synced")}
sortKeyName="syncedAt"
activeKey={zoneSortKey}
direction={zoneSortDir}
@@ -536,7 +536,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</tr>
))}
{sortedZones && sortedZones.length === 0 && (
<EmptyRow colSpan={3} title="No zones found" hint="The provider answered with none. Check that its credentials can see the zones, or sync it again." />
<EmptyRow colSpan={3} title={t("No zones found")} hint="The provider answered with none. Check that its credentials can see the zones, or sync it again." />
)}
</tbody>
</table>
@@ -560,22 +560,22 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</button>
{canEdit && (
<button className="btn btn-sm btn-outline-secondary me-2" onClick={syncZone} disabled={syncing}>
{syncing ? "Syncing…" : "Sync now"}
{syncing ? t("Syncing…") : t("Sync now")}
</button>
)}
{canEdit && !recordForm && (
<button className="btn btn-sm btn-primary" onClick={startAddRecord}>
Add record
{t("Add record")}
</button>
)}
{isAdmin && selectedProvider?.canEditZones && selectedProvider.enabled && (
<button className="btn btn-sm btn-outline-secondary ms-2" onClick={() => setEditingZone((v) => !v)} aria-expanded={editingZone}>
Edit zone
{t("Edit zone")}
</button>
)}
{isAdmin && selectedProvider?.canDeleteZones && selectedProvider.enabled && (
<button className="btn btn-sm btn-outline-danger ms-2" onClick={() => void deleteZone()}>
Delete zone
{t("Delete zone")}
</button>
)}
</div>
@@ -589,7 +589,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<form onSubmit={submitRecord}>
<div className="card-body row g-2">
<div className="col-2">
<label className="form-label">Type</label>
<label className="form-label">{t("Type")}</label>
<input
className="form-control"
required
@@ -613,7 +613,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
/>
</div>
<div className="col-3">
<label className="form-label">Content</label>
<label className="form-label">{t("Content")}</label>
<input
className="form-control"
required
@@ -631,7 +631,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
/>
</div>
<div className="col-2">
<label className="form-label">Priority</label>
<label className="form-label">{t("Priority")}</label>
<input
type="number"
className="form-control"
@@ -650,14 +650,14 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
checked={Boolean(recordForm.proxied)}
onChange={(e) => setRecordForm({ ...recordForm, proxied: e.target.checked })}
/>
<span className="form-check-label">Proxied through Cloudflare</span>
<span className="form-check-label">{t("Proxied through Cloudflare")}</span>
</label>
</div>
)}
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={savingRecord}>
{editingRecordId ? "Save changes" : "Add record"}
{editingRecordId ? t("Save changes") : t("Add record")}
</button>
<button type="button" className="btn" onClick={() => setRecordForm(null)}>
{t("Cancel")}
@@ -670,10 +670,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<DnsRecord> label="Type" sortKeyName="type" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
<SortableTh<DnsRecord> label={t("Type")} sortKeyName="type" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
<SortableTh<DnsRecord> label={t("Name")} sortKeyName="name" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
<SortableTh<DnsRecord>
label="Content"
label={t("Content")}
sortKeyName="content"
activeKey={recordSortKey}
direction={recordSortDir}
@@ -707,7 +707,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</tr>
))}
{sortedRecords?.length === 0 && (
<EmptyRow colSpan={canEdit ? 5 : 4} title="No records cached" hint={syncedAt === null ? "Sync this zone to fetch its records from the provider." : "This zone has no records."} action={canEdit ? { label: "Add a record", onClick: startAddRecord } : undefined} />
<EmptyRow colSpan={canEdit ? 5 : 4} title={t("No records cached")} hint={syncedAt === null ? t("Sync this zone to fetch its records from the provider.") : t("This zone has no records.")} action={canEdit ? { label: t("Add a record"), onClick: startAddRecord } : undefined} />
)}
</tbody>
</table>
@@ -716,7 +716,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</div>
) : (
<div className="card">
<div className="card-body text-secondary">Select a zone to view its records.</div>
<div className="card-body text-secondary">{t("Select a zone to view its records.")}</div>
</div>
)}
</div>
+17 -17
View File
@@ -29,14 +29,14 @@ function updateBadge(c: DockhandContainer) {
if (!c.updateAvailable) return <span className="badge bg-green-lt text-green">{t("Up to date")}</span>;
return (
<span className="badge bg-yellow-lt text-yellow" title={c.newerVersion ?? undefined}>
Update available
{t("Update available")}
</span>
);
}
/** What is wrong with a container, in a badge: the same finding the health pass raises an alert for. */
function problemBadge(c: DockhandContainer) {
if (c.leftAlone) return <span className="badge bg-secondary-lt text-secondary" title="No alert is raised for it">left alone</span>;
if (c.leftAlone) return <span className="badge bg-secondary-lt text-secondary" title={t("No alert is raised for it")}>left alone</span>;
if (!c.problem) return null;
return (
<span className={`badge ${c.problem.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`} title={`An alert is raised: ${c.name} ${c.problem.text}`}>
@@ -48,14 +48,14 @@ function problemBadge(c: DockhandContainer) {
function containerStateBadge(state: string) {
switch (state) {
case "running":
return <span className="badge bg-green-lt text-green">Running</span>;
return <span className="badge bg-green-lt text-green">{t("Running")}</span>;
case "exited":
case "dead":
return <span className="badge bg-red-lt text-red">{state === "dead" ? "Dead" : "Exited"}</span>;
return <span className="badge bg-red-lt text-red">{state === "dead" ? t("Dead") : t("Exited")}</span>;
case "paused":
return <span className="badge bg-yellow-lt text-yellow">Paused</span>;
return <span className="badge bg-yellow-lt text-yellow">{t("Paused")}</span>;
case "restarting":
return <span className="badge bg-blue-lt text-blue">Restarting</span>;
return <span className="badge bg-blue-lt text-blue">{t("Restarting")}</span>;
default:
return <span className="badge bg-secondary-lt text-secondary">{state}</span>;
}
@@ -159,12 +159,12 @@ export default function Docker({ user }: { user: CurrentUser }) {
async function containerAction(c: DockhandContainer, action: "start" | "stop" | "restart") {
if (!selectedId) return;
if (action === "stop" && !(await confirmDialog({ title: "Stop container", message: `Stop container "${c.name}"?`, confirmLabel: "Stop", danger: true }))) return;
if (action === "stop" && !(await confirmDialog({ title: t("Stop container"), message: `Stop container "${c.name}"?`, confirmLabel: t("Stop"), danger: true }))) return;
setActingOnContainer(c.id);
setError(null);
try {
await api.integrations.dockhand[action](selectedId, c.environmentId, c.id);
toast.success(`${action === "start" ? "Started" : action === "stop" ? "Stopped" : "Restarted"} ${c.name}.`);
toast.success(`${action === "start" ? t("Started") : action === "stop" ? "Stopped" : t("Restarted")} ${c.name}.`);
loadContainers(selectedId);
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
@@ -182,7 +182,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
<div className="card">
<div className="card-body text-secondary">
No Dockhand integration configured yet.{" "}
<Link to="/integrations">Add one under Integrations</Link>.
<Link to="/integrations">{t("Add one under Integrations")}</Link>.
</div>
</div>
) : (
@@ -246,7 +246,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
value={hostFilter}
onChange={(e) => setHostFilter(e.target.value)}
>
<option value="">All hosts</option>
<option value="">{t("All hosts")}</option>
{hosts.map((host) => (
<option key={host} value={host}>
{host}
@@ -259,7 +259,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
</button>
{canEdit && (
<button className="btn btn-sm btn-outline-secondary" onClick={checkForUpdates} disabled={checkingUpdates}>
{checkingUpdates ? "Checking…" : "Check for updates"}
{checkingUpdates ? t("Checking…") : t("Check for updates")}
</button>
)}
<button
@@ -267,7 +267,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
onClick={() => selected && loadContainers(selected.id)}
disabled={loading}
>
{loading ? "Refreshing…" : "Refresh"}
{loading ? t("Refreshing…") : t("Refresh")}
</button>
</div>
</div>
@@ -277,7 +277,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
<tr>
<SortableTh<DockhandContainer> label={t("Container")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<DockhandContainer>
label="Host"
label={t("Host")}
sortKeyName="environmentName"
activeKey={sortKey}
direction={sortDir}
@@ -286,7 +286,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
<SortableTh<DockhandContainer> label={t("Image")} sortKeyName="image" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<DockhandContainer> label={t("Status")} sortKeyName="state" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<DockhandContainer>
label="Update"
label={t("Update")}
sortKeyName="updateAvailable"
activeKey={sortKey}
direction={sortDir}
@@ -338,8 +338,8 @@ export default function Docker({ user }: { user: CurrentUser }) {
</button>
)}
{user.role === "admin" && (c.problem || c.leftAlone) && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => void leaveAlone(c)} title={c.leftAlone ? "Raise alerts about it again" : "Stop raising alerts about this container"}>
{c.leftAlone ? "Watch again" : "Leave alone"}
<button className="btn btn-sm btn-outline-secondary" onClick={() => void leaveAlone(c)} title={c.leftAlone ? t("Raise alerts about it again") : t("Stop raising alerts about this container")}>
{c.leftAlone ? t("Watch again") : t("Leave alone")}
</button>
)}
</div>
@@ -348,7 +348,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
</tr>
))}
{data && sorted?.length === 0 && (
<EmptyRow colSpan={canEdit ? 6 : 5} {...(hostFilter ? { filtered: () => setHostFilter("") } : { title: "No containers found", hint: "Dockhand answered with no containers in any environment. Check the integration and its environments.", action: { label: "Check the integration", to: "/integrations" } })} />
<EmptyRow colSpan={canEdit ? 6 : 5} {...(hostFilter ? { filtered: () => setHostFilter("") } : { title: t("No containers found"), hint: t("Dockhand answered with no containers in any environment. Check the integration and its environments."), action: { label: t("Check the integration"), to: "/integrations" } })} />
)}
</tbody>
</table>
+11 -11
View File
@@ -17,11 +17,11 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
<div className="d-flex flex-wrap align-items-center gap-2">
<strong>{env.environmentName}</strong>
{env.critical === null ? (
<span className="badge bg-secondary-lt text-secondary">Not read</span>
<span className="badge bg-secondary-lt text-secondary">{t("Not read")}</span>
) : env.critical > 0 ? (
<span className="badge bg-red-lt text-red">{env.critical} critical</span>
) : (
<span className="badge bg-green-lt text-green">No critical</span>
<span className="badge bg-green-lt text-green">{t("No critical")}</span>
)}
<span className="text-secondary small">
{count(env.high)} high · {count(env.medium)} medium · {count(env.low)} low
@@ -41,7 +41,7 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
{env.findings.length > 0 && (
<>
<button className="btn btn-link btn-sm p-0 mt-1" onClick={() => setOpen((o) => !o)}>
{open ? "Hide the critical findings" : `Show the critical findings${env.critical !== null && env.critical > env.findings.length ? ` (first ${env.findings.length} of ${env.critical})` : ""}`}
{open ? t("Hide the critical findings") : `Show the critical findings${env.critical !== null && env.critical > env.findings.length ? ` (first ${env.findings.length} of ${env.critical})` : ""}`}
</button>
{open && (
<div className="table-responsive mt-2">
@@ -49,11 +49,11 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
<thead>
<tr>
<th>CVE</th>
<th>Package</th>
<th>Installed</th>
<th>Fixed in</th>
<th>{t("Package")}</th>
<th>{t("Installed")}</th>
<th>{t("Fixed in")}</th>
<th>{t("Image")}</th>
<th>Used by</th>
<th>{t("Used by")}</th>
</tr>
</thead>
<tbody>
@@ -112,7 +112,7 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
</div>
<div className="card-body">
{error && <div className="text-yellow">{error}</div>}
{!data && !error && <div className="text-secondary">Reading…</div>}
{!data && !error && <div className="text-secondary">{t("Reading…")}</div>}
{data && (
<>
<p className="text-secondary small">
@@ -122,7 +122,7 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
<strong>{t("Critical")}</strong> findings are an alert — see <Link to="/alerts">{t("Alerts")}</Link>;{" "}
{data.highThreshold > 0 ? (
<>
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">Settings → Notifications</Link>); medium and low are only shown here.
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">{t("Settings → Notifications")}</Link>); medium and low are only shown here.
</>
) : (
<>high, medium and low are only shown here (high ones can be alerted from a number you choose under Settings → Notifications).</>
@@ -130,13 +130,13 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
</>
) : (
<>
The alert for critical findings is switched off (<Link to="/settings/notifications">Settings → Notifications</Link>).
The alert for critical findings is switched off (<Link to="/settings/notifications">{t("Settings → Notifications")}</Link>).
</>
)}
</p>
{data.status && !data.status.ok && <div className="text-yellow mb-2">The last attempt to read them failed: {data.status.error ?? "no answer"}.</div>}
{data.environments.length === 0 && !data.status && <div className="text-secondary">Not read yet — it is read a few minutes after Dockhand is added, then every quarter of an hour.</div>}
{data.environments.length === 0 && data.status?.ok && <div className="text-secondary">Dockhand lists no Docker hosts.</div>}
{data.environments.length === 0 && data.status?.ok && <div className="text-secondary">{t("Dockhand lists no Docker hosts.")}</div>}
{data.environments.map((e) => (
<Host key={e.environmentId} env={e} imageAgeDays={data.imageAgeDays} />
))}
+18 -18
View File
@@ -40,7 +40,7 @@ function durationText(seconds: number): string {
}
function Badge({ c }: { c: DownloadClient }) {
if (!c.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!c.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
if (!c.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
if (!c.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (c.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
@@ -70,11 +70,11 @@ function ItemsTable({ items, stuck }: { items: DownloadItem[]; stuck: Set<string
<thead>
<tr>
<th>{t("Name")}</th>
<th>State</th>
<th>Progress</th>
<th>Speed</th>
<th>Left</th>
<th>Category</th>
<th>{t("State")}</th>
<th>{t("Progress")}</th>
<th>{t("Speed")}</th>
<th>{t("Left")}</th>
<th>{t("Category")}</th>
</tr>
</thead>
<tbody>
@@ -156,16 +156,16 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
{s && (
<>
<div className="row g-3 mb-3">
<Tile label="Downloading" value={speedText(s.speedDown)} sub={s.speedUp !== null ? `uploading ${speedText(s.speedUp)}` : null} />
<Tile label={t("Downloading")} value={speedText(s.speedDown)} sub={s.speedUp !== null ? `uploading ${speedText(s.speedUp)}` : null} />
<Tile
label={c.kind === "sabnzbd" ? "Queue" : "Not finished"}
label={c.kind === "sabnzbd" ? t("Queue") : t("Not finished")}
value={String(pending)}
sub={[`${s.counts.downloading} downloading`, `${s.counts.queued + s.counts.waiting} waiting`, s.counts.stalled > 0 ? `${s.counts.stalled} stalled` : null, s.counts.error > 0 ? `${s.counts.error} in error` : null, c.kind === "qbittorrent" ? `${s.counts.seeding} seeding` : null].filter(Boolean).join(", ")}
/>
{c.kind === "qbittorrent" ? (
<Tile label="Stuck" value={String(stuck.size)} sub={stuck.size > 0 ? "in error, or nothing moving for a day" : "nothing stuck"} warn={stuck.size > 0} />
<Tile label={t("Stuck")} value={String(stuck.size)} sub={stuck.size > 0 ? "in error, or nothing moving for a day" : "nothing stuck"} warn={stuck.size > 0} />
) : (
<Tile label="Failed in the last day" value={s.failed === null ? "—" : String(failedRecent.size)} sub={s.failed === null ? "could not be read" : null} warn={failedRecent.size > 0} />
<Tile label={t("Failed in the last day")} value={s.failed === null ? "—" : String(failedRecent.size)} sub={s.failed === null ? "could not be read" : null} warn={failedRecent.size > 0} />
)}
{c.kind === "qbittorrent" ? (
<Tile
@@ -175,13 +175,13 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
warn={s.connection === "disconnected"}
/>
) : (
<Tile label="Queue is" value={s.paused ? "Paused" : "Running"} sub={s.paused && s.since.pausedSince ? `for ${durationText((Date.now() - Date.parse(s.since.pausedSince)) / 1000)}` : null} warn={s.paused && pending > 0} />
<Tile label={t("Queue is")} value={s.paused ? "Paused" : t("Running")} sub={s.paused && s.since.pausedSince ? `for ${durationText((Date.now() - Date.parse(s.since.pausedSince)) / 1000)}` : null} warn={s.paused && pending > 0} />
)}
{fullest && <Tile label="Free space" value={formatBytes(fullest.free)} sub={fullest.total ? `of ${formatBytes(fullest.total)} (${fullest.label.toLowerCase()})` : fullest.label.toLowerCase()} warn={fullest.total ? fullest.free / fullest.total < 0.1 : fullest.free < 20 * 1024 ** 3} />}
{fullest && <Tile label={t("Free space")} value={formatBytes(fullest.free)} sub={fullest.total ? `of ${formatBytes(fullest.total)} (${fullest.label.toLowerCase()})` : fullest.label.toLowerCase()} warn={fullest.total ? fullest.free / fullest.total < 0.1 : fullest.free < 20 * 1024 ** 3} />}
</div>
{s.disks && s.disks.some((d) => d.total) && (
<div className="mb-3">
<h4>Disks</h4>
<h4>{t("Disks")}</h4>
{s.disks
.filter((d) => d.total)
.map((d) => {
@@ -201,15 +201,15 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
)}
{s.items.length > 0 && (
<>
<h4>{c.kind === "sabnzbd" ? "Queue" : "Not finished"}</h4>
<h4>{c.kind === "sabnzbd" ? t("Queue") : t("Not finished")}</h4>
<ItemsTable items={s.items} stuck={stuck} />
{s.counts.seeding + s.counts.completed > 0 && <div className="text-secondary small">{s.counts.seeding + s.counts.completed} more are finished and idle (seeding or stopped), and not listed.</div>}
</>
)}
{s.items.length === 0 && <div className="text-secondary">{s.total === 0 ? "Nothing in the queue." : `${s.total} item${s.total === 1 ? "" : "s"}, all finished and idle.`}</div>}
{s.items.length === 0 && <div className="text-secondary">{s.total === 0 ? t("Nothing in the queue.") : `${s.total} item${s.total === 1 ? "" : "s"}, all finished and idle.`}</div>}
{failed.length > 0 && (
<>
<h4 className="mt-3">Failed in the last day</h4>
<h4 className="mt-3">{t("Failed in the last day")}</h4>
<ul className="mb-0">
{failed.map((f) => (
<li key={f.id} className="text-break">
@@ -264,7 +264,7 @@ export default function Downloads({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">{t("Download clients")}</h2>
<PageIntro>
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is added, paused or removed. <strong>Downloads that are stuck</strong>, <strong>no connection</strong>, <strong>a queue left paused or getting nothing</strong> and{" "}
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is added, paused or removed. <strong>{t("Downloads that are stuck")}</strong>, <strong>no connection</strong>, <strong>a queue left paused or getting nothing</strong> and{" "}
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>. What Sonarr, Radarr and the others think of their downloads is on <Link to="/media">{t("Media managers")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
@@ -272,7 +272,7 @@ export default function Downloads({ user }: { user: CurrentUser }) {
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No download client connected" hint="Add qBittorrent (its Web UI address, and the user name and password of the Web UI) or SABnzbd (its address and API key) under Integrations." />
<EmptyState title={t("No download client connected")} hint="Add qBittorrent (its Web UI address, and the user name and password of the Web UI) or SABnzbd (its address and API key) under Integrations." />
</div>
</div>
)}
+33 -33
View File
@@ -15,10 +15,10 @@ import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const STATE: Record<DuplicatiBackup["state"], { label: string; cls: string }> = {
ok: { label: "In order", cls: "bg-green-lt text-green" },
warning: { label: "Warnings", cls: "bg-yellow-lt text-yellow" },
failed: { label: "Failed", cls: "bg-red-lt text-red" },
stale: { label: "Overdue", cls: "bg-red-lt text-red" },
ok: { get label() { return t("In order"); }, cls: "bg-green-lt text-green" },
warning: { get label() { return t("Warnings"); }, cls: "bg-yellow-lt text-yellow" },
failed: { get label() { return t("Failed"); }, cls: "bg-red-lt text-red" },
stale: { get label() { return t("Overdue"); }, cls: "bg-red-lt text-red" },
};
/** What needs a look comes first. */
@@ -79,18 +79,18 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
<DetailDrawer title={backup.name} subtitle={`${backup.sourceName} — the last backups`} onClose={onClose}>
<ErrorNotice error={error} />
{runs === null && !error && <BlockSkeleton lines={4} />}
{runs?.length === 0 && <EmptyState title="No runs yet" />}
{runs?.length === 0 && <EmptyState title={t("No runs yet")} />}
{runs && runs.length > 0 && (
<div className="table-responsive">
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>{t("When")}</th>
<th>Result</th>
<th className="text-end">Took</th>
<th className="text-end">Size</th>
<th>{t("Result")}</th>
<th className="text-end">{t("Took")}</th>
<th className="text-end">{t("Size")}</th>
<th className="text-end" title={t("How much the backups take up where they are kept")}>{t("Stored")}</th>
<th className="text-end">Changed</th>
<th className="text-end">{t("Changed")}</th>
</tr>
</thead>
<tbody>
@@ -149,7 +149,7 @@ function Activity({ s }: { s: DuplicatiSource }) {
)}
{a.sample && (
<details>
<summary className="text-secondary">What was sent</summary>
<summary className="text-secondary">{t("What was sent")}</summary>
<pre className="mb-0 small text-break" style={{ whiteSpace: "pre-wrap", maxHeight: 200, overflow: "auto" }}>
{a.sample}
</pre>
@@ -188,10 +188,10 @@ function Address({ path, name, onDone }: { path: string; name: string; onDone: (
<div className="fw-bold mb-1">Point Duplicati on {name} at this app</div>
<div className="text-secondary mb-2">Copy it now — the address can&rsquo;t be shown again. If it is lost, remove the machine and add it again.</div>
<ol className="mb-2">
<li>In Duplicati, open <strong>Settings → Default options</strong> (so every job on that machine reports) and add these three <strong>advanced options</strong>:</li>
<li>In Duplicati, open <strong>{t("Settings → Default options")}</strong> (so every job on that machine reports) and add these three <strong>advanced options</strong>:</li>
</ol>
<div className="input-group mb-2">
<textarea className="form-control" rows={3} readOnly value={options} aria-label="The three Duplicati options" onFocus={(e) => e.currentTarget.select()} style={{ fontFamily: "monospace", fontSize: "0.8125rem" }} />
<textarea className="form-control" rows={3} readOnly value={options} aria-label={t("The three Duplicati options")} onFocus={(e) => e.currentTarget.select()} style={{ fontFamily: "monospace", fontSize: "0.8125rem" }} />
<CopyButton text={options} />
</div>
<div className="text-secondary small mb-2">
@@ -251,7 +251,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
}
async function removeSource(id: number, label: string) {
if (!(await confirmDialog({ title: "Remove a machine", message: `Remove "${label}" with its backups and their history? Its address stops working.`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove a machine"), message: `Remove "${label}" with its backups and their history? Its address stops working.`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.duplicati.removeSource(id);
load();
@@ -270,7 +270,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
}
async function forget(b: DuplicatiBackup) {
if (!(await confirmDialog({ title: "Forget a backup", message: `Forget "${b.name}" on ${b.sourceName} and its history? If Duplicati reports it again, it is learned again.`, confirmLabel: "Forget", danger: true }))) return;
if (!(await confirmDialog({ title: t("Forget a backup"), message: `Forget "${b.name}" on ${b.sourceName} and its history? If Duplicati reports it again, it is learned again.`, confirmLabel: t("Forget"), danger: true }))) return;
try {
await api.duplicati.forgetBackup(b.id);
load();
@@ -287,13 +287,13 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<h2 className="page-title mb-0">Duplicati</h2>
{isAdmin && !adding && (
<button className="btn btn-primary ms-auto" onClick={() => setAdding(true)}>
Add a machine
{t("Add a machine")}
</button>
)}
</div>
<PageIntro>
Whether the backups Duplicati makes are being made. Duplicati tells this app how each backup went (its own <em>send-http-url</em> option), so nothing here calls Duplicati and no password for it is kept. A backup that <strong>fails</strong>,
or has <strong>not succeeded for longer than it should</strong>, is an alert — see <Link to="/alerts">{t("Alerts")}</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job&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>{t("Alert on warnings")}</em> for the jobs where they matter.
</PageIntro>
<ErrorNotice error={error} />
{fresh && <Address path={fresh.path} name={fresh.name} onDone={() => setFresh(null)} />}
@@ -301,7 +301,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
{adding && data && (
<form className="card mb-3" onSubmit={addSource}>
<div className="card-header">
<h3 className="card-title">Add a machine running Duplicati</h3>
<h3 className="card-title">{t("Add a machine running Duplicati")}</h3>
</div>
<div className="card-body row g-3">
<div className="col-md-5">
@@ -312,10 +312,10 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-7">
<label className="form-label" htmlFor="dup-server">
It runs on the server
{t("It runs on the server")}
</label>
<select id="dup-server" className="form-select" value={serverId} onChange={(e) => setServerId(e.target.value)}>
<option value="">— none in particular —</option>
<option value="">{t("— none in particular —")}</option>
{data.servers.map((s) => (
<option key={s.id} value={s.id}>
{s.name}
@@ -327,7 +327,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer d-flex gap-2">
<button className="btn btn-primary" disabled={busy || name.trim() === ""}>
{busy ? "Adding…" : "Add and show its address"}
{busy ? "Adding…" : t("Add and show its address")}
</button>
<button type="button" className="btn" onClick={() => setAdding(false)}>
{t("Cancel")}
@@ -341,9 +341,9 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<div className="card">
<div className="card-body">
<EmptyState
title="No machine reports yet"
title={t("No machine reports yet")}
hint="Add each machine that runs Duplicati: you get an address to give Duplicati once, and every backup it makes then shows up here with how it went."
action={isAdmin ? { label: "Add a machine", onClick: () => setAdding(true) } : undefined}
action={isAdmin ? { label: t("Add a machine"), onClick: () => setAdding(true) } : undefined}
/>
</div>
</div>
@@ -395,14 +395,14 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Backup</th>
<th>Last good backup</th>
<th className="text-end">Took</th>
<th className="text-end">Size</th>
<th>{t("Backup")}</th>
<th>{t("Last good backup")}</th>
<th className="text-end">{t("Took")}</th>
<th className="text-end">{t("Size")}</th>
<th className="text-end" title={t("How much the backups take up where they are kept, and how that is growing")}>{t("Stored")}</th>
<th className="text-end">Changed</th>
<th>Expected every</th>
<th>State</th>
<th className="text-end">{t("Changed")}</th>
<th>{t("Expected every")}</th>
<th>{t("State")}</th>
<th className="w-1">{t("Actions")}</th>
</tr>
</thead>
@@ -443,7 +443,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
<span className={`badge ${STATE[b.state].cls}`}>{STATE[b.state].label}</span>
{b.problem && <div className="text-secondary small">{b.problem}</div>}
{b.state === "warning" && !b.problem && <Warnings count={b.warnings} messages={b.warningMessages} label={`${b.warnings} warning${b.warnings === 1 ? "" : "s"} in the last run`} />}
{b.problem && b.state === "warning" && <Warnings count={b.warnings} messages={b.warningMessages} label="All the warnings" />}
{b.problem && b.state === "warning" && <Warnings count={b.warnings} messages={b.warningMessages} label={t("All the warnings")} />}
{b.warningStreak >= data.streakRuns && <div className="text-yellow small">{t("Warnings {n} runs in a row", { n: b.warningStreak })}</div>}
{!b.alert && <div className="text-secondary small">no alert</div>}
{b.alert && b.alertWarnings && <div className="text-secondary small">alerts on warnings</div>}
@@ -456,7 +456,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
{canEdit && (
<>
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alert: !b.alert })}>
{b.alert ? "Mute" : "Alert"}
{b.alert ? t("Mute") : t("Alert")}
</button>
{b.alert && !b.alertWarnings && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { warnStreakAlert: !b.warnStreakAlert })} title={t("Whether {n} runs in a row with warnings raise an alert (on unless you switch it off; a job that always has a few warnings can be left alone)", { n: data.streakRuns })}>
@@ -465,11 +465,11 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
)}
{b.alert && (
<button className="btn btn-sm btn-outline-secondary" onClick={() => void patch(b, { alertWarnings: !b.alertWarnings })} title="Whether a run that finishes with warnings raises an alert (it counts as a good backup either way)">
{b.alertWarnings ? "Stop warning alerts" : "Alert on warnings"}
{b.alertWarnings ? t("Stop warning alerts") : t("Alert on warnings")}
</button>
)}
<button className="btn btn-sm btn-outline-danger" onClick={() => void forget(b)}>
Forget
{t("Forget")}
</button>
</>
)}
+43 -43
View File
@@ -31,11 +31,11 @@ const KIND_HINTS: Record<EndpointKind, string> = {
type State = "waiting" | "up" | "failing" | "down" | "off";
const STATE_BADGE: Record<State, { label: string; badge: string }> = {
waiting: { label: "Not asked yet", badge: "bg-secondary-lt text-secondary" },
up: { label: "Up", badge: "bg-green-lt text-green" },
failing: { label: "Failing", badge: "bg-yellow-lt text-yellow" },
down: { label: "Down", badge: "bg-red-lt text-red" },
off: { label: "Switched off", badge: "bg-secondary-lt text-secondary" },
waiting: { get label() { return t("Not asked yet"); }, badge: "bg-secondary-lt text-secondary" },
up: { get label() { return t("Up"); }, badge: "bg-green-lt text-green" },
failing: { get label() { return t("Failing"); }, badge: "bg-yellow-lt text-yellow" },
down: { get label() { return t("Down"); }, badge: "bg-red-lt text-red" },
off: { get label() { return t("Switched off"); }, badge: "bg-secondary-lt text-secondary" },
};
const RANK: Record<State, number> = { down: 0, failing: 1, waiting: 2, up: 3, off: 4 };
@@ -201,7 +201,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
try {
if (draft.id === null) await api.endpoints.create(toInput(draft));
else await api.endpoints.update(draft.id, toInput(draft));
toast.success(draft.id === null ? `Added ${draft.name}.` : "Saved.");
toast.success(draft.id === null ? `Added ${draft.name}.` : t("Saved."));
setDraft(null);
load();
} catch (err) {
@@ -212,7 +212,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
}
async function remove(c: EndpointCheck) {
if (!(await confirmDialog({ title: "Remove a check", message: `Remove "${c.name}" and its history?`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove a check"), message: `Remove "${c.name}" and its history?`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.endpoints.remove(c.id);
load();
@@ -245,9 +245,9 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
const set = <K extends keyof Draft>(key: K, value: Draft[K]) => setDraft((d) => (d ? { ...d, [key]: value } : d));
const cards = [
{ label: "Checks", value: checks ? String(rows.length) : "…", color: "" },
{ label: "Not answering", value: checks ? String(down) : "…", color: down > 0 ? "text-red" : "text-green" },
{ label: "Certificates to renew", value: checks ? String(certs) : "…", color: certs > 0 ? "text-yellow" : "" },
{ label: t("Checks"), value: checks ? String(rows.length) : "…", color: "" },
{ label: t("Not answering"), value: checks ? String(down) : "…", color: down > 0 ? "text-red" : "text-green" },
{ label: t("Certificates to renew"), value: checks ? String(certs) : "…", color: certs > 0 ? "text-yellow" : "" },
];
return (
@@ -256,7 +256,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<h2 className="page-title mb-0">{t("Endpoints")}</h2>
{isAdmin && !draft && (
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
Add a check
{t("Add a check")}
</button>
)}
</div>
@@ -284,7 +284,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
{draft && (
<form className="card mb-3" onSubmit={save}>
<div className="card-header">
<h3 className="card-title">{draft.id === null ? "Add a check" : `Edit ${draft.name || "the check"}`}</h3>
<h3 className="card-title">{draft.id === null ? t("Add a check") : `Edit ${draft.name || "the check"}`}</h3>
</div>
<div className="card-body row g-3">
<div className="col-md-4">
@@ -295,7 +295,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="ep-kind">
What to ask
{t("What to ask")}
</label>
<select id="ep-kind" className="form-select" value={draft.kind} onChange={(e) => set("kind", e.target.value as EndpointKind)}>
{(Object.keys(KIND_LABELS) as EndpointKind[]).map((k) => (
@@ -308,10 +308,10 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="ep-server">
It is about the server
{t("It is about the server")}
</label>
<select id="ep-server" className="form-select" value={draft.serverId} onChange={(e) => set("serverId", e.target.value)}>
<option value="">— none in particular —</option>
<option value="">{t("— none in particular —")}</option>
{servers.map((s) => (
<option key={s.id} value={s.id}>
{s.name}
@@ -322,7 +322,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className={draft.kind === "http" ? "col-md-8" : "col-md-5"}>
<label className="form-label" htmlFor="ep-target">
{draft.kind === "http" ? "Address" : "Host name or address"}
{draft.kind === "http" ? t("Address") : t("Host name or address")}
</label>
<input
id="ep-target"
@@ -337,7 +337,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
{draft.kind !== "http" && (
<div className="col-md-3">
<label className="form-label" htmlFor="ep-port">
Port
{t("Port")}
</label>
<input id="ep-port" type="number" min={1} max={65535} className="form-control" required value={draft.port} placeholder={draft.kind === "tls" ? "443" : ""} onChange={(e) => set("port", e.target.value)} />
</div>
@@ -346,13 +346,13 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<>
<div className="col-md-2">
<label className="form-label" htmlFor="ep-status">
Good answers
{t("Good answers")}
</label>
<input id="ep-status" className="form-control" placeholder="200-399" value={draft.expectStatus} onChange={(e) => set("expectStatus", e.target.value)} />
</div>
<div className="col-md-2">
<label className="form-label" htmlFor="ep-keyword">
Page contains
{t("Page contains")}
</label>
<input id="ep-keyword" className="form-control" maxLength={200} value={draft.keyword} onChange={(e) => set("keyword", e.target.value)} />
</div>
@@ -361,7 +361,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
{draft.kind === "http" && (
<div className="col-12">
<div className="border rounded p-3">
<div className="fw-bold mb-1">Judge a value in the answer (optional)</div>
<div className="fw-bold mb-1">{t("Judge a value in the answer (optional)")}</div>
<div className="text-secondary small mb-2">
For an answer in JSON: say where the value is and what it should be. For example <code>power.now</code> is below 5000, <code>state</code> is equal to playing, or, for a Prometheus query, <code>data.result[0].value[1]</code> is above 0.
Use <code>[0]</code> for the first place in a list.
@@ -369,13 +369,13 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<div className="row g-2">
<div className="col-md-4">
<label className="form-label" htmlFor="ep-vpath">
Where in the answer
{t("Where in the answer")}
</label>
<input id="ep-vpath" className="form-control" maxLength={200} placeholder="power.now" value={draft.valuePath} onChange={(e) => set("valuePath", e.target.value)} />
</div>
<div className="col-md-3">
<label className="form-label" htmlFor="ep-vop">
It should be
{t("It should be")}
</label>
<select id="ep-vop" className="form-select" value={draft.valueOp} disabled={draft.valuePath.trim() === ""} onChange={(e) => set("valueOp", e.target.value as EndpointValueOp)}>
{(Object.keys(OP_LABELS) as EndpointValueOp[]).map((op) => (
@@ -395,7 +395,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
)}
<div className="col-md-2">
<label className="form-label" htmlFor="ep-vunit">
Unit
{t("Unit")}
</label>
<input id="ep-vunit" className="form-control" maxLength={12} disabled={draft.valuePath.trim() === ""} placeholder="W" value={draft.valueUnit} onChange={(e) => set("valueUnit", e.target.value)} />
</div>
@@ -403,13 +403,13 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<div className="row g-2 mt-1">
<div className="col-md-4">
<label className="form-label" htmlFor="ep-hname">
Send a header (optional)
{t("Send a header (optional)")}
</label>
<input id="ep-hname" className="form-control" maxLength={100} placeholder="Authorization" value={draft.headerName} onChange={(e) => set("headerName", e.target.value)} />
<input id="ep-hname" className="form-control" maxLength={100} placeholder={t("Authorization")} value={draft.headerName} onChange={(e) => set("headerName", e.target.value)} />
</div>
<div className="col-md-8">
<label className="form-label" htmlFor="ep-hvalue">
Its value
{t("Its value")}
</label>
<input
id="ep-hvalue"
@@ -418,7 +418,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
className="form-control"
maxLength={2000}
disabled={draft.headerName.trim() === ""}
placeholder={draft.hadHeader ? "Saved — leave blank to keep it" : "Bearer …"}
placeholder={draft.hadHeader ? t("Saved — leave blank to keep it") : "Bearer …"}
value={draft.headerValue}
onChange={(e) => set("headerValue", e.target.value)}
/>
@@ -430,7 +430,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
)}
<div className="col-md-2">
<label className="form-label" htmlFor="ep-interval">
Every
{t("Every")}
</label>
<div className="input-group">
<input id="ep-interval" type="number" min={1} max={1440} className="form-control" value={draft.intervalMinutes} onChange={(e) => set("intervalMinutes", e.target.value)} />
@@ -439,7 +439,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-2">
<label className="form-label" htmlFor="ep-timeout">
Give up after
{t("Give up after")}
</label>
<div className="input-group">
<input id="ep-timeout" type="number" min={1} max={60} className="form-control" value={draft.timeoutSeconds} onChange={(e) => set("timeoutSeconds", e.target.value)} />
@@ -448,7 +448,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-3">
<label className="form-label" htmlFor="ep-fails">
Alert after
{t("Alert after")}
</label>
<div className="input-group">
<input id="ep-fails" type="number" min={1} max={20} className="form-control" value={draft.failuresBeforeAlert} onChange={(e) => set("failuresBeforeAlert", e.target.value)} />
@@ -457,7 +457,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-3">
<label className="form-label" htmlFor="ep-warn">
Warn about the certificate
{t("Warn about the certificate")}
</label>
<div className="input-group">
<input id="ep-warn" type="number" min={1} max={90} className="form-control" value={draft.warnDays} onChange={(e) => set("warnDays", e.target.value)} />
@@ -478,7 +478,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === "" || draft.target.trim() === ""}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
{t("Cancel")}
@@ -488,16 +488,16 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
)}
<div className="card">
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder="Search checks…" shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder={t("Search checks…")} shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
<div className="table-responsive">
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Row> label="Check" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Check")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Answer" sortKeyName="lastResponseMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Uptime" sortKeyName="uptime24h" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Certificate" sortKeyName="certDays" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Answer")} sortKeyName="lastResponseMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Uptime")} sortKeyName="uptime24h" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Certificate")} sortKeyName="certDays" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Checked")} sortKeyName="lastCheckedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
{(canCheck || isAdmin) && <th className="w-1">{t("Actions")}</th>}
</tr>
@@ -534,7 +534,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
)}
</td>
<td className="stack-label" data-label="Answer">
<td className="stack-label" data-label={t("Answer")}>
{c.lastValue !== null && (
<div className="fw-bold" title={limitWords(c)}>
{c.lastValue}
@@ -556,7 +556,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</div>
)}
</td>
<td className="stack-label" data-label="Uptime">
<td className="stack-label" data-label={t("Uptime")}>
{c.stats?.uptime24h == null ? (
<span className="text-secondary">—</span>
) : (
@@ -569,10 +569,10 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<Ticks recent={c.stats?.recent ?? []} />
</div>
<button type="button" className="btn btn-link btn-sm p-0" onClick={() => setHistoryFor({ id: c.id, name: c.name })}>
History…
{t("History…")}
</button>
</td>
<td className="stack-label" data-label="Certificate">
<td className="stack-label" data-label={t("Certificate")}>
{c.certDays === null ? (
<span className="text-secondary">—</span>
) : c.certDays < 0 ? (
@@ -595,7 +595,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
<div className="btn-list flex-nowrap">
{canCheck && (
<button className="btn btn-sm btn-outline-primary" disabled={asking === c.id} onClick={() => void askNow(c)}>
{asking === c.id ? "Asking…" : "Check now"}
{asking === c.id ? t("Asking…") : t("Check now")}
</button>
)}
{isAdmin && (
@@ -614,7 +614,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</tr>
))}
{checks !== null && sorted?.length === 0 && (
<EmptyRow colSpan={7} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: "Nothing is being checked yet", hint: "Ask a web address, a port or a certificate every few minutes, and hear about it when it stops answering or a certificate is about to run out.", action: isAdmin ? { label: "Add a check", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
<EmptyRow colSpan={7} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: t("Nothing is being checked yet"), hint: t("Ask a web address, a port or a certificate every few minutes, and hear about it when it stops answering or a certificate is about to run out."), action: isAdmin ? { label: t("Add a check"), onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
)}
</tbody>
</table>
+40 -40
View File
@@ -20,7 +20,7 @@ type Server = FragnetServerInfo;
const MB = 1024 ** 2;
function Badge({ a }: { a: FragnetAccount }) {
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
@@ -29,15 +29,15 @@ function Badge({ a }: { a: FragnetAccount }) {
}
function StateBadge({ s }: { s: Server }) {
if (s.suspended) return <span className="badge bg-red-lt text-red">Suspended</span>;
if (s.installing) return <span className="badge bg-blue-lt text-blue">Installing</span>;
if (s.panelStatus === "restoring_backup") return <span className="badge bg-blue-lt text-blue">Restoring a backup</span>;
if (s.panelStatus === "install_failed" || s.panelStatus === "reinstall_failed") return <span className="badge bg-red-lt text-red">Install failed</span>;
if (s.state === "running") return <span className="badge bg-green-lt text-green">Running</span>;
if (s.state === "offline") return <span className="badge bg-secondary-lt text-secondary">Stopped</span>;
if (s.state === "starting") return <span className="badge bg-blue-lt text-blue">Starting</span>;
if (s.state === "stopping") return <span className="badge bg-yellow-lt text-yellow">Stopping</span>;
return <span className="badge bg-yellow-lt text-yellow">Unknown</span>;
if (s.suspended) return <span className="badge bg-red-lt text-red">{t("Suspended")}</span>;
if (s.installing) return <span className="badge bg-blue-lt text-blue">{t("Installing")}</span>;
if (s.panelStatus === "restoring_backup") return <span className="badge bg-blue-lt text-blue">{t("Restoring a backup")}</span>;
if (s.panelStatus === "install_failed" || s.panelStatus === "reinstall_failed") return <span className="badge bg-red-lt text-red">{t("Install failed")}</span>;
if (s.state === "running") return <span className="badge bg-green-lt text-green">{t("Running")}</span>;
if (s.state === "offline") return <span className="badge bg-secondary-lt text-secondary">{t("Stopped")}</span>;
if (s.state === "starting") return <span className="badge bg-blue-lt text-blue">{t("Starting")}</span>;
if (s.state === "stopping") return <span className="badge bg-yellow-lt text-yellow">{t("Stopping")}</span>;
return <span className="badge bg-yellow-lt text-yellow">{t("Unknown")}</span>;
}
/** What is used of a limit, as a bar that turns yellow at the integration's limit for "nearly full" and red near the top. A limit of 0 (or none) is no limit: only the use is written. */
@@ -65,7 +65,7 @@ function CopyAddress({ a }: { a: Server["allocations"][number] }) {
<button
type="button"
className="btn btn-link p-0 text-reset text-decoration-none"
title="Copy the address"
title={t("Copy the address")}
onClick={() => {
void navigator.clipboard?.writeText(text).then(
() => toast.success(`Copied ${text}`),
@@ -92,7 +92,7 @@ function PowerHistory({ power }: { power: Server["power"] }) {
const headline = stats ? onHeadline(stats) : null;
return (
<div className="col-12">
<h5>Power history</h5>
<h5>{t("Power history")}</h5>
{!stats && <div className="text-secondary small">Nothing yet — this app keeps it from the first time it reads a server, so it fills in as the days go by.</div>}
{stats && (
<div className="row g-3">
@@ -118,7 +118,7 @@ function PowerHistory({ power }: { power: Server["power"] }) {
<div className="position-relative rounded overflow-hidden bg-secondary-lt" style={{ height: 16 }} role="img" aria-label="The last seven days: green where the server was on, grey where it was off">
{timeline.segments.map((seg, i) => {
const [left, width] = barPosition(timeline, seg);
return <div key={i} className={seg.on ? "bg-green" : "bg-secondary"} style={{ position: "absolute", top: 0, bottom: 0, left: `${left}%`, width: `${width}%`, opacity: seg.on ? 1 : 0.35 }} title={`${seg.on ? "On" : "Off"} from ${formatDateTime(new Date(seg.from))} to ${formatDateTime(new Date(seg.to))}`} />;
return <div key={i} className={seg.on ? "bg-green" : "bg-secondary"} style={{ position: "absolute", top: 0, bottom: 0, left: `${left}%`, width: `${width}%`, opacity: seg.on ? 1 : 0.35 }} title={`${seg.on ? t("On") : t("Off")} from ${formatDateTime(new Date(seg.from))} to ${formatDateTime(new Date(seg.to))}`} />;
})}
</div>
<div className="d-flex justify-content-between small text-secondary mt-1">
@@ -130,8 +130,8 @@ function PowerHistory({ power }: { power: Server["power"] }) {
<div className="small text-secondary mt-1">Seen by reading the account every five minutes, so each time is to the nearest five. Known since {formatDateTime(new Date(stats.trackedSince))}.</div>
</div>
<div className="col-lg-4">
<div className="small text-secondary mb-1">Latest</div>
{power && power.recent.length === 0 && <div className="small text-secondary">Nothing has changed since it was first read.</div>}
<div className="small text-secondary mb-1">{t("Latest")}</div>
{power && power.recent.length === 0 && <div className="small text-secondary">{t("Nothing has changed since it was first read.")}</div>}
<ul className="list-unstyled small mb-0">
{power?.recent.slice(0, 8).map((e, i) => (
<li key={i}>
@@ -160,8 +160,8 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
return (
<div className="row g-3">
<div className="col-lg-4">
<h5>Addresses</h5>
{s.allocations.length === 0 && <div className="text-secondary small">The panel did not list any.</div>}
<h5>{t("Addresses")}</h5>
{s.allocations.length === 0 && <div className="text-secondary small">{t("The panel did not list any.")}</div>}
<ul className="list-unstyled mb-2">
{s.allocations.map((a) => (
<li key={`${a.ip}:${a.port}`}>
@@ -185,18 +185,18 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
<div>
Room for {s.backupLimit ?? "?"} backups, {s.databaseLimit ?? "?"} databases{s.databases !== null ? ` (${s.databases} made)` : ""}
</div>
{!s.owner && <div>Shared with this account — not owned by it.</div>}
{!s.owner && <div>{t("Shared with this account — not owned by it.")}</div>}
<div>
Known here since <TimeAgo value={s.firstSeenAt} />
</div>
</div>
<div className="mt-2 btn-list">
<a className="btn btn-sm" href={`${panelUrl.replace(/\/+$/, "")}/server/${s.id}`} target="_blank" rel="noopener noreferrer">
Open in the game panel
{t("Open in the game panel")}
</a>
{canAct && !s.suspended && !s.installing && (
<button className="btn btn-sm btn-outline-danger" onClick={() => onSignal(s, "kill")}>
Kill…
{t("Kill…")}
</button>
)}
</div>
@@ -205,13 +205,13 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
<div className="d-flex align-items-center gap-2 mb-2">
<h5 className="mb-0">Backups{s.backupLimit ? ` (${backups.filter((b) => b.completedAt !== null).length} of ${s.backupLimit})` : ""}</h5>
{canAct && s.backupLimit ? (
<button className="btn btn-sm ms-auto" disabled={busy || making} onClick={() => onBackup(s)} title={making ? "One is already being made" : "Ask the panel to make a backup now"}>
{making ? "Being made…" : "Back up now"}
<button className="btn btn-sm ms-auto" disabled={busy || making} onClick={() => onBackup(s)} title={making ? t("One is already being made") : t("Ask the panel to make a backup now")}>
{making ? t("Being made…") : t("Back up now")}
</button>
) : null}
</div>
{s.backups === null && <div className="text-secondary small">They could not be listed (the key may not be allowed to).</div>}
{s.backups !== null && backups.length === 0 && <div className="text-secondary small">{s.backupLimit ? "None has been made." : "This plan has none."}</div>}
{s.backups === null && <div className="text-secondary small">{t("They could not be listed (the key may not be allowed to).")}</div>}
{s.backups !== null && backups.length === 0 && <div className="text-secondary small">{s.backupLimit ? t("None has been made.") : t("This plan has none.")}</div>}
<ul className="list-unstyled mb-0">
{backups.slice(0, 8).map((b) => (
<li key={b.uuid}>
@@ -227,8 +227,8 @@ function Details({ s, panelUrl, canAct, onSignal, onBackup, busy }: { s: Server;
{backups.length > 8 && <div className="text-secondary small">and {backups.length - 8} older</div>}
</div>
<div className="col-lg-4">
<h5>Schedules</h5>
{s.schedules === null && <div className="text-secondary small">They could not be listed.</div>}
<h5>{t("Schedules")}</h5>
{s.schedules === null && <div className="text-secondary small">{t("They could not be listed.")}</div>}
{s.schedules !== null && s.schedules.length === 0 && <div className="text-secondary small">None. A restart or a backup on a schedule is set in the game panel.</div>}
<ul className="list-unstyled mb-0">
{s.schedules?.map((x) => (
@@ -295,8 +295,8 @@ function ServerRow({ a, s, readAt, canAct, open, onToggle, onSignal, onBackup, b
{s.allocations.length > 1 && <div className="small text-secondary">+{s.allocations.length - 1} more</div>}
</td>
<td>
<UseBar label="Memory" used={s.state === "running" || s.state === "starting" ? (s.usage?.memoryBytes ?? null) : null} limitMb={s.memoryLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.memory} />
<UseBar label="Disk" used={s.usage?.diskBytes ?? null} limitMb={s.diskLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.disk} />
<UseBar label={t("Memory")} used={s.state === "running" || s.state === "starting" ? (s.usage?.memoryBytes ?? null) : null} limitMb={s.memoryLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.memory} />
<UseBar label={t("Disk")} used={s.usage?.diskBytes ?? null} limitMb={s.diskLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.disk} />
</td>
<td className="text-secondary">
{backup === null ? (
@@ -330,8 +330,8 @@ function ServerRow({ a, s, readAt, canAct, open, onToggle, onSignal, onBackup, b
</>
)}
{s.backupLimit ? (
<button className="btn btn-sm" disabled={busy || backupInProgress(s)} onClick={() => onBackup(s)} title={backupInProgress(s) ? "One is already being made" : "Ask the panel to make a backup now"}>
{backupInProgress(s) ? "Backing up…" : "Back up"}
<button className="btn btn-sm" disabled={busy || backupInProgress(s)} onClick={() => onBackup(s)} title={backupInProgress(s) ? t("One is already being made") : t("Ask the panel to make a backup now")}>
{backupInProgress(s) ? t("Backing up…") : t("Back up")}
</button>
) : null}
</div>
@@ -398,7 +398,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
const ok = await confirmDialog({
title: `Back up ${server.name}`,
message: `Ask the game panel to make a backup of ${server.name} now? It is made in the background while the game keeps running, and a large one can take a few minutes.${server.backupLimit ? ` It counts towards the ${server.backupLimit} the plan allows${used !== null ? ` (${used} made)` : ""} — if the plan is full the panel will refuse, and one has to be deleted in the panel first.` : ""}`,
confirmLabel: "Back up now",
confirmLabel: t("Back up now"),
});
if (!ok) return;
setBusy(true);
@@ -460,7 +460,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
<div className="col-6 col-lg-3">
<div className="card card-sm h-100">
<div className="card-body">
<div className="text-secondary small">Games</div>
<div className="text-secondary small">{t("Games")}</div>
<div className="h2 mb-0">{new Set(s.servers.map((x) => x.game ?? x.dockerImage ?? "?")).size}</div>
<div className="text-secondary small text-truncate">{[...new Set(s.servers.map((x) => x.game).filter(Boolean))].join(", ") || "not said by the panel"}</div>
</div>
@@ -478,7 +478,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
<div className="col-6 col-lg-3">
<div className="card card-sm h-100">
<div className="card-body">
<div className="text-secondary small">Addresses</div>
<div className="text-secondary small">{t("Addresses")}</div>
<div className="h2 mb-0">{s.servers.reduce((n, x) => n + x.allocations.length, 0)}</div>
<div className="text-secondary small">on {new Set(s.servers.flatMap((x) => x.allocations.map((y) => y.ip))).size} IP address(es)</div>
</div>
@@ -490,10 +490,10 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
<thead>
<tr>
<th>{t("Server")}</th>
<th>State</th>
<th>Address</th>
<th>Use</th>
<th>Newest backup</th>
<th>{t("State")}</th>
<th>{t("Address")}</th>
<th>{t("Use")}</th>
<th>{t("Newest backup")}</th>
<th />
</tr>
</thead>
@@ -504,7 +504,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
{s.servers.length === 0 && (
<tr>
<td colSpan={6} className="text-secondary">
The account has no game servers.
{t("The account has no game servers.")}
</td>
</tr>
)}
@@ -541,7 +541,7 @@ export default function GameServers({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">{t("Game servers")}</h2>
<PageIntro>
What Fragnet&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.
What Fragnet&rsquo;s game panel says about your servers, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>). <strong>{t("A backup that is late")}</strong> and <strong>a disk or memory nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>; a server that is stopped is not, since a game server is often stopped on purpose.
{canAct ? " Start, stop and restart are sent to the panel when you press them; nothing else is ever changed." : " Operators can start, stop and restart them from here."} What they cost is added by hand under <Link to="/costs">{t("Costs")}</Link>.
</PageIntro>
<ErrorNotice error={error} />
@@ -549,7 +549,7 @@ export default function GameServers({ user }: { user: CurrentUser }) {
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No Fragnet account connected" hint="Add one under Integrations with an API key from the game panel (panel.fragnet.net → your profile → API Credentials; it starts with ptlc_)." />
<EmptyState title={t("No Fragnet account connected")} hint="Add one under Integrations with an API key from the game panel (panel.fragnet.net → your profile → API Credentials; it starts with ptlc_)." />
</div>
</div>
)}
+22 -22
View File
@@ -104,21 +104,21 @@ export default function Generator({ user }: { user: CurrentUser }) {
{user.role === "admin" && (
<>
{" "}
<Link to="/settings/names">Edit the lists</Link>.
<Link to="/settings/names">{t("Edit the lists")}</Link>.
</>
)}
</p>
<ErrorNotice error={themesError} className="py-2" />
<label className="form-label">Theme</label>
<label className="form-label">{t("Theme")}</label>
<select className="form-select mb-1" value={theme} onChange={(e) => setTheme(e.target.value)} disabled={!themes}>
<option value={MIXED}>Mixed — all lists</option>
<option value={MIXED}>{t("Mixed — all lists")}</option>
{(themes ?? []).map((t) => (
<option key={t.id} value={t.id}>
{t.label} ({t.names.length})
</option>
))}
</select>
<div className="form-hint mb-3">{themes ? `${pool.length} name${pool.length === 1 ? "" : "s"} to pick from.` : "Loading the lists…"}</div>
<div className="form-hint mb-3">{themes ? `${pool.length} name${pool.length === 1 ? "" : "s"} to pick from.` : t("Loading the lists…")}</div>
{serverNames.length > 1 ? (
<ul className="list-group">
{serverNames.map((n) => (
@@ -130,22 +130,22 @@ export default function Generator({ user }: { user: CurrentUser }) {
</ul>
) : (
<div className="input-group">
<input type="text" className="form-control" readOnly value={serverNames[0] ?? ""} placeholder="Click Generate…" aria-label="Generated server name" />
<input type="text" className="form-control" readOnly value={serverNames[0] ?? ""} placeholder="Click Generate…" aria-label={t("Generated server name")} />
{serverNames[0] && <CopyButton text={serverNames[0]} />}
</div>
)}
{serverNames.length > 1 && (
<div className="mt-2">
<CopyButton text={serverNames.join("\n")} label="Copy all" />
<CopyButton text={serverNames.join("\n")} label={t("Copy all")} />
</div>
)}
</div>
<div className="card-footer d-flex flex-wrap align-items-center gap-2">
<button className="btn btn-primary" onClick={rollServerName} disabled={pool.length === 0}>
Generate
{t("Generate")}
</button>
<label className="d-flex align-items-center gap-2 mb-0 ms-auto">
<span className="text-secondary">How many</span>
<span className="text-secondary">{t("How many")}</span>
<input
type="number"
className="form-control"
@@ -163,22 +163,22 @@ export default function Generator({ user }: { user: CurrentUser }) {
<div className="col-md-6 col-lg-4">
<div className="card h-100">
<div className="card-header">
<h3 className="card-title">Username</h3>
<h3 className="card-title">{t("Username")}</h3>
</div>
<div className="card-body">
<p className="text-secondary">An adjective + animal, optionally with a number — easy to say, hard to collide.</p>
<div className="row g-2 mb-3">
<div className="col-7">
<label className="form-label">Separator</label>
<label className="form-label">{t("Separator")}</label>
<select
className="form-select"
value={usernameOptions.separator}
onChange={(e) => setUsernameOptions((o) => ({ ...o, separator: e.target.value as UsernameOptions["separator"] }))}
>
<option value="-">Hyphen (clever-otter)</option>
<option value="_">Underscore (clever_otter)</option>
<option value=".">Dot (clever.otter)</option>
<option value="">None (cleverotter)</option>
<option value="-">{t("Hyphen (clever-otter)")}</option>
<option value="_">{t("Underscore (clever_otter)")}</option>
<option value=".">{t("Dot (clever.otter)")}</option>
<option value="">{t("None (cleverotter)")}</option>
</select>
</div>
<div className="col-5 d-flex align-items-end">
@@ -189,18 +189,18 @@ export default function Generator({ user }: { user: CurrentUser }) {
checked={usernameOptions.includeNumber}
onChange={(e) => setUsernameOptions((o) => ({ ...o, includeNumber: e.target.checked }))}
/>
<span className="form-check-label">Add number</span>
<span className="form-check-label">{t("Add number")}</span>
</label>
</div>
</div>
<div className="input-group">
<input type="text" className="form-control" readOnly value={username} placeholder="Click Generate…" aria-label="Generated username" />
<input type="text" className="form-control" readOnly value={username} placeholder="Click Generate…" aria-label={t("Generated username")} />
{username && <CopyButton text={username} />}
</div>
</div>
<div className="card-footer">
<button className="btn btn-primary" onClick={rollUsername}>
Generate
{t("Generate")}
</button>
</div>
</div>
@@ -209,7 +209,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
<div className="col-md-6 col-lg-4">
<div className="card h-100">
<div className="card-header">
<h3 className="card-title">Password</h3>
<h3 className="card-title">{t("Password")}</h3>
</div>
<div className="card-body">
<label className="form-label">Length: {passwordOptions.length}</label>
@@ -252,20 +252,20 @@ export default function Generator({ user }: { user: CurrentUser }) {
/>
<span className="form-check-label">Exclude ambiguous characters (0/O, 1/l/I…)</span>
</label>
{noCharsetSelected && <div className="alert alert-danger py-2">Pick at least one character type.</div>}
{noCharsetSelected && <div className="alert alert-danger py-2">{t("Pick at least one character type.")}</div>}
<div className="input-group mb-2">
<input
type={showPassword ? "text" : "password"}
className="form-control font-monospace"
readOnly
value={password}
aria-label="Generated password"
aria-label={t("Generated password")}
placeholder="Click Generate…"
/>
{password && (
<>
<button type="button" className="btn btn-outline-secondary" onClick={() => setShowPassword((v) => !v)}>
{showPassword ? "Hide" : "Show"}
{showPassword ? t("Hide") : t("Show")}
</button>
<CopyButton text={password} />
</>
@@ -279,7 +279,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer">
<button className="btn btn-primary" onClick={rollPassword} disabled={noCharsetSelected}>
Generate
{t("Generate")}
</button>
</div>
</div>
+16 -16
View File
@@ -19,24 +19,24 @@ import { t } from "../i18n";
function runStatusBadge(repo: GiteaRepo) {
const run = repo.latestRun;
if (!run) return <span className="badge bg-secondary-lt text-secondary">No runs</span>;
if (!run) return <span className="badge bg-secondary-lt text-secondary">{t("No runs")}</span>;
const state = run.conclusion || run.status;
switch (state) {
case "success":
return <span className="badge bg-green-lt text-green">Success</span>;
return <span className="badge bg-green-lt text-green">{t("Success")}</span>;
case "failure":
return <span className="badge bg-red-lt text-red">Failed</span>;
return <span className="badge bg-red-lt text-red">{t("Failed")}</span>;
case "cancelled":
return <span className="badge bg-secondary-lt text-secondary">Cancelled</span>;
return <span className="badge bg-secondary-lt text-secondary">{t("Cancelled")}</span>;
case "skipped":
return <span className="badge bg-secondary-lt text-secondary">Skipped</span>;
return <span className="badge bg-secondary-lt text-secondary">{t("Skipped")}</span>;
case "waiting":
case "queued":
case "pending":
return <span className="badge bg-yellow-lt text-yellow">Queued</span>;
return <span className="badge bg-yellow-lt text-yellow">{t("Queued")}</span>;
case "running":
case "in_progress":
return <span className="badge bg-blue-lt text-blue">Running</span>;
return <span className="badge bg-blue-lt text-blue">{t("Running")}</span>;
default:
return <span className="badge bg-secondary-lt text-secondary">{state}</span>;
}
@@ -129,7 +129,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
{integrations?.length === 0 ? (
<div className="card">
<div className="card-body text-secondary">
No Gitea integration configured yet. <Link to="/integrations">Add one under Integrations</Link>.
No Gitea integration configured yet. <Link to="/integrations">{t("Add one under Integrations")}</Link>.
</div>
</div>
) : (
@@ -161,7 +161,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
) : (
<div className="card">
<div className="card-header">
<h3 className="card-title">Repositories</h3>
<h3 className="card-title">{t("Repositories")}</h3>
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
<div className="card-actions">
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
@@ -172,7 +172,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
onClick={() => selected && loadRepos(selected.id)}
disabled={loading}
>
{loading ? "Refreshing…" : "Refresh"}
{loading ? t("Refreshing…") : t("Refresh")}
</button>
</div>
</div>
@@ -180,10 +180,10 @@ export default function Gitea({ user }: { user: CurrentUser }) {
<table className="table table-vcenter card-table">
<thead>
<tr>
<SortableTh<GiteaRepo> label="Repository" sortKeyName="fullName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<GiteaRepo> label="Last updated" sortKeyName="updatedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>Last run</th>
<th>Branch</th>
<SortableTh<GiteaRepo> label={t("Repository")} sortKeyName="fullName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<GiteaRepo> label={t("Last updated")} sortKeyName="updatedAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>{t("Last run")}</th>
<th>{t("Branch")}</th>
<th>{t("Status")}</th>
{canEdit && <th className="w-1">{t("Actions")}</th>}
</tr>
@@ -195,7 +195,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
<a href={r.htmlUrl} target="_blank" rel="noopener noreferrer">
{r.fullName}
</a>
{r.private && <span className="badge bg-secondary-lt ms-2">Private</span>}
{r.private && <span className="badge bg-secondary-lt ms-2">{t("Private")}</span>}
</td>
<td>
{r.updatedAt ? (
@@ -236,7 +236,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
</tr>
))}
{sorted?.length === 0 && (
<EmptyRow colSpan={canEdit ? 6 : 5} title="No repositories to show" hint="A token only sees the repositories it has been given access to. Check its permissions in Gitea." action={{ label: "Check the integration", to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<EmptyRow colSpan={canEdit ? 6 : 5} title={t("No repositories to show")} hint="A token only sees the repositories it has been given access to. Check its permissions in Gitea." action={{ label: t("Check the integration"), to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
)}
</tbody>
</table>
+12 -12
View File
@@ -12,7 +12,7 @@ import FigureHistory from "../components/FigureHistory";
import { t } from "../i18n";
function Badge({ g }: { g: GrafanaInstance }) {
if (!g.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!g.enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Off")}</span>;
if (!g.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
if (!g.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (g.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
@@ -67,22 +67,22 @@ function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; on
{s && (
<>
<div className="row g-3 mb-3">
<Tile label="Alert rules" value={rules ? String(rules.total) : "—"} sub={rules ? "in Grafana-managed alerting" : "could not be read"} />
<Tile label="Firing" value={rules ? String(firing.length) : "—"} sub={rules ? (pending.length > 0 ? `and ${pending.length} pending` : "none pending") : null} warn={firing.length > 0} />
<Tile label="Cannot be evaluated" value={rules ? String(broken.length) : "—"} sub="rules in an error state" warn={broken.length > 0} />
<Tile label="Data sources" value={ds ? String(ds.length) : "—"} sub={ds ? (failing.length > 0 ? `${failing.length} failing its check` : "none failing") : "could not be listed"} warn={failing.length > 0} />
<Tile label={t("Alert rules")} value={rules ? String(rules.total) : "—"} sub={rules ? "in Grafana-managed alerting" : "could not be read"} />
<Tile label={t("Firing")} value={rules ? String(firing.length) : "—"} sub={rules ? (pending.length > 0 ? `and ${pending.length} pending` : "none pending") : null} warn={firing.length > 0} />
<Tile label={t("Cannot be evaluated")} value={rules ? String(broken.length) : "—"} sub="rules in an error state" warn={broken.length > 0} />
<Tile label={t("Data sources")} value={ds ? String(ds.length) : "—"} sub={ds ? (failing.length > 0 ? `${failing.length} failing its check` : "none failing") : "could not be listed"} warn={failing.length > 0} />
</div>
{rules && rules.items.length > 0 && (
<>
<h4>Rules that are not quiet</h4>
<h4>{t("Rules that are not quiet")}</h4>
<div className="table-responsive">
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>Rule</th>
<th>State</th>
<th>{t("Rule")}</th>
<th>{t("State")}</th>
<th>{t("Where")}</th>
<th>Since</th>
<th>{t("Since")}</th>
</tr>
</thead>
<tbody>
@@ -111,7 +111,7 @@ function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; on
{rules && rules.items.length === 0 && <div className="text-secondary small mb-3">All {rules.total} rules are quiet.</div>}
{ds && ds.length > 0 && (
<>
<h4 className="mt-3">Data sources</h4>
<h4 className="mt-3">{t("Data sources")}</h4>
<ul className="mb-0">
{ds.map((d) => (
<li key={d.uid}>
@@ -154,7 +154,7 @@ export default function Grafana({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title">Grafana</h2>
<PageIntro>
Read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is silenced, paused or changed. <strong>A rule that is firing</strong>, <strong>a rule Grafana cannot evaluate</strong> and <strong>a data source that fails its check</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
Read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is silenced, paused or changed. <strong>{t("A rule that is firing")}</strong>, <strong>a rule Grafana cannot evaluate</strong> and <strong>a data source that fails its check</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
Grafana can notify about its own alerts too; with both you hear twice.
</PageIntro>
<ErrorNotice error={error} />
@@ -162,7 +162,7 @@ export default function Grafana({ user }: { user: CurrentUser }) {
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No Grafana connected" hint="Add one under Integrations with its address and a service account token (Administration → Users and access → Service accounts; the Viewer role is enough)." />
<EmptyState title={t("No Grafana connected")} hint="Add one under Integrations with its address and a service account token (Administration → Users and access → Service accounts; the Viewer role is enough)." />
</div>
</div>
)}
+28 -28
View File
@@ -21,12 +21,12 @@ import PageIntro from "../components/PageIntro";
import { t } from "../i18n";
const STATE_BADGE: Record<HeartbeatState, { label: string; badge: string }> = {
waiting: { label: "Waiting for the first call", badge: "bg-secondary-lt text-secondary" },
up: { label: "On time", badge: "bg-green-lt text-green" },
running: { label: "Running", badge: "bg-blue-lt text-blue" },
late: { label: "Late", badge: "bg-yellow-lt text-yellow" },
failed: { label: "Said it failed", badge: "bg-red-lt text-red" },
off: { label: "Switched off", badge: "bg-secondary-lt text-secondary" },
waiting: { get label() { return t("Waiting for the first call"); }, badge: "bg-secondary-lt text-secondary" },
up: { get label() { return t("On time"); }, badge: "bg-green-lt text-green" },
running: { get label() { return t("Running"); }, badge: "bg-blue-lt text-blue" },
late: { get label() { return t("Late"); }, badge: "bg-yellow-lt text-yellow" },
failed: { get label() { return t("Said it failed"); }, badge: "bg-red-lt text-red" },
off: { get label() { return t("Switched off"); }, badge: "bg-secondary-lt text-secondary" },
};
const RANK: Record<HeartbeatState, number> = { failed: 0, late: 1, waiting: 2, running: 3, up: 4, off: 5 };
@@ -101,7 +101,7 @@ function HowToCall({ url, onClose, name }: { url: string; onClose: () => void; n
Have the job call this address when it finishes. Anyone with it can say &ldquo;I&rsquo;m alive&rdquo; for the job — and nothing else — so keep it between the job and you. If it gets out, give the heartbeat a new address.
</p>
<div className="input-group mb-3">
<input className="form-control" readOnly value={url} aria-label="The address to call" onFocus={(e) => e.currentTarget.select()} />
<input className="form-control" readOnly value={url} aria-label={t("The address to call")} onFocus={(e) => e.currentTarget.select()} />
<CopyButton text={url} />
</div>
<div className="mb-1 fw-bold">In cron, after the job:</div>
@@ -194,7 +194,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
}
async function remove(h: Heartbeat) {
if (!(await confirmDialog({ title: "Remove a heartbeat", message: `Remove "${h.name}" and its history? The job's calls to its address will get "not found".`, confirmLabel: "Remove", danger: true }))) return;
if (!(await confirmDialog({ title: t("Remove a heartbeat"), message: `Remove "${h.name}" and its history? The job's calls to its address will get "not found".`, confirmLabel: t("Remove"), danger: true }))) return;
try {
await api.heartbeats.remove(h.id);
load();
@@ -204,7 +204,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
}
async function newAddress(h: Heartbeat) {
if (!(await confirmDialog({ title: "Give it a new address", message: `The old address for "${h.name}" stops working at once, and the job has to be changed to call the new one. Do this if the old one got out.`, confirmLabel: "Make a new address", danger: true }))) return;
if (!(await confirmDialog({ title: t("Give it a new address"), message: `The old address for "${h.name}" stops working at once, and the job has to be changed to call the new one. Do this if the old one got out.`, confirmLabel: t("Make a new address"), danger: true }))) return;
try {
const { path } = await api.heartbeats.newAddress(h.id);
setShowing({ name: h.name, path });
@@ -224,9 +224,9 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
const set = <K extends keyof Draft>(key: K, value: Draft[K]) => setDraft((d) => (d ? { ...d, [key]: value } : d));
const cards = [
{ label: "Heartbeats", value: items ? String(rows.length) : "…", color: "" },
{ label: "Late or failed", value: items ? String(wrong) : "…", color: wrong > 0 ? "text-red" : "text-green" },
{ label: "Waiting for a first call", value: items ? String(waiting) : "…", color: waiting > 0 ? "text-yellow" : "" },
{ label: t("Heartbeats"), value: items ? String(rows.length) : "…", color: "" },
{ label: t("Late or failed"), value: items ? String(wrong) : "…", color: wrong > 0 ? "text-red" : "text-green" },
{ label: t("Waiting for a first call"), value: items ? String(waiting) : "…", color: waiting > 0 ? "text-yellow" : "" },
];
return (
@@ -235,7 +235,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<h2 className="page-title mb-0">{t("Heartbeats")}</h2>
{isAdmin && !draft && (
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
Add a heartbeat
{t("Add a heartbeat")}
</button>
)}
</div>
@@ -263,7 +263,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
{draft && (
<form className="card mb-3" onSubmit={save}>
<div className="card-header">
<h3 className="card-title">{draft.id === null ? "Add a heartbeat" : `Edit ${draft.name || "the heartbeat"}`}</h3>
<h3 className="card-title">{draft.id === null ? t("Add a heartbeat") : `Edit ${draft.name || "the heartbeat"}`}</h3>
</div>
<div className="card-body row g-3">
<div className="col-md-4">
@@ -274,11 +274,11 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="hb-every">
It should report every
{t("It should report every")}
</label>
<div className="input-group">
<input id="hb-every" type="number" min={1} step="any" className="form-control" required value={draft.every} onChange={(e) => set("every", e.target.value)} />
<select className="form-select" aria-label="Unit" value={draft.unit} onChange={(e) => set("unit", e.target.value as Unit)} style={{ maxWidth: "7rem" }}>
<select className="form-select" aria-label={t("Unit")} value={draft.unit} onChange={(e) => set("unit", e.target.value as Unit)} style={{ maxWidth: "7rem" }}>
<option value="minutes">minutes</option>
<option value="hours">hours</option>
<option value="days">days</option>
@@ -297,10 +297,10 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="hb-server">
It runs on the server
{t("It runs on the server")}
</label>
<select id="hb-server" className="form-select" value={draft.serverId} onChange={(e) => set("serverId", e.target.value)}>
<option value="">— none in particular —</option>
<option value="">{t("— none in particular —")}</option>
{servers.map((s) => (
<option key={s.id} value={s.id}>
{s.name}
@@ -324,7 +324,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</div>
<div className="card-footer d-flex gap-2">
<button type="submit" className="btn btn-primary" disabled={busy || draft.name.trim() === "" || !(Number(draft.every) > 0)}>
{busy ? "Saving…" : "Save"}
{busy ? "Saving…" : t("Save")}
</button>
<button type="button" className="btn" onClick={() => setDraft(null)}>
{t("Cancel")}
@@ -334,15 +334,15 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
)}
<div className="card">
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder="Search heartbeats…" shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
<TableToolbar search={tableSearch.query} onSearch={tableSearch.setQuery} placeholder={t("Search heartbeats…")} shown={sorted?.length} total={rows.length} onExport={exportCsv} exportDisabled={!sorted || sorted.length === 0} />
<div className="table-responsive">
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<SortableTh<Row> label="Job" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Job")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Last call" sortKeyName="lastPingAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label="Due by" sortKeyName="dueBy" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Last call")} sortKeyName="lastPingAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<SortableTh<Row> label={t("Due by")} sortKeyName="dueBy" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
<th>{t("Recent runs")}</th>
{isAdmin && <th className="w-1">{t("Actions")}</th>}
</tr>
@@ -370,7 +370,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<span className={`badge ${STATE_BADGE[h.state].badge}`}>{STATE_BADGE[h.state].label}</span>
{h.state === "failed" && h.lastMessage && <div className="text-secondary small text-break">{h.lastMessage}</div>}
</td>
<td className="stack-label" data-label="Last call">
<td className="stack-label" data-label={t("Last call")}>
{h.lastPingAt ? (
<>
<TimeAgo value={h.lastPingAt} />
@@ -381,7 +381,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<span className="text-secondary">never</span>
)}
</td>
<td className="stack-label" data-label="Due by">
<td className="stack-label" data-label={t("Due by")}>
{h.enabled ? (
<span className={h.state === "late" ? "text-yellow" : "text-secondary"}>{formatDateTime(new Date(h.dueBy))}</span>
) : (
@@ -396,14 +396,14 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
<div className="btn-list flex-nowrap">
{h.path && (
<button className="btn btn-sm btn-outline-primary" onClick={() => setShowing({ name: h.name, path: h.path! })}>
Address
{t("Address")}
</button>
)}
<button className="btn btn-sm btn-outline-secondary" onClick={() => setDraft(toDraft(h))}>
{t("Edit")}
</button>
<button className="btn btn-sm btn-outline-secondary" onClick={() => void newAddress(h)}>
New address
{t("New address")}
</button>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(h)}>
{t("Remove")}
@@ -414,7 +414,7 @@ export default function Heartbeats({ user }: { user: CurrentUser }) {
</tr>
))}
{items !== null && sorted?.length === 0 && (
<EmptyRow colSpan={6} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: "No job is reporting in yet", hint: "Add a heartbeat for a backup, a sync or any job that should run on its own; it calls an address when it finishes, and you hear about it when it doesn't.", action: isAdmin ? { label: "Add a heartbeat", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
<EmptyRow colSpan={6} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: t("No job is reporting in yet"), hint: "Add a heartbeat for a backup, a sync or any job that should run on its own; it calls an address when it finishes, and you hear about it when it doesn't.", action: isAdmin ? { label: t("Add a heartbeat"), onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
)}
</tbody>
</table>
Loaded 100 of 173 files, more files were not shown because too many files have changed in this diff. Show more