Add a Swedish interface with a per-person language switch
A small translation system (the English text is its own key, so anything without a Swedish entry stays English) and a Language switch in the user menu, saved on the account (users.language) and following the browser when no choice has been made. Swedish covers the menu, shared parts (search, tables, dialogs, relative times), the sign-in page and the everyday pages: Dashboard, Alerts, Servers, Updates, Maintenance, My work, Coming up, To do, Integrations and the display settings. Server-written messages stay English for now. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e7f23ba13f
commit
645816d5a8
168 files changed
+12142
-1422
No files matched your search
@@ -137,6 +137,7 @@ Everyone who has signed in through Authentik. The first one becomes admin.
|
||||
| `created_at` | text NOT NULL | SQLite UTC. |
|
||||
| `last_login_at` | text | ISO. |
|
||||
| `favorites` | text | JSON array of the page paths this person pinned to the top of their menu (`["/servers","/alerts"]`), up to 24. A path may carry a short query for a saved view of a page (`"/servers?status=offline"`). Follows them to any browser. |
|
||||
| `language` | text | The language this person chose for the interface: `en` or `sv`; null = they have not chosen, so the browser's language decides. Follows them to any browser. |
|
||||
| `picture_url` | text | The `picture` claim the identity provider gave at the last sign-in. Only an address; nothing is fetched from it unless Settings → Sign-in → Profile pictures allows it (and then only Gravatar or the provider's own host). Pictures themselves are kept in the server's memory for a day, not in the database. |
|
||||
| `dashboard_layout` | text | JSON object `{"hidden":["Gitea"],"order":{"Secrets":0,"DNS":1}}`: the dashboard cards this person hid and the order of the rest (lower first; a card with no entry goes last). Null = the default layout. Follows them to any browser. |
|
||||
| `server_page_layout` | text | JSON object `{"folded":["admin-links"],"order":{"notes":10}}`: the cards of a server's overview page this person folded and the order of the blocks (lower first). The same for every server. Null is the page as drawn. |
|
||||
|
||||
@@ -913,6 +913,8 @@ exists; it can be hidden, and brought back from the search box.
|
||||
|
||||
**Proxmox snapshots.** Click a guest on Infrastructure → Proxmox and its drawer has a **Snapshots** section: what there is (oldest first, a branch indented, *with memory* marked), **Take a snapshot** for operators (a name or one from the time, a description, and for a running VM whether to keep its memory), and **Roll back…** and **Delete…** for administrators, each behind a confirmation that says what is lost. Proxmox does each as a task, followed for up to 20 seconds; each is in the audit log and the change log. The API token needs VM.Snapshot and VM.Snapshot.Rollback (the PVEVMAdmin role has them). The guest actions (start, shut down, restart, stop) were there already.
|
||||
|
||||
**Swedish interface.** Press *Svenska* under *Language* in the user menu and the whole screen is drawn again in Swedish at once; the choice is kept on your account and follows you to any browser (without a choice the browser's language decides, and that guess is not stored). Swedish covers the menu, the shared parts (search, tables, dialogs, "5 min ago"), the sign-in page, and the headings, buttons, table columns, filters and messages of the pages used every day — Dashboard, Alerts, Servers, Updates, Maintenance, My work, Coming up, To do, Integrations and Settings → Display. Text with no Swedish yet is shown in English, so nothing looks broken. Not yet translated: what the server writes (alert messages, notifications, digests, reports, e-mail), the long page introductions and the less-used pages. How to add more is in docs/LANGUAGES.md.
|
||||
|
||||
**Accessibility.** There is a skip-to-content link, labelled landmarks, visible
|
||||
keyboard focus, and page changes are announced to screen readers; sortable table
|
||||
headings are real buttons; every form field is tied to its label; status is
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# Languages
|
||||
|
||||
The interface is in English and, for the parts people see every day, in Swedish. This page says how a person chooses, what is covered, and how to translate more.
|
||||
|
||||
## Choosing
|
||||
|
||||
Open the user menu (your name, bottom of the sidebar) and press **English** or **Svenska** under *Language*. The whole screen is drawn again in that language at once, and the choice is **kept on your account**, so it follows you to any browser. Somebody who has never chosen gets the language their browser asks for — Swedish if it is set to Swedish, otherwise English — and that guess is not stored. The sign-in page follows the browser (or what this browser last used) since nobody is signed in yet. `<html lang>` is set to match, for screen readers.
|
||||
|
||||
The choice is one person's; an administrator cannot switch it for anyone else, and a viewer can use Swedish while the others use English.
|
||||
|
||||
## What is translated
|
||||
|
||||
Swedish covers the menu and breadcrumbs, the shared parts (search, tables, pagination, empty lists, dialogs, toasts, "5 min ago"), the sign-in page and the user menu, and the headings, buttons, table columns, filters, labels and messages of the pages used every day: **Dashboard, Alerts, Servers (and a server's own page), Updates (with update runs, restarts and patch plans), Maintenance, My work, Coming up, To do, Integrations, Settings → Display**, and the history of integration figures. Texts that have no Swedish yet show in English, so a page can be half done without anything looking broken.
|
||||
|
||||
Not translated yet:
|
||||
|
||||
- **What the server writes** — alert messages, notifications and their channels, the weekly digest, the monthly report, e-mails, the change log's sentences, audit entries. These are made in many places on the server and are English; translating them is a separate piece of work.
|
||||
- The long explanatory introductions at the top of pages, and the less-used pages and settings, apart from words they share with the above (*Save*, *Cancel*, *Delete* …).
|
||||
- The documentation (these files).
|
||||
|
||||
Dates and times keep following **Settings → Display** (year-month-day by default, which is also the Swedish habit). Numbers use the language's own separators only where a figure is formatted by the page itself.
|
||||
|
||||
## Adding to it (for whoever changes the code)
|
||||
|
||||
English is the language the code is written in, and the English text is its own key:
|
||||
|
||||
```tsx
|
||||
import { t, tn } from "../i18n";
|
||||
|
||||
<button>{t("Save")}</button>
|
||||
toast.success(t("Started updating {name}.", { name }));
|
||||
tn(n, "{n} server", "{n} servers") // the one form for 1, the many form otherwise
|
||||
```
|
||||
|
||||
- The Swedish is an entry in `web/src/i18n/sv.ts`: `"Save": "Spara"`. A text with no entry is shown as written, so nothing breaks while it is waiting for a translation.
|
||||
- **Keep the `{placeholders}` the same** in the Swedish as in the English. A test (`server/test/language.test.ts`) checks that, that no entry is empty, and that every page of the menu has a Swedish name.
|
||||
- Brand and product names (Proxmox, Synology, Docker …) are the same in both languages and have no entry.
|
||||
- Do not call `t()` where a module is loaded (in a constant outside any component or function): it would be fixed to the language at that moment. Keep the English in the constant and call `t(label)` where it is drawn, as the menu (`layout/nav.tsx`) does.
|
||||
- Do not translate half a sentence that runs on into a link or more English: put the whole sentence in one `t()` with placeholders, or leave it all English.
|
||||
- A local variable called `t` hides the function; call such a variable something else (`todo`, `item`).
|
||||
- Changing the language re-draws the whole app (the tree is keyed on it), so no component needs to subscribe to anything.
|
||||
|
||||
The account setting is `users.language` (`en`, `sv` or null for "follow the browser"); it is read with `GET /api/me` (`user.language`) and changed with `PUT /api/me/language` (`{ "language": "sv" }`, or `null`).
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `users` ADD `language` text;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -666,6 +666,13 @@
|
||||
"when": 1794350837756,
|
||||
"tag": "0094_integration_figures",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 95,
|
||||
"version": "6",
|
||||
"when": 1794514473426,
|
||||
"tag": "0095_user_language",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -32,6 +32,8 @@ export const users = sqliteTable("users", {
|
||||
// The address of the picture the identity provider gave for this person (the OIDC "picture" claim), as of their last sign-in. Only an address:
|
||||
// nothing is fetched from it unless Settings → Sign-in → Profile pictures allows it, and then only by this server, never by the browser.
|
||||
pictureUrl: text("picture_url"),
|
||||
// The language this person chose for the interface: "en" or "sv". Null: they have not chosen, so the browser's language decides. Follows them to any browser.
|
||||
language: text("language"),
|
||||
});
|
||||
|
||||
// ─── Audit log ──────────────────────────────────────────────────────────────
|
||||
|
||||
+17
-2
@@ -11,6 +11,13 @@ import { getSettings } from "../services/settingsStore.js";
|
||||
|
||||
export const meRouter = Router();
|
||||
|
||||
/** The languages the interface is written in. */
|
||||
export const LANGUAGES = ["en", "sv"] as const;
|
||||
export type Language = (typeof LANGUAGES)[number];
|
||||
|
||||
/** What is stored, read back as a language; anything else is "no choice yet". */
|
||||
export const parseLanguage = (stored: string | null | undefined): Language | null => (LANGUAGES as readonly string[]).includes(stored ?? "") ? (stored as Language) : null;
|
||||
|
||||
/** The most pages anyone can pin: enough for a working set, not a second menu. */
|
||||
export const MAX_FAVORITES = 24;
|
||||
|
||||
@@ -40,9 +47,9 @@ export function parseDashboardLayout(stored: string | null): DashboardLayout {
|
||||
|
||||
meRouter.get("/", requireAuth, asyncHandler(async (req, res) => {
|
||||
const me = req.currentUser!;
|
||||
const { id, email, name, role, oidcSub, favorites, dashboardLayout, serverPageLayout } = me;
|
||||
const { id, email, name, role, oidcSub, favorites, dashboardLayout, serverPageLayout, language } = me;
|
||||
const avatarUrl = avatarUrlFor(me, (await getSettings()).profilePictures);
|
||||
res.json({ user: { id, sub: oidcSub, email, name, role, avatarUrl, favorites: parseFavorites(favorites), dashboard: parseDashboardLayout(dashboardLayout), serverPage: parsePageLayout(serverPageLayout) } });
|
||||
res.json({ user: { id, sub: oidcSub, email, name, role, avatarUrl, favorites: parseFavorites(favorites), dashboard: parseDashboardLayout(dashboardLayout), serverPage: parsePageLayout(serverPageLayout), language: parseLanguage(language) } });
|
||||
}));
|
||||
|
||||
// Paths inside the app only: a slash, then letters, digits, dashes, underscores and further slashes — and, for a saved view of a page,
|
||||
@@ -93,6 +100,14 @@ export function parsePageLayout(stored: string | null): PageLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// The language of the signed-in person's interface: "en" or "sv", or null to go back to following the browser. Only ever their own.
|
||||
meRouter.put("/language", requireAuth, asyncHandler(async (req, res) => {
|
||||
const parsed = z.object({ language: z.enum(LANGUAGES).nullable() }).safeParse(req.body);
|
||||
if (!parsed.success) return res.status(400).json({ error: "invalid_body", message: "Choose en or sv, or null for the browser's language." });
|
||||
await db.update(users).set({ language: parsed.data.language }).where(eq(users.id, req.currentUser!.id));
|
||||
res.json({ language: parsed.data.language });
|
||||
}));
|
||||
|
||||
// Replaces the signed-in person's pinned pages. Only ever their own.
|
||||
meRouter.put("/favorites", requireAuth, asyncHandler(async (req, res) => {
|
||||
const parsed = favoritesSchema.safeParse(req.body);
|
||||
|
||||
@@ -81,9 +81,9 @@ describe("links, targets and names", () => {
|
||||
});
|
||||
|
||||
test("the controls the sweep found without a name have one", () => {
|
||||
assert.match(web("pages", "Alerts.tsx"), /aria-label="Severity"/);
|
||||
assert.match(web("pages", "Alerts.tsx"), /aria-label="Kind of alert"/);
|
||||
assert.match(web("pages", "Secrets.tsx"), /aria-label="Status"/);
|
||||
assert.match(web("pages", "Alerts.tsx"), /aria-label=\{t\("Severity"\)\}/);
|
||||
assert.match(web("pages", "Alerts.tsx"), /aria-label=\{t\("Kind of alert"\)\}/);
|
||||
assert.match(web("pages", "Secrets.tsx"), /aria-label=\{t\("Status"\)\}/);
|
||||
assert.match(web("pages", "Users.tsx"), /aria-label=\{`Role of \$\{u\.name \?\? u\.email \?\? "this user"\}`\}/);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* The Swedish interface: how a text is looked up and filled in, that the Swedish keeps the placeholders of the English, that every page of the menu has its Swedish name, and the
|
||||
* account setting that remembers a person's language.
|
||||
*
|
||||
* Run with: npm test --workspace server
|
||||
*/
|
||||
import { test, describe, before, after } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import type { AddressInfo } from "node:net";
|
||||
import type { Server } from "node:http";
|
||||
|
||||
const dir = mkdtempSync(join(tmpdir(), "hm-lang-"));
|
||||
process.env.DATABASE_PATH = join(dir, "test.sqlite");
|
||||
process.env.SESSION_DIR = join(dir, "sessions");
|
||||
process.env.CREDENTIALS_ENCRYPTION_KEY = "ab".repeat(32);
|
||||
process.env.HEALTH_STARTUP_GRACE_MS = "0";
|
||||
|
||||
const express = (await import("express")).default;
|
||||
const { db } = await import("../src/db/client.js");
|
||||
const { users } = await import("../src/db/schema.js");
|
||||
const { runMigrations } = await import("../src/db/migrate.js");
|
||||
const { meRouter, parseLanguage, LANGUAGES } = await import("../src/routes/me.js");
|
||||
const i18n = await import("../../web/src/i18n/index.js");
|
||||
const { sv } = await import("../../web/src/i18n/sv.js");
|
||||
const { formatAgo } = await import("../../web/src/utils/duration.js");
|
||||
const { eq } = await import("drizzle-orm");
|
||||
|
||||
await runMigrations();
|
||||
|
||||
const placeholders = (s: string) => [...s.matchAll(/\{(\w+)\}/g)].map((m) => m[1]).sort();
|
||||
|
||||
describe("looking a text up", () => {
|
||||
test("English is the text as written; Swedish is its entry, or the English when there is none", () => {
|
||||
assert.equal(i18n.translate("en", "Save"), "Save");
|
||||
assert.equal(i18n.translate("sv", "Save"), "Spara");
|
||||
assert.equal(i18n.translate("sv", "A text nobody has translated yet"), "A text nobody has translated yet");
|
||||
});
|
||||
|
||||
test("{placeholders} are filled in, and one with no value is left as it is", () => {
|
||||
assert.equal(i18n.translate("en", "Page {page} of {pages} ({total} total)", { page: 2, pages: 5, total: 90 }), "Page 2 of 5 (90 total)");
|
||||
assert.equal(i18n.translate("sv", "Page {page} of {pages} ({total} total)", { page: 2, pages: 5, total: 90 }), "Sida 2 av 5 (90 totalt)");
|
||||
assert.equal(i18n.fill("Hello {name}, {missing}", { name: "Ada" }), "Hello Ada, {missing}");
|
||||
assert.equal(i18n.fill("No placeholders"), "No placeholders");
|
||||
});
|
||||
|
||||
test("the language in use decides t(), tn() and the formats; the tests start in English whatever the machine is set to", () => {
|
||||
assert.equal(i18n.getLanguage(), "en", "no window, no browser language to follow");
|
||||
assert.equal(i18n.t("Cancel"), "Cancel");
|
||||
assert.equal(i18n.tn(1, "{n} active alert", "{n} active alerts"), "1 active alert");
|
||||
assert.equal(i18n.tn(3, "{n} active alert", "{n} active alerts"), "3 active alerts");
|
||||
assert.equal(i18n.locale(), "en");
|
||||
|
||||
i18n.setLanguage("sv", false);
|
||||
try {
|
||||
assert.equal(i18n.t("Cancel"), "Avbryt");
|
||||
assert.equal(i18n.tn(1, "{n} active alert", "{n} active alerts"), "1 aktivt larm");
|
||||
assert.equal(i18n.tn(3, "{n} active alert", "{n} active alerts"), "3 aktiva larm");
|
||||
assert.equal(i18n.locale(), "sv-SE");
|
||||
assert.equal(formatAgo(new Date(Date.now() - 5 * 60_000).toISOString()), "för 5 min sedan", "relative times are in the language too");
|
||||
assert.equal(formatAgo(new Date().toISOString()), "nyss");
|
||||
} finally {
|
||||
i18n.setLanguage("en", false);
|
||||
}
|
||||
assert.equal(formatAgo(new Date(Date.now() - 5 * 60_000).toISOString()), "5 min ago");
|
||||
});
|
||||
});
|
||||
|
||||
describe("the Swedish text", () => {
|
||||
test("keeps the placeholders of the English, no more and no fewer", () => {
|
||||
const wrong = Object.entries(sv).filter(([en, swedish]) => placeholders(en).join() !== placeholders(swedish).join());
|
||||
assert.deepEqual(wrong.map(([en]) => en), []);
|
||||
});
|
||||
|
||||
test("has no empty text, and none that is the English left in", () => {
|
||||
const empty = Object.entries(sv).filter(([, swedish]) => swedish.trim() === "");
|
||||
assert.deepEqual(empty, []);
|
||||
});
|
||||
|
||||
test("names every page of the menu", () => {
|
||||
const source = readFileSync(new URL("../../web/src/layout/nav.tsx", import.meta.url), "utf8");
|
||||
// The words that are the same in both languages (a brand, or a word Swedish borrows) are not asked for.
|
||||
const SAME = new Set(["Proxmox", "Synology", "Docker", "Hetzner Cloud", "Hetzner Robot", "Tailscale", "Home Assistant", "Jellyfin", "Immich", "Paperless", "Nextcloud", "Authentik", "Duplicati", "DNS", "AdGuard Home", "Technitium DNS", "NetBox", "Uptime Kuma", "UPS", "Prometheus", "Grafana", "Speedtest", "Semaphore", "Gitea", "n8n", "osTicket", "Automation", "Generator", "Administration", "Info"]);
|
||||
const labels = [...source.matchAll(/label: "([^"]+)"/g)].map((m) => m[1]).filter((l) => !SAME.has(l));
|
||||
assert.ok(labels.length > 25, `found the menu's labels (${labels.length})`);
|
||||
assert.deepEqual(labels.filter((l) => !(l in sv)), [], "labels with no Swedish name");
|
||||
});
|
||||
|
||||
test("translates the words the app's own lists show (the ranges, the density, the task states)", () => {
|
||||
for (const w of ["24 hours", "7 days", "30 days", "90 days", "1 year", "Compact", "Normal", "Roomy"]) assert.ok(w in sv, w);
|
||||
});
|
||||
});
|
||||
|
||||
describe("remembering a person's language", () => {
|
||||
let app: Server;
|
||||
let base = "";
|
||||
let who = "ada";
|
||||
const call = (method: string, path: string, body?: unknown) => fetch(`${base}${path}`, { method, headers: { "content-type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body) });
|
||||
|
||||
before(async () => {
|
||||
await db.insert(users).values([
|
||||
{ oidcSub: "ada", name: "Ada", role: "admin" },
|
||||
{ oidcSub: "bo", name: "Bo", role: "viewer" },
|
||||
]);
|
||||
const a = express();
|
||||
a.use(express.json());
|
||||
a.use((req, _res, next) => {
|
||||
(req as unknown as { session: unknown }).session = { user: { sub: who } };
|
||||
next();
|
||||
});
|
||||
a.use("/api/me", meRouter);
|
||||
app = await new Promise<Server>((resolve) => {
|
||||
const x = a.listen(0, "127.0.0.1", () => resolve(x));
|
||||
});
|
||||
base = `http://127.0.0.1:${(app.address() as AddressInfo).port}/api/me`;
|
||||
});
|
||||
after(() => {
|
||||
app.close();
|
||||
try {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
} catch {
|
||||
// Windows keeps the database file locked until the process exits.
|
||||
}
|
||||
});
|
||||
|
||||
test("what is stored is read back as a language, or as no choice", () => {
|
||||
assert.deepEqual(LANGUAGES, ["en", "sv"]);
|
||||
assert.equal(parseLanguage("sv"), "sv");
|
||||
assert.equal(parseLanguage("en"), "en");
|
||||
for (const odd of [null, undefined, "", "de", "SV", "sv-SE"]) assert.equal(parseLanguage(odd), null, String(odd));
|
||||
});
|
||||
|
||||
test("nobody has chosen at first; each person's choice is theirs alone and follows them", async () => {
|
||||
assert.equal((await (await call("GET", "/")).json()).user.language, null);
|
||||
assert.equal((await call("PUT", "/language", { language: "sv" })).status, 200);
|
||||
assert.equal((await (await call("GET", "/")).json()).user.language, "sv");
|
||||
who = "bo";
|
||||
assert.equal((await (await call("GET", "/")).json()).user.language, null, "someone else's choice does not reach them");
|
||||
assert.equal((await call("PUT", "/language", { language: "en" })).status, 200);
|
||||
assert.equal((await (await call("GET", "/")).json()).user.language, "en");
|
||||
who = "ada";
|
||||
assert.equal((await (await call("GET", "/")).json()).user.language, "sv", "and Ada's is still Swedish");
|
||||
});
|
||||
|
||||
test("it can be taken back to following the browser, and nothing else is accepted", async () => {
|
||||
assert.equal((await call("PUT", "/language", { language: null })).status, 200);
|
||||
assert.equal((await (await call("GET", "/")).json()).user.language, null);
|
||||
for (const bad of [{ language: "de" }, { language: "" }, { language: 5 }, {}, { lang: "sv" }]) assert.equal((await call("PUT", "/language", bad)).status, 400, JSON.stringify(bad));
|
||||
const [row] = await db.select().from(users).where(eq(users.oidcSub, "ada"));
|
||||
assert.equal(row.language, null);
|
||||
});
|
||||
});
|
||||
+27
-12
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import { Fragment, useEffect, useState, type ReactNode } from "react";
|
||||
import { detectLanguage, forgetLanguage, setLanguage, t, useLanguage } from "./i18n";
|
||||
import { Routes, Route, Navigate, useLocation, useParams } from "react-router-dom";
|
||||
import { api, type CurrentUser, type UserRole, UnauthorizedError } from "./api/client";
|
||||
import Login from "./pages/Login";
|
||||
@@ -111,13 +112,23 @@ function OldIncidentLink() {
|
||||
|
||||
export default function App() {
|
||||
const [user, setUser] = useState<CurrentUser | null | undefined>(undefined);
|
||||
// Changing the language draws everything again: the tree below is keyed on it.
|
||||
const lang = useLanguage();
|
||||
// A share link's page is for someone who isn't signed in: it asks nothing of the app's own session.
|
||||
const shared = useLocation().pathname.startsWith("/share/wall/") || useLocation().pathname.startsWith("/share/status/");
|
||||
|
||||
useEffect(() => {
|
||||
if (shared) return;
|
||||
api.me().then(
|
||||
(res) => setUser(res.user),
|
||||
(res) => {
|
||||
// The language this person chose, on their account; without a choice the browser's decides (and is not kept).
|
||||
if (res.user.language) setLanguage(res.user.language);
|
||||
else {
|
||||
forgetLanguage();
|
||||
setLanguage(detectLanguage(), false);
|
||||
}
|
||||
setUser(res.user);
|
||||
},
|
||||
(err) => {
|
||||
if (!(err instanceof UnauthorizedError)) {
|
||||
console.error(err);
|
||||
@@ -133,27 +144,31 @@ export default function App() {
|
||||
|
||||
if (shared) {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/share/wall/:token" element={<SharedWall />} />
|
||||
<Route path="/share/status/:token" element={<SharedStatus />} />
|
||||
</Routes>
|
||||
<Fragment key={lang}>
|
||||
<Routes>
|
||||
<Route path="/share/wall/:token" element={<SharedWall />} />
|
||||
<Route path="/share/status/:token" element={<SharedStatus />} />
|
||||
</Routes>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
if (user === undefined) {
|
||||
return <div className="loading-screen">Loading…</div>;
|
||||
return <div className="loading-screen">{t("Loading…")}</div>;
|
||||
}
|
||||
|
||||
if (user === null) {
|
||||
return <Login />;
|
||||
return <Login key={lang} />;
|
||||
}
|
||||
|
||||
// The wall display is a screen of its own, with none of the app's menu around it; everything else sits inside the shell.
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/wall" element={<Wall />} />
|
||||
<Route path="*" element={<Shelled user={user} />} />
|
||||
</Routes>
|
||||
<Fragment key={lang}>
|
||||
<Routes>
|
||||
<Route path="/wall" element={<Wall />} />
|
||||
<Route path="*" element={<Shelled user={user} />} />
|
||||
</Routes>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ export interface CurrentUser {
|
||||
dashboard?: DashboardLayout;
|
||||
/** How this person arranged a server's overview page. */
|
||||
serverPage?: PageLayout;
|
||||
/** The language they chose for the interface; null: they have not, and the browser's decides. */
|
||||
language?: "en" | "sv" | null;
|
||||
}
|
||||
|
||||
export type ShareLinkDetail = "summary" | "names";
|
||||
@@ -3718,6 +3720,7 @@ async function request<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
export const api = {
|
||||
me: Object.assign(() => request<{ user: CurrentUser }>("/api/me"), {
|
||||
setFavorites: (paths: string[]) => request<{ favorites: string[] }>("/api/me/favorites", { method: "PUT", body: JSON.stringify({ paths }) }),
|
||||
setLanguage: (language: "en" | "sv" | null) => request<{ language: "en" | "sv" | null }>("/api/me/language", { method: "PUT", body: JSON.stringify({ language }) }),
|
||||
setServerPage: (layout: PageLayout) => request<{ serverPage: PageLayout }>("/api/me/server-page", { method: "PUT", body: JSON.stringify(layout) }),
|
||||
setDashboard: (layout: DashboardLayout) => request<{ dashboard: DashboardLayout }>("/api/me/dashboard", { method: "PUT", body: JSON.stringify(layout) }),
|
||||
changes: () => request<ChangesSummary>("/api/me/changes"),
|
||||
|
||||
@@ -6,6 +6,7 @@ import { toast } from "../utils/toast";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const LENGTHS: { hours: number | null; label: string }[] = [
|
||||
{ hours: null, label: "Until the alert is gone" },
|
||||
@@ -92,7 +93,7 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
|
||||
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="ack-note">
|
||||
Note <span className="text-secondary">(optional)</span>
|
||||
Note <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<textarea id="ack-note" className="form-control" rows={3} maxLength={500} placeholder="e.g. power cut in the cellar, UPS is holding" value={note} onChange={(e) => setNote(e.target.value)} />
|
||||
</div>
|
||||
@@ -101,7 +102,7 @@ export default function AckDrawer({ alert, me, onClose, onSaved }: { alert: Aler
|
||||
Who has it
|
||||
</label>
|
||||
<select id="ack-assignee" className="form-select" value={assignee} onChange={(e) => setAssignee(e.target.value)}>
|
||||
<option value="">Nobody in particular</option>
|
||||
<option value="">{t("Nobody in particular")}</option>
|
||||
{people.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.id === me.id ? `${p.name} (me)` : p.name}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { kindWords } from "../utils/alertKinds";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import RunbookText from "./RunbookText";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t } from "../i18n";
|
||||
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ export default function AlertKindRunbookEntry({ kind, canEdit, offerAdd = true }
|
||||
{here ? "What to do" : "Add what to do"}
|
||||
</button>
|
||||
{open && (
|
||||
<DetailDrawer title="What to do" subtitle={kindWords(kind)} onClose={() => setOpen(false)}>
|
||||
<DetailDrawer title={t("What to do")} subtitle={kindWords(kind)} onClose={() => setOpen(false)}>
|
||||
<Panel kind={kind} existing={here} canEdit={canEdit} onDone={() => setOpen(false)} />
|
||||
</DetailDrawer>
|
||||
)}
|
||||
@@ -56,7 +57,7 @@ function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: Al
|
||||
setError(null);
|
||||
try {
|
||||
await api.runbooks.kinds.save(kind, { title: title.trim(), body, url: url.trim() === "" ? null : url.trim() });
|
||||
toast.success("Saved.");
|
||||
toast.success(t("Saved."));
|
||||
changed();
|
||||
onDone();
|
||||
} catch (err) {
|
||||
@@ -85,7 +86,7 @@ function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: Al
|
||||
<p>
|
||||
<a className="btn btn-sm btn-outline-primary" href={existing.url} target="_blank" rel="noopener noreferrer">
|
||||
<IconExternalLink size={14} className="me-1" aria-hidden="true" />
|
||||
Open the page
|
||||
{t("Open the page")}
|
||||
</a>{" "}
|
||||
<span className="text-secondary small text-break">{existing.url}</span>
|
||||
</p>
|
||||
@@ -99,10 +100,10 @@ function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: Al
|
||||
{canEdit && (
|
||||
<span className="ms-auto btn-list flex-nowrap">
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setEditing(true)}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" onClick={() => void remove()}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
@@ -116,19 +117,19 @@ function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: Al
|
||||
<p className="text-secondary small">Written once, shown beside every alert of this kind — {kindWords(kind)} — on whatever it happens to. What is specific to one server or integration goes in its own runbook.</p>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="akr-title">
|
||||
Title
|
||||
{t("Title")}
|
||||
</label>
|
||||
<input id="akr-title" className="form-control" required maxLength={120} value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="akr-url">
|
||||
A page to open (optional)
|
||||
{t("A page to open (optional)")}
|
||||
</label>
|
||||
<input id="akr-url" className="form-control" type="url" maxLength={500} placeholder="https://wiki.example.lan/certificates" value={url} onChange={(e) => setUrl(e.target.value)} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="akr-body">
|
||||
What to do first
|
||||
{t("What to do first")}
|
||||
</label>
|
||||
<textarea id="akr-body" className="form-control" rows={9} maxLength={20000} value={body} onChange={(e) => setBody(e.target.value)} />
|
||||
<div className="form-hint">
|
||||
@@ -141,7 +142,7 @@ function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: Al
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => (existing ? setEditing(false) : onDone())}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { EmptyRow } from "./EmptyState";
|
||||
import { CATEGORY_NAMES, durationWords } from "./IncidentHistory";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const PERIODS = [
|
||||
{ days: 7, label: "Last 7 days" },
|
||||
@@ -118,7 +119,7 @@ export default function AlertNoise() {
|
||||
<TableToolbar
|
||||
search={tableSearch.query}
|
||||
onSearch={tableSearch.setQuery}
|
||||
placeholder="Search noisy alerts…"
|
||||
placeholder={t("Search noisy alerts…")}
|
||||
shown={sorted?.length}
|
||||
total={rows.length}
|
||||
onExport={exportCsv}
|
||||
@@ -130,10 +131,10 @@ export default function AlertNoise() {
|
||||
<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="Time in total" sortKeyName="totalMinutes" 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="Most in an hour" sortKeyName="mostInAnHour" 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} />
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -150,12 +151,12 @@ export default function AlertNoise() {
|
||||
<td className="stack-wide">
|
||||
{r.link ? <Link to={r.link}>{r.message}</Link> : r.message}
|
||||
{r.flappingNow && (
|
||||
<span className="badge bg-red-lt text-red ms-2" title="Its messages are being held back right now">
|
||||
<span className="badge bg-red-lt text-red ms-2" title={t("Its messages are being held back right now")}>
|
||||
flapping now
|
||||
</span>
|
||||
)}
|
||||
{!r.flappingNow && r.flapped && (
|
||||
<span className="badge bg-yellow-lt text-yellow ms-2" title="Raised and cleared often enough within an hour to count as flapping">
|
||||
<span className="badge bg-yellow-lt text-yellow ms-2" title={t("Raised and cleared often enough within an hour to count as flapping")}>
|
||||
flapped
|
||||
</span>
|
||||
)}
|
||||
@@ -166,7 +167,7 @@ export default function AlertNoise() {
|
||||
<div className="text-secondary small">{r.hint}</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Raised">{r.fired}×</td>
|
||||
<td className="stack-label text-nowrap" data-label="Time in total">
|
||||
<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">
|
||||
@@ -175,7 +176,7 @@ export default function AlertNoise() {
|
||||
<td className="stack-label text-nowrap" data-label="Longest">
|
||||
{minutesWords(r.longestMinutes)}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Most in an hour">{r.mostInAnHour}</td>
|
||||
<td className="stack-label" data-label={t("Most in an hour")}>{r.mostInAnHour}</td>
|
||||
<td className="stack-label text-nowrap" data-label="Last">
|
||||
<TimeAgo value={r.lastAt} />
|
||||
</td>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, type FormEvent } from "react";
|
||||
import type { AuthentikGroup, AuthentikPerson } from "../api/client";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export interface AuthentikChange {
|
||||
name?: string;
|
||||
@@ -43,7 +44,7 @@ export default function AuthentikEditUser({ p, groups, groupsError, busy, onSave
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-md-6">
|
||||
<label className="form-label" htmlFor={`ak-edit-name-${p.pk}`}>
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id={`ak-edit-name-${p.pk}`} className="form-control form-control-sm" required maxLength={200} autoComplete="off" value={name} onChange={(e) => setName(e.target.value)} />
|
||||
</div>
|
||||
@@ -79,7 +80,7 @@ export default function AuthentikEditUser({ p, groups, groupsError, busy, onSave
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={onCancel} disabled={busy}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { api, type AuthentikGroupDetail, type AuthentikGroupPerson, type Authent
|
||||
import { ErrorNotice, SuccessNotice } from "./Notice";
|
||||
import { confirmDialog, promptDialog } from "../utils/dialogs";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGroupDetail; people: AuthentikGroupPerson[]; self: number | null; busy: boolean; onSave: (name: string, add: number[], remove: number[]) => void; onCancel: () => void }) {
|
||||
const [name, setName] = useState(g.name);
|
||||
@@ -33,7 +34,7 @@ function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGr
|
||||
)}
|
||||
{g.admin && <div className="text-secondary small mb-2">Members of this group are administrators of Authentik. Whether a group is one is changed in Authentik, not here.</div>}
|
||||
<label className="form-label" htmlFor={`ak-group-name-${g.id}`}>
|
||||
Name
|
||||
{t("Name")}
|
||||
</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)} />
|
||||
|
||||
@@ -66,7 +67,7 @@ function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGr
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={onCancel} disabled={busy}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -203,7 +204,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
|
||||
{busy === "new" ? "Making…" : "Make group"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={() => { setCreating(false); setNewName(""); }} disabled={busy === "new"}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -249,7 +250,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
|
||||
<td className="text-end text-secondary">{g.members === null ? "?" : g.members.length}</td>
|
||||
<td className="text-end text-nowrap">
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary me-1" disabled={busy !== null} onClick={() => { setEditing(g.id); setNotice(null); }}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
{g.admin ? (
|
||||
<span className="small text-secondary" title="A group that makes administrators of Authentik is deleted in Authentik, not here.">
|
||||
@@ -257,7 +258,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
|
||||
</span>
|
||||
) : (
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" disabled={busy !== null} onClick={() => void removeGroup(g)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
)}
|
||||
</td>
|
||||
|
||||
@@ -5,6 +5,7 @@ import CopyButton from "./CopyButton";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const EMPTY = { username: "", name: "", email: "" };
|
||||
|
||||
@@ -25,7 +26,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
|
||||
if (!a.canCreateUsers) {
|
||||
return (
|
||||
<div className="text-secondary small mt-3">
|
||||
To make and manage users from here, give this Authentik a token that may add, change and delete them: <Link to="/integrations">Integrations</Link> → edit → <em>Token for making and managing users</em>.
|
||||
To make and manage users from here, give this Authentik a token that may add, change and delete them: <Link to="/integrations">{t("Integrations")}</Link> → edit → <em>Token for making and managing users</em>.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -120,7 +121,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
|
||||
Make another
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={close}>
|
||||
Done
|
||||
{t("Done")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -139,13 +140,13 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor={`ak-name-${a.id}`}>
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id={`ak-name-${a.id}`} className="form-control" required maxLength={200} autoComplete="off" value={fields.name} onChange={(e) => setFields({ ...fields, name: e.target.value })} />
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor={`ak-email-${a.id}`}>
|
||||
Email <span className="text-secondary">(optional)</span>
|
||||
Email <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<input id={`ak-email-${a.id}`} type="email" className="form-control" maxLength={254} autoComplete="off" value={fields.email} onChange={(e) => setFields({ ...fields, email: e.target.value })} />
|
||||
</div>
|
||||
@@ -174,7 +175,7 @@ export default function AuthentikNewUser({ a, onChanged }: { a: AuthentikInfo; o
|
||||
{busy ? "Making…" : "Make user and link"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-link text-secondary" onClick={close} disabled={busy}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
<span className="text-secondary small">They choose their own password with the link; none is set here.</span>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import TimeAgo from "./TimeAgo";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { confirmDialog, promptDialog } from "../utils/dialogs";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* The people in an Authentik, read when the tab opens, for an administrator to edit, switch off, switch on again or delete. Switching off is the way that can be undone; deleting asks for the user name to be typed.
|
||||
@@ -122,7 +123,7 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
|
||||
|
||||
return (
|
||||
<div className="mt-3">
|
||||
<h4>Users</h4>
|
||||
<h4>{t("Users")}</h4>
|
||||
<ErrorNotice error={error} />
|
||||
{people === null ? (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void load()} disabled={busy !== null}>
|
||||
@@ -144,7 +145,7 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Status</th>
|
||||
<th>{t("Status")}</th>
|
||||
<th>Last sign-in</th>
|
||||
<th className="text-end"> </th>
|
||||
</tr>
|
||||
@@ -177,13 +178,13 @@ export default function AuthentikUserList({ a }: { a: AuthentikInfo }) {
|
||||
) : (
|
||||
<>
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary me-1" disabled={busy !== null} onClick={() => void startEdit(p)}>
|
||||
Edit
|
||||
{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"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" disabled={busy !== null} onClick={() => void remove(p)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import { api } from "../api/client";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** The little forms behind the bulk bar: each says what will be done and to how many, collects the one or two answers it needs, and hands them back. */
|
||||
|
||||
@@ -19,7 +20,7 @@ function Shell({ title, subtitle, onClose, onSubmit, submitLabel, busy, disabled
|
||||
{busy ? "Working…" : submitLabel}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={onClose}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="text-secondary small mt-2">Afterwards there is an Undo button for a little while; it puts back what was changed.</div>
|
||||
@@ -68,7 +69,7 @@ export function SilenceBulkDrawer({ noun, count, canSilenceDependents, onSubmit,
|
||||
))}
|
||||
</select>
|
||||
<label className="form-label" htmlFor="bulk-reason">
|
||||
Why <span className="text-secondary">(optional)</span>
|
||||
Why <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<input id="bulk-reason" className="form-control mb-3" maxLength={200} value={reason} onChange={(e) => setReason(e.target.value)} placeholder="e.g. Firmware update" />
|
||||
{canSilenceDependents && (
|
||||
@@ -122,14 +123,14 @@ export function AckBulkDrawer({ count, onSubmit, onClose }: { count: number; onS
|
||||
>
|
||||
<p className="text-secondary">Says that somebody has seen them. The alerts stay, and are still counted by /metrics, but they are no longer ones nobody has looked at. One that was already acknowledged has its note replaced.</p>
|
||||
<label className="form-label" htmlFor="bulk-note">
|
||||
Note <span className="text-secondary">(optional)</span>
|
||||
Note <span className="text-secondary">{t("(optional)")}</span>
|
||||
</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
|
||||
</label>
|
||||
<select id="bulk-assignee" className="form-select mb-3" value={assignee} onChange={(e) => setAssignee(e.target.value)}>
|
||||
<option value="">Nobody in particular</option>
|
||||
<option value="">{t("Nobody in particular")}</option>
|
||||
{people.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
@@ -157,7 +158,7 @@ export function TagBulkDrawer({ count, tags, onSubmit, onClose }: { count: numbe
|
||||
const [busy, setBusy] = useState(false);
|
||||
return (
|
||||
<Shell
|
||||
title="Tags"
|
||||
title={t("Tags")}
|
||||
subtitle={`${count} server${count === 1 ? "" : "s"}`}
|
||||
onClose={onClose}
|
||||
busy={busy}
|
||||
@@ -197,7 +198,7 @@ export function RunsOnBulkDrawer({ count, servers, onSubmit, onClose }: { count:
|
||||
const [busy, setBusy] = useState(false);
|
||||
return (
|
||||
<Shell
|
||||
title="Runs on"
|
||||
title={t("Runs on")}
|
||||
subtitle={`${count} server${count === 1 ? "" : "s"}`}
|
||||
onClose={onClose}
|
||||
busy={busy}
|
||||
@@ -214,7 +215,7 @@ export function RunsOnBulkDrawer({ count, servers, onSubmit, onClose }: { count:
|
||||
They run on
|
||||
</label>
|
||||
<select id="bulk-parent" className="form-select" value={choice} onChange={(e) => setChoice(e.target.value)}>
|
||||
<option value="">Choose…</option>
|
||||
<option value="">{t("Choose…")}</option>
|
||||
<option value="auto">Work it out from the Proxmox node (the default)</option>
|
||||
{servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
@@ -239,7 +240,7 @@ function FieldChange({ id, label, type, value, onChange }: { id: string; label:
|
||||
<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="clear">Clear</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 />}
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* "Close" an alert: it has been dealt with, or it is accepted. It is hidden — held back like one under maintenance, so not counted in the badges, the dashboard or the digest, and its
|
||||
@@ -39,7 +40,7 @@ export default function CloseDrawer({ alert, onClose, onSaved }: { alert: AlertI
|
||||
<DetailDrawer title="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>Silence</em> for planned work.
|
||||
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">
|
||||
@@ -72,7 +73,7 @@ export default function CloseDrawer({ alert, onClose, onSaved }: { alert: AlertI
|
||||
{busy ? "Closing…" : "Close the alert"}
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={busy} onClick={onClose}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</DetailDrawer>
|
||||
@@ -92,7 +93,7 @@ export function CloseBulkDrawer({ count, tickets, onSubmit, onClose }: { count:
|
||||
<DetailDrawer title={`Close ${count} alert${count === 1 ? "" : "s"}`} onClose={onClose}>
|
||||
<div className="text-secondary mb-3">
|
||||
Hide them, with no end. Each comes back only if it <strong>gets worse</strong> than it is now, or if its problem goes away for half an hour and then returns. Until then they are not counted and nothing is sent about them. The reason goes on each one’s
|
||||
incident. Nothing about the things themselves is promised — use <em>Silence</em> for planned work.
|
||||
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)
|
||||
@@ -129,7 +130,7 @@ export function CloseBulkDrawer({ count, tickets, onSubmit, onClose }: { count:
|
||||
{busy ? "Closing…" : `Close ${count === 1 ? "the alert" : `all ${count}`}`}
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={busy} onClick={onClose}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</DetailDrawer>
|
||||
|
||||
@@ -26,6 +26,7 @@ import { toast } from "../utils/toast";
|
||||
import { SETTINGS_INDEX } from "../utils/settingsIndex";
|
||||
import { useHiddenPages } from "../hooks/useMenuHiding";
|
||||
import { SHOW_SETUP_EVENT } from "./SetupGuide";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const SECRET_TYPE_LABELS: Record<SecretType, string> = {
|
||||
api_token: "API Token",
|
||||
@@ -220,8 +221,8 @@ export default function CommandPalette({
|
||||
const items: PaletteItem[] = [];
|
||||
const pages: { to: string; label: string; group: string }[] = [];
|
||||
for (const entry of visibleNav(user.role)) {
|
||||
if (isGroup(entry)) entry.items.forEach((i) => pages.push({ to: i.to, label: i.label, group: entry.label }));
|
||||
else pages.push({ to: entry.to, label: entry.label, group: "" });
|
||||
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: "" });
|
||||
for (const p of pages) {
|
||||
@@ -466,8 +467,8 @@ export default function CommandPalette({
|
||||
opener.current = document.activeElement as HTMLElement | null;
|
||||
setOpen(true);
|
||||
}}
|
||||
title="Search and actions (Ctrl/Cmd+K)"
|
||||
aria-label="Search and actions"
|
||||
title={t("Search and actions (Ctrl/Cmd+K)")}
|
||||
aria-label={t("Search and actions")}
|
||||
aria-keyshortcuts="Control+K Meta+K"
|
||||
>
|
||||
<IconSearch size={16} />
|
||||
@@ -489,7 +490,7 @@ export default function CommandPalette({
|
||||
for a result row. */}
|
||||
<div className="modal-backdrop show"></div>
|
||||
<div className="modal modal-blur show" style={{ display: "block" }} onClick={() => setOpen(false)}>
|
||||
<div className="modal-dialog modal-dialog-centered" role="dialog" aria-modal="true" aria-label="Search and actions" style={{ maxWidth: 640 }} onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal-dialog modal-dialog-centered" role="dialog" aria-modal="true" aria-label={t("Search and actions")} style={{ maxWidth: 640 }} onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal-content">
|
||||
<div className="modal-body p-0">
|
||||
<div className="p-2 border-bottom">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, type NetworkOverview } from "../api/client";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* What a server is plugged into, as a UniFi controller says (matched by the server's IP address): the switch and port, or the access point it is on over Wi-Fi.
|
||||
@@ -30,7 +31,7 @@ export default function ConnectedThrough({ serverId }: { serverId: number }) {
|
||||
<h3 className="card-title">Connected through</h3>
|
||||
<div className="card-actions">
|
||||
<Link to="/network/devices" className="small">
|
||||
Network devices
|
||||
{t("Network devices")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { formatDate } from "../utils/date";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { eventText, money } from "../utils/costText";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** "Oct 25" — in UTC, since a month is a month wherever it is looked at from. */
|
||||
const monthLabel = (m: string) => new Date(`${m}-01T12:00:00Z`).toLocaleDateString(undefined, { month: "short", year: "2-digit", timeZone: "UTC" });
|
||||
@@ -43,7 +44,7 @@ export default function CostHistory({ refreshKey }: { refreshKey: unknown }) {
|
||||
return (
|
||||
<div className="card mt-3">
|
||||
<div className="card-header flex-wrap gap-2">
|
||||
<h3 className="card-title me-auto">History</h3>
|
||||
<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">
|
||||
{data.series.map((s) => (
|
||||
|
||||
@@ -6,6 +6,7 @@ import { BlockSkeleton } from "./Skeleton";
|
||||
import { refreshMyWork } from "../hooks/useMyWork";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* Every open job on the to-do list, soonest due first, beside the cards at the top of the dashboard: a box to tick one off (with an undo) and, for operators, a line to add another. It is the
|
||||
@@ -79,9 +80,9 @@ export default function DashboardTodos({ canEdit }: { canEdit: boolean }) {
|
||||
return (
|
||||
<div className="card dash-todos">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">To do{jobs && jobs.length > 0 ? ` (${jobs.length})` : ""}</h3>
|
||||
<h3 className="card-title">{t("To do")}{jobs && jobs.length > 0 ? ` (${jobs.length})` : ""}</h3>
|
||||
<div className="card-actions small">
|
||||
<Link to="/todo">All jobs</Link>
|
||||
<Link to="/todo">{t("All jobs")}</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="dash-todos-list">
|
||||
@@ -92,7 +93,7 @@ export default function DashboardTodos({ canEdit }: { canEdit: boolean }) {
|
||||
<BlockSkeleton lines={3} />
|
||||
</div>
|
||||
) : jobs.length === 0 ? (
|
||||
<div className="card-body text-secondary">Nothing to do.{canEdit ? " Add a job below." : ""}</div>
|
||||
<div className="card-body text-secondary">{t("Nothing to do.")}{canEdit ? " Add a job below." : ""}</div>
|
||||
) : (
|
||||
<ul className="list-group list-group-flush">
|
||||
{jobs.map((t) => {
|
||||
@@ -121,10 +122,10 @@ export default function DashboardTodos({ canEdit }: { canEdit: boolean }) {
|
||||
</div>
|
||||
{canEdit && (
|
||||
<form className="card-footer d-flex flex-wrap gap-2" onSubmit={(e) => void add(e)}>
|
||||
<input className="form-control flex-fill" style={{ minWidth: "10rem", width: "auto" }} maxLength={160} value={title} onChange={(e) => setTitle(e.target.value)} placeholder="Add a job…" aria-label="A job to add" />
|
||||
<input type="date" className="form-control w-auto" value={due} onChange={(e) => setDue(e.target.value)} aria-label="Due day (optional)" />
|
||||
<input className="form-control flex-fill" style={{ minWidth: "10rem", width: "auto" }} maxLength={160} value={title} onChange={(e) => setTitle(e.target.value)} placeholder={t("Add a job…")} aria-label={t("A job to add")} />
|
||||
<input type="date" className="form-control w-auto" value={due} onChange={(e) => setDue(e.target.value)} aria-label={t("Due day (optional)")} />
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || title.trim() === ""}>
|
||||
Add
|
||||
{t("Add")}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { toast } from "../utils/toast";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
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" },
|
||||
@@ -155,7 +156,7 @@ export default function DatabaseBackups() {
|
||||
Servers whose agents were installed after that backup need their token rotated (Servers → Manage servers).
|
||||
</div>
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void run("dismiss", () => api.dbBackups.dismissRestoreResult())}>
|
||||
Dismiss
|
||||
{t("Dismiss")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -203,7 +204,7 @@ export default function DatabaseBackups() {
|
||||
</div>
|
||||
<div className="col-auto">
|
||||
<button type="submit" className="btn btn-sm btn-outline-primary" disabled={!dirty || busy !== null}>
|
||||
Save
|
||||
{t("Save")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="col-12 text-secondary small">The time is in the notification time zone (Settings → Notifications). An alert is raised if the newest backup gets more than two days old.</div>
|
||||
@@ -220,7 +221,7 @@ export default function DatabaseBackups() {
|
||||
<th>Kind</th>
|
||||
<th>Taken</th>
|
||||
<th>Size</th>
|
||||
<th className="w-1">Actions</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -251,7 +252,7 @@ export default function DatabaseBackups() {
|
||||
Restore…
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" disabled={busy !== null} onClick={() => void remove(s)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useId, useRef, type ReactNode } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* A panel that slides in from the right with everything about one row, so the table stays where it was. Mount it only while a row
|
||||
@@ -53,7 +54,7 @@ export default function DetailDrawer({ title, subtitle, onClose, children }: { t
|
||||
</h3>
|
||||
{subtitle && <div className="text-secondary small text-truncate">{subtitle}</div>}
|
||||
</div>
|
||||
<button ref={closeRef} type="button" className="btn btn-icon btn-ghost-secondary" aria-label="Close" onClick={onClose}>
|
||||
<button ref={closeRef} type="button" className="btn btn-icon btn-ghost-secondary" aria-label={t("Close")} onClick={onClose}>
|
||||
<IconX size={18} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useId, useRef, useState, type FormEvent, type KeyboardEvent } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { settle, subscribe, type DialogRequest } from "../utils/dialogs";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const FOCUSABLE = "button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [href]";
|
||||
|
||||
@@ -80,7 +81,7 @@ function DialogView({ request }: { request: DialogRequest }) {
|
||||
settle(request, true, value);
|
||||
}
|
||||
|
||||
const title = request.title ?? (isPrompt ? "Enter a value" : "Please confirm");
|
||||
const title = request.title ?? (isPrompt ? t("Enter a value") : t("Please confirm"));
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -105,7 +106,7 @@ function DialogView({ request }: { request: DialogRequest }) {
|
||||
<h5 className="modal-title" id={titleId}>
|
||||
{title}
|
||||
</h5>
|
||||
<button type="button" className="btn-close" aria-label="Close" onClick={cancel} />
|
||||
<button type="button" className="btn-close" aria-label={t("Close")} onClick={cancel} />
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div style={{ whiteSpace: "pre-line" }}>{request.message}</div>
|
||||
@@ -131,10 +132,10 @@ function DialogView({ request }: { request: DialogRequest }) {
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button type="button" className="btn me-auto" ref={cancelRef} onClick={cancel}>
|
||||
{request.cancelLabel ?? "Cancel"}
|
||||
{request.cancelLabel ?? t("Cancel")}
|
||||
</button>
|
||||
<button type="submit" className={`btn ${danger ? "btn-danger" : "btn-primary"}`} ref={confirmRef} disabled={blocked}>
|
||||
{request.confirmLabel ?? (isPrompt ? "OK" : "Confirm")}
|
||||
{request.confirmLabel ?? (isPrompt ? t("OK") : t("Confirm"))}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState, type FormEvent } from "react";
|
||||
import { api, type NewDnsZoneInput } from "../api/client";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
type Kind = NewDnsZoneInput["type"];
|
||||
type Protocol = "Udp" | "Tcp" | "Tls" | "Https" | "Quic";
|
||||
@@ -63,7 +64,7 @@ export default function DnsNewZone({ providerId, providerName, onCreated, onCanc
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="newzone-name">
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id="newzone-name" className="form-control form-control-sm" required autoFocus maxLength={300} autoComplete="off" placeholder="home.lan — or 192.168.1.0/24 for a reverse zone" value={name} onChange={(e) => setName(e.target.value)} />
|
||||
<div className="text-secondary small mt-1">Written in lower case, ASCII (a name with other letters in its xn-- form), with no dot at the end.</div>
|
||||
@@ -110,7 +111,7 @@ export default function DnsNewZone({ providerId, providerName, onCreated, onCanc
|
||||
{busy ? "Making…" : "Make zone"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={onCancel} disabled={busy}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { api, type DnsProviderField, type DnsProviderType } from "../api/client";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const PROVIDER_LABELS: Record<DnsProviderType, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -153,7 +154,7 @@ export default function DnsProviderForm({
|
||||
Add provider
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={onCancel}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ErrorNotice } from "./Notice";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const QUERY_ACCESS: [string, string][] = [
|
||||
["Allow", "Everyone"],
|
||||
@@ -144,7 +145,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<h4 className="mb-0">Edit {zone.name}</h4>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary ms-auto" onClick={onClose}>
|
||||
Close
|
||||
{t("Close")}
|
||||
</button>
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -213,7 +214,7 @@ export default function DnsZoneEditor({ providerId, zone, onChanged, onClose }:
|
||||
{usesServers(notify) && (
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="zopt-notify-servers">
|
||||
Servers
|
||||
{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>
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { IconInbox, IconSearch } from "@tabler/icons-react";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export interface EmptyAction {
|
||||
label: string;
|
||||
@@ -42,9 +43,9 @@ export function EmptyRow({ colSpan, title, hint, action, filtered }: { colSpan:
|
||||
<tr>
|
||||
<td colSpan={colSpan}>
|
||||
{filtered ? (
|
||||
<EmptyState filtered title={title ?? "Nothing matches that"} hint={hint ?? "Try a different word, or clear the search and the filters."} action={{ label: "Clear the search and filters", onClick: filtered }} />
|
||||
<EmptyState filtered title={title ?? t("Nothing matches that")} hint={hint ?? t("Try a different word, or clear the search and the filters.")} action={{ label: t("Clear the search and filters"), onClick: filtered }} />
|
||||
) : (
|
||||
<EmptyState title={title ?? "Nothing here yet"} hint={hint} action={action} />
|
||||
<EmptyState title={title ?? t("Nothing here yet")} hint={hint} action={action} />
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { downloadCsv, tableToRows } from "../utils/csv";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* "Export CSV" for a table that has no export of its own. It reads the table as it is on screen, so what you see is what you get.
|
||||
@@ -32,7 +33,7 @@ export default function ExportTableButton({ filename, of = "card", className = "
|
||||
|
||||
return (
|
||||
<button ref={ref} type="button" className={className} onClick={exportNow} hidden={!hasTable}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { ErrorNotice } from "./Notice";
|
||||
import RangeSelect from "./RangeSelect";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import TimeChart from "./TimeChart";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* How the figures an integration reports have moved, a day to a year: one small chart for each figure with where it stands, how it has changed over the stretch and its lowest and highest.
|
||||
@@ -57,13 +58,13 @@ export default function FigureHistory({ integrationId, name }: { integrationId:
|
||||
{open && (
|
||||
<div className="mt-3">
|
||||
<div className="d-flex flex-wrap gap-2 align-items-center mb-2">
|
||||
<h4 className="mb-0 me-auto">History</h4>
|
||||
<h4 className="mb-0 me-auto">{t("History")}</h4>
|
||||
<RangeSelect value={days} onChange={setDays} />
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={3} />}
|
||||
{data && !data.kept && <div className="text-secondary small">No history is kept for this kind of integration: it is read when a page is opened, and nothing is stored to draw from.</div>}
|
||||
{data && data.kept && data.figures.length === 0 && <div className="text-secondary small">Nothing has been kept in this stretch yet. A reading is kept about every quarter of an hour once the integration has been read, so lines appear after a short while.</div>}
|
||||
{data && !data.kept && <div className="text-secondary small">{t("No history is kept for this kind of integration: it is read when a page is opened, and nothing is stored to draw from.")}</div>}
|
||||
{data && data.kept && data.figures.length === 0 && <div className="text-secondary small">{t("Nothing has been kept in this stretch yet. A reading is kept about every quarter of an hour once the integration has been read, so lines appear after a short while.")}</div>}
|
||||
{data && data.figures.length > 0 && (
|
||||
<div className="trend-grid">
|
||||
{charts.map(({ f, words, series }) => (
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Link } from "react-router-dom";
|
||||
import { api, type HetznerForServer } from "../api/client";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { ForecastText, StatusBadge, TrafficBar } from "../pages/Hetzner";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** On a server's page: the Hetzner Cloud server it is (matched by address, else by name), when there is one. Nothing is shown for a server that is not at Hetzner. */
|
||||
export default function HetznerServerCard({ serverId }: { serverId: number }) {
|
||||
@@ -41,7 +42,7 @@ export default function HetznerServerCard({ serverId }: { serverId: number }) {
|
||||
)}
|
||||
<div className="row g-3">
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="text-secondary small">Status</div>
|
||||
<div className="text-secondary small">{t("Status")}</div>
|
||||
<StatusBadge status={s.status} />
|
||||
{s.rescueEnabled && <span className="badge bg-yellow-lt text-yellow ms-1">rescue on</span>}
|
||||
</div>
|
||||
@@ -50,7 +51,7 @@ export default function HetznerServerCard({ serverId }: { serverId: number }) {
|
||||
{s.type ?? "—"} · {s.location ?? "?"}
|
||||
</div>
|
||||
<div className="col-6 col-lg-3">
|
||||
<div className="text-secondary small">Backups</div>
|
||||
<div className="text-secondary small">{t("Backups")}</div>
|
||||
{s.backupWindow ? (match.newestBackup ? <>newest <TimeAgo value={match.newestBackup} /></> : "on, none made yet") : "off"}
|
||||
{match.snapshots > 0 && <span className="text-secondary small"> · {match.snapshots} snapshot{match.snapshots === 1 ? "" : "s"}</span>}
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ErrorNotice } from "./Notice";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { EmptyRow } from "./EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export const CATEGORY_NAMES: Record<AlertCategory, string> = {
|
||||
offline: "Server down",
|
||||
@@ -122,9 +123,9 @@ export default function IncidentHistory() {
|
||||
onSearch={tableSearch.setQuery}
|
||||
placeholder="Search incidents…"
|
||||
filters={
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Show" value={status} onChange={(e) => setStatus(e.target.value as typeof status)}>
|
||||
<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="open">Open</option>
|
||||
<option value="open">{t("Open")}</option>
|
||||
<option value="resolved">Resolved</option>
|
||||
</select>
|
||||
}
|
||||
@@ -142,7 +143,7 @@ export default function IncidentHistory() {
|
||||
<SortableTh<Row> label="Lasted" sortKeyName="durationMs" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Worst" sortKeyName="peakSeverity" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Kind" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Where" sortKeyName="where" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Where")} sortKeyName="where" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="What" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { api, type IntegrationField, type IntegrationSummary, type IntegrationTy
|
||||
import { readableError } from "../utils/errors";
|
||||
import { TYPE_LABELS } from "../utils/integrationTypes";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export default function IntegrationEditForm({
|
||||
integration,
|
||||
@@ -157,7 +158,7 @@ export default function IntegrationEditForm({
|
||||
{saving ? "Saving…" : "Save changes"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={onCancel}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { api, type IntegrationField, type IntegrationType } from "../api/client";
|
||||
import { readableError } from "../utils/errors";
|
||||
import IntegrationTypePicker from "./IntegrationTypePicker";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export default function IntegrationForm({ onCreated, onCancel }: { onCreated: () => void; onCancel: () => void }) {
|
||||
const [allFields, setAllFields] = useState<Partial<Record<IntegrationType, IntegrationField[]>> | null>(null);
|
||||
@@ -143,10 +144,10 @@ export default function IntegrationForm({ onCreated, onCancel }: { onCreated: ()
|
||||
{testing ? "Testing…" : "Test connection"}
|
||||
</button>
|
||||
<button type="submit" className="btn btn-primary" disabled={saving || !type}>
|
||||
Add integration
|
||||
{t("Add integration")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={onCancel}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import type { MaintenanceWindow } from "../api/client";
|
||||
import { formatDate, formatDateTime, formatTime } from "../utils/date";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const HOUR = 3600_000;
|
||||
const DAY = 24 * HOUR;
|
||||
@@ -76,7 +77,7 @@ export default function MaintenanceTimeline({ windows, now }: { windows: Mainten
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Timeline</h3>
|
||||
<div className="card-actions">
|
||||
<div className="btn-group btn-group-sm" role="group" aria-label="Time range">
|
||||
<div className="btn-group btn-group-sm" role="group" aria-label={t("Time range")}>
|
||||
{RANGES.map((r) => (
|
||||
<button key={r.key} type="button" className={`btn btn-sm ${r.key === rangeKey ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={r.key === rangeKey} onClick={() => setRangeKey(r.key)}>
|
||||
{r.label}
|
||||
@@ -93,7 +94,7 @@ export default function MaintenanceTimeline({ windows, now }: { windows: Mainten
|
||||
<div className="timeline-scroll" aria-hidden="true">
|
||||
<div className="timeline">
|
||||
<div className="timeline-row timeline-axis">
|
||||
<div className="timeline-label text-secondary">From now</div>
|
||||
<div className="timeline-label text-secondary">{t("From now")}</div>
|
||||
<div className="timeline-track">
|
||||
{ticks.map((t) => (
|
||||
<span key={t} className="timeline-tick" style={{ left: `${pct(t)}%` }}>
|
||||
@@ -153,7 +154,7 @@ export default function MaintenanceTimeline({ windows, now }: { windows: Mainten
|
||||
<span>
|
||||
<span className="timeline-key timeline-bar-recurring" /> Recurring
|
||||
</span>
|
||||
<span>The same windows are listed in the tables below.</span>
|
||||
<span>{t("The same windows are listed in the tables below.")}</span>
|
||||
{further > 0 && <span>{further} further ahead than this range.</span>}
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { readableError } from "../utils/errors";
|
||||
import { shrinkPhoto } from "../utils/shrinkPhoto";
|
||||
import { toast } from "../utils/toast";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** Most photos on one note; the server enforces the same. */
|
||||
const MAX_PHOTOS = 12;
|
||||
@@ -72,12 +73,12 @@ function Viewer({ photos, index, canEdit, onMove, onClose, onChanged }: { photos
|
||||
Caption…
|
||||
</button>
|
||||
<button type="button" className="btn btn-outline-danger" onClick={() => void remove()}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<button type="button" className="btn btn-primary ms-auto" onClick={onClose} autoFocus>
|
||||
Close
|
||||
{t("Close")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import RunbookText from "./RunbookText";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* Free-form notes about a server or a network device — what it is, where it sits, what was done to it last time. One text, written with the same small formatting
|
||||
@@ -57,7 +58,7 @@ export default function NotesCard({ targetType, targetId, canEdit, bare = false
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={busy} onClick={() => setDraft(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
@@ -94,7 +95,7 @@ export default function NotesCard({ targetType, targetId, canEdit, bare = false
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Notes</h3>
|
||||
<h3 className="card-title">{t("Notes")}</h3>
|
||||
{edit && <div className="card-actions">{edit}</div>}
|
||||
</div>
|
||||
<div className="card-body">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from "../i18n";
|
||||
export default function Pagination({
|
||||
page,
|
||||
pageCount,
|
||||
@@ -13,13 +14,13 @@ export default function Pagination({
|
||||
return (
|
||||
<div className="card-footer d-flex align-items-center justify-content-between">
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => onPageChange(page - 1)} disabled={page === 0}>
|
||||
← Prev
|
||||
{t("← Prev")}
|
||||
</button>
|
||||
<span className="text-secondary small">
|
||||
Page {page + 1} of {pageCount} ({totalCount} total)
|
||||
{t("Page {page} of {pages} ({total} total)", { page: page + 1, pages: pageCount, total: totalCount })}
|
||||
</span>
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => onPageChange(page + 1)} disabled={page >= pageCount - 1}>
|
||||
Next →
|
||||
{t("Next →")}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { confirmDialog } from "../utils/dialogs";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const WEEK: { day: number; label: string }[] = [
|
||||
{ day: 1, label: "Mon" },
|
||||
@@ -105,7 +106,7 @@ function Progress({ run, canStop, onStop }: { run: PatchPlanRun; canStop: boolea
|
||||
</span>
|
||||
{run.status === "running" && canStop && (
|
||||
<button className="btn btn-sm btn-outline-danger ms-auto" onClick={onStop}>
|
||||
Stop
|
||||
{t("Stop")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -268,7 +269,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<p className="text-secondary">
|
||||
Updates on a schedule: <em>Sundays at 02:00, the servers tagged lab, one at a time, stop at the first failure.</em> Each server is updated by an ordinary update run — put under maintenance, the playbook run for it
|
||||
Updates on a schedule: <em>{t("Sundays at 02:00, the servers tagged lab, one at a time, stop at the first failure.")}</em> Each server is updated by an ordinary update run — put under maintenance, the playbook run for it
|
||||
alone, the app waits for it to report again — and the plan goes on to the next only when that one is over. What depends on a server is silenced while it is updated. A message at the end says how each went.
|
||||
</p>
|
||||
<ErrorNotice error={error} />
|
||||
@@ -276,7 +277,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
{data && data.runs.length > 0 && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Recent runs</h3>
|
||||
<h3 className="card-title">{t("Recent runs")}</h3>
|
||||
</div>
|
||||
<div className="list-group list-group-flush">
|
||||
{data.runs.slice(0, running ? 15 : 5).map((r) => (
|
||||
@@ -294,12 +295,12 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="pp-name">
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id="pp-name" className="form-control" required maxLength={100} placeholder="e.g. Lab on Sunday nights" value={draft.name} onChange={(e) => set("name", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-7">
|
||||
<div className="form-label">Days</div>
|
||||
<div className="form-label">{t("Days")}</div>
|
||||
<div className="d-flex flex-wrap gap-2">
|
||||
{WEEK.map((d) => (
|
||||
<label key={d.day} className={`btn btn-sm ${draft.days.includes(d.day) ? "btn-primary" : "btn-outline-secondary"} mb-0`}>
|
||||
@@ -311,13 +312,13 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<label className="form-label" htmlFor="pp-time">
|
||||
Starts at
|
||||
{t("Starts at")}
|
||||
</label>
|
||||
<input id="pp-time" type="time" className="form-control" required value={draft.startTime} onChange={(e) => set("startTime", e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="pp-zone">
|
||||
On the clock of
|
||||
{t("On the clock of")}
|
||||
</label>
|
||||
<input id="pp-zone" className="form-control" list="pp-zones" required value={draft.timezone} onChange={(e) => set("timezone", e.target.value)} />
|
||||
<datalist id="pp-zones">
|
||||
@@ -325,11 +326,11 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
<option key={z} value={z} />
|
||||
))}
|
||||
</datalist>
|
||||
<div className="form-hint text-secondary small mt-1">A name like Europe/Stockholm, so 02:00 stays 02:00 in summer and winter.</div>
|
||||
<div className="form-hint text-secondary small mt-1">{t("A name like Europe/Stockholm, so 02:00 stays 02:00 in summer and winter.")}</div>
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="pp-window">
|
||||
Each server may be under maintenance for
|
||||
{t("Each server may be under maintenance for")}
|
||||
</label>
|
||||
<select id="pp-window" className="form-select" value={draft.windowMinutes} onChange={(e) => set("windowMinutes", Number(e.target.value))}>
|
||||
{WINDOWS.map((w) => (
|
||||
@@ -338,13 +339,13 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="form-hint text-secondary small mt-1">It ends sooner when that server's update does.</div>
|
||||
<div className="form-hint text-secondary small mt-1">{t("It ends sooner when that server's update does.")}</div>
|
||||
</div>
|
||||
|
||||
<div className="col-12">
|
||||
<div className="form-label">Which servers</div>
|
||||
<div className="form-label">{t("Which servers")}</div>
|
||||
{data.tags.length === 0 ? (
|
||||
<div className="text-secondary small mb-2">No server has a tag yet — tag servers on their pages (for example “lab”), or name them below.</div>
|
||||
<div className="text-secondary small mb-2">{t("No server has a tag yet — tag servers on their pages (for example “lab”), or name them below.")}</div>
|
||||
) : (
|
||||
<div className="d-flex flex-wrap gap-2 mb-2">
|
||||
{data.tags.map((t) => (
|
||||
@@ -371,17 +372,17 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
|
||||
<div className="col-md-8">
|
||||
<label className="form-label" htmlFor="pp-template">
|
||||
Playbook that applies updates
|
||||
{t("Playbook that applies updates")}
|
||||
</label>
|
||||
{templates === null ? (
|
||||
<BlockSkeleton lines={1} />
|
||||
) : templates.length === 0 && draft.id === null ? (
|
||||
<div className="text-secondary">
|
||||
There is no Semaphore connected, or it has no templates. Add one under <Link to="/integrations">Integrations</Link>.
|
||||
There is no Semaphore connected, or it has no templates. Add one under <Link to="/integrations">{t("Integrations")}</Link>.
|
||||
</div>
|
||||
) : (
|
||||
<select id="pp-template" className="form-select" value={draft.template} onChange={(e) => set("template", e.target.value)} required>
|
||||
<option value="">Choose a template…</option>
|
||||
<option value="">{t("Choose a template…")}</option>
|
||||
{draft.id !== null && !templates.some((t) => t.key === draft.template) && <option value={draft.template}>{data.plans.find((p) => p.id === draft.id)?.templateName ?? "the current one"} (as it is now)</option>}
|
||||
{templates.map((t) => (
|
||||
<option key={t.key} value={t.key}>
|
||||
@@ -393,22 +394,22 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="pp-limit">
|
||||
Run it on each server by its
|
||||
{t("Run it on each server by its")}
|
||||
</label>
|
||||
<select id="pp-limit" className="form-select" value={draft.limitFrom} onChange={(e) => set("limitFrom", e.target.value as "name" | "hostname")}>
|
||||
<option value="name">name here</option>
|
||||
<option value="hostname">host name it reports</option>
|
||||
</select>
|
||||
<div className="form-hint text-secondary small mt-1">Must match the host name in the Semaphore inventory.</div>
|
||||
<div className="form-hint text-secondary small mt-1">{t("Must match the host name in the Semaphore inventory.")}</div>
|
||||
</div>
|
||||
|
||||
{templates !== null && (
|
||||
<div className="col-md-8">
|
||||
<label className="form-label" htmlFor="pp-restart">
|
||||
Restart a server afterwards, if it says a restart is due, with
|
||||
{t("Restart a server afterwards, if it says a restart is due, with")}
|
||||
</label>
|
||||
<select id="pp-restart" className="form-select" value={draft.restart} onChange={(e) => set("restart", e.target.value)}>
|
||||
<option value="">No second playbook (the update playbook may restart it itself)</option>
|
||||
<option value="">{t("No second playbook (the update playbook may restart it itself)")}</option>
|
||||
{draft.id !== null && draft.restart !== "" && !templates.some((t) => t.key === draft.restart) && <option value={draft.restart}>{data.plans.find((p) => p.id === draft.id)?.restartTemplateName ?? "the current one"} (as it is now)</option>}
|
||||
{templates
|
||||
.filter((t) => t.key !== draft.template && t.integration.id === Number(draft.template.split(":")[0]))
|
||||
@@ -418,26 +419,26 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="form-hint text-secondary small mt-1">A playbook that only restarts the server, in the same Semaphore. It runs once a server's updates are in; a server with nothing waiting that still says a restart is due is restarted too. Each restart is checked: the server must report that it started again. The window below counts for the update and the restart together.</div>
|
||||
<div className="form-hint text-secondary small mt-1">{t("A playbook that only restarts the server, in the same Semaphore. It runs once a server's updates are in; a server with nothing waiting that still says a restart is due is restarted too. Each restart is checked: the server must report that it started again. The window below counts for the update and the restart together.")}</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="col-12 d-flex flex-column gap-2">
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={draft.stopOnFailure} onChange={(e) => set("stopOnFailure", e.target.checked)} />
|
||||
<span className="form-check-label">Stop at the first failure, and leave the servers after it alone</span>
|
||||
<span className="form-check-label">{t("Stop at the first failure, and leave the servers after it alone")}</span>
|
||||
</label>
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={draft.onlyWithUpdates} onChange={(e) => set("onlyWithUpdates", e.target.checked)} />
|
||||
<span className="form-check-label">Leave a server alone when it has no updates waiting</span>
|
||||
<span className="form-check-label">{t("Leave a server alone when it has no updates waiting")}</span>
|
||||
</label>
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={draft.silenceDependents} onChange={(e) => set("silenceDependents", e.target.checked)} />
|
||||
<span className="form-check-label">Silence what depends on a server while it is updated (a guest that runs on it, a service that needs it)</span>
|
||||
<span className="form-check-label">{t("Silence what depends on a server while it is updated (a guest that runs on it, a service that needs it)")}</span>
|
||||
</label>
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={draft.enabled} onChange={(e) => set("enabled", e.target.checked)} />
|
||||
<span className="form-check-label">Switched on</span>
|
||||
<span className="form-check-label">{t("Switched on")}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -446,7 +447,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -458,7 +459,7 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
{isAdmin && !draft && (
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-primary" onClick={() => setDraft({ ...EMPTY, timezone: browserZone() })}>
|
||||
Make a plan
|
||||
{t("Make a plan")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -466,8 +467,8 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
{data === null && !error && <BlockSkeleton lines={3} />}
|
||||
{data && data.plans.length === 0 && (
|
||||
<EmptyState
|
||||
title="No patch plans yet"
|
||||
hint="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."
|
||||
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}
|
||||
/>
|
||||
)}
|
||||
@@ -477,31 +478,31 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Plan</th>
|
||||
<th>When</th>
|
||||
<th>Servers</th>
|
||||
<th>Next</th>
|
||||
{(canRun || isAdmin) && <th className="w-1">Actions</th>}
|
||||
<th>{t("When")}</th>
|
||||
<th>{t("Servers")}</th>
|
||||
<th>{t("Next")}</th>
|
||||
{(canRun || isAdmin) && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{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">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">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"}
|
||||
</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label="When">
|
||||
<td className="stack-label" data-label={t("When")}>
|
||||
{whenWords(p.days, p.startTime)}
|
||||
<div className="text-secondary small">{p.timezone}</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Servers">
|
||||
<td className="stack-label" data-label={t("Servers")}>
|
||||
{p.servers.length === 0 ? <span className="text-yellow">none match</span> : p.servers.map((s) => s.name).join(", ")}
|
||||
<div className="text-secondary small">{[...p.tags.map((t) => `tag ${t}`), p.serverIds.length > 0 ? `${p.serverIds.length} named` : null].filter(Boolean).join(" · ")}</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Next">
|
||||
<td className="stack-label" data-label={t("Next")}>
|
||||
{p.enabled && p.next[0] ? formatDateTime(new Date(p.next[0])) : <span className="text-secondary">—</span>}
|
||||
</td>
|
||||
{(canRun || isAdmin) && (
|
||||
@@ -509,16 +510,16 @@ export default function PatchPlans({ user }: { user: CurrentUser }) {
|
||||
<div className="btn-list flex-nowrap">
|
||||
{canRun && (
|
||||
<button className="btn btn-sm btn-outline-primary" disabled={p.running || p.servers.length === 0} onClick={() => void runNow(p)}>
|
||||
Run now
|
||||
{t("Run now")}
|
||||
</button>
|
||||
)}
|
||||
{isAdmin && (
|
||||
<>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => edit(p)}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" disabled={p.running} onClick={() => void remove(p)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { formatPortLines, parsePortLines } from "../utils/portPresetText";
|
||||
import { toast } from "../utils/toast";
|
||||
import { removeWithUndo } from "../utils/undoable";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** The chips of a preset: "22 SSH · 3389 RDP …", UDP marked. */
|
||||
function PortChips({ preset }: { preset: PortPreset }) {
|
||||
@@ -101,7 +102,7 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<h4 className="mb-0">Check “{preset.name}” on hosts</h4>
|
||||
<button className="btn btn-sm ms-auto" onClick={onClose}>
|
||||
Close
|
||||
{t("Close")}
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
@@ -130,7 +131,7 @@ function CheckHosts({ preset, canEdit, onClose }: { preset: PortPreset; canEdit:
|
||||
)}
|
||||
</div>
|
||||
<div className="border rounded p-2 mb-3" style={{ maxHeight: 220, overflowY: "auto" }}>
|
||||
{servers === null && <div className="text-secondary small">Loading…</div>}
|
||||
{servers === null && <div className="text-secondary small">{t("Loading…")}</div>}
|
||||
{servers !== null && shown.length === 0 && <div className="text-secondary small">No host matches.</div>}
|
||||
<div className="row">
|
||||
{shown.map((s) => (
|
||||
@@ -278,7 +279,7 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
|
||||
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} />
|
||||
{!presets && !error && <div className="text-secondary">Loading…</div>}
|
||||
{!presets && !error && <div className="text-secondary">{t("Loading…")}</div>}
|
||||
{presets && presets.length === 0 && !form && <div className="text-secondary">No preset yet.{canEdit ? " Add one to name ports and to check hosts for them." : ""}</div>}
|
||||
{presets?.map((p) => (
|
||||
<div key={p.id} className="border rounded p-2 mb-2">
|
||||
@@ -294,10 +295,10 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
|
||||
{canEdit && (
|
||||
<>
|
||||
<button className="btn btn-sm" onClick={() => { setForm({ id: p.id, name: p.name, text: formatPortLines(p.ports) }); setFormErrors([]); }}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(p)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
@@ -312,7 +313,7 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
|
||||
<form onSubmit={save} className="border rounded p-3 mt-3">
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="pp-name">
|
||||
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 />
|
||||
</div>
|
||||
@@ -337,7 +338,7 @@ export default function PortPresets({ canEdit }: { canEdit: boolean }) {
|
||||
{saving ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setForm(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { toast } from "../utils/toast";
|
||||
import { snapshotDepths } from "../utils/proxmoxSnapshots";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* The snapshots of one guest: what there is (in the order they were taken, each indented under the one it was taken after), a way to take one (an operator's), and to roll back to one or
|
||||
@@ -96,7 +97,7 @@ export default function ProxmoxSnapshots({ integrationId, guest, canTake, canRol
|
||||
<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)} />
|
||||
</div>
|
||||
<div className="col-sm-7">
|
||||
<input className="form-control form-control-sm" aria-label="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="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" && (
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState, type FormEvent } from "react";
|
||||
import { api, type NpmCertificate, type NpmHost, type NpmHostSettings } from "../api/client";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const DAY_MS = 86_400_000;
|
||||
const certLabel = (c: NpmCertificate) => {
|
||||
@@ -153,7 +154,7 @@ export default function ProxyHostForm({ integrationId, integrationName, certific
|
||||
{busy ? "Saving…" : host ? "Save" : "Make proxy host"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-link text-secondary" onClick={onCancel} disabled={busy}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { CATEGORY_LABELS } from "./RoutingEditor";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const supported = typeof window !== "undefined" && "serviceWorker" in navigator && "PushManager" in window && "Notification" in window;
|
||||
|
||||
@@ -204,7 +205,7 @@ export default function PushDevices({ serverEnabled }: { serverEnabled: boolean
|
||||
{d.endpoint === thisEndpoint && <span className="badge bg-blue-lt text-blue">this browser</span>}
|
||||
<span className="text-secondary small">via {d.host}</span>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger ms-auto" onClick={() => void remove(d)}>
|
||||
Remove
|
||||
{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."}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { CHART_RANGES } from "../utils/chartRanges";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** The one way to choose how far back a chart looks: 24 hours, 7, 30 or 90 days, or a year. */
|
||||
export default function RangeSelect({ value, onChange, label = "Time range", only }: { value: number; onChange: (days: number) => void; label?: string; /** Offer only these (in days), for a chart that has no use for the shortest. */ only?: number[] }) {
|
||||
export default function RangeSelect({ value, onChange, label, only }: { value: number; onChange: (days: number) => void; label?: string; /** Offer only these (in days), for a chart that has no use for the shortest. */ only?: number[] }) {
|
||||
return (
|
||||
<div className="btn-group btn-group-sm" role="group" aria-label={label}>
|
||||
<div className="btn-group btn-group-sm" role="group" aria-label={label ?? t("Time range")}>
|
||||
{CHART_RANGES.filter((r) => !only || only.includes(r.days)).map((r) => (
|
||||
<button key={r.days} type="button" className={`btn ${value === r.days ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={value === r.days} onClick={() => onChange(r.days)}>
|
||||
{r.label}
|
||||
{t(r.label)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import TimeAgo from "./TimeAgo";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import ExportTableButton from "./ExportTableButton";
|
||||
import { EmptyRow, LoadingRow } from "./EmptyState";
|
||||
import { t } from "../i18n";
|
||||
|
||||
// Monday first, as a week reads; the numbers are what the server keeps (0 = Sunday).
|
||||
const DAYS: { value: number; short: string }[] = [
|
||||
@@ -158,7 +159,7 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
}
|
||||
|
||||
async function remove(s: MaintenanceSchedule) {
|
||||
if (!(await confirmDialog({ title: "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: "Remove", danger: true }))) return;
|
||||
try {
|
||||
await api.maintenance.schedules.remove(s.id);
|
||||
toast.success(`Removed ${s.name}.`);
|
||||
@@ -174,12 +175,12 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Recurring</h3>
|
||||
<h3 className="card-title">{t("Recurring")}</h3>
|
||||
<div className="card-actions">
|
||||
<ExportTableButton filename="maintenance-recurring" />
|
||||
{canEdit && !adding && (
|
||||
<button type="button" className="btn btn-sm btn-primary" onClick={() => { setError(null); setAdding(true); }}>
|
||||
Add recurring maintenance
|
||||
{t("Add recurring maintenance")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -190,19 +191,19 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-4">
|
||||
<label className="form-label" htmlFor="rec-name">
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id="rec-name" className="form-control" required maxLength={80} placeholder="e.g. Patch night" value={name} onChange={(e) => setName(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-md-8">
|
||||
<label className="form-label" htmlFor="rec-reason">
|
||||
Reason (optional)
|
||||
{t("Reason (optional)")}
|
||||
</label>
|
||||
<input id="rec-reason" className="form-control" maxLength={200} placeholder="e.g. OS updates and restarts" value={reason} onChange={(e) => setReason(e.target.value)} />
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<div className="form-label" id="rec-days">
|
||||
Days
|
||||
{t("Days")}
|
||||
</div>
|
||||
<div className="btn-group" role="group" aria-labelledby="rec-days">
|
||||
{DAYS.map((d) => {
|
||||
@@ -217,14 +218,14 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
</div>
|
||||
<div className="col-sm-6 col-md-3">
|
||||
<label className="form-label" htmlFor="rec-start">
|
||||
Starts at
|
||||
{t("Starts at")}
|
||||
</label>
|
||||
<input id="rec-start" type="time" className="form-control" required value={startTime} onChange={(e) => setStartTime(e.target.value)} />
|
||||
<div className="form-hint text-secondary small mt-1">Clock in {timezone}</div>
|
||||
<div className="form-hint text-secondary small mt-1">{t("Clock in")} {timezone}</div>
|
||||
</div>
|
||||
<div className="col-sm-6 col-md-3">
|
||||
<label className="form-label" htmlFor="rec-length">
|
||||
For
|
||||
{t("For")}
|
||||
</label>
|
||||
<select id="rec-length" className="form-select" value={minutes} onChange={(e) => setMinutes(Number(e.target.value))}>
|
||||
{/* A schedule made some other way (or before these choices) keeps whatever length it has. */}
|
||||
@@ -237,7 +238,7 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<div className="form-label">What it covers</div>
|
||||
<div className="form-label">{t("What it covers")}</div>
|
||||
<div className="border rounded p-2" style={{ maxHeight: 220, overflowY: "auto" }}>
|
||||
{groups.map(
|
||||
(g) =>
|
||||
@@ -289,10 +290,10 @@ 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 ? "Save" : "Save changes"}
|
||||
{busy ? "Saving…" : editingId === null ? t("Save") : t("Save changes")}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={closeForm}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -303,11 +304,11 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Covers</th>
|
||||
<th>When</th>
|
||||
<th>Next</th>
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
<th>{t("When")}</th>
|
||||
<th>{t("Next")}</th>
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -328,13 +329,13 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => startEditing(s)} disabled={editingId === s.id}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void toggle(s)}>
|
||||
{s.enabled ? "Turn off" : "Turn on"}
|
||||
{s.enabled ? t("Turn off") : t("Turn on")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" onClick={() => void remove(s)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
@@ -343,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="No recurring maintenance" hint="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: "Add recurring maintenance", onClick: () => { setError(null); setAdding(true); } } : undefined} />
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import type { AlertCategory, EscalationSettings, EscalationStep, NotifyChannelId, RoutingRule, RoutingSettings } from "../api/client";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export const CHANNEL_LABELS: Record<NotifyChannelId, string> = { gotify: "Gotify", ntfy: "ntfy", telegram: "Telegram", pushover: "Pushover", smtp: "Email", webhook: "Webhook", webPush: "Phone and browser" };
|
||||
const CHANNELS = Object.keys(CHANNEL_LABELS) as NotifyChannelId[];
|
||||
@@ -127,7 +128,7 @@ export default function RoutingEditor({
|
||||
↓
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" onClick={() => onRouting({ rules: routing.rules.filter((_, j) => j !== i) })}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -197,7 +198,7 @@ export default function RoutingEditor({
|
||||
<div className="d-flex align-items-center mb-3">
|
||||
<strong>Step {i + 1}</strong>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger ms-auto" onClick={() => onEscalation({ ...escalation, steps: escalation.steps.filter((_, j) => j !== i) })}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="row g-3">
|
||||
|
||||
@@ -6,6 +6,7 @@ import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { t } from "../i18n";
|
||||
|
||||
interface Loaded {
|
||||
integration: IntegrationSummary;
|
||||
@@ -113,12 +114,12 @@ export default function RunPlaybook({ serverName, defaultLimit }: { serverName:
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) return <div className="text-secondary">Couldn't load the integrations.</div>;
|
||||
if (failed) return <div className="text-secondary">{t("Couldn't load the integrations.")}</div>;
|
||||
if (loaded === null) return <BlockSkeleton lines={3} />;
|
||||
if (loaded.length === 0) {
|
||||
return (
|
||||
<div className="text-secondary">
|
||||
There is no Semaphore connected. Add one under <Link to="/integrations">Integrations</Link> to run playbooks from here.
|
||||
There is no Semaphore connected. Add one under <Link to="/integrations">{t("Integrations")}</Link> to run playbooks from here.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -127,7 +128,7 @@ export default function RunPlaybook({ serverName, defaultLimit }: { serverName:
|
||||
<div>
|
||||
{loaded.some((l) => l.failed) && <div className="text-secondary small mb-2">Couldn't read the templates of {loaded.filter((l) => l.failed).map((l) => l.integration.name).join(", ")}.</div>}
|
||||
{options.length === 0 ? (
|
||||
<div className="text-secondary">No templates found in Semaphore.</div>
|
||||
<div className="text-secondary">{t("No templates found in Semaphore.")}</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="mb-3">
|
||||
@@ -135,7 +136,7 @@ export default function RunPlaybook({ serverName, defaultLimit }: { serverName:
|
||||
Template
|
||||
</label>
|
||||
<select id="run-template" className="form-select" value={choice} onChange={(e) => setChoice(e.target.value)}>
|
||||
<option value="">Choose a template…</option>
|
||||
<option value="">{t("Choose a template…")}</option>
|
||||
{options.map((o) => (
|
||||
<option key={o.key} value={o.key}>
|
||||
{o.label}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import RunPlaybook from "./RunPlaybook";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** "Run…" on an alert about a server: opens a side panel to start a playbook on that server, without leaving the alerts. */
|
||||
export default function RunPlaybookButton({ serverName }: { serverName: string }) {
|
||||
@@ -11,7 +12,7 @@ export default function RunPlaybookButton({ serverName }: { serverName: string }
|
||||
Run…
|
||||
</button>
|
||||
{open && (
|
||||
<DetailDrawer title="Run a playbook" subtitle={`On ${serverName}`} onClose={() => setOpen(false)}>
|
||||
<DetailDrawer title={t("Run a playbook")} subtitle={`On ${serverName}`} onClose={() => setOpen(false)}>
|
||||
<RunPlaybook serverName={serverName} defaultLimit={serverName} />
|
||||
</DetailDrawer>
|
||||
)}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { toast } from "../utils/toast";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import RunbookText from "./RunbookText";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export const CATEGORY_WORDS: Record<AlertCategory, string> = {
|
||||
offline: "a server that stopped reporting",
|
||||
@@ -127,10 +128,10 @@ export default function RunbookPanel({
|
||||
{canEdit && (
|
||||
<span className="ms-auto btn-list flex-nowrap">
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setDraft({ id: n.id, title: n.title, body: n.body, category: (n.category as AlertCategory | null) ?? "" })}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" onClick={() => void remove(n)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
@@ -142,7 +143,7 @@ export default function RunbookPanel({
|
||||
<form onSubmit={save} className="border rounded p-3">
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="rb-title">
|
||||
Title
|
||||
{t("Title")}
|
||||
</label>
|
||||
<input id="rb-title" className="form-control" required maxLength={120} placeholder={`e.g. If ${targetName} is down`} value={draft.title} onChange={(e) => setDraft({ ...draft, title: e.target.value })} />
|
||||
</div>
|
||||
@@ -161,7 +162,7 @@ export default function RunbookPanel({
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="rb-body">
|
||||
What to do
|
||||
{t("What to do")}
|
||||
</label>
|
||||
<textarea id="rb-body" className="form-control" rows={9} required maxLength={20000} value={draft.body} onChange={(e) => setDraft({ ...draft, body: e.target.value })} />
|
||||
<div className="form-hint">
|
||||
@@ -174,7 +175,7 @@ export default function RunbookPanel({
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { api, type ServerActivityEvent } from "../api/client";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const TONE_CLASS: Record<ServerActivityEvent["tone"], string> = {
|
||||
good: "text-green",
|
||||
@@ -42,17 +43,17 @@ export default function ServerActivity({ serverId }: { serverId: number }) {
|
||||
<h3 className="card-title">Activity</h3>
|
||||
<div className="card-actions">
|
||||
<Link to={`/changes?serverId=${serverId}&days=90`} className="small">
|
||||
Everything about this server in the change log
|
||||
{t("Everything about this server in the change log")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{failed ? (
|
||||
<div className="text-secondary">Couldn't load the activity.</div>
|
||||
<div className="text-secondary">{t("Couldn't load the activity.")}</div>
|
||||
) : events === null ? (
|
||||
<BlockSkeleton lines={4} />
|
||||
) : events.length === 0 ? (
|
||||
<div className="text-secondary">Nothing recorded yet. Changes to this server, times it stopped reporting, and its maintenance windows will be listed here.</div>
|
||||
<div className="text-secondary">{t("Nothing recorded yet. Changes to this server, times it stopped reporting, and its maintenance windows will be listed here.")}</div>
|
||||
) : (
|
||||
<ol className="activity-list">
|
||||
{events.map((e, i) => (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useRef, type ReactNode } from "react";
|
||||
import { IconChevronDown, IconChevronUp, IconFoldDown, IconFoldUp } from "@tabler/icons-react";
|
||||
import { moveBlock, resetServerPageLayout, setEditingServerPage, toggleFolded, useServerPageLayout } from "../utils/serverPageLayout";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* A card (or a row of them) on a server's overview that its reader can fold — a click on the card's header does it, or the button while arranging — and, in a stack, move up or
|
||||
@@ -39,10 +40,10 @@ export default function ServerBlock({ id, label, at, noFold = false, className =
|
||||
<span className="text-secondary small me-auto">{label}</span>
|
||||
{arrangeable && (
|
||||
<>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} up`} title="Move up" onClick={() => ref.current && void moveBlock(ref.current, -1)}>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} up`} title={t("Move up")} onClick={() => ref.current && void moveBlock(ref.current, -1)}>
|
||||
<IconChevronUp size={16} aria-hidden="true" />
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} down`} title="Move down" onClick={() => ref.current && void moveBlock(ref.current, 1)}>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} down`} title={t("Move down")} onClick={() => ref.current && void moveBlock(ref.current, 1)}>
|
||||
<IconChevronDown size={16} aria-hidden="true" />
|
||||
</button>
|
||||
</>
|
||||
@@ -68,10 +69,10 @@ export function ArrangeBar() {
|
||||
<div className="d-flex justify-content-end gap-2 mb-2">
|
||||
{editing && changed && (
|
||||
<button type="button" className="btn btn-sm" onClick={() => void resetServerPageLayout()}>
|
||||
Reset
|
||||
{t("Reset")}
|
||||
</button>
|
||||
)}
|
||||
<button type="button" className={`btn btn-sm ${editing ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={editing} onClick={() => setEditingServerPage(!editing)} title="Fold the cards you do not need and put the others in the order you like — for every server">
|
||||
<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"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState, type FormEvent } from "react";
|
||||
import { api, type ServerRecord } from "../api/client";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* A server's hostname, with (for an administrator) a way to change it by hand. A hostname set by hand is kept even when the agent reports another — the page says so, shows what the agent
|
||||
@@ -52,19 +53,19 @@ export default function ServerHostname({ server, isAdmin, onChanged }: { server:
|
||||
|
||||
return (
|
||||
<>
|
||||
<dt className="col-5">Hostname</dt>
|
||||
<dt className="col-5">{t("Hostname")}</dt>
|
||||
<dd className="col-7">
|
||||
{editing ? (
|
||||
<form onSubmit={save}>
|
||||
<ErrorNotice error={error} />
|
||||
<input className="form-control form-control-sm mb-1" autoFocus required maxLength={300} autoComplete="off" aria-label="Hostname" placeholder="nas.home.lan" value={value} onChange={(e) => setValue(e.target.value)} />
|
||||
<input className="form-control form-control-sm mb-1" autoFocus required maxLength={300} autoComplete="off" aria-label={t("Hostname")} placeholder="nas.home.lan" value={value} onChange={(e) => setValue(e.target.value)} />
|
||||
<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"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-link text-secondary" onClick={() => setEditing(false)} disabled={busy}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -10,6 +10,7 @@ import SortableTh from "./SortableTh";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { portName } from "../utils/portName";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const PRESETS: { key: string; label: string; from: number; to: number }[] = [
|
||||
{ key: "well-known", label: "1–1024 (well-known)", from: 1, to: 1024 },
|
||||
@@ -39,22 +40,22 @@ function StatusBadges({ entry }: { entry: PortEntry }) {
|
||||
return (
|
||||
<div className="d-flex flex-wrap gap-1">
|
||||
{entry.isNew && (
|
||||
<span className="badge bg-yellow-lt text-yellow" title="It began listening after this server's first report and nobody has said it is expected. It is on the Alerts page until you note it or it stops listening.">
|
||||
New
|
||||
<span className="badge bg-yellow-lt text-yellow" title={t("It began listening after this server's first report and nobody has said it is expected. It is on the Alerts page until you note it or it stops listening.")}>
|
||||
{t("New")}
|
||||
</span>
|
||||
)}
|
||||
{entry.scanOpen && (
|
||||
<span className="badge bg-green-lt text-green" title="A scan from this app connected to it">
|
||||
Reachable
|
||||
<span className="badge bg-green-lt text-green" title={t("A scan from this app connected to it")}>
|
||||
{t("Reachable")}
|
||||
</span>
|
||||
)}
|
||||
{entry.agent && (
|
||||
<span className="badge bg-blue-lt text-blue" title={`Bound on: ${entry.agent.addresses.join(", ")}`}>
|
||||
Listening
|
||||
{t("Listening")}
|
||||
</span>
|
||||
)}
|
||||
{entry.agent?.localOnly && (
|
||||
<span className="badge bg-yellow-lt text-yellow" title="Bound to localhost only — other machines can't connect, but the port is still taken">
|
||||
<span className="badge bg-yellow-lt text-yellow" title={t("Bound to localhost only — other machines can't connect, but the port is still taken")}>
|
||||
local only
|
||||
</span>
|
||||
)}
|
||||
@@ -232,20 +233,20 @@ export default function ServerPorts({
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Ports</h3>
|
||||
<h3 className="card-title">{t("Ports")}</h3>
|
||||
<div className="card-actions btn-list flex-nowrap">
|
||||
{data && data.ports.length > 0 && (
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={exportCsv}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
)}
|
||||
{canEdit && (
|
||||
<>
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={() => openNote()}>
|
||||
Add note
|
||||
{t("Add note")}
|
||||
</button>
|
||||
<button className="btn btn-primary btn-sm" onClick={() => setShowScan((s) => !s)}>
|
||||
Scan…
|
||||
{t("Scan…")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
@@ -271,7 +272,7 @@ export default function ServerPorts({
|
||||
{data.lastScan.to}.
|
||||
</>
|
||||
) : (
|
||||
<>Not scanned yet.</>
|
||||
<>{t("Not scanned yet.")}</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -279,7 +280,7 @@ export default function ServerPorts({
|
||||
{canEdit && showScan && (
|
||||
<form onSubmit={runScan} className="row g-2 align-items-end border rounded p-3 mb-3">
|
||||
<div className="col-md-4">
|
||||
<label className="form-label">Address to scan</label>
|
||||
<label className="form-label">{t("Address to scan")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -295,7 +296,7 @@ export default function ServerPorts({
|
||||
</datalist>
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<label className="form-label">Ports</label>
|
||||
<label className="form-label">{t("Ports")}</label>
|
||||
<select className="form-select" value={presetKey} onChange={(e) => setPresetKey(e.target.value)}>
|
||||
{PRESETS.map((p) => (
|
||||
<option key={p.key} value={p.key}>
|
||||
@@ -312,7 +313,7 @@ export default function ServerPorts({
|
||||
min={1}
|
||||
max={65535}
|
||||
required
|
||||
aria-label="First port"
|
||||
aria-label={t("First port")}
|
||||
value={customFrom}
|
||||
onChange={(e) => setCustomFrom(e.target.value)}
|
||||
/>
|
||||
@@ -323,7 +324,7 @@ export default function ServerPorts({
|
||||
min={1}
|
||||
max={65535}
|
||||
required
|
||||
aria-label="Last port"
|
||||
aria-label={t("Last port")}
|
||||
value={customTo}
|
||||
onChange={(e) => setCustomTo(e.target.value)}
|
||||
/>
|
||||
@@ -368,7 +369,7 @@ export default function ServerPorts({
|
||||
key={r[0]}
|
||||
type="button"
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
title="Reserve this port"
|
||||
title={t("Reserve this port")}
|
||||
disabled={!canEdit}
|
||||
onClick={() => openNote({ port: String(r[0]) })}
|
||||
>
|
||||
@@ -382,10 +383,10 @@ export default function ServerPorts({
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-secondary">No port in this range was confirmed free.</div>
|
||||
<div className="text-secondary">{t("No port in this range was confirmed free.")}</div>
|
||||
)}
|
||||
{result.freeRanges.length > 0 && canEdit && (
|
||||
<div className="text-secondary small mt-2">Click a range to reserve a port from it with a note.</div>
|
||||
<div className="text-secondary small mt-2">{t("Click a range to reserve a port from it with a note.")}</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
@@ -444,9 +445,9 @@ export default function ServerPorts({
|
||||
{editing ? "Save" : "Add"}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setNote(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
{!editing && <span className="text-secondary small align-self-center">A port with a note counts as taken, even when nothing is listening.</span>}
|
||||
{!editing && <span className="text-secondary small align-self-center">{t("A port with a note counts as taken, even when nothing is listening.")}</span>}
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
@@ -455,7 +456,7 @@ export default function ServerPorts({
|
||||
<input
|
||||
className="form-control form-control-sm mb-2"
|
||||
style={{ maxWidth: 280 }}
|
||||
placeholder="Filter by port, service, or comment"
|
||||
placeholder={t("Filter by port, service, or comment")}
|
||||
value={filter}
|
||||
onChange={(e) => setFilter(e.target.value)}
|
||||
/>
|
||||
@@ -475,10 +476,10 @@ export default function ServerPorts({
|
||||
<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="Status" sortKeyName="state" 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} />
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -500,8 +501,8 @@ export default function ServerPorts({
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
{p.isNew && (
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => void markExpected(p)} title="Notes it as expected, so there is no alert for it">
|
||||
Mark as expected
|
||||
<button className="btn btn-sm btn-outline-primary" onClick={() => void markExpected(p)} title={t("Notes it as expected, so there is no alert for it")}>
|
||||
{t("Mark as expected")}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => editEntry(p)}>
|
||||
@@ -522,7 +523,7 @@ export default function ServerPorts({
|
||||
</div>
|
||||
)}
|
||||
{visible && visible.length === 0 && data && data.ports.length > 0 && (
|
||||
<div className="card-body pt-0 text-secondary">Nothing matches that filter.</div>
|
||||
<div className="card-body pt-0 text-secondary">{t("Nothing matches that filter.")}</div>
|
||||
)}
|
||||
<Pagination page={page} pageCount={pageCount} totalCount={totalCount} onPageChange={setPage} />
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Link } from "react-router-dom";
|
||||
import type { AlertItem, HealthCheckSettings, MaintenanceWindow, ServerHardware, ServerRecord } from "../api/client";
|
||||
import { serverStrip, type StripTile, type StripTone } from "../utils/serverStrip";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const TEXT: Record<StripTone, string> = { ok: "text-green", warn: "text-yellow", bad: "text-red", info: "text-blue", muted: "" };
|
||||
|
||||
@@ -36,7 +37,7 @@ function Tile({ t }: { t: StripTile }) {
|
||||
export default function ServerStatusStrip({ server, hardware, defaults, alerts, windows }: { server: ServerRecord; hardware: ServerHardware; defaults: HealthCheckSettings; alerts: AlertItem[] | null; windows: MaintenanceWindow[] | null }) {
|
||||
const tiles = serverStrip({ server, hardware, defaults, alerts, windows });
|
||||
return (
|
||||
<div className="row g-2 mb-3" role="group" aria-label="How this server is">
|
||||
<div className="row g-2 mb-3" role="group" aria-label={t("How this server is")}>
|
||||
{tiles.map((t) => (
|
||||
<Tile key={t.id} t={t} />
|
||||
))}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api } from "../api/client";
|
||||
import { normalizeTagInput, tagBadge, useTagColors } from "../utils/tags";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export function TagBadges({ tags, linked = false }: { tags: string[]; linked?: boolean }) {
|
||||
const colors = useTagColors();
|
||||
@@ -101,7 +102,7 @@ export default function ServerTags({
|
||||
<div className="card mb-3">
|
||||
<div className="card-body">
|
||||
<ErrorNotice error={error} />
|
||||
<label className="form-label">Tags</label>
|
||||
<label className="form-label">{t("Tags")}</label>
|
||||
<div className="d-flex flex-wrap align-items-center gap-1 mb-2">
|
||||
{draftTags.map((tag) => {
|
||||
const { className, style } = tagBadge(tag, colors);
|
||||
@@ -118,13 +119,13 @@ export default function ServerTags({
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
{draftTags.length === 0 && <span className="text-secondary small">No tags yet.</span>}
|
||||
{draftTags.length === 0 && <span className="text-secondary small">{t("No tags yet.")}</span>}
|
||||
</div>
|
||||
<div className="d-flex gap-2">
|
||||
<input
|
||||
className="form-control"
|
||||
list={`tag-suggestions-${serverId}`}
|
||||
placeholder="Type a tag and press Enter — e.g. prod, media, rack-1"
|
||||
placeholder={t("Type a tag and press Enter — e.g. prod, media, rack-1")}
|
||||
maxLength={40}
|
||||
value={input}
|
||||
autoFocus
|
||||
@@ -146,15 +147,15 @@ export default function ServerTags({
|
||||
))}
|
||||
</datalist>
|
||||
<button className="btn btn-primary" onClick={save} disabled={saving}>
|
||||
Save
|
||||
{t("Save")}
|
||||
</button>
|
||||
<button className="btn" onClick={() => setEditing(false)} disabled={saving}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
{suggestions.some((s) => !draftTags.includes(s)) && (
|
||||
<div className="d-flex flex-wrap align-items-center gap-1 mt-2">
|
||||
<span className="text-secondary small me-1">Add:</span>
|
||||
<span className="text-secondary small me-1">{t("Add:")}</span>
|
||||
{suggestions
|
||||
.filter((s) => !draftTags.includes(s))
|
||||
.slice(0, 30)
|
||||
@@ -168,7 +169,7 @@ export default function ServerTags({
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-secondary small mt-2">Lowercase letters, numbers and - _ . : / — up to 12 tags per server.</div>
|
||||
<div className="text-secondary small mt-2">{t("Lowercase letters, numbers and - _ . : / — up to 12 tags per server.")}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { formatDateTime, is24HourFormat } from "../utils/date";
|
||||
import { sortItems, type SortDirection } from "../hooks/useSortable";
|
||||
import SortableTh from "./SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export const SCHEDULE_TYPE_LABELS: Record<string, string> = {
|
||||
cron: "Cron jobs",
|
||||
@@ -97,7 +98,7 @@ export default function ServerTaskTable({
|
||||
{tasks.length > 0 && (
|
||||
<div className="card-body py-2 d-flex justify-content-end">
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={exportCsv}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -110,7 +111,7 @@ export default function ServerTaskTable({
|
||||
<table className="table table-vcenter card-table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<TaskRecord> label="Name" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<TaskRecord> label={t("Name")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<TaskRecord>
|
||||
label="Command"
|
||||
sortKeyName="command"
|
||||
@@ -126,20 +127,20 @@ export default function ServerTaskTable({
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<TaskRecord>
|
||||
label="Next run"
|
||||
label={t("Next run")}
|
||||
sortKeyName="nextRunAt"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<TaskRecord>
|
||||
label="Status"
|
||||
label={t("Status")}
|
||||
sortKeyName="enabled"
|
||||
activeKey={sortKey}
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
{canEditTasks && <th className="w-1">Actions</th>}
|
||||
{canEditTasks && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -173,9 +174,9 @@ export default function ServerTaskTable({
|
||||
{task.isStale ? (
|
||||
<span className="badge bg-red-lt text-red me-1">Missing</span>
|
||||
) : task.enabled ? (
|
||||
<span className="badge bg-green-lt text-green me-1">Enabled</span>
|
||||
<span className="badge bg-green-lt text-green me-1">{t("Enabled")}</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary me-1">Disabled</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>}
|
||||
</td>
|
||||
@@ -184,10 +185,10 @@ export default function ServerTaskTable({
|
||||
{task.origin === "manual" && (
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm" onClick={() => onEdit(task)}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => onDelete(task)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { api, type HealthCheckSettings, type ServerRecord, type ServerThresholds
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { t } from "../i18n";
|
||||
|
||||
type Field = "serverOfflineMinutes" | "diskUsagePercent" | "diskForecastDays" | "backupStaleHours";
|
||||
|
||||
@@ -77,10 +78,10 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Alert limits</h3>
|
||||
<h3 className="card-title">{t("Alert limits")}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="text-secondary small mb-2">This server has limits of its own; everything else follows Settings.</div>
|
||||
<div className="text-secondary small mb-2">{t("This server has limits of its own; everything else follows Settings.")}</div>
|
||||
<ul className="mb-0">
|
||||
{FIELDS.filter((f) => own?.[f.key] !== undefined).map((f) => (
|
||||
<li key={f.key}>
|
||||
@@ -101,7 +102,7 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Alert limits</h3>
|
||||
<h3 className="card-title">{t("Alert limits")}</h3>
|
||||
{has(own) && (
|
||||
<div className="card-actions">
|
||||
<span className="badge bg-blue-lt text-blue">its own limits</span>
|
||||
@@ -115,7 +116,7 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
|
||||
}}
|
||||
>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary small">Leave a box empty to follow Settings → Notifications (shown inside the box). Only what you fill in is different for this server.</p>
|
||||
<p className="text-secondary small">{t("Leave a box empty to follow Settings → Notifications (shown inside the box). Only what you fill in is different for this server.")}</p>
|
||||
<div className="row g-3">
|
||||
{FIELDS.filter((f) => !f.onlyForGuests || isGuest || own?.[f.key] !== undefined).map((f) => (
|
||||
<div className="col-md-6" key={f.key}>
|
||||
@@ -146,8 +147,8 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Disk</th>
|
||||
<th style={{ width: 180 }}>Alert at (%)</th>
|
||||
<th>Leave it alone</th>
|
||||
<th style={{ width: 180 }}>{t("Alert at (%)")}</th>
|
||||
<th>{t("Leave it alone")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -198,7 +199,7 @@ export default function ServerThresholds({ server, defaults, disks, canEdit, onC
|
||||
</button>
|
||||
{has(own) && (
|
||||
<button type="button" className="btn" disabled={busy} onClick={() => void save(own?.ignoreServices?.length ? { ignoreServices: own.ignoreServices } : null)}>
|
||||
Follow Settings again
|
||||
{t("Follow Settings again")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import TimeChart from "./TimeChart";
|
||||
import RangeSelect from "./RangeSelect";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { CHART_RANGES, useChartRange } from "../utils/chartRanges";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function levelColor(series: ServerMetricSeries): string {
|
||||
const v = series.latest ?? 0;
|
||||
@@ -98,12 +99,12 @@ export default function ServerTrends({ serverId }: { serverId: number }) {
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{failed ? (
|
||||
<div className="text-secondary">Couldn't load the history.</div>
|
||||
<div className="text-secondary">{t("Couldn't load the history.")}</div>
|
||||
) : series === null ? (
|
||||
<BlockSkeleton lines={4} />
|
||||
) : series.length === 0 ? (
|
||||
<div className="text-secondary">
|
||||
No history in this stretch yet. A sample is kept about every ten minutes once the agent has reported, and its hours and days after that, so lines appear here after a short while.
|
||||
{t("No history in this stretch yet. A sample is kept about every ten minutes once the agent has reported, and its hours and days after that, so lines appear here after a short while.")}
|
||||
</div>
|
||||
) : (
|
||||
<div className="trend-grid">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { IconCircle, IconCircleCheck, IconX } from "@tabler/icons-react";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export interface SetupStep {
|
||||
id: string;
|
||||
@@ -61,25 +62,25 @@ export default function SetupGuide({ steps }: { steps: SetupStep[] }) {
|
||||
<div className="card-header">
|
||||
<div>
|
||||
<h3 className="card-title" id="setup-guide-title">
|
||||
Getting started
|
||||
{t("Getting started")}
|
||||
</h3>
|
||||
<div className="text-secondary small">
|
||||
{done} of {steps.length} done
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-actions">
|
||||
<button type="button" className="btn btn-sm btn-ghost-secondary" onClick={dismiss} aria-label="Hide the getting started guide" title="Hide this guide (bring it back from the search box: Ctrl K)">
|
||||
<button type="button" className="btn btn-sm btn-ghost-secondary" onClick={dismiss} aria-label={t("Hide the getting started guide")} title={t("Hide this guide (bring it back from the search box: Ctrl K)")}>
|
||||
<IconX size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="progress progress-sm rounded-0" role="progressbar" aria-label="Setup progress" aria-valuemin={0} aria-valuemax={steps.length} aria-valuenow={done}>
|
||||
<div className="progress progress-sm rounded-0" role="progressbar" aria-label={t("Setup progress")} aria-valuemin={0} aria-valuemax={steps.length} aria-valuenow={done}>
|
||||
<div className="progress-bar bg-green" style={{ width: `${(done / steps.length) * 100}%` }} />
|
||||
</div>
|
||||
<ul className="list-group list-group-flush">
|
||||
{steps.map((s) => (
|
||||
<li key={s.id} className="list-group-item d-flex align-items-center gap-3">
|
||||
{s.done ? <IconCircleCheck size={22} className="text-green flex-shrink-0" aria-label="Done" /> : <IconCircle size={22} className="text-secondary flex-shrink-0" aria-label="Not done yet" />}
|
||||
{s.done ? <IconCircleCheck size={22} className="text-green flex-shrink-0" aria-label={t("Done")} /> : <IconCircle size={22} className="text-secondary flex-shrink-0" aria-label={t("Not done yet")} />}
|
||||
<div className="flex-fill" style={{ minWidth: 0 }}>
|
||||
<div className={s.done ? "text-secondary" : "fw-medium"}>{s.title}</div>
|
||||
{!s.done && <div className="text-secondary small">{s.description}</div>}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { GO_SHORTCUTS, OTHER_SHORTCUTS, SHOW_SHORTCUTS_EVENT } from "../layout/shortcuts";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** The keyboard shortcuts, listed. Opens on "?", from the command palette, or when asked for by event. Mount once, near the root. */
|
||||
export default function ShortcutHelp() {
|
||||
@@ -49,7 +50,7 @@ export default function ShortcutHelp() {
|
||||
<h3 className="modal-title" id={titleId}>
|
||||
Keyboard shortcuts
|
||||
</h3>
|
||||
<button ref={closeRef} type="button" className="btn-close" aria-label="Close" onClick={() => setOpen(false)} />
|
||||
<button ref={closeRef} type="button" className="btn-close" aria-label={t("Close")} onClick={() => setOpen(false)} />
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div className="fw-bold mb-2">Go to a page — press g, then…</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState } from "react";
|
||||
import { api, type AlertItem, type MaintenanceTargetType } from "../api/client";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const CHOICES = [
|
||||
{ minutes: 60, label: "1 h", words: "1 hour" },
|
||||
@@ -50,7 +51,7 @@ export default function SilenceButton({ alert, target: given, onDone }: { alert?
|
||||
title={`Silence all alerts about ${target.name} for a while`}
|
||||
onClick={() => setChoosing(true)}
|
||||
>
|
||||
Silence
|
||||
{t("Silence")}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -61,7 +62,7 @@ export default function SilenceButton({ alert, target: given, onDone }: { alert?
|
||||
{c.label}
|
||||
</button>
|
||||
))}
|
||||
<button type="button" className="btn" disabled={busy} onClick={() => setChoosing(false)} aria-label="Cancel">
|
||||
<button type="button" className="btn" disabled={busy} onClick={() => setChoosing(false)} aria-label={t("Cancel")}>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { CSSProperties } from "react";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** A grey bar with a slow shimmer, standing where text or a figure will be, so the page keeps its shape while it loads. */
|
||||
export function Skeleton({ width = "100%", height = "1rem", className = "", style }: { width?: string | number; height?: string | number; className?: string; style?: CSSProperties }) {
|
||||
@@ -18,7 +19,7 @@ export function WidgetSkeleton() {
|
||||
))}
|
||||
</div>
|
||||
<Skeleton height="0.55rem" className="d-block" />
|
||||
<span className="visually-hidden">Loading…</span>
|
||||
<span className="visually-hidden">{t("Loading…")}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -31,7 +32,7 @@ export function BlockSkeleton({ lines = 3 }: { lines?: number }) {
|
||||
{Array.from({ length: lines }, (_, i) => (
|
||||
<Skeleton key={i} width={widths[i % widths.length]} height="0.95rem" className="d-block mb-2" />
|
||||
))}
|
||||
<span className="visually-hidden">Loading…</span>
|
||||
<span className="visually-hidden">{t("Loading…")}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -46,7 +47,7 @@ export function PageSkeleton() {
|
||||
<BlockSkeleton lines={5} />
|
||||
</div>
|
||||
</div>
|
||||
<span className="visually-hidden">Loading…</span>
|
||||
<span className="visually-hidden">{t("Loading…")}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { toast } from "../utils/toast";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { t } from "../i18n";
|
||||
|
||||
interface Choice {
|
||||
key: string;
|
||||
@@ -114,13 +115,13 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
|
||||
<p className="text-secondary small">Whoever has the address sees only the name you give each thing and whether it is working — nothing else about it.</p>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="sp-title">
|
||||
Heading <span className="text-secondary">(optional)</span>
|
||||
Heading <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<input id="sp-title" className="form-control" maxLength={60} placeholder={linkLabel} value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="sp-message">
|
||||
Message <span className="text-secondary">(optional)</span>
|
||||
Message <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<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>
|
||||
@@ -140,14 +141,14 @@ export default function StatusPageEditor({ linkId, linkLabel, onClose, onSaved }
|
||||
</div>
|
||||
</div>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button type="button" className="btn btn-sm btn-ghost-secondary" aria-label="Move up" disabled={i === 0} onClick={() => move(i, -1)}>
|
||||
<button type="button" className="btn btn-sm btn-ghost-secondary" aria-label={t("Move up")} disabled={i === 0} onClick={() => move(i, -1)}>
|
||||
▲
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-ghost-secondary" aria-label="Move down" disabled={i === items.length - 1} onClick={() => move(i, 1)}>
|
||||
<button type="button" className="btn btn-sm btn-ghost-secondary" aria-label={t("Move down")} disabled={i === items.length - 1} onClick={() => move(i, 1)}>
|
||||
▼
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" aria-label={`Remove ${it.label}`} onClick={() => setItems((prev) => prev.filter((_, j) => j !== i))}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useAlertsReport } from "../hooks/useAlertsReport";
|
||||
import { summariseAlerts } from "../utils/alertSummary";
|
||||
import { CATEGORY_LABELS } from "./RoutingEditor";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t, tn } from "../i18n";
|
||||
|
||||
const SEVERITY_ORDER = { critical: 0, warning: 1, info: 2 } as const;
|
||||
|
||||
@@ -40,26 +41,26 @@ export default function StatusStrip() {
|
||||
const unsure = needs === 0 && blind > 0;
|
||||
const tone = unsure ? "yellow" : sum.tone;
|
||||
const headline = unsure
|
||||
? "No active alerts, but some checks couldn't run"
|
||||
? t("No active alerts, but some checks couldn't run")
|
||||
: needs > 0
|
||||
? `${needs} ${needs === 1 ? "thing needs" : "things need"} attention`
|
||||
? tn(needs, "{n} thing needs attention", "{n} things need attention")
|
||||
: sum.acknowledged > 0
|
||||
? "Nothing new"
|
||||
: "All clear";
|
||||
? t("Nothing new")
|
||||
: t("All clear");
|
||||
|
||||
const notes: string[] = [];
|
||||
if (needs === 0 && sum.acknowledged > 0) notes.push(`${sum.acknowledged} acknowledged — somebody is on ${sum.acknowledged === 1 ? "it" : "them"}`);
|
||||
else if (sum.acknowledged > 0) notes.push(`${sum.acknowledged} more acknowledged`);
|
||||
if (silenced > 0) notes.push(`${silenced} silenced by maintenance`);
|
||||
if (sum.held > 0 && sum.roots.length === 0) notes.push(`${sum.held} more explained by something that is down`);
|
||||
if (needs === 0 && !unsure && notes.length === 0) notes.push("No active alerts.");
|
||||
if (unsure) notes.push(`${report.couldntCheck.map((c) => c.name).join(", ")} — see Alerts for what that leaves unchecked`);
|
||||
else if (blind > 0) notes.push(`${blind} check${blind === 1 ? "" : "s"} couldn't run`);
|
||||
if (needs === 0 && sum.acknowledged > 0) notes.push(tn(sum.acknowledged, "{n} acknowledged — somebody is on it", "{n} acknowledged — somebody is on them"));
|
||||
else if (sum.acknowledged > 0) notes.push(t("{n} more acknowledged", { n: sum.acknowledged }));
|
||||
if (silenced > 0) notes.push(t("{n} silenced by maintenance", { n: silenced }));
|
||||
if (sum.held > 0 && sum.roots.length === 0) notes.push(t("{n} more explained by something that is down", { n: sum.held }));
|
||||
if (needs === 0 && !unsure && notes.length === 0) notes.push(t("No active alerts."));
|
||||
if (unsure) notes.push(t("{names} — see Alerts for what that leaves unchecked", { names: report.couldntCheck.map((c) => c.name).join(", ") }));
|
||||
else if (blind > 0) notes.push(tn(blind, "{n} check couldn't run", "{n} checks couldn't run"));
|
||||
|
||||
const Icon = tone === "green" ? IconCircleCheck : IconAlertTriangle;
|
||||
|
||||
return (
|
||||
<section className={`card mb-3 status-banner status-banner-${tone}`} aria-label="Status" role={tone === "red" ? "alert" : "status"}>
|
||||
<section className={`card mb-3 status-banner status-banner-${tone}`} aria-label={t("Status")} role={tone === "red" ? "alert" : "status"}>
|
||||
<div className="card-body">
|
||||
<div className="d-flex gap-3">
|
||||
<Icon size={32} className={`flex-shrink-0 status-banner-icon status-banner-icon-${tone}`} aria-hidden="true" />
|
||||
@@ -67,7 +68,7 @@ export default function StatusStrip() {
|
||||
<div className="d-flex flex-wrap align-items-center gap-2">
|
||||
<h3 className="mb-0">{headline}</h3>
|
||||
<Link to="/alerts" className="btn btn-sm ms-auto flex-shrink-0">
|
||||
{needs > 0 ? "View all alerts" : "Alerts"}
|
||||
{needs > 0 ? t("View all alerts") : t("Alerts")}
|
||||
</Link>
|
||||
</div>
|
||||
{sum.roots.length > 0 && (
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { IconSearch } from "@tabler/icons-react";
|
||||
import SaveViewButton from "./SaveViewButton";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/** The search box every table uses, so they look and behave alike. Esc clears it. */
|
||||
export function SearchBox({
|
||||
value,
|
||||
onChange,
|
||||
placeholder = "Search…",
|
||||
placeholder,
|
||||
className = "",
|
||||
}: {
|
||||
value: string;
|
||||
@@ -14,6 +15,7 @@ export function SearchBox({
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
const hint = placeholder ?? t("Search…");
|
||||
return (
|
||||
<div className={`input-icon table-search ${className}`.trim()}>
|
||||
<span className="input-icon-addon">
|
||||
@@ -22,8 +24,8 @@ export function SearchBox({
|
||||
<input
|
||||
type="search"
|
||||
className="form-control form-control-sm"
|
||||
placeholder={placeholder}
|
||||
aria-label={placeholder}
|
||||
placeholder={hint}
|
||||
aria-label={hint}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Escape" && value && onChange("")}
|
||||
@@ -66,13 +68,13 @@ export default function TableToolbar({
|
||||
<div className="table-toolbar-inner">
|
||||
<SearchBox value={search} onChange={onSearch} placeholder={placeholder} />
|
||||
{filters}
|
||||
{narrowed && <span className="text-secondary small">{shown} of {total}</span>}
|
||||
{narrowed && <span className="text-secondary small">{t("{shown} of {total}", { shown, total })}</span>}
|
||||
<div className="table-toolbar-actions">
|
||||
<SaveViewButton />
|
||||
{actions}
|
||||
{onExport && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={onExport} disabled={exportDisabled}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { formatDateTime, parseDbTimestamp } from "../utils/date";
|
||||
import { formatAgo, formatRemaining } from "../utils/duration";
|
||||
import { t } from "../i18n";
|
||||
|
||||
// One shared clock for every TimeAgo on screen: "5 min ago" moves on by itself without each one running its own timer.
|
||||
const listeners = new Set<() => void>();
|
||||
@@ -39,7 +40,7 @@ export default function TimeAgo({ value, fromDb, empty = "—" }: { value: strin
|
||||
const future = date.getTime() > Date.now() + 60_000;
|
||||
return (
|
||||
<time dateTime={iso} title={formatDateTime(date)}>
|
||||
{future ? `in ${formatRemaining(iso)}` : formatAgo(iso)}
|
||||
{future ? t("in {time}", { time: formatRemaining(iso) }) : formatAgo(iso)}
|
||||
</time>
|
||||
);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { IconAlertTriangle, IconCircleCheck, IconInfoCircle, IconX } from "@tabler/icons-react";
|
||||
import { dismissToast, subscribeToasts, type ToastItem } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const LIFETIME_MS = { success: 4_500, info: 6_000, error: 9_000 } as const;
|
||||
/** A toast with a button stays long enough to decide to press it. */
|
||||
@@ -39,7 +40,7 @@ function ToastView({ item }: { item: ToastItem }) {
|
||||
{item.action.label}
|
||||
</button>
|
||||
)}
|
||||
<button type="button" className="toast-close" aria-label="Dismiss" onClick={() => dismissToast(item.id)}>
|
||||
<button type="button" className="toast-close" aria-label={t("Dismiss")} onClick={() => dismissToast(item.id)}>
|
||||
<IconX size={16} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { BlockSkeleton } from "./Skeleton";
|
||||
import { refreshMyWork } from "../hooks/useMyWork";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* The open jobs on the to-do list that are about this server or device, with a box to tick one off and (for operators) a line to add another that is already about it.
|
||||
@@ -80,7 +81,7 @@ export default function TodosCard({ targetType, targetId, canEdit, bare = false
|
||||
) : jobs === null ? (
|
||||
<BlockSkeleton lines={2} />
|
||||
) : jobs.length === 0 ? (
|
||||
<div className="text-secondary">Nothing to do about this.</div>
|
||||
<div className="text-secondary">{t("Nothing to do about this.")}</div>
|
||||
) : (
|
||||
<ul className="list-group list-group-flush mb-2">
|
||||
{jobs.map((t) => {
|
||||
@@ -107,15 +108,15 @@ export default function TodosCard({ targetType, targetId, canEdit, bare = false
|
||||
)}
|
||||
{canEdit && (
|
||||
<form className="d-flex flex-wrap gap-2" onSubmit={(e) => void add(e)}>
|
||||
<input className="form-control flex-fill" style={{ minWidth: "12rem", width: "auto" }} maxLength={160} value={title} onChange={(e) => setTitle(e.target.value)} placeholder="Add a job about this…" aria-label="A job about this" />
|
||||
<input type="date" className="form-control w-auto" value={due} onChange={(e) => setDue(e.target.value)} aria-label="Due day (optional)" />
|
||||
<input className="form-control flex-fill" style={{ minWidth: "12rem", width: "auto" }} maxLength={160} value={title} onChange={(e) => setTitle(e.target.value)} placeholder={t("Add a job about this…")} aria-label={t("A job about this")} />
|
||||
<input type="date" className="form-control w-auto" value={due} onChange={(e) => setDue(e.target.value)} aria-label={t("Due day (optional)")} />
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || title.trim() === ""}>
|
||||
Add
|
||||
{t("Add")}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
<div className="small mt-2">
|
||||
<Link to="/todo">All jobs</Link>
|
||||
<Link to="/todo">{t("All jobs")}</Link>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -123,14 +124,14 @@ export default function TodosCard({ targetType, targetId, canEdit, bare = false
|
||||
if (bare)
|
||||
return (
|
||||
<>
|
||||
<h4 className="mb-2">To do</h4>
|
||||
<h4 className="mb-2">{t("To do")}</h4>
|
||||
{content}
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">To do{jobs && jobs.length > 0 ? ` (${jobs.length})` : ""}</h3>
|
||||
<h3 className="card-title">{t("To do")}{jobs && jobs.length > 0 ? ` (${jobs.length})` : ""}</h3>
|
||||
</div>
|
||||
<div className="card-body">{content}</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { toast } from "../utils/toast";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import UpdatesBadge from "./UpdatesBadge";
|
||||
import { t } from "../i18n";
|
||||
|
||||
interface Loaded {
|
||||
integration: IntegrationSummary;
|
||||
@@ -145,15 +146,15 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
|
||||
</div>
|
||||
|
||||
{failed ? (
|
||||
<div className="text-secondary">Couldn't load the integrations.</div>
|
||||
<div className="text-secondary">{t("Couldn't load the integrations.")}</div>
|
||||
) : loaded === null ? (
|
||||
<BlockSkeleton lines={3} />
|
||||
) : loaded.length === 0 ? (
|
||||
<div className="text-secondary">
|
||||
There is no Semaphore connected. Add one under <Link to="/integrations">Integrations</Link>, with a playbook that {restartOnly ? "restarts a server" : "applies updates"}, and this server can be {restartOnly ? "restarted" : "updated"} from here.
|
||||
There is no Semaphore connected. Add one under <Link to="/integrations">{t("Integrations")}</Link>, with a playbook that {restartOnly ? "restarts a server" : "applies updates"}, and this server can be {restartOnly ? "restarted" : "updated"} from here.
|
||||
</div>
|
||||
) : options.length === 0 ? (
|
||||
<div className="text-secondary">No templates found in Semaphore.</div>
|
||||
<div className="text-secondary">{t("No templates found in Semaphore.")}</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="mb-3">
|
||||
@@ -161,19 +162,19 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
|
||||
</div>
|
||||
{watching && (
|
||||
<div className="alert alert-warning" role="status">
|
||||
<strong>Somebody is watching.</strong> {watching[0].toUpperCase()}
|
||||
<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.
|
||||
</div>
|
||||
)}
|
||||
<ol className="text-secondary small ps-3 mb-3">
|
||||
<li>Alerts for this server are silenced (a maintenance window).</li>
|
||||
<li>The playbook runs in Semaphore, for this server only.</li>
|
||||
<li>Homelab Manager waits for the server to report again — it may be restarting.</li>
|
||||
<li>{t("Alerts for this server are silenced (a maintenance window).")}</li>
|
||||
<li>{t("The playbook runs in Semaphore, for this server only.")}</li>
|
||||
<li>{t("Homelab Manager waits for the server to report again — it may be restarting.")}</li>
|
||||
{restartOnly ? (
|
||||
<li>It checks that the server did start again (from its uptime), and the window ends.</li>
|
||||
<li>{t("It checks that the server did start again (from its uptime), and the window ends.")}</li>
|
||||
) : (
|
||||
<>
|
||||
{restartPicked && <li>If the server then says a restart is due, the restart playbook runs, and the server is checked to have started again.</li>}
|
||||
{restartPicked && <li>{t("If the server then says a restart is due, the restart playbook runs, and the server is checked to have started again.")}</li>}
|
||||
<li>It tells you what is still waiting{restartPicked ? "" : " and whether a restart is due"}, and the window ends.</li>
|
||||
</>
|
||||
)}
|
||||
@@ -183,7 +184,7 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
|
||||
{restartOnly ? "Playbook that restarts the server" : "Playbook that applies updates"}
|
||||
</label>
|
||||
<select id="ur-template" className="form-select" value={choice} onChange={(e) => setChoice(e.target.value)}>
|
||||
<option value="">Choose a template…</option>
|
||||
<option value="">{t("Choose a template…")}</option>
|
||||
{options.map((o) => (
|
||||
<option key={o.key} value={o.key}>
|
||||
{o.label}
|
||||
@@ -194,29 +195,29 @@ export default function UpdateRunDrawer({ server, mode = "update", onClose, onSt
|
||||
{!restartOnly && (
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="ur-restart">
|
||||
Restart it afterwards, if it says a restart is due, with
|
||||
{t("Restart it afterwards, if it says a restart is due, with")}
|
||||
</label>
|
||||
<select id="ur-restart" className="form-select" value={restartPicked ? restartChoice : ""} onChange={(e) => setRestartChoice(e.target.value)} disabled={!picked}>
|
||||
<option value="">No second playbook (the update playbook may restart it itself)</option>
|
||||
<option value="">{t("No second playbook (the update playbook may restart it itself)")}</option>
|
||||
{restartOptions.map((o) => (
|
||||
<option key={o.key} value={o.key}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="form-hint text-secondary small mt-1">A playbook that only restarts the server. It runs once the updates are in and the server has reported again.</div>
|
||||
<div className="form-hint text-secondary small mt-1">{t("A playbook that only restarts the server. It runs once the updates are in and the server has reported again.")}</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="ur-limit">
|
||||
Run it on — the host name as it is in the Semaphore inventory
|
||||
{t("Run it on — the host name as it is in the Semaphore inventory")}
|
||||
</label>
|
||||
<input id="ur-limit" className="form-control" value={limit} maxLength={200} onChange={(e) => setLimit(e.target.value)} placeholder="e.g. web01" />
|
||||
<div className="form-hint text-secondary small mt-1">{restartOnly ? "A restart" : "An update run"} is always for this one server, never the whole inventory.</div>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="ur-window">
|
||||
Silence its alerts for up to
|
||||
{t("Silence its alerts for up to")}
|
||||
</label>
|
||||
<select id="ur-window" className="form-select" value={minutes} onChange={(e) => setMinutes(Number(e.target.value))}>
|
||||
{WINDOWS.map((w) => (
|
||||
|
||||
@@ -5,6 +5,7 @@ import { confirmDialog } from "../utils/dialogs";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const TASK_WORDS: Record<string, string> = {
|
||||
waiting: "waiting to start in Semaphore",
|
||||
@@ -19,19 +20,19 @@ const TASK_WORDS: Record<string, string> = {
|
||||
export function describeRun(run: UpdateRun): { label: string; badge: string } {
|
||||
switch (run.status) {
|
||||
case "running":
|
||||
return { label: TASK_WORDS[run.taskStatus ?? ""] ?? "playbook running", badge: "bg-blue-lt text-blue" };
|
||||
return { label: t(TASK_WORDS[run.taskStatus ?? ""] ?? "playbook running"), badge: "bg-blue-lt text-blue" };
|
||||
case "waiting_for_host":
|
||||
return { label: run.kind === "restart" ? "waiting for the server to come back" : "waiting for the server to report again", badge: "bg-blue-lt text-blue" };
|
||||
return { label: run.kind === "restart" ? t("waiting for the server to come back") : t("waiting for the server to report again"), badge: "bg-blue-lt text-blue" };
|
||||
case "restarting":
|
||||
return { label: TASK_WORDS[run.restartTaskStatus ?? ""] ? `restart: ${TASK_WORDS[run.restartTaskStatus ?? ""]}` : "restart playbook running", badge: "bg-blue-lt text-blue" };
|
||||
return { label: TASK_WORDS[run.restartTaskStatus ?? ""] ? t("restart: {state}", { state: t(TASK_WORDS[run.restartTaskStatus ?? ""]) }) : t("restart playbook running"), badge: "bg-blue-lt text-blue" };
|
||||
case "waiting_for_restart":
|
||||
return { label: "waiting for the server to come back from its restart", badge: "bg-blue-lt text-blue" };
|
||||
return { label: t("waiting for the server to come back from its restart"), badge: "bg-blue-lt text-blue" };
|
||||
case "done":
|
||||
return { label: "finished", badge: run.rebootRequired ? "bg-yellow-lt text-yellow" : "bg-green-lt text-green" };
|
||||
return { label: t("finished"), badge: run.rebootRequired ? "bg-yellow-lt text-yellow" : "bg-green-lt text-green" };
|
||||
case "failed":
|
||||
return { label: "didn't finish", badge: "bg-red-lt text-red" };
|
||||
return { label: t("didn't finish"), badge: "bg-red-lt text-red" };
|
||||
default:
|
||||
return { label: "stopped being followed", badge: "bg-secondary-lt text-secondary" };
|
||||
return { label: t("stopped being followed"), badge: "bg-secondary-lt text-secondary" };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,16 +72,16 @@ export default function UpdateRunsCard({ canEdit, reloadKey, onFinished }: { can
|
||||
async function stop(run: UpdateRun) {
|
||||
if (
|
||||
!(await confirmDialog({
|
||||
title: "Stop following this run?",
|
||||
message: `The maintenance window on ${run.serverName} ends now. A playbook already started keeps running in Semaphore — it can't be stopped from here.`,
|
||||
confirmLabel: "Stop following",
|
||||
title: t("Stop following this run?"),
|
||||
message: t("The maintenance window on {name} ends now. A playbook already started keeps running in Semaphore — it can't be stopped from here.", { name: run.serverName ?? "" }),
|
||||
confirmLabel: t("Stop following"),
|
||||
danger: true,
|
||||
}))
|
||||
)
|
||||
return;
|
||||
try {
|
||||
await api.updateRuns.cancel(run.id);
|
||||
toast.success("No longer following it.");
|
||||
toast.success(t("No longer following it."));
|
||||
setRuns((await api.updateRuns.list()).runs);
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
@@ -91,8 +92,8 @@ export default function UpdateRunsCard({ canEdit, reloadKey, onFinished }: { can
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Update runs</h3>
|
||||
<div className="card-actions text-secondary small">{active ? "checking every few seconds" : "most recent first"}</div>
|
||||
<h3 className="card-title">{t("Update runs")}</h3>
|
||||
<div className="card-actions text-secondary small">{active ? t("checking every few seconds") : t("most recent first")}</div>
|
||||
</div>
|
||||
<div className="list-group list-group-flush">
|
||||
{runs.slice(0, 8).map((r) => {
|
||||
@@ -103,16 +104,16 @@ export default function UpdateRunsCard({ canEdit, reloadKey, onFinished }: { can
|
||||
<Link to={`/servers/${r.serverId}`}>
|
||||
<strong>{r.serverName ?? `server #${r.serverId}`}</strong>
|
||||
</Link>
|
||||
<span className="text-secondary">{r.kind === "restart" ? "Restart · " : ""}{r.template}{r.restartTemplate && r.kind === "update" ? ` (then ${r.restartTemplate} if a restart is due)` : ""}</span>
|
||||
<span className="text-secondary">{r.kind === "restart" ? `${t("Restart")} · ` : ""}{r.template}{r.restartTemplate && r.kind === "update" ? ` ${t("(then {name} if a restart is due)", { name: r.restartTemplate })}` : ""}</span>
|
||||
<span className={`badge ${w.badge}`}>{w.label}</span>
|
||||
{r.status === "done" && r.restarted && <span className="badge bg-green-lt text-green">restarted</span>}
|
||||
{r.status === "done" && r.rebootRequired && <span className="badge bg-yellow-lt text-yellow">restart needed</span>}
|
||||
{r.status === "done" && r.restarted && <span className="badge bg-green-lt text-green">{t("restarted")}</span>}
|
||||
{r.status === "done" && r.rebootRequired && <span className="badge bg-yellow-lt text-yellow">{t("restart needed")}</span>}
|
||||
<span className="text-secondary small ms-auto">
|
||||
started <TimeAgo value={r.startedAt} /> by {r.startedBy ?? "someone"}
|
||||
{t("started")} <TimeAgo value={r.startedAt} /> {t("by {name}", { name: r.startedBy ?? t("someone") })}
|
||||
</span>
|
||||
{canEdit && r.active && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void stop(r)}>
|
||||
Stop following
|
||||
{t("Stop following")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -124,8 +125,8 @@ export default function UpdateRunsCard({ canEdit, reloadKey, onFinished }: { can
|
||||
)}
|
||||
{r.taskId !== null && (
|
||||
<div className="text-secondary small">
|
||||
Run #{r.taskId} in Semaphore — the playbook's output is there.
|
||||
{r.restartTaskId !== null && <> The restart is run #{r.restartTaskId}.</>}
|
||||
{t("Run #{id} in Semaphore — the playbook's output is there.", { id: r.taskId })}
|
||||
{r.restartTaskId !== null && <> {t("The restart is run #{id}.", { id: r.restartTaskId })}</>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { PendingUpdates } from "../api/client";
|
||||
import { t } from "../i18n";
|
||||
|
||||
/**
|
||||
* What a server has waiting: "Up to date", "5 waiting" or "5 waiting, 2 security" (red when any are security fixes), and a
|
||||
@@ -7,8 +8,8 @@ import type { PendingUpdates } from "../api/client";
|
||||
export default function UpdatesBadge({ updates }: { updates: PendingUpdates | null }) {
|
||||
if (!updates) {
|
||||
return (
|
||||
<span className="badge bg-secondary-lt text-secondary" title="This server's agent hasn't reported updates — it may be an older agent, or its package manager isn't one it can ask.">
|
||||
not reported
|
||||
<span className="badge bg-secondary-lt text-secondary" title={t("This server's agent hasn't reported updates — it may be an older agent, or its package manager isn't one it can ask.")}>
|
||||
{t("not reported")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -17,9 +18,9 @@ export default function UpdatesBadge({ updates }: { updates: PendingUpdates | nu
|
||||
return (
|
||||
<span className="d-inline-flex flex-wrap align-items-center gap-1">
|
||||
<span className={`badge ${level}`}>
|
||||
{updates.count === 0 ? "Up to date" : `${updates.count} waiting${security > 0 ? `, ${security} security` : ""}`}
|
||||
{updates.count === 0 ? t("Up to date") : security > 0 ? t("{n} waiting, {security} security", { n: updates.count, security }) : t("{n} waiting", { n: updates.count })}
|
||||
</span>
|
||||
{updates.rebootRequired && <span className="badge bg-orange-lt text-orange">restart needed</span>}
|
||||
{updates.rebootRequired && <span className="badge bg-orange-lt text-orange">{t("restart needed")}</span>}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import RangeSelect from "./RangeSelect";
|
||||
import TimeChart from "./TimeChart";
|
||||
import { BlockSkeleton } from "./Skeleton";
|
||||
import { useChartRange } from "../utils/chartRanges";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const DAY_MS = 24 * 3600_000;
|
||||
/** A day of uptime is drawn green when nothing was wrong, amber for some time down, red for most of the day. */
|
||||
@@ -64,7 +65,7 @@ export default function UptimeHistory({ kind, id, name }: { kind: "servers" | "i
|
||||
<>
|
||||
<div className="mb-2">
|
||||
<span className="h3 me-2">{series.percent}%</span>
|
||||
<span className="text-secondary">up over the last {days} days</span>
|
||||
<span className="text-secondary">{t("up over the last {days} days", { days })}</span>
|
||||
</div>
|
||||
<TimeChart series={lines} from={to - days * DAY_MS} to={to} bars barColor={dayColor} label={`${name}: share of each day it was up, over the last ${days} days. ${series.percent}% in all.`} />
|
||||
<div className="text-secondary small mt-2">
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { WallGroup, WallTile } from "../api/client";
|
||||
import { formatDate, formatTime } from "../utils/date";
|
||||
import { formatRemaining } from "../utils/duration";
|
||||
import { groupMembers, pageOrOverview, ROTATE_CHOICES, stepPage, wallPages } from "../utils/wallPages";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export const REFRESH_MS = 30_000;
|
||||
|
||||
@@ -226,7 +227,7 @@ export default function WallView({
|
||||
<div>
|
||||
{data.problems && (
|
||||
<>
|
||||
<h2 className="wall-heading">Needs attention</h2>
|
||||
<h2 className="wall-heading">{t("Needs attention")}</h2>
|
||||
{data.problems.length === 0 ? (
|
||||
<div className="wall-empty">Nothing right now.</div>
|
||||
) : (
|
||||
@@ -259,7 +260,7 @@ export default function WallView({
|
||||
<div>
|
||||
{data.integrations && (
|
||||
<>
|
||||
<h2 className="wall-heading">Integrations</h2>
|
||||
<h2 className="wall-heading">{t("Integrations")}</h2>
|
||||
{data.integrations.length === 0 ? (
|
||||
<div className="wall-empty">None connected.</div>
|
||||
) : (
|
||||
@@ -343,8 +344,8 @@ function AlertsPage({ data, now }: { data: WallData; now: Date }) {
|
||||
const alertCount = data.alerts ? data.alerts.critical + data.alerts.warning : problems.length;
|
||||
const shown = problems.slice(0, 12);
|
||||
return (
|
||||
<section className="wall-page" aria-label="Needs attention">
|
||||
<h2 className="wall-heading">Needs attention</h2>
|
||||
<section className="wall-page" aria-label={t("Needs attention")}>
|
||||
<h2 className="wall-heading">{t("Needs attention")}</h2>
|
||||
<ul className="wall-list wall-list-cols">
|
||||
{shown.map((a) => (
|
||||
<li key={a.id} className={a.severity === "critical" ? "wall-bad" : "wall-warn"}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { IconAlertTriangle, IconCircleCheck, IconPlugConnected, IconServer, Icon
|
||||
import { api, type ChangeEvent, type ChangesSummary, type UserRole } from "../api/client";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import { toast } from "../utils/toast";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const TONE_CLASS: Record<ChangeEvent["tone"], string> = { good: "text-green", bad: "text-red", info: "text-blue", neutral: "text-secondary" };
|
||||
|
||||
@@ -47,22 +48,22 @@ export default function WhatChanged({ role }: { role: UserRole }) {
|
||||
await api.me.markChangesSeen();
|
||||
setDismissed(true);
|
||||
} catch {
|
||||
toast.error("Couldn't save that. Try again.");
|
||||
toast.error(t("Couldn't save that. Try again."));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card mb-3" aria-label="Since you last looked">
|
||||
<section className="card mb-3" aria-label={t("Since you last looked")}>
|
||||
<div className="card-header">
|
||||
<div>
|
||||
<h3 className="card-title">Since you last looked</h3>
|
||||
<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>
|
||||
<div className="card-actions">
|
||||
<button type="button" className="btn btn-sm btn-primary" onClick={gotIt} disabled={busy}>
|
||||
Got it
|
||||
{t("Got it")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,7 +84,7 @@ export default function WhatChanged({ role }: { role: UserRole }) {
|
||||
))}
|
||||
</ol>
|
||||
) : (
|
||||
<div className="text-secondary">Nothing went wrong or came back.</div>
|
||||
<div className="text-secondary">{t("Nothing went wrong or came back.")}</div>
|
||||
)}
|
||||
{(summary.moreEvents > 0 || others > 0) && (
|
||||
<div className="text-secondary small mt-2">
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* The language of the interface. English is what the code is written in, and the English text is its own key: `t("Save")` is "Save" in English and "Spara" in Swedish, and a text with no Swedish
|
||||
* entry yet is shown in English — so a page can be translated bit by bit, and nothing ever shows up as a missing-key placeholder. The Swedish entries are in ./sv.ts.
|
||||
*
|
||||
* A text can hold {placeholders}: `t("Started updating {name}.", { name })`. For counts, `tn(n, "{n} server", "{n} servers")` picks the one or the many form (both are translated, as
|
||||
* texts of their own). The chosen language is remembered on the person's account and mirrored in this browser, so the sign-in page and the first paint are right.
|
||||
*
|
||||
* Changing the language re-draws the whole app (App keys its tree on it), so nothing has to subscribe: `t()` is simply read as each screen is drawn.
|
||||
*/
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { sv } from "./sv";
|
||||
|
||||
export type Language = "en" | "sv";
|
||||
export const LANGUAGES: { code: Language; name: string }[] = [
|
||||
{ code: "en", name: "English" },
|
||||
{ code: "sv", name: "Svenska" },
|
||||
];
|
||||
|
||||
const KEY = "hlm.language";
|
||||
|
||||
const isLanguage = (v: unknown): v is Language => v === "en" || v === "sv";
|
||||
|
||||
/** The language the browser asks for: Swedish if it says so, otherwise English. */
|
||||
export function detectLanguage(): Language {
|
||||
// Only a browser has a language to ask; the tests (and anything else without a window) are in English whatever the machine is set to.
|
||||
if (typeof window === "undefined") return "en";
|
||||
try {
|
||||
const wanted = (typeof navigator !== "undefined" ? navigator.languages?.[0] ?? navigator.language : "") ?? "";
|
||||
return wanted.toLowerCase().startsWith("sv") ? "sv" : "en";
|
||||
} catch {
|
||||
return "en";
|
||||
}
|
||||
}
|
||||
|
||||
function remembered(): Language | null {
|
||||
try {
|
||||
const v = localStorage.getItem(KEY);
|
||||
return isLanguage(v) ? v : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
let current: Language = remembered() ?? detectLanguage();
|
||||
|
||||
/** Tells the page which language it is in, for screen readers, hyphenation and the browser's own translation offer. */
|
||||
function markPage(): void {
|
||||
if (typeof document !== "undefined") document.documentElement.lang = current;
|
||||
}
|
||||
markPage();
|
||||
const listeners = new Set<() => void>();
|
||||
|
||||
export const getLanguage = (): Language => current;
|
||||
|
||||
/** Changes the language (and tells whoever draws the app). `remember` keeps the choice in this browser; a language only guessed from the browser is not kept. */
|
||||
export function setLanguage(language: Language, remember = true): void {
|
||||
if (remember) {
|
||||
try {
|
||||
localStorage.setItem(KEY, language);
|
||||
} catch {
|
||||
// the account holds the choice; this is only for the first paint
|
||||
}
|
||||
}
|
||||
if (language === current) return;
|
||||
current = language;
|
||||
markPage();
|
||||
listeners.forEach((l) => l());
|
||||
}
|
||||
|
||||
/** Forgets this browser's copy of the choice (the person went back to "follow the browser"). */
|
||||
export function forgetLanguage(): void {
|
||||
try {
|
||||
localStorage.removeItem(KEY);
|
||||
} catch {
|
||||
// nothing to forget
|
||||
}
|
||||
}
|
||||
|
||||
/** Re-renders a component when the language changes. App uses it to key its tree. */
|
||||
export function useLanguage(): Language {
|
||||
return useSyncExternalStore(
|
||||
(l) => {
|
||||
listeners.add(l);
|
||||
return () => listeners.delete(l);
|
||||
},
|
||||
getLanguage,
|
||||
getLanguage,
|
||||
);
|
||||
}
|
||||
|
||||
export type Vars = Record<string, string | number>;
|
||||
|
||||
/** Fills {name} in a text from `vars`; a placeholder with no value is left as it is. */
|
||||
export function fill(text: string, vars?: Vars): string {
|
||||
return vars ? text.replace(/\{(\w+)\}/g, (whole, key: string) => (key in vars ? String(vars[key]) : whole)) : text;
|
||||
}
|
||||
|
||||
/** The text in the language of the interface; English as written when there is no translation. */
|
||||
export function t(text: string, vars?: Vars): string {
|
||||
return fill(current === "sv" ? (sv[text] ?? text) : text, vars);
|
||||
}
|
||||
|
||||
/** The one form for 1 and the many form for anything else, each translated; {n} is the count. */
|
||||
export function tn(n: number, one: string, many: string, vars?: Vars): string {
|
||||
return t(n === 1 ? one : many, { n, ...vars });
|
||||
}
|
||||
|
||||
/** For dates, numbers and sorting: "sv-SE" or "en". */
|
||||
export const locale = (): string => (current === "sv" ? "sv-SE" : "en");
|
||||
|
||||
/** The text in a given language, whatever the interface is in (for the tests, and the language names). */
|
||||
export function translate(language: Language, text: string, vars?: Vars): string {
|
||||
return fill(language === "sv" ? (sv[text] ?? text) : text, vars);
|
||||
}
|
||||
@@ -0,0 +1,676 @@
|
||||
/**
|
||||
* The Swedish text of the interface. The key is the English text exactly as it is written in the code (see ./index.ts); a text that is not here is shown in English. Keep the {placeholders}
|
||||
* the same as in the English (a test checks it), and write the way a person at the other end of the sofa would say it: plain, not stiff.
|
||||
*
|
||||
* Brand and product names (Proxmox, Synology, Docker, Jellyfin, Immich …) are the same in both languages and have no entry.
|
||||
*/
|
||||
export const sv: Record<string, string> = {
|
||||
"(critical alerts still come through)": "(kritiska larm kommer fortfarande fram)",
|
||||
"(optional)": "(valfritt)",
|
||||
"(then {name} if a restart is due)": "(sedan {name} om en omstart behövs)",
|
||||
"{n} acknowledged — somebody is on it": "{n} kvitterat — någon jobbar med det",
|
||||
"{n} acknowledged — somebody is on them": "{n} kvitterade — någon jobbar med dem",
|
||||
"{n} active alert": "{n} aktivt larm",
|
||||
"{n} active alerts": "{n} aktiva larm",
|
||||
"{n} check couldn't run": "{n} kontroll kunde inte köras",
|
||||
"{n} checks couldn't run": "{n} kontroller kunde inte köras",
|
||||
"{n} d ago": "för {n} d sedan",
|
||||
"{n} h ago": "för {n} tim sedan",
|
||||
"{n} haven't reported updates": "{n} har inte rapporterat uppdateringar",
|
||||
"{n} maintenance window open": "{n} underhållsfönster öppet",
|
||||
"{n} maintenance windows open": "{n} underhållsfönster öppna",
|
||||
"{n} min ago": "för {n} min sedan",
|
||||
"{n} minutes": "{n} minuter",
|
||||
"{n} mo ago": "för {n} mån sedan",
|
||||
"{n} more acknowledged": "{n} till kvitterade",
|
||||
"{n} more explained by something that is down": "{n} till förklaras av något som ligger nere",
|
||||
"{n} silenced by maintenance": "{n} tystade av underhåll",
|
||||
"{n} so far": "{n} hittills",
|
||||
"{n} thing needs attention": "{n} sak behöver uppmärksamhet",
|
||||
"{n} thing of yours wants a look: handed to you, about to run out, or still going": "{n} sak av dig behöver en titt: tilldelad dig, på väg att löpa ut eller pågår fortfarande",
|
||||
"{n} things need attention": "{n} saker behöver uppmärksamhet",
|
||||
"{n} things of yours want a look: handed to you, about to run out, or still going": "{n} saker av dig behöver en titt: tilldelade dig, på väg att löpa ut eller pågår fortfarande",
|
||||
"{n} waiting": "{n} väntar",
|
||||
"{n} waiting, {security} security": "{n} väntar, {security} säkerhet",
|
||||
"{n} y ago": "för {n} år sedan",
|
||||
"{name} ({time} left)": "{name} ({time} kvar)",
|
||||
"{names} — see Alerts for what that leaves unchecked": "{names} — se Larm för vad det lämnar okontrollerat",
|
||||
"{names} and {n} more (the last ends in {time})": "{names} och {n} till (det sista slutar om {time})",
|
||||
"{shown} of {total}": "{shown} av {total}",
|
||||
"← Prev": "← Föregående",
|
||||
"1 hour": "1 timme",
|
||||
"1 year": "1 år",
|
||||
"2 hours": "2 timmar",
|
||||
"24 hours": "24 timmar",
|
||||
"3 days": "3 dagar",
|
||||
"30 days": "30 dagar",
|
||||
"30 minutes": "30 minuter",
|
||||
"4 hours": "4 timmar",
|
||||
"7 days": "7 dagar",
|
||||
"8 hours": "8 timmar",
|
||||
"90 days": "90 dagar",
|
||||
"A full-screen status board for a spare monitor or tablet": "En helskärmsöversikt för en ledig skärm eller surfplatta",
|
||||
"A job about this": "Ett jobb om det här",
|
||||
"A job to add": "Ett jobb att lägga till",
|
||||
"A name like Europe/Stockholm, so 02:00 stays 02:00 in summer and winter.": "Ett namn som Europe/Stockholm, så att 02:00 förblir 02:00 sommar som vinter.",
|
||||
"A page to open (optional)": "En sida att öppna (valfritt)",
|
||||
"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.": "En plan uppdaterar en grupp servrar enligt schema, en i taget, och stannar om en misslyckas. Tagga servrarna (till exempel ”lab”) och skapa sedan en plan för taggen.",
|
||||
"A playbook that only restarts the server, in the same Semaphore. It runs once a server's updates are in; a server with nothing waiting that still says a restart is due is restarted too. Each restart is checked: the server must report that it started again. The window below counts for the update and the restart together.": "En playbook som bara startar om servern, i samma Semaphore. Den körs när en servers uppdateringar är installerade; en server utan väntande uppdateringar som ändå säger att en omstart behövs startas också om. Varje omstart kontrolleras: servern måste rapportera att den startade om. Fönstret nedan gäller för uppdateringen och omstarten tillsammans.",
|
||||
"A playbook that only restarts the server. It runs once the updates are in and the server has reported again.": "En playbook som bara startar om servern. Den körs när uppdateringarna är installerade och servern har rapporterat igen.",
|
||||
"A port with a note counts as taken, even when nothing is listening.": "En port med en anteckning räknas som upptagen, även när inget lyssnar.",
|
||||
"A scan from this app connected to it": "En skanning från den här appen kopplade upp sig mot den",
|
||||
"About": "Gäller",
|
||||
"Acknowledge…": "Kvittera…",
|
||||
"Acknowledged": "Kvitterad",
|
||||
"Acknowledged or not": "Kvitterad eller inte",
|
||||
"Actions": "Åtgärder",
|
||||
"Active": "Aktiv",
|
||||
"Add {name} to favourites": "Lägg till {name} i favoriter",
|
||||
"Add a job": "Lägg till ett jobb",
|
||||
"Add a job about this…": "Lägg till ett jobb om det här…",
|
||||
"Add a job above, and give it a day if it has one.": "Lägg till ett jobb ovan och ge det en dag om det har en.",
|
||||
"Add a job…": "Lägg till ett jobb…",
|
||||
"Add a server": "Lägg till en server",
|
||||
"Add a server and install its agent": "Lägg till en server och installera dess agent",
|
||||
"Add a server and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates, and the app can tell when it goes quiet.": "Lägg till en server och installera dess agent: den rapporterar då sina uppgifter, diskar, minne, öppna portar och väntande uppdateringar, och appen märker när den tystnar.",
|
||||
"Add a server with the form above and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates.": "Lägg till en server med formuläret ovan och installera dess agent: den rapporterar då sina uppgifter, diskar, minne, öppna portar och väntande uppdateringar.",
|
||||
"Add a task manually": "Lägg till en uppgift manuellt",
|
||||
"Add alias": "Lägg till alias",
|
||||
"Add integration": "Lägg till integration",
|
||||
"Add link": "Lägg till länk",
|
||||
"Add note": "Lägg till anteckning",
|
||||
"Add one": "Lägg till en",
|
||||
"Add one for the night you patch, and its windows appear a week ahead, so alerts stay quiet without anyone remembering to.": "Lägg till ett för natten du patchar, så dyker dess fönster upp en vecka i förväg och larmen håller sig tysta utan att någon behöver komma ihåg det.",
|
||||
"Add recurring maintenance": "Lägg till återkommande underhåll",
|
||||
"Add server": "Lägg till server",
|
||||
"Add task": "Lägg till uppgift",
|
||||
"Add:": "Lägg till:",
|
||||
"Added.": "Tillagd.",
|
||||
"Adding…": "Lägger till…",
|
||||
"Address aliases": "Adressalias",
|
||||
"Address in Uptime Kuma": "Adress i Uptime Kuma",
|
||||
"Address to scan": "Adress att skanna",
|
||||
"Admin Links": "Adminlänkar",
|
||||
"Administration": "Administration",
|
||||
"Agent": "Agent",
|
||||
"Agent behind": "Agenten ligger efter",
|
||||
"Agent token for": "Agentnyckel för",
|
||||
"Agents to update": "Agenter att uppdatera",
|
||||
"Alert at (%)": "Larma vid (%)",
|
||||
"Alert limits": "Larmgränser",
|
||||
"Alert settings": "Larminställningar",
|
||||
"Alerts": "Larm",
|
||||
"Alerts for this server are silenced (a maintenance window).": "Larm för den här servern tystas (ett underhållsfönster).",
|
||||
"Alerts view": "Vy för larm",
|
||||
"Alerts you have": "Dina larm",
|
||||
"All": "Alla",
|
||||
"All answering": "Alla svarar",
|
||||
"All checks": "Alla kontroller",
|
||||
"All clear": "Allt väl",
|
||||
"All DNS providers (the enabled ones)": "Alla DNS-leverantörer (de påslagna)",
|
||||
"All heartbeats": "Alla hjärtslag",
|
||||
"All integrations (the enabled ones)": "Alla integrationer (de påslagna)",
|
||||
"All jobs": "Alla jobb",
|
||||
"All kinds": "Alla sorter",
|
||||
"All OK": "Allt OK",
|
||||
"All online": "Alla online",
|
||||
"All reporting": "Alla rapporterar",
|
||||
"All severities": "Alla allvarlighetsgrader",
|
||||
"Already past its date, or waiting": "Redan förbi sitt datum, eller väntar",
|
||||
"Also takes down {n} thing: {list}": "Tar också ned {n} sak: {list}",
|
||||
"Also takes down {n} things: {list}": "Tar också ned {n} saker: {list}",
|
||||
"An API token, a certificate or a password — you're warned before it runs out.": "En API-nyckel, ett certifikat eller ett lösenord — du varnas innan det löper ut.",
|
||||
"Any status": "Valfri status",
|
||||
"API tokens": "API-nycklar",
|
||||
"App versions": "Appversioner",
|
||||
"Apply this server's updates through a Semaphore playbook": "Installera serverns uppdateringar via en Semaphore-playbook",
|
||||
"approved in Semaphore": "godkänd i Semaphore",
|
||||
"Apps": "Appar",
|
||||
"Automation": "Automation",
|
||||
"Awaiting reply": "Väntar på svar",
|
||||
"Awake again.": "Vaken igen.",
|
||||
"Away from {from} until {until}": "Borta från {from} till {until}",
|
||||
"Away until {until}": "Borta till {until}",
|
||||
"Back to servers": "Tillbaka till servrar",
|
||||
"Backup-failure and uncovered-guest alerts (for a Proxmox integration).": "Larm om misslyckade säkerhetskopior och gäster utan täckning (för en Proxmox-integration).",
|
||||
"Backup-verification-failure alerts (for a Proxmox Backup Server integration).": "Larm om misslyckad verifiering av säkerhetskopior (för en Proxmox Backup Server-integration).",
|
||||
"Backups": "Säkerhetskopior",
|
||||
"behind": "efter",
|
||||
"Belongs to": "Tillhör",
|
||||
"Between 5 and 500.": "Mellan 5 och 500.",
|
||||
"Blocking is switched off.": "Blockering är avstängd.",
|
||||
"Bound to localhost only — other machines can't connect, but the port is still taken": "Bunden bara till localhost — andra maskiner kan inte ansluta, men porten är ändå upptagen",
|
||||
"breadcrumb": "sökväg",
|
||||
"by {name}": "av {name}",
|
||||
"Can’t be read": "Kan inte läsas",
|
||||
"Cancel": "Avbryt",
|
||||
"Cards": "Kort",
|
||||
"Cards with a problem come first": "Kort med problem kommer först",
|
||||
"Change log": "Ändringslogg",
|
||||
"Change…": "Ändra…",
|
||||
"Check now": "Kontrollera nu",
|
||||
"Checked": "Kontrollerad",
|
||||
"checking every few seconds": "kollar med några sekunders mellanrum",
|
||||
"Checking everything — this can take a few seconds…": "Kontrollerar allt — det kan ta några sekunder…",
|
||||
"Checking…": "Kontrollerar…",
|
||||
"Choose a template…": "Välj en mall…",
|
||||
"Choose how you'll be told about problems": "Välj hur du får veta om problem",
|
||||
"Choose…": "Välj…",
|
||||
"Clear": "Rensa",
|
||||
"Clear filters": "Rensa filter",
|
||||
"Clear the search and filters": "Rensa sökning och filter",
|
||||
"Click a range to reserve a port from it with a note.": "Klicka på ett intervall för att reservera en port ur det med en anteckning.",
|
||||
"Clock in": "Klockslag i",
|
||||
"Close": "Stäng",
|
||||
"Close…": "Stäng…",
|
||||
"Coming up": "På gång",
|
||||
"Command / description": "Kommando / beskrivning",
|
||||
"Compact": "Tät",
|
||||
"Compare": "Jämför",
|
||||
"Confirm": "Bekräfta",
|
||||
"Connect": "Anslut",
|
||||
"Connect a DNS provider": "Anslut en DNS-leverantör",
|
||||
"connect a DNS provider to see zones and records": "anslut en DNS-leverantör för att se zoner och poster",
|
||||
"Connect an integration": "Anslut en integration",
|
||||
"connect it under Integrations": "anslut den under Integrationer",
|
||||
"Connecting…": "Ansluter…",
|
||||
"Consistency": "Konsekvens",
|
||||
"Container": "Container",
|
||||
"Costs": "Kostnader",
|
||||
"Couldn't check everything — what's missing below isn't necessarily fine": "Kunde inte kontrollera allt — det som saknas nedan är inte nödvändigtvis i sin ordning",
|
||||
"Couldn't load the activity.": "Kunde inte läsa in aktiviteten.",
|
||||
"Couldn't load the history.": "Kunde inte läsa in historiken.",
|
||||
"Couldn't load the integrations.": "Kunde inte läsa in integrationerna.",
|
||||
"Couldn't save that. Try again.": "Det gick inte att spara. Försök igen.",
|
||||
"CPU load": "Processorbelastning",
|
||||
"Created": "Skapad",
|
||||
"Critical": "Kritisk",
|
||||
"Customise": "Anpassa",
|
||||
"Dark mode": "Mörkt läge",
|
||||
"Dashboard": "Översikt",
|
||||
"Date & time format": "Datum- och tidsformat",
|
||||
"Date format": "Datumformat",
|
||||
"Days": "Dagar",
|
||||
"Dealt with, or accepted: hide it until it gets worse": "Åtgärdat eller godtaget: dölj det tills det blir värre",
|
||||
"Dealt with, or accepted: hide them until they get worse": "Åtgärdade eller godtagna: dölj dem tills de blir värre",
|
||||
"Delete": "Ta bort",
|
||||
"Delete integration": "Ta bort integration",
|
||||
"Delete task": "Ta bort uppgift",
|
||||
"Density": "Täthet",
|
||||
"Description": "Beskrivning",
|
||||
"Details": "Detaljer",
|
||||
"didn't finish": "blev inte klar",
|
||||
"Disable": "Stäng av",
|
||||
"Disabled": "Avstängd",
|
||||
"Disk (allocated)": "Disk (tilldelad)",
|
||||
"Dismiss": "Avfärda",
|
||||
"DNS answers": "DNS-svar",
|
||||
"DNS providers": "DNS-leverantörer",
|
||||
"DNS record change notifications.": "Notiser om ändrade DNS-poster.",
|
||||
"DNS, Secrets, Servers and Domains are built into this app rather than connected integrations, but get the same at-a-glance treatment.": "DNS, Hemligheter, Servrar och Domäner är inbyggda i appen och inte anslutna integrationer, men får samma överblick.",
|
||||
"Docker containers with a newer image": "Docker-containrar med nyare avbild",
|
||||
"Domains": "Domäner",
|
||||
"Done": "Klar",
|
||||
"Download clients": "Nedladdningsklienter",
|
||||
"Due day (optional)": "Förfallodag (valfritt)",
|
||||
"Each connected system gets its own page — open it from here or from the sidebar, in the group shown. Add and manage credentials here.": "Varje anslutet system får en egen sida — öppna den härifrån eller från sidomenyn, i gruppen som visas. Lägg till och hantera inloggningsuppgifter här.",
|
||||
"Each server may be under maintenance for": "Varje server får vara under underhåll i högst",
|
||||
"Edit": "Redigera",
|
||||
"Edit task": "Redigera uppgift",
|
||||
"Edit the job": "Redigera jobbet",
|
||||
"Enable": "Slå på",
|
||||
"Enabled": "Påslagen",
|
||||
"End all maintenance": "Avsluta allt underhåll",
|
||||
"End now": "Avsluta nu",
|
||||
"Endpoints": "Slutpunkter",
|
||||
"Ends": "Slutar",
|
||||
"Ends in": "Slutar om",
|
||||
"Enter a value": "Ange ett värde",
|
||||
"Every alert is live. Start a window above before you work on something, so it doesn't raise alarms while you do.": "Alla larm är aktiva. Starta ett fönster ovan innan du jobbar med något, så att det inte larmar medan du gör det.",
|
||||
"Every container is on its latest image, as far as the last check could tell.": "Alla containrar kör sin senaste avbild, så vitt den senaste kontrollen kunde se.",
|
||||
"Every server": "Alla servrar",
|
||||
"Every time a recurring maintenance happens": "Varje gång ett återkommande underhåll sker",
|
||||
"Every Uptime Kuma integration is disabled — enable one under Integrations.": "Alla Uptime Kuma-integrationer är avstängda — slå på en under Integrationer.",
|
||||
"Everything — every server, integration, network device and DNS provider": "Allt — alla servrar, integrationer, nätverksenheter och DNS-leverantörer",
|
||||
"Everything about this server in the change log": "Allt om den här servern i ändringsloggen",
|
||||
"Everything coming up": "Allt som är på gång",
|
||||
"Expired:": "Utgånget:",
|
||||
"Expiring:": "Löper ut:",
|
||||
"Export CSV": "Exportera CSV",
|
||||
"Failed-run alerts for the Semaphore or Gitea integration you choose.": "Larm om misslyckade körningar för den Semaphore- eller Gitea-integration du väljer.",
|
||||
"Failing": "Misslyckas",
|
||||
"Failing builds": "Misslyckade bygg",
|
||||
"Fill from a known port (optional)": "Fyll i från en känd port (valfritt)",
|
||||
"Filter by port, service, or comment": "Filtrera på port, tjänst eller kommentar",
|
||||
"Find a setting": "Hitta en inställning",
|
||||
"Find a setting…": "Hitta en inställning…",
|
||||
"finished": "klar",
|
||||
"First port": "Första port",
|
||||
"Fold the cards you do not need and put the others in the order you like — for every server": "Fäll ihop korten du inte behöver och lägg de andra i den ordning du vill — för alla servrar",
|
||||
"Follow Settings again": "Följ Inställningar igen",
|
||||
"From now": "Från nu",
|
||||
"Further ahead": "Längre fram",
|
||||
"Game servers": "Spelservrar",
|
||||
"Generator": "Generator",
|
||||
"Getting started": "Kom igång",
|
||||
"Go to Servers": "Gå till Servrar",
|
||||
"Got it": "Uppfattat",
|
||||
"Gotify, ntfy, Telegram, Pushover, email, a webhook or push to your phone, with the checks you want.": "Gotify, ntfy, Telegram, Pushover, e-post, en webhook eller push till din telefon, med de kontroller du vill ha.",
|
||||
"Group under their cause": "Gruppera under orsaken",
|
||||
"Handed to me": "Tilldelade mig",
|
||||
"Hardware & Network": "Hårdvara & nätverk",
|
||||
"Hardware, network and identity": "Hårdvara, nätverk och identitet",
|
||||
"Heartbeats": "Hjärtslag",
|
||||
"Hide": "Dölj",
|
||||
"Hide it until a time, and hear of it again then if it is still there": "Dölj det tills en tidpunkt, och få veta om det igen då om det fortfarande finns kvar",
|
||||
"Hide the getting started guide": "Dölj kom igång-guiden",
|
||||
"Hide the history": "Dölj historiken",
|
||||
"Hide the pages of integrations I have not added": "Dölj sidorna för integrationer jag inte har lagt till",
|
||||
"Hide this guide (bring it back from the search box: Ctrl K)": "Dölj den här guiden (få tillbaka den från sökrutan: Ctrl K)",
|
||||
"History": "Historik",
|
||||
"Homelab Manager waits for the server to report again — it may be restarting.": "Homelab Manager väntar på att servern ska rapportera igen — den kanske startar om.",
|
||||
"Hostname": "Värdnamn",
|
||||
"How far ahead": "Hur långt framåt",
|
||||
"How this server is": "Hur servern mår",
|
||||
"How tightly pages are packed": "Hur tätt sidorna packas",
|
||||
"How to show the integrations": "Hur integrationerna visas",
|
||||
"If the server then says a restart is due, the restart playbook runs, and the server is checked to have started again.": "Om servern sedan säger att en omstart behövs körs omstarts-playbooken, och servern kontrolleras så att den har startat om.",
|
||||
"Image": "Avbild",
|
||||
"Import from Uptime Kuma": "Importera från Uptime Kuma",
|
||||
"Import now": "Importera nu",
|
||||
"Importing…": "Importerar…",
|
||||
"in {time}": "om {time}",
|
||||
"In order": "I sin ordning",
|
||||
"Info": "Info",
|
||||
"Infrastructure": "Infrastruktur",
|
||||
"Inspect": "Granska",
|
||||
"Integrations": "Integrationer",
|
||||
"Integrations view": "Vy för integrationer",
|
||||
"Inventory": "Inventarie",
|
||||
"IP addresses": "IP-adresser",
|
||||
"IP Addresses": "IP-adresser",
|
||||
"IP addresses unavailable — the QEMU guest agent isn't installed or running on this VM.": "IP-adresser saknas — QEMU guest agent är inte installerad eller körs inte på den här VM:en.",
|
||||
"It began listening after this server's first report and nobody has said it is expected. It is on the Alerts page until you note it or it stops listening.": "Den började lyssna efter serverns första rapport och ingen har sagt att det är väntat. Den ligger på larmsidan tills du antecknar den eller den slutar lyssna.",
|
||||
"It checks that the server did start again (from its uptime), and the window ends.": "Den kontrollerar att servern verkligen startade om (utifrån drifttiden), och fönstret avslutas.",
|
||||
"It ends sooner when that server's update does.": "Den slutar tidigare när serverns uppdatering är klar.",
|
||||
"Its acknowledgement ran out — nobody is on it now.": "Kvitteringen har gått ut — ingen jobbar med det nu.",
|
||||
"Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.": "Dess agent är äldre än den som Homelab Manager skulle installera nu. Kör dess installationskommando igen för att uppdatera den.",
|
||||
"Its messages are being held back right now": "Dess meddelanden hålls tillbaka just nu",
|
||||
"Jobs handed to you": "Jobb som tilldelats dig",
|
||||
"just now": "nyss",
|
||||
"Keep maintenance windows in step": "Håll underhållsfönster i takt",
|
||||
"Keys expiring": "Nycklar som löper ut",
|
||||
"Kind of alert": "Sorts larm",
|
||||
"Kinds of things": "Sorters saker",
|
||||
"Language": "Språk",
|
||||
"Last 30 days": "Senaste 30 dagarna",
|
||||
"Last failed": "Senast misslyckad",
|
||||
"Last port": "Sista port",
|
||||
"Last seen": "Senast sedd",
|
||||
"Late or failed": "Sena eller misslyckade",
|
||||
"Leave a box empty to follow Settings → Notifications (shown inside the box). Only what you fill in is different for this server.": "Lämna en ruta tom för att följa Inställningar → Notiser (visas i rutan). Bara det du fyller i skiljer sig för den här servern.",
|
||||
"Leave a server alone when it has no updates waiting": "Lämna en server ifred när den inte har några väntande uppdateringar",
|
||||
"Leave it alone": "Lämna det ifred",
|
||||
"Left out now": "Utelämnas nu",
|
||||
"Let someone else in (optional)": "Släpp in någon annan (valfritt)",
|
||||
"Light mode": "Ljust läge",
|
||||
"Link": "Koppla",
|
||||
"Linked to": "Kopplad till",
|
||||
"Linking…": "Kopplar…",
|
||||
"Listening": "Lyssnar",
|
||||
"Load:": "Belastning:",
|
||||
"Loading…": "Läser in…",
|
||||
"Longest wait": "Längsta väntan",
|
||||
"Lowercase letters, numbers and - _ . : / — up to 12 tags per server.": "Små bokstäver, siffror och - _ . : / — upp till 12 taggar per server.",
|
||||
"Main menu": "Huvudmeny",
|
||||
"Maintenance": "Underhåll",
|
||||
"Maintenance — alerts silenced for": "Underhåll — larm tystade för",
|
||||
"Maintenance you started": "Underhåll du startade",
|
||||
"Make a plan": "Skapa en plan",
|
||||
"Manage": "Hantera",
|
||||
"Manage servers": "Hantera servrar",
|
||||
"Many at once": "Många på en gång",
|
||||
"Map": "Karta",
|
||||
"Mark as expected": "Markera som väntad",
|
||||
"Matched to a server": "Kopplad till en server",
|
||||
"Matching settings": "Matchande inställningar",
|
||||
"Media managers": "Mediahanterare",
|
||||
"Monitoring": "Övervakning",
|
||||
"Most in an hour": "Flest på en timme",
|
||||
"most recent first": "senaste först",
|
||||
"Move down": "Flytta ned",
|
||||
"Move earlier": "Flytta tidigare",
|
||||
"Move later": "Flytta senare",
|
||||
"Move the Overview cards with the arrows, and hide any card you don't use — the ones at the top too. It saves as you go, for you only, and follows you to other browsers.": "Flytta översiktskorten med pilarna och dölj de kort du inte använder — även de överst. Det sparas medan du går, bara för dig, och följer med till andra webbläsare.",
|
||||
"Move up": "Flytta upp",
|
||||
"Must match the host name in the Semaphore inventory.": "Måste stämma med värdnamnet i Semaphores inventarie.",
|
||||
"My work": "Mitt arbete",
|
||||
"Name": "Namn",
|
||||
"Narrow sidebar": "Smal sidomeny",
|
||||
"Narrow the sidebar to icons": "Smalna av sidomenyn till ikoner",
|
||||
"Narrow the sidebar to icons ([)": "Smalna av sidomenyn till ikoner ([)",
|
||||
"Need a restart": "Behöver startas om",
|
||||
"Needs a look": "Behöver en titt",
|
||||
"Needs attention": "Behöver uppmärksamhet",
|
||||
"Needs attention now": "Behöver uppmärksamhet nu",
|
||||
"Network": "Nätverk",
|
||||
"Network devices": "Nätverksenheter",
|
||||
"Never reported": "Har aldrig rapporterat",
|
||||
"New": "Ny",
|
||||
"Newer version": "Nyare version",
|
||||
"Next": "Nästa",
|
||||
"Next →": "Nästa →",
|
||||
"Next run": "Nästa körning",
|
||||
"Next to expire:": "Nästa som löper ut:",
|
||||
"No active alerts, but some checks couldn't run": "Inga aktiva larm, men vissa kontroller kunde inte köras",
|
||||
"No active alerts.": "Inga aktiva larm.",
|
||||
"No admin links added yet — e.g. Dockge, Webmin, or Cockpit for this server.": "Inga adminlänkar tillagda än — till exempel Dockge, Webmin eller Cockpit för den här servern.",
|
||||
"No agent data": "Inga agentdata",
|
||||
"No data": "Inga data",
|
||||
"No enabled Proxmox integrations configured yet.": "Inga påslagna Proxmox-integrationer har konfigurerats än.",
|
||||
"No expiry dates": "Inga utgångsdatum",
|
||||
"No hardware data yet. Install the agent on this server, or link it to a Proxmox VM/LXC (under Settings).": "Inga hårdvarudata än. Installera agenten på servern, eller koppla den till en Proxmox-VM/LXC (under Inställningar).",
|
||||
"No history in this stretch yet. A sample is kept about every ten minutes once the agent has reported, and its hours and days after that, so lines appear here after a short while.": "Ingen historik under den här perioden än. Ett prov sparas ungefär var tionde minut när agenten har rapporterat, och därefter dess timmar och dagar, så linjer dyker upp här efter en kort stund.",
|
||||
"No history is kept for this kind of integration: it is read when a page is opened, and nothing is stored to draw from.": "Ingen historik sparas för den här sortens integration: den läses när en sida öppnas och inget lagras att rita utifrån.",
|
||||
"No integrations configured yet.": "Inga integrationer har konfigurerats än.",
|
||||
"No longer following it.": "Följer den inte längre.",
|
||||
"No patch plans yet": "Inga patchplaner än",
|
||||
"No port in this range was confirmed free.": "Ingen port i det här intervallet bekräftades som ledig.",
|
||||
"No problems found in what could be checked — see the warning above for what couldn't.": "Inga problem hittades i det som gick att kontrollera — se varningen ovan för det som inte gick.",
|
||||
"No recurring maintenance": "Inget återkommande underhåll",
|
||||
"No scheduled tasks found for this server yet.": "Inga schemalagda uppgifter hittades för den här servern än.",
|
||||
"No second playbook": "Ingen andra playbook",
|
||||
"No second playbook (the update playbook may restart it itself)": "Ingen andra playbook (uppdateringsplaybooken kan starta om den själv)",
|
||||
"No server has a tag yet — tag servers on their pages (for example “lab”), or name them below.": "Ingen server har en tagg än — tagga servrar på deras sidor (till exempel ”lab”), eller namnge dem nedan.",
|
||||
"No server has reported yet": "Ingen server har rapporterat än",
|
||||
"No servers yet": "Inga servrar än",
|
||||
"No setting matches that.": "Ingen inställning matchar det.",
|
||||
"No tags yet.": "Inga taggar än.",
|
||||
"No templates found in Semaphore.": "Inga mallar hittades i Semaphore.",
|
||||
"Nobody in particular": "Ingen särskild",
|
||||
"Nobody is on it": "Ingen jobbar med det",
|
||||
"Normal": "Normal",
|
||||
"Not a VM? Hide this": "Ingen VM? Dölj det här",
|
||||
"Not checked yet": "Inte kontrollerad än",
|
||||
"Not configured": "Inte konfigurerad",
|
||||
"Not connected": "Inte ansluten",
|
||||
"Not done yet": "Inte klart än",
|
||||
"Not read yet": "Inte läst än",
|
||||
"Not read yet.": "Inte läst än.",
|
||||
"not reported": "ej rapporterat",
|
||||
"Not reporting": "Rapporterar inte",
|
||||
"Not scanned yet.": "Inte skannad än.",
|
||||
"Not set up yet": "Inte uppsatt än",
|
||||
"Not silenced": "Inte tystad",
|
||||
"Notes": "Anteckningar",
|
||||
"Notes it as expected, so there is no alert for it": "Antecknar den som väntad, så att det inte blir något larm för den",
|
||||
"Nothing expires, ends or is planned in the next 30 days.": "Inget löper ut, slutar eller är planerat de närmaste 30 dagarna.",
|
||||
"Nothing has been kept in this stretch yet. A reading is kept about every quarter of an hour once the integration has been read, so lines appear after a short while.": "Inget har sparats under den här perioden än. En avläsning sparas ungefär var 15:e minut när integrationen har lästs, så linjer dyker upp efter en kort stund.",
|
||||
"Nothing has been written down.": "Inget har skrivits ned.",
|
||||
"Nothing has called it since the app started. Use Test to check it now.": "Inget har anropat den sedan appen startade. Använd Testa för att kontrollera den nu.",
|
||||
"Nothing here yet": "Inget här än",
|
||||
"Nothing in particular": "Inget särskilt",
|
||||
"Nothing is coming up": "Inget är på gång",
|
||||
"Nothing is handed to you": "Inget är tilldelat dig",
|
||||
"Nothing is in maintenance": "Inget är under underhåll",
|
||||
"Nothing is waiting, or the agent hasn't said": "Inget väntar, eller så har agenten inte sagt något",
|
||||
"Nothing matches that": "Inget matchar det",
|
||||
"Nothing matches that filter.": "Inget matchar det filtret.",
|
||||
"Nothing matches that.": "Inget matchar det.",
|
||||
"Nothing needs attention right now.": "Inget behöver uppmärksamhet just nu.",
|
||||
"Nothing new": "Inget nytt",
|
||||
"Nothing on your plate": "Inget på din lista",
|
||||
"Nothing recorded yet. Changes to this server, times it stopped reporting, and its maintenance windows will be listed here.": "Inget antecknat än. Ändringar av servern, tider då den slutade rapportera och dess underhållsfönster listas här.",
|
||||
"Nothing soon": "Inget inom kort",
|
||||
"Nothing to do": "Inget att göra",
|
||||
"Nothing to do about this.": "Inget att göra åt det här.",
|
||||
"Nothing to do.": "Inget att göra.",
|
||||
"Nothing went wrong or came back.": "Inget gick fel eller kom tillbaka.",
|
||||
"Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters.": "Inget med ett datum passar de valda sorterna och servern. Prova en längre period, eller färre filter.",
|
||||
"Notifications": "Notiser",
|
||||
"Notifications are held": "Notiser hålls tillbaka",
|
||||
"Offline": "Offline",
|
||||
"Offline:": "Offline:",
|
||||
"OK": "OK",
|
||||
"Older than the agent this Homelab Manager would install now.": "Äldre än den agent som Homelab Manager skulle installera nu.",
|
||||
"On the clock of": "Enligt klockan i",
|
||||
"On time": "I tid",
|
||||
"Online": "Online",
|
||||
"Online / Total": "Online / Totalt",
|
||||
"Only those with updates": "Bara de med uppdateringar",
|
||||
"Open": "Öppna",
|
||||
"Open again": "Öppna igen",
|
||||
"Open Technitium DNS": "Öppna Technitium DNS",
|
||||
"Open the page": "Öppna sidan",
|
||||
"Open Users": "Öppna Användare",
|
||||
"Opened again.": "Öppnad igen.",
|
||||
"Operating system": "Operativsystem",
|
||||
"Operations": "Drift",
|
||||
"OS type": "OS-typ",
|
||||
"Others sign in with Authentik and appear under Users; you decide their role.": "Andra loggar in med Authentik och dyker upp under Användare; du bestämmer deras roll.",
|
||||
"Overview": "Översikt",
|
||||
"Page {page} of {pages} ({total} total)": "Sida {page} av {pages} ({total} totalt)",
|
||||
"Patch plans": "Patchplaner",
|
||||
"Pick all {n} shown": "Markera alla {n} som visas",
|
||||
"Pick the servers to change together, then choose what to do from the bar at the foot of the page.": "Markera de servrar som ska ändras tillsammans och välj sedan vad som ska göras i fältet längst ned på sidan.",
|
||||
"playbook running": "playbook körs",
|
||||
"Playbook that applies updates": "Playbook som installerar uppdateringar",
|
||||
"Please confirm": "Bekräfta",
|
||||
"Ports": "Portar",
|
||||
"Privacy": "Integritet",
|
||||
"Proxmox backups": "Proxmox-säkerhetskopior",
|
||||
"Proxmox integration": "Proxmox-integration",
|
||||
"Proxmox link": "Proxmox-koppling",
|
||||
"Proxmox, Synology, Tailscale, Docker, Uptime Kuma… each gets its own page and shows up in alerts.": "Proxmox, Synology, Tailscale, Docker, Uptime Kuma… var och en får en egen sida och dyker upp i larmen.",
|
||||
"Proxy hosts": "Proxyvärdar",
|
||||
"Put back.": "Återlagd.",
|
||||
"Queries, 24 h": "Frågor, 24 tim",
|
||||
"Raised and cleared again and again within an hour — its messages are held back until it has been calm for an hour": "Larmat och släckts om och om igen inom en timme — dess meddelanden hålls tillbaka tills det har varit lugnt i en timme",
|
||||
"Raised and cleared often enough within an hour to count as flapping": "Larmat och släckts tillräckligt ofta inom en timme för att räknas som fladdrande",
|
||||
"Reachable": "Nåbar",
|
||||
"Read it once now and see what each request got back — to check that what is shown is what is there": "Läs den en gång nu och se vad varje fråga gav tillbaka — för att kontrollera att det som visas är det som finns",
|
||||
"Reason": "Orsak",
|
||||
"Reason (optional)": "Orsak (valfritt)",
|
||||
"Recent runs": "Senaste körningar",
|
||||
"Records": "Register",
|
||||
"Recurring": "Återkommande",
|
||||
"Reference": "Referens",
|
||||
"Refresh": "Uppdatera",
|
||||
"Refreshing…": "Uppdaterar…",
|
||||
"Remove": "Ta bort",
|
||||
"Remove {name} from favourites": "Ta bort {name} från favoriter",
|
||||
"Remove acknowledgement": "Ta bort kvittering",
|
||||
"Remove it": "Ta bort den",
|
||||
"Remove recurring maintenance": "Ta bort återkommande underhåll",
|
||||
"Remove server": "Ta bort server",
|
||||
"Reported": "Rapporterad",
|
||||
"Reported by the agent as of": "Rapporterat av agenten per",
|
||||
"Reporting": "Rapporterar",
|
||||
"Reports": "Rapporter",
|
||||
"Reserve this port": "Reservera den här porten",
|
||||
"Reset": "Återställ",
|
||||
"Reset to default": "Återställ till standard",
|
||||
"Restart": "Starta om",
|
||||
"Restart a server afterwards, if it says a restart is due, with": "Starta om en server efteråt, om den säger att en omstart behövs, med",
|
||||
"Restart it afterwards, if it says a restart is due, with": "Starta om den efteråt, om den säger att en omstart behövs, med",
|
||||
"restart needed": "omstart behövs",
|
||||
"restart playbook running": "omstarts-playbook körs",
|
||||
"restart: {state}": "omstart: {state}",
|
||||
"Restart…": "Starta om…",
|
||||
"restarted": "omstartad",
|
||||
"Roomy": "Luftig",
|
||||
"Rotate token": "Byt nyckel",
|
||||
"Rows per page": "Rader per sida",
|
||||
"Run #{id} in Semaphore — the playbook's output is there.": "Körning #{id} i Semaphore — playbookens utdata finns där.",
|
||||
"Run a playbook": "Kör en playbook",
|
||||
"Run it on — the host name as it is in the Semaphore inventory": "Kör på — värdnamnet så som det står i Semaphores inventarie",
|
||||
"Run it on each server by its": "Kör på varje server med dess",
|
||||
"Run its install command again to update it (Servers → Manage servers), or switch on automatic agent updates on the Servers page.": "Kör dess installationskommando igen för att uppdatera den (Servrar → Hantera servrar), eller slå på automatiska agentuppdateringar på Servrar-sidan.",
|
||||
"Run now": "Kör nu",
|
||||
"run their install command again": "kör deras installationskommando igen",
|
||||
"Running / Total": "Körs / Totalt",
|
||||
"Runs here": "Körs här",
|
||||
"Runs on": "Körs på",
|
||||
"Runs on…": "Körs på…",
|
||||
"Save": "Spara",
|
||||
"Save changes": "Spara ändringar",
|
||||
"Save Settings": "Spara inställningar",
|
||||
"Saved.": "Sparat.",
|
||||
"Saving…": "Sparar…",
|
||||
"Scan…": "Skanna…",
|
||||
"Schedule type": "Schematyp",
|
||||
"Search alerts…": "Sök larm…",
|
||||
"Search and actions": "Sök och åtgärder",
|
||||
"Search and actions (Ctrl/Cmd+K)": "Sök och åtgärder (Ctrl/Cmd+K)",
|
||||
"Search integrations…": "Sök integrationer…",
|
||||
"Search noisy alerts…": "Sök bullriga larm…",
|
||||
"Search servers…": "Sök servrar…",
|
||||
"Search…": "Sök…",
|
||||
"Secret and certificate expiry, Tailscale key expiry, Docker update reminders.": "Utgång för hemligheter och certifikat, utgång för Tailscale-nycklar, påminnelser om Docker-uppdateringar.",
|
||||
"Secrets": "Hemligheter",
|
||||
"Sections of this server's page": "Delar av serverns sida",
|
||||
"Security": "Säkerhet",
|
||||
"Security updates waiting": "Väntande säkerhetsuppdateringar",
|
||||
"See your zones and records, and have names matched to servers.": "Se dina zoner och poster, och låt namn kopplas till servrar.",
|
||||
"Select": "Markera",
|
||||
"Server": "Server",
|
||||
"Server name": "Servernamn",
|
||||
"Server offline and disk-full alerts (for a server).": "Larm om offline-servrar och fulla diskar (för en server).",
|
||||
"Server removed.": "Servern är borttagen.",
|
||||
"Servers": "Servrar",
|
||||
"Servers with updates waiting": "Servrar med väntande uppdateringar",
|
||||
"Set up": "Ställ in",
|
||||
"Set up a few things first, then the useful parts appear": "Ställ in några saker först, så dyker de användbara delarna upp",
|
||||
"Settings": "Inställningar",
|
||||
"Setup progress": "Hur långt du kommit",
|
||||
"Severity": "Allvarlighet",
|
||||
"Show": "Visa",
|
||||
"Show an icon before each page in the menu": "Visa en ikon framför varje sida i menyn",
|
||||
"Show integrations that are": "Visa integrationer som är",
|
||||
"Show servers that are": "Visa servrar som är",
|
||||
"Show silenced": "Visa tystade",
|
||||
"Show silenced and grouped": "Visa tystade och grupperade",
|
||||
"Show the history": "Visa historiken",
|
||||
"Shutdown": "Stäng av",
|
||||
"Sign in with Authentik": "Logga in med Authentik",
|
||||
"Sign in with your homelab identity provider to continue.": "Logga in med din homelab-inloggning för att fortsätta.",
|
||||
"Sign out": "Logga ut",
|
||||
"Silence": "Tysta",
|
||||
"Silence everything?": "Tysta allt?",
|
||||
"Silence its alerts for up to": "Tysta larmen i upp till",
|
||||
"Silence what depends on a server while it is updated (a guest that runs on it, a service that needs it)": "Tysta det som är beroende av en server medan den uppdateras (en gäst som körs på den, en tjänst som behöver den)",
|
||||
"Silence…": "Tysta…",
|
||||
"Silenced for the target": "Tystad för målet",
|
||||
"Since you last looked": "Sedan du senast tittade",
|
||||
"Skip to content": "Hoppa till innehållet",
|
||||
"Snooze…": "Påminn senare…",
|
||||
"Somebody is watching.": "Någon tittar.",
|
||||
"someone": "någon",
|
||||
"Source": "Källa",
|
||||
"Start": "Starta",
|
||||
"Start maintenance": "Starta underhåll",
|
||||
"started": "startad",
|
||||
"Started": "Startad",
|
||||
"Started by": "Startad av",
|
||||
"starting in Semaphore": "startar i Semaphore",
|
||||
"Starting…": "Startar…",
|
||||
"Starts at": "Börjar",
|
||||
"Status": "Status",
|
||||
"Stop": "Stoppa",
|
||||
"Stop at the first failure, and leave the servers after it alone": "Stanna vid första misslyckandet och lämna servrarna efter den ifred",
|
||||
"Stop following": "Sluta följa",
|
||||
"Stop following this run?": "Sluta följa den här körningen?",
|
||||
"Stop server": "Stoppa server",
|
||||
"stopped being followed": "följs inte längre",
|
||||
"stopping": "stoppar",
|
||||
"Storage, volume and disk-health alerts (for a Proxmox or Synology integration).": "Larm om lagring, volymer och diskhälsa (för en Proxmox- eller Synology-integration).",
|
||||
"Sundays at 02:00, the servers tagged lab, one at a time, stop at the first failure.": "Söndagar 02:00, servrarna taggade lab, en i taget, stanna vid första misslyckandet.",
|
||||
"Switched off": "Avstängd",
|
||||
"Switched off under Integrations.": "Avstängd under Integrationer.",
|
||||
"Switched on": "Påslagen",
|
||||
"Sync schedule": "Synkschema",
|
||||
"Syncing…": "Synkar…",
|
||||
"Table": "Tabell",
|
||||
"Table pagination": "Sidindelning av tabell",
|
||||
"Tag…": "Tagga…",
|
||||
"Tags": "Taggar",
|
||||
"Target": "Mål",
|
||||
"Templates": "Mallar",
|
||||
"Test": "Testa",
|
||||
"Testing…": "Testar…",
|
||||
"The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.": "Agenten rapporterar schemalagda uppgifter, diskar, minne och öppna portar, och låter appen märka när en server tystnar.",
|
||||
"The last read is old, so this may be out of date.": "Den senaste avläsningen är gammal, så det här kan vara inaktuellt.",
|
||||
"The logo of the system for an integration’s page, the page’s own icon for the rest. Only for this browser, and it applies at once.": "Systemets logga för en integrations sida, sidans egen ikon för resten. Gäller bara den här webbläsaren och slår igenom direkt.",
|
||||
"The maintenance window on {name} ends now. A playbook already started keeps running in Semaphore — it can't be stopped from here.": "Underhållsfönstret för {name} avslutas nu. En playbook som redan har startat fortsätter i Semaphore — den kan inte stoppas härifrån.",
|
||||
"The playbook runs in Semaphore, for this server only.": "Playbooken körs i Semaphore, bara för den här servern.",
|
||||
"The rest of the month": "Resten av månaden",
|
||||
"The restart is run #{id}.": "Omstarten är körning #{id}.",
|
||||
"The same windows are listed in the tables below.": "Samma fönster listas i tabellerna nedan.",
|
||||
"This Homelab Manager instance uses a self-signed certificate (skip TLS verification on the agent)": "Den här Homelab Manager-instansen använder ett självsignerat certifikat (hoppa över TLS-verifiering i agenten)",
|
||||
"This server has limits of its own; everything else follows Settings.": "Den här servern har egna gränser; allt annat följer Inställningar.",
|
||||
"This server says a restart is due: restart it through a Semaphore playbook": "Servern säger att en omstart behövs: starta om den via en Semaphore-playbook",
|
||||
"This server's agent hasn't reported updates — it may be an older agent, or its package manager isn't one it can ask.": "Serverns agent har inte rapporterat uppdateringar — det kan vara en äldre agent, eller så är dess pakethanterare ingen den kan fråga.",
|
||||
"This token is only shown once — copy it now.": "Nyckeln visas bara en gång — kopiera den nu.",
|
||||
"This week": "Den här veckan",
|
||||
"Time in total": "Tid totalt",
|
||||
"Time range": "Tidsperiod",
|
||||
"Title": "Titel",
|
||||
"To do": "Att göra",
|
||||
"Today": "Idag",
|
||||
"Toggle navigation": "Visa eller dölj menyn",
|
||||
"Token": "Nyckel",
|
||||
"Track something that expires": "Håll koll på något som löper ut",
|
||||
"track when a token, certificate or password expires": "håll koll på när en nyckel, ett certifikat eller ett lösenord löper ut",
|
||||
"Try a different word, or clear the search and the filters.": "Prova ett annat ord, eller rensa sökningen och filtren.",
|
||||
"Turn off": "Stäng av",
|
||||
"Turn on": "Slå på",
|
||||
"Type a tag and press Enter — e.g. prod, media, rack-1": "Skriv en tagg och tryck Enter — till exempel prod, media, rack-1",
|
||||
"Under a maintenance window — notifications for this are held back": "Under ett underhållsfönster — notiser för den här hålls tillbaka",
|
||||
"Uninstall": "Avinstallera",
|
||||
"Uninstall agent from": "Avinstallera agenten från",
|
||||
"Unlink": "Koppla bort",
|
||||
"up over the last {days} days": "uppe de senaste {days} dagarna",
|
||||
"Up to date": "Uppdaterad",
|
||||
"Update agents automatically": "Uppdatera agenter automatiskt",
|
||||
"Update runs": "Uppdateringskörningar",
|
||||
"Update runs you started": "Uppdateringskörningar du startade",
|
||||
"Update…": "Uppdatera…",
|
||||
"Updates": "Uppdateringar",
|
||||
"Updates view": "Vy för uppdateringar",
|
||||
"Uptime Kuma integration": "Uptime Kuma-integration",
|
||||
"Users": "Användare",
|
||||
"v1 or older": "v1 eller äldre",
|
||||
"View all alerts": "Visa alla larm",
|
||||
"waiting for approval in Semaphore": "väntar på godkännande i Semaphore",
|
||||
"waiting for the server to come back": "väntar på att servern ska komma tillbaka",
|
||||
"waiting for the server to come back from its restart": "väntar på att servern ska komma tillbaka efter omstarten",
|
||||
"waiting for the server to report again": "väntar på att servern ska rapportera igen",
|
||||
"Waiting now": "Väntar nu",
|
||||
"Waiting since": "Väntat sedan",
|
||||
"waiting to start in Semaphore": "väntar på att starta i Semaphore",
|
||||
"Waiting updates are read by each server's agent. Install or update the agent and its figures appear here.": "Väntande uppdateringar läses av varje servers agent. Installera eller uppdatera agenten så dyker siffrorna upp här.",
|
||||
"Wake": "Väck",
|
||||
"Wake now": "Väck nu",
|
||||
"Wall display": "Väggskärm",
|
||||
"Warning": "Varning",
|
||||
"Welcome back,": "Välkommen tillbaka,",
|
||||
"What are you working on?": "Vad jobbar du med?",
|
||||
"What gets silenced": "Vad som tystas",
|
||||
"What has your name on it: alerts you acknowledged or were handed, maintenance you started and update runs you started, and jobs handed to you. Whatever is about to run out is marked, and listed first.": "Det som har ditt namn på sig: larm du kvitterade eller fick tilldelade, underhåll du startade och uppdateringskörningar du startade, samt jobb som tilldelats dig. Det som snart löper ut markeras och listas först.",
|
||||
"What is to be done": "Vad som ska göras",
|
||||
"What it covers": "Vad det omfattar",
|
||||
"What to do": "Vad du ska göra",
|
||||
"What to do first": "Vad du ska göra först",
|
||||
"When": "När",
|
||||
"When a window ends": "När ett fönster slutar",
|
||||
"When the acknowledgement runs out and the alert counts as nobody's again": "När kvitteringen går ut och larmet åter räknas som ingens",
|
||||
"When you acknowledge an alert, are handed one, put something under maintenance or start an update run, it is listed here until it is done.": "När du kvitterar ett larm, får ett tilldelat, sätter något under underhåll eller startar en uppdateringskörning listas det här tills det är klart.",
|
||||
"Where": "Var",
|
||||
"Whether somebody is on it": "Om någon jobbar med det",
|
||||
"Which servers": "Vilka servrar",
|
||||
"Whose jobs": "Vems jobb",
|
||||
"Widen the sidebar": "Bredda sidomenyn",
|
||||
"Widen the sidebar ([)": "Bredda sidomenyn ([)",
|
||||
"With what you have added, there is nothing to leave out.": "Med det du har lagt till finns inget att utelämna.",
|
||||
"Would leave out": "Skulle utelämna",
|
||||
};
|
||||
+51
-27
@@ -22,6 +22,7 @@ import { useFormLabels } from "../hooks/useFormLabels";
|
||||
import ShortcutHelp from "../components/ShortcutHelp";
|
||||
import Avatar from "../components/Avatar";
|
||||
import { useBreadcrumbTailValue } from "../utils/breadcrumb";
|
||||
import { getLanguage, LANGUAGES, setLanguage, t, tn } from "../i18n";
|
||||
|
||||
const RAIL_KEY = "hlm-sidebar-rail";
|
||||
|
||||
@@ -176,7 +177,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
if (!isGroup(entry)) continue;
|
||||
const leaf = entry.items.find((item) => isCurrent(pathname, item.to));
|
||||
if (!leaf) continue;
|
||||
crumbs.push({ label: entry.label }, breadcrumbTail ? { label: leaf.label, to: leaf.to } : { label: leaf.label });
|
||||
crumbs.push({ label: t(entry.label) }, breadcrumbTail ? { label: t(leaf.label), to: leaf.to } : { label: t(leaf.label) });
|
||||
if (breadcrumbTail) crumbs.push({ label: breadcrumbTail });
|
||||
break;
|
||||
}
|
||||
@@ -213,21 +214,21 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
badges["/alerts"] = {
|
||||
text: String(alerts.count),
|
||||
className: alerts.level === "critical" ? "bg-red text-red-fg" : "bg-yellow text-yellow-fg",
|
||||
title: `${alerts.count} active alert${alerts.count === 1 ? "" : "s"}`,
|
||||
title: tn(alerts.count, "{n} active alert", "{n} active alerts"),
|
||||
};
|
||||
}
|
||||
if (myWork && myWork.needsAttention > 0) {
|
||||
badges["/my-work"] = {
|
||||
text: String(myWork.needsAttention),
|
||||
className: "bg-blue text-blue-fg",
|
||||
title: `${myWork.needsAttention} ${myWork.needsAttention === 1 ? "thing" : "things"} of yours want a look: handed to you, about to run out, or still going`,
|
||||
title: tn(myWork.needsAttention, "{n} thing of yours wants a look: handed to you, about to run out, or still going", "{n} things of yours want a look: handed to you, about to run out, or still going"),
|
||||
};
|
||||
}
|
||||
if (maintenance.length > 0) {
|
||||
badges["/maintenance"] = {
|
||||
text: String(maintenance.length),
|
||||
className: "bg-blue text-blue-fg",
|
||||
title: `${maintenance.length} maintenance window${maintenance.length === 1 ? "" : "s"} open`,
|
||||
title: tn(maintenance.length, "{n} maintenance window open", "{n} maintenance windows open"),
|
||||
};
|
||||
}
|
||||
function toggleTheme() {
|
||||
@@ -246,7 +247,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
mainRef.current?.focus();
|
||||
}}
|
||||
>
|
||||
Skip to content
|
||||
{t("Skip to content")}
|
||||
</a>
|
||||
<div className="visually-hidden" role="status" aria-live="polite" aria-atomic="true">
|
||||
{announcement}
|
||||
@@ -258,7 +259,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
type="button"
|
||||
className="navbar-toggler"
|
||||
onClick={() => setSidebarOpen((open) => !open)}
|
||||
aria-label="Toggle navigation"
|
||||
aria-label={t("Toggle navigation")}
|
||||
>
|
||||
<IconMenu2 size={20} />
|
||||
</button>
|
||||
@@ -288,17 +289,17 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
type="button"
|
||||
className="rail-toggle d-none d-lg-flex"
|
||||
aria-expanded={!collapsed}
|
||||
aria-label={collapsed ? "Widen the sidebar" : "Narrow the sidebar to icons"}
|
||||
title={collapsed ? "Widen the sidebar ([)" : "Narrow the sidebar to icons ([)"}
|
||||
aria-label={collapsed ? t("Widen the sidebar") : t("Narrow the sidebar to icons")}
|
||||
title={collapsed ? t("Widen the sidebar ([)") : t("Narrow the sidebar to icons ([)")}
|
||||
onClick={() => setCollapsed((c) => !c)}
|
||||
>
|
||||
{collapsed ? <IconChevronsRight size={16} /> : <IconChevronsLeft size={16} />}
|
||||
<span className="rail-toggle-text">Narrow sidebar</span>
|
||||
<span className="rail-toggle-text">{t("Narrow sidebar")}</span>
|
||||
</button>
|
||||
{menuOpen && (
|
||||
<div className="user-menu-list" role="menu">
|
||||
<div className="user-menu-density" role="group" aria-label="How tightly pages are packed">
|
||||
<span className="small opacity-75">Density</span>
|
||||
<div className="user-menu-density" role="group" aria-label={t("How tightly pages are packed")}>
|
||||
<span className="small opacity-75">{t("Density")}</span>
|
||||
<div className="btn-group btn-group-sm w-100">
|
||||
{DENSITIES.map((d) => (
|
||||
<button
|
||||
@@ -311,14 +312,35 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
setDensityState(d.value);
|
||||
}}
|
||||
>
|
||||
{d.label}
|
||||
{t(d.label)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="user-menu-density" role="group" aria-label={t("Language")}>
|
||||
<span className="small opacity-75">{t("Language")}</span>
|
||||
<div className="btn-group btn-group-sm w-100">
|
||||
{LANGUAGES.map((l) => (
|
||||
<button
|
||||
key={l.code}
|
||||
type="button"
|
||||
lang={l.code}
|
||||
className={`btn ${getLanguage() === l.code ? "active" : ""}`}
|
||||
aria-pressed={getLanguage() === l.code}
|
||||
onClick={() => {
|
||||
// Saved on the account so it follows this person; the screen is drawn again in the new language at once.
|
||||
setLanguage(l.code);
|
||||
void api.me.setLanguage(l.code).catch(() => undefined);
|
||||
}}
|
||||
>
|
||||
{l.name}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" className="user-menu-item" role="menuitem" onClick={toggleTheme}>
|
||||
{theme === "dark" ? <IconSun size={16} /> : <IconMoon size={16} />}
|
||||
{theme === "dark" ? "Light mode" : "Dark mode"}
|
||||
{theme === "dark" ? t("Light mode") : t("Dark mode")}
|
||||
</button>
|
||||
<NavLink
|
||||
to="/privacy"
|
||||
@@ -330,7 +352,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
}}
|
||||
>
|
||||
<IconShieldLock size={16} />
|
||||
Privacy
|
||||
{t("Privacy")}
|
||||
</NavLink>
|
||||
<NavLink
|
||||
to="/api-tokens"
|
||||
@@ -342,7 +364,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
}}
|
||||
>
|
||||
<IconKey size={16} />
|
||||
API tokens
|
||||
{t("API tokens")}
|
||||
</NavLink>
|
||||
<NavLink
|
||||
to="/wall"
|
||||
@@ -354,11 +376,11 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
}}
|
||||
>
|
||||
<IconDeviceDesktop size={16} />
|
||||
Wall display
|
||||
{t("Wall display")}
|
||||
</NavLink>
|
||||
<a className="user-menu-item" role="menuitem" href="/auth/logout">
|
||||
<IconLogout size={16} />
|
||||
Sign out
|
||||
{t("Sign out")}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
@@ -389,10 +411,10 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
<div className="alert alert-info d-flex align-items-center gap-2">
|
||||
<IconPlaneDeparture size={18} />
|
||||
<div>
|
||||
{away.away.state === "planned" ? `Away from ${formatDateTime(new Date(away.away.from!))} until ${formatDateTime(new Date(away.away.until))}` : `Away until ${formatDateTime(new Date(away.away.until))}`}
|
||||
{away.away.state === "planned" ? t("Away from {from} until {until}", { from: formatDateTime(new Date(away.away.from!)), until: formatDateTime(new Date(away.away.until)) }) : t("Away until {until}", { until: formatDateTime(new Date(away.away.until)) })}
|
||||
{away.away.note ? ` — ${away.away.note}` : ""}.{" "}
|
||||
{away.away.state === "active" ? `Notifications are held${away.away.criticalThrough ? " (critical alerts still come through)" : ""}${away.held > 0 ? ` — ${away.held} so far` : ""}. ` : ""}
|
||||
<Link to="/settings/notifications?tab=when">{user.role === "admin" ? "Manage" : "Details"}</Link>
|
||||
{away.away.state === "active" ? `${t("Notifications are held")}${away.away.criticalThrough ? ` ${t("(critical alerts still come through)")}` : ""}${away.held > 0 ? ` — ${t("{n} so far", { n: away.held })}` : ""}. ` : ""}
|
||||
<Link to="/settings/notifications?tab=when">{user.role === "admin" ? t("Manage") : t("Details")}</Link>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -400,19 +422,21 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
|
||||
<div className="alert alert-warning d-flex align-items-center gap-2">
|
||||
<IconTool size={18} />
|
||||
<div>
|
||||
Maintenance — alerts silenced for{" "}
|
||||
{t("Maintenance — alerts silenced for")}{" "}
|
||||
{maintenance.length <= 3
|
||||
? maintenance.map((w) => `${w.targetName} (${formatRemaining(w.endsAt)} left)`).join(", ")
|
||||
: `${maintenance.slice(0, 3).map((w) => w.targetName).join(", ")} and ${maintenance.length - 3} more (the last ends in ${formatRemaining(
|
||||
maintenance.reduce((latest, w) => (w.endsAt > latest ? w.endsAt : latest), maintenance[0].endsAt),
|
||||
)})`}
|
||||
? maintenance.map((w) => t("{name} ({time} left)", { name: w.targetName, time: formatRemaining(w.endsAt) })).join(", ")
|
||||
: t("{names} and {n} more (the last ends in {time})", {
|
||||
names: maintenance.slice(0, 3).map((w) => w.targetName).join(", "),
|
||||
n: maintenance.length - 3,
|
||||
time: formatRemaining(maintenance.reduce((latest, w) => (w.endsAt > latest ? w.endsAt : latest), maintenance[0].endsAt)),
|
||||
})}
|
||||
.{" "}
|
||||
<Link to="/maintenance">Manage</Link>
|
||||
<Link to="/maintenance">{t("Manage")}</Link>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{crumbs.length > 0 && (
|
||||
<nav aria-label="breadcrumb" className="mb-2">
|
||||
<nav aria-label={t("breadcrumb")} className="mb-2">
|
||||
<ol className="breadcrumb breadcrumb-arrows mb-0">
|
||||
{crumbs.map((c, i) => (
|
||||
<li key={i} className={`breadcrumb-item ${i === crumbs.length - 1 ? "active" : ""}`} aria-current={i === crumbs.length - 1 ? "page" : undefined}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { IconStar, IconStarFilled } from "@tabler/icons-react";
|
||||
import { isCurrent, isGroup, type NavEntry, type NavGroup, type NavLeaf } from "./nav";
|
||||
import { toggleFavorite, useFavorites } from "../utils/favorites";
|
||||
import { canonicalSearch, describeView, splitView } from "../utils/savedViews";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export interface NavBadge {
|
||||
text: string;
|
||||
@@ -92,9 +93,9 @@ export default function SidebarNav({
|
||||
) : null;
|
||||
};
|
||||
|
||||
const star = (leaf: NavLeaf, path: string = leaf.to, name: string = leaf.label) => {
|
||||
const star = (leaf: NavLeaf, path: string = leaf.to, name: string = t(leaf.label)) => {
|
||||
const on = favorites.includes(path);
|
||||
const label = on ? `Remove ${name} from favourites` : `Add ${name} to favourites`;
|
||||
const label = on ? t("Remove {name} from favourites", { name }) : t("Add {name} to favourites", { name });
|
||||
return (
|
||||
<button type="button" className="fav-star" aria-pressed={on} aria-label={label} title={label} onClick={() => void toggleFavorite(path)}>
|
||||
{on ? <IconStarFilled size={16} /> : <IconStar size={16} />}
|
||||
@@ -104,14 +105,14 @@ export default function SidebarNav({
|
||||
|
||||
const viewRow = (leaf: NavLeaf, path: string, search: string) => {
|
||||
const words = describeView(search);
|
||||
const name = `${leaf.label}: ${words}`;
|
||||
const name = `${t(leaf.label)}: ${words}`;
|
||||
const here = location.pathname === leaf.to && canonicalSearch(location.search) === search;
|
||||
return (
|
||||
<li className="nav-item nav-row" key={`fav-${path}`}>
|
||||
<NavLink to={path} className={() => `nav-link ${here ? "active" : ""}`} title={rail ? name : undefined} aria-current={here ? "page" : undefined} onClick={onNavigate}>
|
||||
<span className="nav-link-icon d-md-none d-lg-inline-block">{leaf.icon}</span>
|
||||
<span className="nav-link-title">
|
||||
{leaf.label} <span className="nav-view">{words}</span>
|
||||
{t(leaf.label)} <span className="nav-view">{words}</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
{star(leaf, path, name)}
|
||||
@@ -121,9 +122,9 @@ export default function SidebarNav({
|
||||
|
||||
const leafRow = (leaf: NavLeaf, key: string) => (
|
||||
<li className="nav-item nav-row" key={key}>
|
||||
<NavLink to={leaf.to} end={leaf.to === "/"} className="nav-link" title={rail ? leaf.label : undefined} onClick={onNavigate}>
|
||||
<NavLink to={leaf.to} end={leaf.to === "/"} className="nav-link" title={rail ? t(leaf.label) : undefined} onClick={onNavigate}>
|
||||
<span className="nav-link-icon d-md-none d-lg-inline-block">{leaf.icon}</span>
|
||||
<span className="nav-link-title">{leaf.label}</span>
|
||||
<span className="nav-link-title">{t(leaf.label)}</span>
|
||||
{badgeOf(leaf.to)}
|
||||
</NavLink>
|
||||
{star(leaf)}
|
||||
@@ -136,7 +137,7 @@ export default function SidebarNav({
|
||||
<span className="menu-item-icon" aria-hidden="true">
|
||||
{leaf.icon}
|
||||
</span>
|
||||
{leaf.label}
|
||||
{t(leaf.label)}
|
||||
{badgeOf(leaf.to)}
|
||||
</NavLink>
|
||||
{star(leaf)}
|
||||
@@ -144,7 +145,7 @@ export default function SidebarNav({
|
||||
);
|
||||
|
||||
return (
|
||||
<nav aria-label="Main menu">
|
||||
<nav aria-label={t("Main menu")}>
|
||||
<ul className="navbar-nav pt-lg-3">
|
||||
{pinned.length > 0 && (
|
||||
<li className="nav-item nav-favourites">
|
||||
@@ -171,7 +172,7 @@ export default function SidebarNav({
|
||||
type="button"
|
||||
className={`nav-link dropdown-toggle w-100 border-0 bg-transparent text-start ${(rail ? flyOpen : open) ? "show" : ""} ${holdsCurrent ? "active" : ""}`}
|
||||
aria-expanded={rail ? flyOpen : open}
|
||||
title={rail ? entry.label : undefined}
|
||||
title={rail ? t(entry.label) : undefined}
|
||||
onClick={(e) => {
|
||||
if (!rail) return onToggleGroup(entry.id);
|
||||
if (flyOpen) return setFlyout(null);
|
||||
@@ -181,7 +182,7 @@ export default function SidebarNav({
|
||||
}}
|
||||
>
|
||||
<span className="nav-link-icon d-md-none d-lg-inline-block">{entry.icon}</span>
|
||||
<span className="nav-link-title">{entry.label}</span>
|
||||
<span className="nav-link-title">{t(entry.label)}</span>
|
||||
{/* A closed group still says that something inside it needs a look. */}
|
||||
{showSummary && (
|
||||
<span className={`badge ms-auto me-4 ${worst.className}`} title={inside.map((b) => b.title).join(", ")}>
|
||||
@@ -197,8 +198,8 @@ export default function SidebarNav({
|
||||
</ul>
|
||||
|
||||
{rail && flyout && (
|
||||
<div ref={flyoutRef} className="rail-flyout" role="group" aria-label={flyout.group.label} style={{ top: flyout.top, left: flyout.left, maxHeight: `calc(100vh - ${flyout.top}px - 0.75rem)` }}>
|
||||
<div className="rail-flyout-title">{flyout.group.label}</div>
|
||||
<div ref={flyoutRef} className="rail-flyout" role="group" aria-label={t(flyout.group.label)} style={{ top: flyout.top, left: flyout.left, maxHeight: `calc(100vh - ${flyout.top}px - 0.75rem)` }}>
|
||||
<div className="rail-flyout-title">{t(flyout.group.label)}</div>
|
||||
{flyout.group.items.map(subRow)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -10,14 +10,15 @@ import { formatAgo } from "../utils/duration";
|
||||
import { readableError } from "../utils/errors";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ a }: { a: AdguardInstance }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
|
||||
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
|
||||
return <span className="badge bg-green-lt text-green">In order</span>;
|
||||
if (a.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("In order")}</span>;
|
||||
}
|
||||
|
||||
function Tile({ label, value, sub, tone }: { label: string; value: string; sub?: string | null; tone?: "bad" | "warn" }) {
|
||||
@@ -87,7 +88,7 @@ function Card({ a, canRead, onRead }: { a: AdguardInstance; canRead: boolean; on
|
||||
<>
|
||||
<div className="row g-3 mb-3">
|
||||
<Tile
|
||||
label="DNS answers"
|
||||
label={t("DNS answers")}
|
||||
value={!s.running ? "Not running" : s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"}
|
||||
sub={s.probe ? (s.probe.ok ? `a question about ${s.probe.name}, asked ${s.probe.host}:${s.dnsPort}` : `${s.probe.error ?? "no answer"} (${s.probe.host}:${s.dnsPort})`) : "no test yet"}
|
||||
tone={!s.running || (s.probe && !s.probe.ok) ? "bad" : undefined}
|
||||
@@ -170,8 +171,8 @@ export default function AdguardHome({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<h2 className="page-title">AdGuard Home</h2>
|
||||
<PageIntro>
|
||||
Read every two minutes (see <Link to="/integrations">Integrations</Link>), with a real DNS question put to it each time — its web interface can be up while DNS is not. Nothing is changed. <strong>DNS that stops answering</strong>, <strong>a DNS server that is not running</strong>,{" "}
|
||||
<strong>protection left off for an hour</strong> and <strong>filter lists that stopped updating</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
|
||||
Read every two minutes (see <Link to="/integrations">{t("Integrations")}</Link>), with a real DNS question put to it each time — its web interface can be up while DNS is not. Nothing is changed. <strong>DNS that stops answering</strong>, <strong>a DNS server that is not running</strong>,{" "}
|
||||
<strong>protection left off for an hour</strong> and <strong>filter lists that stopped updating</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import TableToolbar from "../components/TableToolbar";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
interface LinkForm {
|
||||
serverId: number | "";
|
||||
@@ -152,7 +153,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title mb-3">Admin Links</h2>
|
||||
<h2 className="page-title mb-3">{t("Admin Links")}</h2>
|
||||
<PageIntro>
|
||||
Every admin bookmark added to a server's own page (Infrastructure → Servers → a server → Admin Links) — Dockge,
|
||||
Webmin, Cockpit, and the like — in one place, instead of visiting each server to find them.
|
||||
@@ -167,7 +168,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
<form onSubmit={submit}>
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-3">
|
||||
<label className="form-label">Server</label>
|
||||
<label className="form-label">{t("Server")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
required
|
||||
@@ -210,7 +211,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
{form.serverId !== "" && (
|
||||
<div className="col-12">
|
||||
<label className="form-label">Fill from a known port (optional)</label>
|
||||
<label className="form-label">{t("Fill from a known port (optional)")}</label>
|
||||
<select
|
||||
className="form-select"
|
||||
style={{ maxWidth: 460 }}
|
||||
@@ -245,7 +246,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
{editing ? "Save changes" : "Add link"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={cancelForm}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -262,7 +263,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
actions={
|
||||
canEdit && !showForm ? (
|
||||
<button className="btn btn-primary btn-sm" onClick={startAdd}>
|
||||
Add link
|
||||
{t("Add link")}
|
||||
</button>
|
||||
) : undefined
|
||||
}
|
||||
@@ -273,10 +274,10 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<AdminLink> label="Server" sortKeyName="serverName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AdminLink> label={t("Server")} sortKeyName="serverName" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<AdminLink> label="Label" sortKeyName="label" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>URL</th>
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -296,10 +297,10 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm" onClick={() => startEdit(l)}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => remove(l)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -9,6 +9,7 @@ import TimeAgo from "../components/TimeAgo";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import { removeWithUndo } from "../utils/undoable";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const METRICS: { value: AlertRuleMetric; label: string; unit: string; hint: string }[] = [
|
||||
{ value: "cpu", label: "CPU load", unit: "%", hint: "As each agent reports it (load average over cores)." },
|
||||
@@ -119,7 +120,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
<ErrorNotice error={error} />
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="rule-name">
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id="rule-name" className="form-control" maxLength={80} value={name} onChange={(e) => setName(e.target.value)} placeholder="e.g. CPU above 90% for 15 minutes" autoFocus />
|
||||
<div className="form-text">It is in the alert’s message, in square brackets.</div>
|
||||
@@ -140,7 +141,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
{metric === "disk" && (
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="rule-mount">
|
||||
Which disk <span className="text-secondary">(optional)</span>
|
||||
Which disk <span className="text-secondary">{t("(optional)")}</span>
|
||||
</label>
|
||||
<input id="rule-mount" className="form-control" value={mount} onChange={(e) => setMount(e.target.value)} placeholder="every disk — or a mount point like /data, or C:" />
|
||||
</div>
|
||||
@@ -183,8 +184,8 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
How serious
|
||||
</label>
|
||||
<select id="rule-severity" className="form-select" value={severity} onChange={(e) => setSeverity(e.target.value as "warning" | "critical")}>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="critical">Critical</option>
|
||||
<option value="warning">{t("Warning")}</option>
|
||||
<option value="critical">{t("Critical")}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-6">
|
||||
@@ -192,7 +193,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
For
|
||||
</label>
|
||||
<select id="rule-scope" className="form-select" value={scope} onChange={(e) => { setScope(e.target.value as typeof scope); setTried(null); }}>
|
||||
<option value="all">Every server</option>
|
||||
<option value="all">{t("Every server")}</option>
|
||||
<option value="server">One server</option>
|
||||
<option value="tag" disabled={tags.length === 0}>
|
||||
Servers with a tag
|
||||
@@ -221,7 +222,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
</select>
|
||||
)}
|
||||
<div className="text-secondary small mb-3">
|
||||
Severity and kind decide who hears of it: these are <strong>Monitoring</strong> alerts, so the routing rules under Settings → Notifications apply to them like any other.
|
||||
Severity and kind decide who hears of it: these are <strong>{t("Monitoring")}</strong> alerts, so the routing rules under Settings → Notifications apply to them like any other.
|
||||
</div>
|
||||
{tried && (
|
||||
<div className={`alert ${tried.length > 0 ? "alert-warning" : "alert-success"} py-2`}>
|
||||
@@ -338,11 +339,11 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Rule</th>
|
||||
<th>Severity</th>
|
||||
<th>{t("Severity")}</th>
|
||||
<th>Right now</th>
|
||||
{canEdit && (
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">Actions</span>
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
</th>
|
||||
)}
|
||||
</tr>
|
||||
@@ -355,7 +356,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
{!r.enabled && <span className="badge bg-secondary-lt text-secondary ms-2">off</span>}
|
||||
<div className="text-secondary small">{sentence(r)}</div>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Severity">
|
||||
<td className="stack-label" data-label={t("Severity")}>
|
||||
<span className={`badge ${r.severity === "critical" ? "bg-red-lt text-red" : "bg-yellow-lt text-yellow"}`}>{r.severity === "critical" ? "Critical" : "Warning"}</span>
|
||||
</td>
|
||||
<td className="stack-label" data-label="Right now">
|
||||
@@ -392,7 +393,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
{r.enabled ? "Switch off" : "Switch on"}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(r)} aria-label={`Remove ${r.name}`}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -5,6 +5,7 @@ import AlertRules from "./AlertRules";
|
||||
import ServiceLevels from "./ServiceLevels";
|
||||
import NotificationSettings from "./settings/NotificationSettings";
|
||||
import AlertTicketSettings from "./settings/AlertTicketSettings";
|
||||
import { t } from "../i18n";
|
||||
|
||||
type View = "rules" | "levels" | "tickets";
|
||||
|
||||
@@ -26,14 +27,14 @@ export default function AlertSettings({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
<h2 className="page-title mb-0">Alert settings</h2>
|
||||
<h2 className="page-title mb-0">{t("Alert settings")}</h2>
|
||||
{isAdmin && (
|
||||
<Link to="/settings/notifications" className="ms-auto">
|
||||
Notification settings: channels, what is sent, quiet hours →
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<ViewTabs label="Alert settings" tabs={tabs} />
|
||||
<ViewTabs label={t("Alert settings")} tabs={tabs} />
|
||||
{view === "levels" ? <ServiceLevels user={user} /> : view === "tickets" ? <AlertTicketSettings /> : <AlertRules user={user} />}
|
||||
</>
|
||||
);
|
||||
|
||||
+53
-52
@@ -30,6 +30,7 @@ import AlertNoise from "../components/AlertNoise";
|
||||
import BulkBar from "../components/BulkBar";
|
||||
import { AckBulkDrawer, SilenceBulkDrawer } from "../components/BulkDrawers";
|
||||
import { doBulk, plural } from "../utils/bulk";
|
||||
import { t, tn } from "../i18n";
|
||||
|
||||
const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = {
|
||||
critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 },
|
||||
@@ -55,7 +56,7 @@ type Row = AlertItem & { rank: number };
|
||||
/** Now, History and Noise: what is wrong right now, every time something was raised and went away, and which alerts keep coming back. The same page, switched by `?view=`. */
|
||||
const alertTabs = (view: "now" | "history" | "noise") => (
|
||||
<ViewTabs
|
||||
label="Alerts view"
|
||||
label={t("Alerts view")}
|
||||
tabs={[
|
||||
{ to: "/alerts", label: "Now", active: view === "now" },
|
||||
{ to: "/alerts?view=history", label: "History", active: view === "history" },
|
||||
@@ -81,7 +82,7 @@ export default function Alerts({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<h2 className="page-title mb-0">Alerts</h2>
|
||||
<h2 className="page-title mb-0">{t("Alerts")}</h2>
|
||||
</div>
|
||||
{alertTabs(view)}
|
||||
{view === "history" ? <IncidentHistory /> : <AlertNoise />}
|
||||
@@ -273,7 +274,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
async function reopen(a: AlertItem) {
|
||||
try {
|
||||
await api.alerts.reopen(a.id);
|
||||
toast.success("Opened again.");
|
||||
toast.success(t("Opened again."));
|
||||
await load(true);
|
||||
reloadBadge();
|
||||
} catch (err) {
|
||||
@@ -283,7 +284,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
async function wake(a: AlertItem) {
|
||||
try {
|
||||
await api.alerts.unsnooze(a.id);
|
||||
toast.success("Awake again.");
|
||||
toast.success(t("Awake again."));
|
||||
await load(true);
|
||||
reloadBadge();
|
||||
} catch (err) {
|
||||
@@ -346,13 +347,13 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">Alerts</h2>
|
||||
<h2 className="page-title mb-0">{t("Alerts")}</h2>
|
||||
<div className="ms-auto btn-list">
|
||||
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={!sorted?.length}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={() => void load(true)} disabled={loading}>
|
||||
{loading ? "Checking…" : "Check now"}
|
||||
{loading ? t("Checking…") : t("Check now")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -364,7 +365,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<>
|
||||
{" "}
|
||||
<span title={formatDateTime(new Date(report.generatedAt))}>
|
||||
Checked {formatAgo(report.generatedAt)}
|
||||
{t("Checked")} {formatAgo(report.generatedAt)}
|
||||
{report.cached ? " (a recent result, reused)" : ""}.
|
||||
</span>
|
||||
</>
|
||||
@@ -374,7 +375,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
|
||||
{!report && !error && (
|
||||
<div className="card">
|
||||
<div className="card-body text-secondary">Checking everything — this can take a few seconds…</div>
|
||||
<div className="card-body text-secondary">{t("Checking everything — this can take a few seconds…")}</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -425,7 +426,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
{report.couldntCheck.length > 0 && (
|
||||
<div className="alert alert-warning">
|
||||
<div>
|
||||
<div className="fw-bold mb-1">Couldn't check everything — what's missing below isn't necessarily fine</div>
|
||||
<div className="fw-bold mb-1">{t("Couldn't check everything — what's missing below isn't necessarily fine")}</div>
|
||||
<ul className="mb-0">
|
||||
{report.couldntCheck.map((c) => (
|
||||
<li key={c.name}>
|
||||
@@ -448,11 +449,11 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<div className="card-body text-center py-5">
|
||||
{report.couldntCheck.length === 0 ? (
|
||||
<>
|
||||
<div className="h3 text-green mb-1">All clear</div>
|
||||
<div className="text-secondary">Nothing needs attention right now.</div>
|
||||
<div className="h3 text-green mb-1">{t("All clear")}</div>
|
||||
<div className="text-secondary">{t("Nothing needs attention right now.")}</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="text-secondary">No problems found in what could be checked — see the warning above for what couldn't.</div>
|
||||
<div className="text-secondary">{t("No problems found in what could be checked — see the warning above for what couldn't.")}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -461,14 +462,14 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search alerts…"
|
||||
placeholder={t("Search alerts…")}
|
||||
filters={
|
||||
<>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Severity" value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
|
||||
<option value="all">All severities</option>
|
||||
<option value="critical">Critical</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="info">Info</option>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Severity")} value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
|
||||
<option value="all">{t("All severities")}</option>
|
||||
<option value="critical">{t("Critical")}</option>
|
||||
<option value="warning">{t("Warning")}</option>
|
||||
<option value="info">{t("Info")}</option>
|
||||
</select>
|
||||
<select className="form-select form-select-sm w-auto" value={groupBy} aria-label="Grouping" onChange={(e) => chooseGroupBy(e.target.value as GroupBy)}>
|
||||
{(Object.keys(GROUP_BY_LABELS) as GroupBy[]).map((g) => (
|
||||
@@ -477,8 +478,8 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Kind of alert" value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
|
||||
<option value="all">All kinds</option>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Kind of alert")} value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
|
||||
<option value="all">{t("All kinds")}</option>
|
||||
{presentCategories.map((c) => (
|
||||
<option key={c} value={c}>
|
||||
{CATEGORY_LABELS[c]}
|
||||
@@ -486,11 +487,11 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
))}
|
||||
</select>
|
||||
{(counts?.acknowledged ?? 0) > 0 && (
|
||||
<select className="form-select form-select-sm w-auto" aria-label="Whether somebody is on it" value={attention} onChange={(e) => setAttention(e.target.value as typeof attention)}>
|
||||
<option value="all">Acknowledged or not</option>
|
||||
<option value="unacknowledged">Nobody is on it</option>
|
||||
<option value="acknowledged">Acknowledged</option>
|
||||
<option value="mine">Handed to me</option>
|
||||
<select className="form-select form-select-sm w-auto" aria-label={t("Whether somebody is on it")} value={attention} onChange={(e) => setAttention(e.target.value as typeof attention)}>
|
||||
<option value="all">{t("Acknowledged or not")}</option>
|
||||
<option value="unacknowledged">{t("Nobody is on it")}</option>
|
||||
<option value="acknowledged">{t("Acknowledged")}</option>
|
||||
<option value="mine">{t("Handed to me")}</option>
|
||||
</select>
|
||||
)}
|
||||
{canSilence && shownIds.length > 0 && (
|
||||
@@ -510,19 +511,19 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
})
|
||||
}
|
||||
/>
|
||||
<span className="form-check-label">Pick all {shownIds.length} shown</span>
|
||||
<span className="form-check-label">{t("Pick all {n} shown", { n: shownIds.length })}</span>
|
||||
</label>
|
||||
)}
|
||||
{(counts?.grouped ?? 0) > 0 && (
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={grouped} onChange={(e) => chooseGrouped(e.target.checked)} />
|
||||
<span className="form-check-label">Group under their cause</span>
|
||||
<span className="form-check-label">{t("Group under their cause")}</span>
|
||||
</label>
|
||||
)}
|
||||
{(counts?.silenced ?? 0) + (counts?.grouped ?? 0) > 0 && (
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={showSilenced} onChange={(e) => setShowSilenced(e.target.checked)} />
|
||||
<span className="form-check-label">{(counts?.grouped ?? 0) > 0 ? "Show silenced and grouped" : "Show silenced"}</span>
|
||||
<span className="form-check-label">{(counts?.grouped ?? 0) > 0 ? t("Show silenced and grouped") : t("Show silenced")}</span>
|
||||
</label>
|
||||
)}
|
||||
</>
|
||||
@@ -532,13 +533,13 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<Row> label="Severity" sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Severity")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Kind" sortKeyName="category" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Source" sortKeyName="source" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Source")} sortKeyName="source" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Alert" sortKeyName="message" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
{canSilence && (
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">Actions</span>
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
</th>
|
||||
)}
|
||||
</tr>
|
||||
@@ -561,7 +562,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<td className="stack-wide">
|
||||
{a.message}
|
||||
{a.flapping && (
|
||||
<span className="badge bg-red-lt text-red ms-2" title="Raised and cleared again and again within an hour — its messages are held back until it has been calm for an hour">
|
||||
<span className="badge bg-red-lt text-red ms-2" title={t("Raised and cleared again and again within an hour — its messages are held back until it has been calm for an hour")}>
|
||||
flapping
|
||||
</span>
|
||||
)}
|
||||
@@ -579,7 +580,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
</span>
|
||||
) : (
|
||||
a.silenced && (
|
||||
<span className="badge bg-secondary-lt text-secondary ms-2" title="Under a maintenance window — notifications for this are held back">
|
||||
<span className="badge bg-secondary-lt text-secondary ms-2" title={t("Under a maintenance window — notifications for this are held back")}>
|
||||
silenced
|
||||
</span>
|
||||
)
|
||||
@@ -593,7 +594,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
</div>
|
||||
)}
|
||||
{a.ack && !a.ack.active && (
|
||||
<div className="small mt-1 text-secondary">Its acknowledgement ran out — nobody is on it now.</div>
|
||||
<div className="small mt-1 text-secondary">{t("Its acknowledgement ran out — nobody is on it now.")}</div>
|
||||
)}
|
||||
{a.incidentId != null && (
|
||||
<div className="small">
|
||||
@@ -608,7 +609,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
)}
|
||||
{a.affects && a.affects.length > 0 && (
|
||||
<div className="text-secondary small">
|
||||
Also takes down {a.affects.length} {a.affects.length === 1 ? "thing" : "things"}: {a.affects.join(", ")}
|
||||
{tn(a.affects.length, "Also takes down {n} thing: {list}", "Also takes down {n} things: {list}", { list: a.affects.join(", ") })}
|
||||
</div>
|
||||
)}
|
||||
{(childrenOf.get(a.id)?.length ?? 0) > 0 && (
|
||||
@@ -625,7 +626,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
})
|
||||
}
|
||||
>
|
||||
{open.has(a.id) ? "Hide" : "Show"} the {childrenOf.get(a.id)!.length} {childrenOf.get(a.id)!.length === 1 ? "alert" : "alerts"} held back under this
|
||||
{open.has(a.id) ? t("Hide") : t("Show")} the {childrenOf.get(a.id)!.length} {childrenOf.get(a.id)!.length === 1 ? "alert" : "alerts"} held back under this
|
||||
</button>
|
||||
)}
|
||||
{a.ticket &&
|
||||
@@ -648,27 +649,27 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<div className="btn-list flex-nowrap">
|
||||
{!a.silenced && (
|
||||
<button type="button" className={`btn btn-sm ${a.ack?.active ? "btn-outline-primary" : "btn-outline-secondary"}`} onClick={() => setAcking(a)}>
|
||||
{a.ack?.active ? "Acknowledged" : "Acknowledge…"}
|
||||
{a.ack?.active ? t("Acknowledged") : t("Acknowledge…")}
|
||||
</button>
|
||||
)}
|
||||
{!a.silenced && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setSnoozing(a)} title="Hide it until a time, and hear of it again then if it is still there">
|
||||
Snooze…
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setSnoozing(a)} title={t("Hide it until a time, and hear of it again then if it is still there")}>
|
||||
{t("Snooze…")}
|
||||
</button>
|
||||
)}
|
||||
{!a.silenced && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setClosing(a)} title="Dealt with, or accepted: hide it until it gets worse">
|
||||
Close…
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setClosing(a)} title={t("Dealt with, or accepted: hide it until it gets worse")}>
|
||||
{t("Close…")}
|
||||
</button>
|
||||
)}
|
||||
{a.closed && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void reopen(a)}>
|
||||
Open again
|
||||
{t("Open again")}
|
||||
</button>
|
||||
)}
|
||||
{a.snoozed && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void wake(a)}>
|
||||
Wake now
|
||||
{t("Wake now")}
|
||||
</button>
|
||||
)}
|
||||
{!a.snoozed && !a.closed && <SilenceButton alert={a} onDone={() => void load(true)} />}
|
||||
@@ -710,25 +711,25 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<div className="has-bulk-bar" />
|
||||
<BulkBar count={pickedIds.length} noun={pickedIds.length === 1 ? "alert" : "alerts"} onClear={() => setPicked(new Set())}>
|
||||
<button type="button" className="btn btn-sm btn-primary" onClick={() => setBulkForm("ack")}>
|
||||
Acknowledge…
|
||||
{t("Acknowledge…")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => void bulkUnack()}>
|
||||
Remove acknowledgement
|
||||
{t("Remove acknowledgement")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("snooze")}>
|
||||
Snooze…
|
||||
{t("Snooze…")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => void bulkWake()}>
|
||||
Wake
|
||||
{t("Wake")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("close")} title="Dealt with, or accepted: hide them until they get worse">
|
||||
Close…
|
||||
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("close")} title={t("Dealt with, or accepted: hide them until they get worse")}>
|
||||
{t("Close…")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => void bulkReopen()}>
|
||||
Open again
|
||||
{t("Open again")}
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("silence")}>
|
||||
Silence…
|
||||
{t("Silence…")}
|
||||
</button>
|
||||
</BulkBar>
|
||||
</>
|
||||
|
||||
+20
-19
@@ -10,6 +10,7 @@ import { formatDate } from "../utils/date";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const EXPIRY = [
|
||||
{ value: "90", label: "90 days" },
|
||||
@@ -69,12 +70,12 @@ export default function ApiTokens() {
|
||||
}
|
||||
}
|
||||
|
||||
async function remove(t: ApiToken) {
|
||||
async function remove(item_: ApiToken) {
|
||||
// Not undoable: the secret is not kept, so a token cannot be made again the same.
|
||||
if (!(await confirmDialog({ title: "Remove a token", message: `Remove "${t.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
if (!(await confirmDialog({ title: "Remove a token", message: `Remove "${item_.label}"? Whatever uses it stops working at once, and it cannot be put back.`, confirmLabel: "Remove", danger: true }))) return;
|
||||
try {
|
||||
await api.apiTokens.remove(t.id);
|
||||
toast.success(`Removed "${t.label}".`);
|
||||
await api.apiTokens.remove(item_.id);
|
||||
toast.success(`Removed "${item_.label}".`);
|
||||
load();
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
@@ -86,7 +87,7 @@ export default function ApiTokens() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-1">
|
||||
<h2 className="page-title mb-0">API tokens</h2>
|
||||
<h2 className="page-title mb-0">{t("API tokens")}</h2>
|
||||
</div>
|
||||
<PageIntro>
|
||||
Read-only access to your installation’s data for scripts, Home Assistant and dashboards. A token can only read, sees what you see, and stops working when you are removed. Make one for each thing that reads, so each can be removed on its own.
|
||||
@@ -150,13 +151,13 @@ export default function ApiTokens() {
|
||||
<table className="table table-vcenter card-table table-stack">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>{t("Name")}</th>
|
||||
<th>Starts with</th>
|
||||
<th>Made</th>
|
||||
<th>Last used</th>
|
||||
<th>Ends</th>
|
||||
<th>{t("Ends")}</th>
|
||||
<th className="w-1">
|
||||
<span className="visually-hidden">Actions</span>
|
||||
<span className="visually-hidden">{t("Actions")}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -168,27 +169,27 @@ export default function ApiTokens() {
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{tokens?.map((t) => (
|
||||
<tr key={t.id}>
|
||||
{tokens?.map((item_) => (
|
||||
<tr key={item_.id}>
|
||||
<td className="stack-wide">
|
||||
<strong>{t.label}</strong>
|
||||
{t.expired && <span className="badge bg-red-lt text-red ms-2">expired</span>}
|
||||
<strong>{item_.label}</strong>
|
||||
{item_.expired && <span className="badge bg-red-lt text-red ms-2">expired</span>}
|
||||
</td>
|
||||
<td className="stack-label font-monospace" data-label="Starts with">
|
||||
{t.tokenPrefix}…
|
||||
{item_.tokenPrefix}…
|
||||
</td>
|
||||
<td className="stack-label" data-label="Made">
|
||||
<TimeAgo value={t.createdAt} fromDb />
|
||||
<TimeAgo value={item_.createdAt} fromDb />
|
||||
</td>
|
||||
<td className="stack-label" data-label="Last used">
|
||||
{t.lastUsedAt ? <TimeAgo value={t.lastUsedAt} /> : <span className="text-secondary">never</span>}
|
||||
{item_.lastUsedAt ? <TimeAgo value={item_.lastUsedAt} /> : <span className="text-secondary">never</span>}
|
||||
</td>
|
||||
<td className="stack-label" data-label="Ends">
|
||||
{t.expiresAt ? formatDate(new Date(t.expiresAt)) : <span className="text-secondary">no end</span>}
|
||||
<td className="stack-label" data-label={t("Ends")}>
|
||||
{item_.expiresAt ? formatDate(new Date(item_.expiresAt)) : <span className="text-secondary">no end</span>}
|
||||
</td>
|
||||
<td className="stack-wide">
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(t)}>
|
||||
Remove
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(item_)}>
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -12,14 +12,15 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import { readableError } from "../utils/errors";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function Badge({ a }: { a: AuthentikInfo }) {
|
||||
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
|
||||
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
|
||||
return <span className="badge bg-green-lt text-green">In order</span>;
|
||||
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("In order")}</span>;
|
||||
}
|
||||
|
||||
/** "in 12 days", "today", "3 days ago": how long until something runs out, in words, coloured by how close it is. */
|
||||
@@ -68,7 +69,7 @@ function Card({ a }: { a: AuthentikInfo }) {
|
||||
<th>Outpost</th>
|
||||
<th>Type</th>
|
||||
<th className="text-end">Serves</th>
|
||||
<th>Reporting</th>
|
||||
<th>{t("Reporting")}</th>
|
||||
<th>Last heard</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -153,7 +154,7 @@ function ManageCard({ a, onChanged }: { a: AuthentikInfo; onChanged: () => void
|
||||
<AuthentikGroupList a={a} />
|
||||
</>
|
||||
) : (
|
||||
<div className="text-secondary">Switched off under Integrations.</div>
|
||||
<div className="text-secondary">{t("Switched off under Integrations.")}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -198,8 +199,8 @@ export default function Authentik({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
{view === "status" ? (
|
||||
<PageIntro>
|
||||
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">Integrations</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
|
||||
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
|
||||
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">{t("Integrations")}</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
|
||||
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>.
|
||||
{isAdmin && (
|
||||
<>
|
||||
{" "}
|
||||
@@ -209,7 +210,7 @@ export default function Authentik({ user }: { user: CurrentUser }) {
|
||||
</PageIntro>
|
||||
) : (
|
||||
<p className="text-secondary">
|
||||
Make a user — with a one-time link for them to choose their own password — switch users off, edit or delete them, and make and rename groups and change who is in them. It needs a token that may do that on the integration (<Link to="/integrations">Integrations</Link> → edit),
|
||||
Make a user — with a one-time link for them to choose their own password — switch users off, edit or delete them, and make and rename groups and change who is in them. It needs a token that may do that on the integration (<Link to="/integrations">{t("Integrations")}</Link> → edit),
|
||||
and everything done here is written in the audit log.
|
||||
</p>
|
||||
)}
|
||||
|
||||
+18
-17
@@ -16,6 +16,7 @@ import { downloadCsv } from "../utils/csv";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { EmptyRow } from "../components/EmptyState";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
interface Row extends CoverageGuest {
|
||||
/** Worst first, so a default sort puts what needs attention at the top. */
|
||||
@@ -96,11 +97,11 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
}
|
||||
}
|
||||
|
||||
async function removeTest(t: RestoreTestEntry) {
|
||||
async function removeTest(item_: RestoreTestEntry) {
|
||||
await removeWithUndo({
|
||||
remove: () => api.backups.removeRestoreTest(t.id),
|
||||
restore: () => api.backups.recordRestoreTest({ key: t.subjectKey, label: t.label, testedAt: t.testedAt, result: t.result, note: t.note ?? undefined }),
|
||||
message: `Removed the test of "${t.label}" from ${t.testedAt}.`,
|
||||
remove: () => api.backups.removeRestoreTest(item_.id),
|
||||
restore: () => api.backups.recordRestoreTest({ key: item_.subjectKey, label: item_.label, testedAt: item_.testedAt, result: item_.result, note: item_.note ?? undefined }),
|
||||
message: `Removed the test of "${item_.label}" from ${item_.testedAt}.`,
|
||||
reload: () => {
|
||||
loadTests();
|
||||
load();
|
||||
@@ -242,7 +243,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
<SortableTh<Row> label="Guest" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="In a job" sortKeyName="inJob" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Last backup" sortKeyName="lastBackupAt" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label="Status" sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<Row> label={t("Status")} sortKeyName="rank" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<th>Restore test</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -361,7 +362,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
{saving ? "Saving…" : "Record it"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setDraft(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -380,7 +381,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</div>
|
||||
<div className="card-body text-secondary small pb-0">
|
||||
A backup nobody has restored is a hope, not a backup. Record each time you try one — for a guest above, or for anything else (a share, a database). A failed test is raised on the
|
||||
Alerts page; under Settings → Notifications you can also ask to be reminded when a guest with backups hasn’t had one in a while{report?.restoreTestDays ? ` (now: ${report.restoreTestDays} days)` : ""}.
|
||||
Alerts page; under Settings → Notifications you can also ask to be reminded when a guest with backups hasn’item_ had one in a while{report?.restoreTestDays ? ` (now: ${report.restoreTestDays} days)` : ""}.
|
||||
</div>
|
||||
{custom.length > 0 && (
|
||||
<div className="card-body pb-0">
|
||||
@@ -402,7 +403,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
<th>What</th>
|
||||
<th>Result</th>
|
||||
<th>Note</th>
|
||||
{isAdmin && <th className="w-1">Actions</th>}
|
||||
{isAdmin && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -413,21 +414,21 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{tests?.map((t) => (
|
||||
<tr key={t.id}>
|
||||
<td className="stack-label" data-label="Date">{t.testedAt}</td>
|
||||
<td>{t.label}</td>
|
||||
{tests?.map((item_) => (
|
||||
<tr key={item_.id}>
|
||||
<td className="stack-label" data-label="Date">{item_.testedAt}</td>
|
||||
<td>{item_.label}</td>
|
||||
<td>
|
||||
<span className={`badge ${RESTORE[t.result].badge}`}>{RESTORE[t.result].label}</span>
|
||||
<span className={`badge ${RESTORE[item_.result].badge}`}>{RESTORE[item_.result].label}</span>
|
||||
</td>
|
||||
<td className="text-secondary stack-wide">
|
||||
{t.note ?? "—"}
|
||||
{t.testedBy && <span className="small"> · {t.testedBy}</span>}
|
||||
{item_.note ?? "—"}
|
||||
{item_.testedBy && <span className="small"> · {item_.testedBy}</span>}
|
||||
</td>
|
||||
{isAdmin && (
|
||||
<td className="stack-wide">
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeTest(t)}>
|
||||
Remove
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void removeTest(item_)}>
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</td>
|
||||
)}
|
||||
|
||||
@@ -9,6 +9,7 @@ import EmptyState from "../components/EmptyState";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { formatDate, formatTime } from "../utils/date";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const TONE_DOT: Record<ChangeEntry["tone"], string> = { good: "#2fb344", bad: "#e05252", info: "#4299e1", neutral: "#8a94a6" };
|
||||
|
||||
@@ -42,7 +43,7 @@ export default function ChangeLog() {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<h2 className="page-title mb-0">Change log</h2>
|
||||
<h2 className="page-title mb-0">{t("Change log")}</h2>
|
||||
</div>
|
||||
{changeTabs("audit")}
|
||||
<AuditLogView />
|
||||
@@ -144,9 +145,9 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">Change log</h2>
|
||||
<h2 className="page-title mb-0">{t("Change log")}</h2>
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={!entries || entries.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
{tabs}
|
||||
@@ -159,15 +160,15 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
<div className="card-body d-flex flex-wrap gap-2 align-items-center">
|
||||
<input className="form-control w-auto flex-grow-1" style={{ maxWidth: "22rem" }} type="search" aria-label="Search the change log" placeholder="Search: a server, a person, a word…" value={text} onChange={(e) => setText(e.target.value)} />
|
||||
<select className="form-select w-auto" aria-label="Kind of change" value={kind} onChange={(e) => setParam("kind", e.target.value || null)}>
|
||||
<option value="">All kinds</option>
|
||||
<option value="">{t("All kinds")}</option>
|
||||
{kinds.map((k) => (
|
||||
<option key={k.id} value={k.id}>
|
||||
{k.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select className="form-select w-auto" aria-label="Server" value={serverId ?? ""} onChange={(e) => setParam("serverId", e.target.value || null)}>
|
||||
<option value="">Every server</option>
|
||||
<select className="form-select w-auto" aria-label={t("Server")} value={serverId ?? ""} onChange={(e) => setParam("serverId", e.target.value || null)}>
|
||||
<option value="">{t("Every server")}</option>
|
||||
{servers.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
@@ -190,7 +191,7 @@ function ReadableChanges({ tabs }: { tabs: ReactNode }) {
|
||||
{q || kind || serverId ? (
|
||||
<EmptyState
|
||||
filtered
|
||||
title="Nothing matches that"
|
||||
title={t("Nothing matches that")}
|
||||
hint={`Nothing in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()} fits what is searched for. Try a wider range, or fewer filters.`}
|
||||
action={{ label: "Clear the search and filters", onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }}
|
||||
/>
|
||||
|
||||
+16
-15
@@ -8,6 +8,7 @@ import { downloadCsv } from "../utils/csv";
|
||||
import { formatDate, formatTime } from "../utils/date";
|
||||
import { readableError } from "../utils/errors";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const KINDS: { id: AgendaKind; label: string }[] = [
|
||||
{ id: "secret", label: "Secrets" },
|
||||
@@ -57,11 +58,11 @@ function sectionsOf(items: AgendaItem[]): Section[] {
|
||||
const now = items.filter((i) => i.daysLeft < 0 || i.kind === "updates");
|
||||
const rest = items.filter((i) => !(i.daysLeft < 0 || i.kind === "updates"));
|
||||
return [
|
||||
{ id: "now", title: "Needs attention now", hint: "Already past its date, or waiting", items: now },
|
||||
{ id: "today", title: "Today", items: rest.filter((i) => i.daysLeft === 0) },
|
||||
{ id: "week", title: "This week", items: rest.filter((i) => i.daysLeft >= 1 && i.daysLeft <= 7) },
|
||||
{ id: "month", title: "The rest of the month", hint: "8 to 30 days away", items: rest.filter((i) => i.daysLeft >= 8 && i.daysLeft <= 30) },
|
||||
{ id: "later", title: "Further ahead", items: rest.filter((i) => i.daysLeft > 30) },
|
||||
{ id: "now", title: t("Needs attention now"), hint: t("Already past its date, or waiting"), items: now },
|
||||
{ id: "today", title: t("Today"), items: rest.filter((i) => i.daysLeft === 0) },
|
||||
{ id: "week", title: t("This week"), items: rest.filter((i) => i.daysLeft >= 1 && i.daysLeft <= 7) },
|
||||
{ id: "month", title: t("The rest of the month"), hint: "8 to 30 days away", items: rest.filter((i) => i.daysLeft >= 8 && i.daysLeft <= 30) },
|
||||
{ id: "later", title: t("Further ahead"), items: rest.filter((i) => i.daysLeft > 30) },
|
||||
].filter((s) => s.items.length > 0);
|
||||
}
|
||||
|
||||
@@ -191,9 +192,9 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">Coming up</h2>
|
||||
<h2 className="page-title mb-0">{t("Coming up")}</h2>
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv} disabled={shown.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
<PageIntro>
|
||||
@@ -230,7 +231,7 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
<div className="card mb-3">
|
||||
<div className="card-body">
|
||||
<div className="d-flex flex-wrap gap-2 align-items-center mb-2">
|
||||
<select className="form-select w-auto" aria-label="How far ahead" value={days} onChange={(e) => setParam("days", e.target.value === "90" ? null : e.target.value)}>
|
||||
<select className="form-select w-auto" aria-label={t("How far ahead")} value={days} onChange={(e) => setParam("days", e.target.value === "90" ? null : e.target.value)}>
|
||||
{RANGES.map((r) => (
|
||||
<option key={r.days} value={r.days}>
|
||||
{r.label}
|
||||
@@ -238,8 +239,8 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
))}
|
||||
</select>
|
||||
{serversWithItems.length > 0 && (
|
||||
<select className="form-select w-auto" aria-label="Server" value={serverId ?? ""} onChange={(e) => setParam("server", e.target.value || null)}>
|
||||
<option value="">Every server</option>
|
||||
<select className="form-select w-auto" aria-label={t("Server")} value={serverId ?? ""} onChange={(e) => setParam("server", e.target.value || null)}>
|
||||
<option value="">{t("Every server")}</option>
|
||||
{serversWithItems.map((id) => (
|
||||
<option key={id} value={id}>
|
||||
{servers.get(id) ?? `Server ${id}`}
|
||||
@@ -250,16 +251,16 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
{(hiddenRecurring > 0 || everyOccurrence) && (
|
||||
<label className="form-check mb-0 ms-2">
|
||||
<input type="checkbox" className="form-check-input" checked={everyOccurrence} onChange={(e) => setEveryOccurrence(e.target.checked)} />
|
||||
<span className="form-check-label">Every time a recurring maintenance happens{hiddenRecurring > 0 ? ` (${hiddenRecurring} more)` : ""}</span>
|
||||
<span className="form-check-label">{t("Every time a recurring maintenance happens")}{hiddenRecurring > 0 ? ` (${hiddenRecurring} more)` : ""}</span>
|
||||
</label>
|
||||
)}
|
||||
{filtered && (
|
||||
<button className="btn btn-sm btn-link" onClick={() => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true })}>
|
||||
Clear filters
|
||||
{t("Clear filters")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div className="d-flex flex-wrap gap-2" role="group" aria-label="Kinds of things">
|
||||
<div className="d-flex flex-wrap gap-2" role="group" aria-label={t("Kinds of things")}>
|
||||
{KINDS.map((k) => {
|
||||
const n = counts.get(k.id) ?? 0;
|
||||
const on = chosen.has(k.id);
|
||||
@@ -277,9 +278,9 @@ export default function ComingUp({ user }: { user: CurrentUser }) {
|
||||
{agenda !== null && sections.length === 0 && (
|
||||
<div className="card">
|
||||
{filtered ? (
|
||||
<EmptyState filtered title="Nothing matches that" hint="Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters." action={{ label: "Clear filters", onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
|
||||
<EmptyState filtered title={t("Nothing matches that")} hint={t("Nothing with a date fits the kinds and server chosen. Try a longer range, or fewer filters.")} action={{ label: "Clear filters", onClick: () => setParams(new URLSearchParams(days === 90 ? {} : { days: String(days) }), { replace: true }) }} />
|
||||
) : (
|
||||
<EmptyState title="Nothing is coming up" hint={`Nothing expires, ends or is planned in the next ${days} days. Dates come from Secrets, Domains, Inventory (warranty and end of support), Maintenance and the endpoint checks' certificates.`} />
|
||||
<EmptyState title={t("Nothing is coming up")} hint={`Nothing expires, ends or is planned in the next ${days} days. Dates come from Secrets, Domains, Inventory (warranty and end of support), Maintenance and the endpoint checks' certificates.`} />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { readableError } from "../utils/errors";
|
||||
import { promptDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice, SuccessNotice } from "../components/Notice";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const KINDS: { kind: ConsistencyKind; title: string; blurb: string }[] = [
|
||||
{ kind: "ip_conflict", title: "Address conflicts", blurb: "The same address reported by more than one server." },
|
||||
@@ -158,10 +159,10 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-3">
|
||||
<h2 className="page-title mb-0">Consistency</h2>
|
||||
<h2 className="page-title mb-0">{t("Consistency")}</h2>
|
||||
<div className="ms-auto btn-list">
|
||||
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={visible.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={() => void load()} disabled={loading}>
|
||||
{loading ? "Checking…" : "Refresh"}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { formatDate } from "../utils/date";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const money = (n: number, currency: string) => {
|
||||
try {
|
||||
@@ -175,7 +176,7 @@ function ItemForm({ initial, categories, currencies, saving, onSave, onCancel }:
|
||||
{saving ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={saving} onClick={onCancel}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -235,9 +236,9 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-3 mb-3">
|
||||
<div style={{ flex: "1 1 320px", minWidth: 0 }}>
|
||||
<h2 className="page-title mb-0">Costs</h2>
|
||||
<h2 className="page-title mb-0">{t("Costs")}</h2>
|
||||
<PageIntro className="small mt-1">
|
||||
What the homelab costs, in one place: what you pay for by hand and what can be read (a Hetzner project’s estimate — see <Link to="/hetzner">Hetzner Cloud</Link>). Each currency has its own total; none is converted into another. A day a bill falls on shows under <Link to="/coming-up">Coming up</Link>.
|
||||
What the homelab costs, in one place: what you pay for by hand and what can be read (a Hetzner project’s estimate — see <Link to="/hetzner">Hetzner Cloud</Link>). Each currency has its own total; none is converted into another. A day a bill falls on shows under <Link to="/coming-up">{t("Coming up")}</Link>.
|
||||
</PageIntro>
|
||||
</div>
|
||||
{isAdmin && !form && (
|
||||
@@ -327,7 +328,7 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
<td className="text-secondary">—</td>
|
||||
<td className="text-end">
|
||||
<Link to={a.link} className="btn btn-sm">
|
||||
Open
|
||||
{t("Open")}
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -348,10 +349,10 @@ export default function Costs({ user }: { user: CurrentUser }) {
|
||||
{isAdmin && (
|
||||
<div className="btn-list justify-content-end flex-nowrap">
|
||||
<button className="btn btn-sm" onClick={() => setForm({ id: i.id, value: { name: i.name, amount: i.amount, currency: i.currency, period: i.period, category: i.category, renewsOn: i.renewsOn, note: i.note } })}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(i)}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+100
-99
@@ -31,6 +31,7 @@ import { TYPE_GROUPS, TYPE_LABELS, TYPE_PAGES } from "../utils/integrationTypes"
|
||||
import type { Agenda, Heartbeat } from "../api/client";
|
||||
import BrandIcon from "../components/BrandIcon";
|
||||
import { kindOfLabel } from "../utils/brands";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const DNS_TYPE_COLORS: Record<string, string> = {
|
||||
A: "#60a5fa",
|
||||
@@ -220,15 +221,15 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
|
||||
<div className={`card h-100 ${hidden ? "card-hidden" : ""} ${problem ? `card-problem card-problem-${problem}` : ""}`}>
|
||||
{editing && (
|
||||
<div className="card-customise">
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} earlier`} title="Move earlier" onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, -1)}>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} earlier`} title={t("Move earlier")} onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, -1)}>
|
||||
<IconArrowLeft size={16} aria-hidden="true" />
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} later`} title="Move later" onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, 1)}>
|
||||
<button type="button" className="btn btn-sm btn-icon" aria-label={`Move ${label} later`} title={t("Move later")} onClick={(e) => void moveCard(e.currentTarget.closest<HTMLElement>("[data-card]")!, 1)}>
|
||||
<IconArrowRight size={16} aria-hidden="true" />
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm ms-auto d-inline-flex align-items-center gap-1" aria-pressed={hidden} onClick={() => void setCardHidden(label, !hidden)}>
|
||||
{hidden ? <IconEye size={16} aria-hidden="true" /> : <IconEyeOff size={16} aria-hidden="true" />}
|
||||
{hidden ? "Show" : "Hide"}
|
||||
{hidden ? t("Show") : t("Hide")}
|
||||
<span className="visually-hidden"> {label}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -249,31 +250,31 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
|
||||
}
|
||||
|
||||
/** The status badge of a Technitium DNS Server widget: switched off, not read yet, can't be read, or what its alerts say (red for a critical one, yellow for the rest). */
|
||||
function technitiumBadge(enabled: boolean, t: TechnitiumInstance | null): ReactNode {
|
||||
if (!enabled) return <span className="badge bg-secondary-lt text-secondary">Disabled</span>;
|
||||
if (!t || !t.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!t.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (t.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
|
||||
if (t.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
|
||||
return <span className="badge bg-green-lt text-green">In order</span>;
|
||||
function technitiumBadge(enabled: boolean, tech: TechnitiumInstance | null): ReactNode {
|
||||
if (!enabled) return <span className="badge bg-secondary-lt text-secondary">{t("Disabled")}</span>;
|
||||
if (!tech || !tech.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!tech.fresh) return <span className="badge bg-yellow-lt text-yellow">{t("Can’t be read")}</span>;
|
||||
if (tech.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
if (tech.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("In order")}</span>;
|
||||
}
|
||||
|
||||
const TECHNITIUM_HOW_COLORS: Record<string, string> = { "from cache": "#60a5fa", resolved: "#22d3ee", "own zones": "#4ade80", blocked: "#fb923c", dropped: "#f87171" };
|
||||
|
||||
/** What the Technitium DNS Server widget says: whether DNS answers and how fast, the last day's queries and how many were blocked, how they were answered, and what is wrong. The page has the rest. */
|
||||
function TechnitiumBody({ enabled, instance, loading }: { enabled: boolean; instance: TechnitiumInstance | null; loading: boolean }) {
|
||||
if (!enabled) return <div className="text-secondary">Switched off under Integrations.</div>;
|
||||
if (!enabled) return <div className="text-secondary">{t("Switched off under Integrations.")}</div>;
|
||||
if (loading) return <WidgetSkeleton />;
|
||||
const s = instance?.state ?? null;
|
||||
const open = (
|
||||
<div className="mt-2">
|
||||
<Link to="/technitium">Open Technitium DNS</Link>
|
||||
<Link to="/technitium">{t("Open Technitium DNS")}</Link>
|
||||
</div>
|
||||
);
|
||||
if (!instance || !s) {
|
||||
return (
|
||||
<>
|
||||
<div className="text-secondary">Not read yet.</div>
|
||||
<div className="text-secondary">{t("Not read yet.")}</div>
|
||||
{open}
|
||||
</>
|
||||
);
|
||||
@@ -292,18 +293,18 @@ function TechnitiumBody({ enabled, instance, loading }: { enabled: boolean; inst
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="DNS answers" value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
|
||||
<MiniStat label={t("DNS answers")} value={s.probe === null ? "—" : s.probe.ok ? `${s.probe.ms ?? "?"} ms` : "No"} accent={s.probe && !s.probe.ok ? "#f87171" : undefined} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Queries, 24 h" value={st ? st.queries.toLocaleString() : "—"} />
|
||||
<MiniStat label={t("Queries, 24 h")} value={st ? st.queries.toLocaleString() : "—"} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Blocked" value={st?.blockedPercent != null ? `${st.blockedPercent}%` : "—"} accent={!s.blockingEnabled && s.settings.blockLists.count > 0 ? "#f59e0b" : undefined} />
|
||||
</div>
|
||||
</div>
|
||||
{how.length > 0 && <BreakdownBar data={how} colors={TECHNITIUM_HOW_COLORS} compact />}
|
||||
{!s.blockingEnabled && s.settings.blockLists.count > 0 && <div className="small text-yellow mt-2">Blocking is switched off.</div>}
|
||||
{!instance.fresh && <div className="small text-yellow mt-2">The last read is old, so this may be out of date.</div>}
|
||||
{!s.blockingEnabled && s.settings.blockLists.count > 0 && <div className="small text-yellow mt-2">{t("Blocking is switched off.")}</div>}
|
||||
{!instance.fresh && <div className="small text-yellow mt-2">{t("The last read is old, so this may be out of date.")}</div>}
|
||||
{instance.problems.slice(0, 2).map((p) => (
|
||||
<div key={p.key} className={`small mt-1 ${p.severity === "critical" ? "text-red" : "text-yellow"}`}>
|
||||
{p.message}
|
||||
@@ -422,7 +423,7 @@ function MyWorkStrip() {
|
||||
<strong>{work.needsAttention}</strong> {work.needsAttention === 1 ? "thing" : "things"} of yours {work.needsAttention === 1 ? "wants" : "want"} a look — alerts handed to you or about to run out, maintenance about to end, update runs still going, jobs that are due.
|
||||
</span>
|
||||
<Link to="/my-work" className="btn btn-sm btn-primary ms-auto">
|
||||
My work
|
||||
{t("My work")}
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
@@ -755,12 +756,12 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
).map(([type, count]) => ({ label: SECRET_TYPE_LABELS[type as SecretRecord["type"]] ?? type, count }));
|
||||
|
||||
const setupSteps: SetupStep[] = [
|
||||
{ id: "integration", title: "Connect an integration", description: "Proxmox, Synology, Tailscale, Docker, Uptime Kuma… each gets its own page and shows up in alerts.", to: "/integrations", action: "Add one", done: (integrations?.length ?? 0) > 0 },
|
||||
{ id: "server", title: "Add a server and install its agent", description: "The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.", to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
|
||||
{ id: "dns", title: "Connect a DNS provider", description: "See your zones and records, and have names matched to servers.", to: "/dns", action: "Connect", done: (dnsStats?.totalProviders ?? 0) > 0 },
|
||||
{ id: "secret", title: "Track something that expires", description: "An API token, a certificate or a password — you're warned before it runs out.", to: "/secrets", action: "Add one", done: (secrets?.length ?? 0) > 0 },
|
||||
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, Telegram, Pushover, email, a webhook or push to your phone, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
|
||||
{ id: "people", title: "Let someone else in (optional)", description: "Others sign in with Authentik and appear under Users; you decide their role.", to: "/users", action: "Open Users", done: (userCount ?? 0) > 1 },
|
||||
{ id: "integration", title: t("Connect an integration"), description: t("Proxmox, Synology, Tailscale, Docker, Uptime Kuma… each gets its own page and shows up in alerts."), to: "/integrations", action: t("Add one"), done: (integrations?.length ?? 0) > 0 },
|
||||
{ id: "server", title: t("Add a server and install its agent"), description: t("The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet."), to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
|
||||
{ id: "dns", title: t("Connect a DNS provider"), description: t("See your zones and records, and have names matched to servers."), to: "/dns", action: t("Connect"), done: (dnsStats?.totalProviders ?? 0) > 0 },
|
||||
{ id: "secret", title: t("Track something that expires"), description: t("An API token, a certificate or a password — you're warned before it runs out."), to: "/secrets", action: t("Add one"), done: (secrets?.length ?? 0) > 0 },
|
||||
{ id: "notify", title: t("Choose how you'll be told about problems"), description: t("Gotify, ntfy, Telegram, Pushover, email, a webhook or push to your phone, with the checks you want."), to: "/settings/notifications", action: t("Set up"), done: notifyConfigured === true },
|
||||
{ id: "people", title: t("Let someone else in (optional)"), description: t("Others sign in with Authentik and appear under Users; you decide their role."), to: "/users", action: t("Open Users"), done: (userCount ?? 0) > 1 },
|
||||
];
|
||||
|
||||
// What the endpoint checks say: the ones that keep failing, and the certificates that are running out.
|
||||
@@ -786,15 +787,15 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
|
||||
// What has nothing set up yet. These get one list at the bottom instead of a grey "Not configured" card each.
|
||||
const notSetUp: { label: string; to: string; what: string }[] = [];
|
||||
if (dnsStats?.totalProviders === 0) notSetUp.push({ label: "DNS", to: "/dns", what: "connect a DNS provider to see zones and records" });
|
||||
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: "Secrets", to: "/secrets", what: "track when a token, certificate or password expires" });
|
||||
if (dnsStats?.totalProviders === 0) notSetUp.push({ label: "DNS", to: "/dns", what: t("connect a DNS provider to see zones and records") });
|
||||
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: "Secrets", to: "/secrets", what: t("track when a token, certificate or password expires") });
|
||||
if (serverSummary?.total === 0) notSetUp.push({ label: "Servers", to: "/servers", what: "add a server and install its agent" });
|
||||
if (heartbeatList !== null && heartbeatList.length === 0) notSetUp.push({ label: "Heartbeats", to: "/heartbeats", what: "have a backup or cron job report in, so you hear when it doesn't run" });
|
||||
if (endpointChecks !== null && endpointChecks.length === 0) notSetUp.push({ label: "Endpoints", to: "/endpoints", what: "ask a web address, a port or a certificate whether it is fine" });
|
||||
if (domainList !== null && domains.length === 0) notSetUp.push({ label: "Domains", to: "/dns?view=domains", what: "appear after a DNS zone is added and the daily check has run" });
|
||||
if (integrations !== null) {
|
||||
for (const { type, label } of WIDGETS) {
|
||||
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: "connect it under Integrations" });
|
||||
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: t("connect it under Integrations") });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,30 +804,30 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<div className="row row-cards mb-3">
|
||||
<div className="col-12">
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
<h2 className="page-title mb-0">Dashboard</h2>
|
||||
<h2 className="page-title mb-0">{t("Dashboard")}</h2>
|
||||
<div className="ms-auto d-flex gap-2">
|
||||
<button type="button" className={`btn btn-sm ${editing ? "btn-primary" : "btn-outline-secondary"}`} aria-pressed={editing} onClick={() => setEditingDashboard(!editing)}>
|
||||
{editing ? "Done" : "Customise"}
|
||||
{editing ? t("Done") : t("Customise")}
|
||||
</button>
|
||||
<Link to="/wall" className="btn btn-sm btn-outline-secondary" title="A full-screen status board for a spare monitor or tablet">
|
||||
Wall display
|
||||
<Link to="/wall" className="btn btn-sm btn-outline-secondary" title={t("A full-screen status board for a spare monitor or tablet")}>
|
||||
{t("Wall display")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
{editing && (
|
||||
<div className="alert alert-info d-flex flex-wrap align-items-center gap-2" role="status">
|
||||
<span>Move the Overview cards with the arrows, and hide any card you don't use — the ones at the top too. It saves as you go, for you only, and follows you to other browsers.</span>
|
||||
<span>{t("Move the Overview cards with the arrows, and hide any card you don't use — the ones at the top too. It saves as you go, for you only, and follows you to other browsers.")}</span>
|
||||
<label className="form-check mb-0 ms-auto">
|
||||
<input type="checkbox" className="form-check-input" checked={problemsFirst} onChange={(e) => setProblemsFirst(e.target.checked)} />
|
||||
<span className="form-check-label">Cards with a problem come first</span>
|
||||
<span className="form-check-label">{t("Cards with a problem come first")}</span>
|
||||
</label>
|
||||
<button type="button" className="btn btn-sm" onClick={() => void resetDashboardLayout()}>
|
||||
Reset to default
|
||||
{t("Reset to default")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<p className="text-secondary">
|
||||
Welcome back, {user.name ?? user.email ?? user.sub}.
|
||||
{t("Welcome back,")} {user.name ?? user.email ?? user.sub}.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -835,19 +836,19 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<div className="row row-cards mb-3">
|
||||
{showTopLeft && (
|
||||
<div className={showTopLeft && todoCard.shown ? "col-xl-6" : "col-12"}>
|
||||
<Hideable label="Needs attention">
|
||||
<Hideable label={t("Needs attention")}>
|
||||
<StatusStrip />
|
||||
</Hideable>
|
||||
{(user.role === "admin" || user.role === "operator") && (
|
||||
<Hideable label="My work">
|
||||
<Hideable label={t("My work")}>
|
||||
<MyWorkStrip />
|
||||
</Hideable>
|
||||
)}
|
||||
<Hideable label="Since you last looked">
|
||||
<Hideable label={t("Since you last looked")}>
|
||||
<WhatChanged role={user.role} />
|
||||
</Hideable>
|
||||
{isAdmin && integrations !== null && dnsStats !== null && serverSummary !== null && secrets !== null && notifyConfigured !== null && (
|
||||
<Hideable label="Getting started">
|
||||
<Hideable label={t("Getting started")}>
|
||||
<SetupGuide steps={setupSteps} />
|
||||
</Hideable>
|
||||
)}
|
||||
@@ -872,14 +873,14 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<SectionHeader title="Overview" hint="DNS, Secrets, Servers and Domains are built into this app rather than connected integrations, but get the same at-a-glance treatment." />
|
||||
<SectionHeader title={t("Overview")} hint={t("DNS, Secrets, Servers and Domains are built into this app rather than connected integrations, but get the same at-a-glance treatment.")} />
|
||||
<div className="row row-cards mb-3">
|
||||
<WidgetCard
|
||||
label="DNS"
|
||||
hide={dnsStats?.totalProviders === 0}
|
||||
badge={
|
||||
!dnsStats ? undefined : dnsStats.totalProviders === 0 ? (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
|
||||
) : (
|
||||
<span className="badge bg-green-lt text-green">
|
||||
{dnsStats.enabledProviders} enabled
|
||||
@@ -898,10 +899,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Domains" value={dnsStats.totalZones} />
|
||||
<MiniStat label={t("Domains")} value={dnsStats.totalZones} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Records" value={dnsStats.totalRecords} />
|
||||
<MiniStat label={t("Records")} value={dnsStats.totalRecords} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Providers" value={`${dnsStats.enabledProviders}/${dnsStats.totalProviders}`} />
|
||||
@@ -923,17 +924,17 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</WidgetCard>
|
||||
|
||||
<WidgetCard
|
||||
label="Secrets"
|
||||
label={t("Secrets")}
|
||||
hide={secrets !== null && totalSecrets === 0}
|
||||
badge={
|
||||
!secrets ? undefined : totalSecrets === 0 ? (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
|
||||
) : expiredSecrets > 0 ? (
|
||||
<span className="badge bg-red-lt text-red">{expiredSecrets} expired</span>
|
||||
) : expiringSecrets > 0 ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">{expiringSecrets} expiring</span>
|
||||
) : (
|
||||
<span className="badge bg-green-lt text-green">All OK</span>
|
||||
<span className="badge bg-green-lt text-green">{t("All OK")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -941,7 +942,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<WidgetSkeleton />
|
||||
) : totalSecrets === 0 ? (
|
||||
<div className="text-secondary">
|
||||
Configure a secret from the <Link to="/secrets">Secrets</Link> page.
|
||||
Configure a secret from the <Link to="/secrets">{t("Secrets")}</Link> page.
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@@ -962,11 +963,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</WidgetCard>
|
||||
|
||||
<WidgetCard
|
||||
label="Servers"
|
||||
label={t("Servers")}
|
||||
hide={serverSummary?.total === 0}
|
||||
badge={
|
||||
!serverSummary ? undefined : serverSummary.total === 0 ? (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
|
||||
) : serverSummary.offline.length > 0 ? (
|
||||
<span className="badge bg-red-lt text-red">{serverSummary.offline.length} offline</span>
|
||||
) : serverSummary.fullDisks.length > 0 ? (
|
||||
@@ -974,9 +975,9 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
{serverSummary.fullDisks.length} disk{serverSummary.fullDisks.length === 1 ? "" : "s"} nearly full
|
||||
</span>
|
||||
) : serverSummary.online > 0 ? (
|
||||
<span className="badge bg-green-lt text-green">All online</span>
|
||||
<span className="badge bg-green-lt text-green">{t("All online")}</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary">No agent data</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("No agent data")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -985,23 +986,23 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
!serverError && <WidgetSkeleton />
|
||||
) : serverSummary.total === 0 ? (
|
||||
<div className="text-secondary">
|
||||
Add a server from the <Link to="/servers">Servers</Link> page.
|
||||
Add a server from the <Link to="/servers">{t("Servers")}</Link> page.
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Servers" value={<Link to="/servers" className="text-reset text-decoration-none">{serverSummary.total}</Link>} />
|
||||
<MiniStat label={t("Servers")} value={<Link to="/servers" className="text-reset text-decoration-none">{serverSummary.total}</Link>} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Online"
|
||||
label={t("Online")}
|
||||
value={serverSummary.online + serverSummary.offline.length === 0 ? "—" : `${serverSummary.online}/${serverSummary.online + serverSummary.offline.length}`}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Offline"
|
||||
label={t("Offline")}
|
||||
value={serverSummary.offline.length}
|
||||
accent={serverSummary.offline.length > 0 ? "#ef4444" : undefined}
|
||||
/>
|
||||
@@ -1009,8 +1010,8 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<BreakdownBar
|
||||
data={[
|
||||
{ label: "Online", count: serverSummary.online },
|
||||
{ label: "Offline", count: serverSummary.offline.length },
|
||||
{ label: t("Online"), count: serverSummary.online },
|
||||
{ label: t("Offline"), count: serverSummary.offline.length },
|
||||
{ label: "No data", count: serverSummary.noData },
|
||||
].filter((d) => d.count > 0)}
|
||||
colors={SERVER_STATE_COLORS}
|
||||
@@ -1018,7 +1019,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
{serverSummary.offline.length > 0 && (
|
||||
<div className="small mt-2">
|
||||
<span className="text-red">Offline:</span>{" "}
|
||||
<span className="text-red">{t("Offline:")}</span>{" "}
|
||||
{serverSummary.offline.slice(0, 3).map((s, i) => (
|
||||
<span key={s.id}>
|
||||
{i > 0 && ", "}
|
||||
@@ -1062,19 +1063,19 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</WidgetCard>
|
||||
|
||||
<WidgetCard
|
||||
label="Domains"
|
||||
label={t("Domains")}
|
||||
hide={domainList !== null && domains.length === 0}
|
||||
badge={
|
||||
!domainList ? undefined : domains.length === 0 ? (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not configured")}</span>
|
||||
) : expiredDomains.length > 0 ? (
|
||||
<span className="badge bg-red-lt text-red">{expiredDomains.length} expired</span>
|
||||
) : expiringDomains.length > 0 ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">{expiringDomains.length} expiring</span>
|
||||
) : okDomains > 0 ? (
|
||||
<span className="badge bg-green-lt text-green">All OK</span>
|
||||
<span className="badge bg-green-lt text-green">{t("All OK")}</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary">No expiry dates</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("No expiry dates")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -1083,7 +1084,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
!domainError && <WidgetSkeleton />
|
||||
) : domains.length === 0 ? (
|
||||
<div className="text-secondary">
|
||||
Domains for your DNS zones appear on the <Link to="/dns?view=domains">Domains</Link> page after the next daily check, or add one there.
|
||||
Domains for your DNS zones appear on the <Link to="/dns?view=domains">{t("Domains")}</Link> page after the next daily check, or add one there.
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@@ -1110,7 +1111,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
/>
|
||||
{expiredDomains.length > 0 && (
|
||||
<div className="small mt-2">
|
||||
<span className="text-red">Expired:</span>{" "}
|
||||
<span className="text-red">{t("Expired:")}</span>{" "}
|
||||
{expiredDomains.slice(0, 3).map((d, i) => (
|
||||
<span key={d.id}>
|
||||
{i > 0 && ", "}
|
||||
@@ -1122,7 +1123,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
{expiringDomains.length > 0 && (
|
||||
<div className="small mt-2">
|
||||
<span className="text-yellow">Expiring:</span>{" "}
|
||||
<span className="text-yellow">{t("Expiring:")}</span>{" "}
|
||||
{expiringDomains
|
||||
.slice()
|
||||
.sort((a, b) => a.daysLeft! - b.daysLeft!)
|
||||
@@ -1138,12 +1139,12 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
{nextDomain && nextDomain.status === "ok" && (
|
||||
<div className="text-secondary small mt-2">
|
||||
Next to expire: {nextDomain.name} in {nextDomain.daysLeft} days ({nextDomain.expiresAt})
|
||||
{t("Next to expire:")} {nextDomain.name} in {nextDomain.daysLeft} days ({nextDomain.expiresAt})
|
||||
</div>
|
||||
)}
|
||||
{failingDomainChecks > 0 && (
|
||||
<div className="text-secondary small mt-2">
|
||||
{failingDomainChecks} domain{failingDomainChecks === 1 ? "" : "s"} couldn't be refreshed — see the <Link to="/dns?view=domains">Domains</Link> page.
|
||||
{failingDomainChecks} domain{failingDomainChecks === 1 ? "" : "s"} couldn't be refreshed — see the <Link to="/dns?view=domains">{t("Domains")}</Link> page.
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
@@ -1151,7 +1152,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</WidgetCard>
|
||||
|
||||
<WidgetCard
|
||||
label="Endpoints"
|
||||
label={t("Endpoints")}
|
||||
hide={endpointChecks !== null && endpointChecks.length === 0}
|
||||
badge={
|
||||
!endpointChecks ? undefined : endpointsDown.length > 0 ? (
|
||||
@@ -1161,7 +1162,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
{endpointCerts} certificate{endpointCerts === 1 ? "" : "s"} to renew
|
||||
</span>
|
||||
) : (
|
||||
<span className="badge bg-green-lt text-green">All answering</span>
|
||||
<span className="badge bg-green-lt text-green">{t("All answering")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -1186,28 +1187,28 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
))}
|
||||
<div className="text-secondary small mt-2">
|
||||
<Link to="/endpoints">All checks</Link>
|
||||
<Link to="/endpoints">{t("All checks")}</Link>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</WidgetCard>
|
||||
|
||||
<WidgetCard
|
||||
label="Coming up"
|
||||
label={t("Coming up")}
|
||||
badge={
|
||||
!agenda ? undefined : soonPast > 0 ? (
|
||||
<span className="badge bg-red-lt text-red">{soonPast} past their date</span>
|
||||
) : soonWeek > 0 ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">{soonWeek} this week</span>
|
||||
) : (
|
||||
<span className="badge bg-green-lt text-green">Nothing soon</span>
|
||||
<span className="badge bg-green-lt text-green">{t("Nothing soon")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
{!agenda ? (
|
||||
<WidgetSkeleton />
|
||||
) : soon.length === 0 ? (
|
||||
<div className="text-secondary small">Nothing expires, ends or is planned in the next 30 days.</div>
|
||||
<div className="text-secondary small">{t("Nothing expires, ends or is planned in the next 30 days.")}</div>
|
||||
) : (
|
||||
<>
|
||||
{soon.slice(0, 5).map((i) => (
|
||||
@@ -1224,18 +1225,18 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</>
|
||||
)}
|
||||
<div className="text-secondary small mt-2">
|
||||
<Link to="/coming-up">Everything coming up</Link>
|
||||
<Link to="/coming-up">{t("Everything coming up")}</Link>
|
||||
</div>
|
||||
</WidgetCard>
|
||||
|
||||
<WidgetCard
|
||||
label="Heartbeats"
|
||||
label={t("Heartbeats")}
|
||||
hide={heartbeatList !== null && heartbeatList.length === 0}
|
||||
badge={
|
||||
!heartbeatList ? undefined : beatsWrong.length > 0 ? (
|
||||
<span className="badge bg-red-lt text-red">{beatsWrong.length} not reporting</span>
|
||||
) : (
|
||||
<span className="badge bg-green-lt text-green">All reporting</span>
|
||||
<span className="badge bg-green-lt text-green">{t("All reporting")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -1248,10 +1249,10 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<MiniStat label="Jobs" value={heartbeatList.filter((h) => h.enabled).length} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="On time" value={heartbeatList.filter((h) => h.state === "up" || h.state === "running").length} />
|
||||
<MiniStat label={t("On time")} value={heartbeatList.filter((h) => h.state === "up" || h.state === "running").length} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Late or failed" value={beatsWrong.length} accent={beatsWrong.length > 0 ? "#ef4444" : undefined} />
|
||||
<MiniStat label={t("Late or failed")} value={beatsWrong.length} accent={beatsWrong.length > 0 ? "#ef4444" : undefined} />
|
||||
</div>
|
||||
</div>
|
||||
{beatsWrong.slice(0, 3).map((h) => (
|
||||
@@ -1260,7 +1261,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
))}
|
||||
<div className="text-secondary small mt-2">
|
||||
<Link to="/heartbeats">All heartbeats</Link>
|
||||
<Link to="/heartbeats">{t("All heartbeats")}</Link>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -1302,9 +1303,9 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
isLive ? (
|
||||
<span className="badge bg-green-lt text-green">Connected</span>
|
||||
) : integration ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">Connecting…</span>
|
||||
<span className="badge bg-yellow-lt text-yellow">{t("Connecting…")}</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not connected</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not connected")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -1312,7 +1313,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Online / Total" value={`${tailscaleSummary!.online}/${tailscaleSummary!.total}`} />
|
||||
<MiniStat label={t("Online / Total")} value={`${tailscaleSummary!.online}/${tailscaleSummary!.total}`} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
@@ -1323,7 +1324,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Keys expiring"
|
||||
label={t("Keys expiring")}
|
||||
value={tailscaleSummary!.expiringSoon}
|
||||
accent={tailscaleSummary!.expiringSoon > 0 ? "#f59e0b" : undefined}
|
||||
/>
|
||||
@@ -1348,7 +1349,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Failing builds"
|
||||
label={t("Failing builds")}
|
||||
value={giteaSummary!.failing}
|
||||
accent={giteaSummary!.failing > 0 ? "#ef4444" : undefined}
|
||||
/>
|
||||
@@ -1362,14 +1363,14 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Running / Total" value={`${dockhandSummary!.running}/${dockhandSummary!.total}`} />
|
||||
<MiniStat label={t("Running / Total")} value={`${dockhandSummary!.running}/${dockhandSummary!.total}`} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Hosts" value={dockhandSummary!.hostCount} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Updates"
|
||||
label={t("Updates")}
|
||||
value={dockhandSummary!.updatesAvailable}
|
||||
accent={dockhandSummary!.updatesAvailable > 0 ? "#f59e0b" : undefined}
|
||||
/>
|
||||
@@ -1383,11 +1384,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-6">
|
||||
<MiniStat label="Templates" value={semaphoreSummary!.total} />
|
||||
<MiniStat label={t("Templates")} value={semaphoreSummary!.total} />
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<MiniStat
|
||||
label="Last failed"
|
||||
label={t("Last failed")}
|
||||
value={semaphoreSummary!.failing}
|
||||
accent={semaphoreSummary!.failing > 0 ? "#ef4444" : undefined}
|
||||
/>
|
||||
@@ -1401,7 +1402,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<>
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Running / Total" value={`${proxmoxSummary!.running}/${proxmoxSummary!.total}`} />
|
||||
<MiniStat label={t("Running / Total")} value={`${proxmoxSummary!.running}/${proxmoxSummary!.total}`} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="VMs" value={proxmoxSummary!.vmCount} />
|
||||
@@ -1433,7 +1434,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="CPU load"
|
||||
label={t("CPU load")}
|
||||
value={synologySummary!.cpuLoadPercent !== null ? `${synologySummary!.cpuLoadPercent.toFixed(0)}%` : "—"}
|
||||
/>
|
||||
</div>
|
||||
@@ -1461,7 +1462,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<MiniStat label="Down" value={uptimeKumaSummary!.down} accent={uptimeKumaSummary!.down > 0 ? "#ef4444" : undefined} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat label="Matched to a server" value={`${uptimeKumaSummary!.matched}/${uptimeKumaSummary!.total}`} />
|
||||
<MiniStat label={t("Matched to a server")} value={`${uptimeKumaSummary!.matched}/${uptimeKumaSummary!.total}`} />
|
||||
</div>
|
||||
</div>
|
||||
{uptimeKumaSummary!.statusBreakdown.length > 0 && (
|
||||
@@ -1491,7 +1492,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
) : isLiveOsTicket ? (
|
||||
<div className="row g-2 mb-3">
|
||||
<div className="col-4">
|
||||
<MiniStat label="Open" value={osTicketSummary!.total} />
|
||||
<MiniStat label={t("Open")} value={osTicketSummary!.total} />
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
@@ -1502,7 +1503,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<div className="col-4">
|
||||
<MiniStat
|
||||
label="Awaiting reply"
|
||||
label={t("Awaiting reply")}
|
||||
value={osTicketSummary!.awaitingReply}
|
||||
accent={osTicketSummary!.awaitingReply > 0 ? "#f59e0b" : undefined}
|
||||
/>
|
||||
@@ -1514,7 +1515,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
<WidgetSkeleton />
|
||||
) : (
|
||||
<>
|
||||
Configure this integration from the <Link to="/integrations">Integrations</Link> page.
|
||||
Configure this integration from the <Link to="/integrations">{t("Integrations")}</Link> page.
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
@@ -1530,15 +1531,15 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
const alerts = integrationAlerts.get(i.id);
|
||||
const failing = i.enabled && i.health?.status === "failing";
|
||||
const badge = !i.enabled ? (
|
||||
<span className="badge bg-secondary-lt text-secondary">Disabled</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Disabled")}</span>
|
||||
) : failing || alerts?.critical ? (
|
||||
<span className="badge bg-red-lt text-red">{failing ? "Failing" : "Needs a look"}</span>
|
||||
<span className="badge bg-red-lt text-red">{failing ? t("Failing") : t("Needs a look")}</span>
|
||||
) : alerts ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">Needs a look</span>
|
||||
<span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>
|
||||
) : i.health?.status === "ok" ? (
|
||||
<span className="badge bg-green-lt text-green">Working</span>
|
||||
) : (
|
||||
<span className="badge bg-secondary-lt text-secondary">Not checked yet</span>
|
||||
<span className="badge bg-secondary-lt text-secondary">{t("Not checked yet")}</span>
|
||||
);
|
||||
return (
|
||||
<WidgetCard key={i.id} label={i.name === TYPE_LABELS[i.type] ? i.name : `${TYPE_LABELS[i.type]}: ${i.name}`} badge={badge}>
|
||||
@@ -1578,7 +1579,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
{notSetUp.length > 0 && (
|
||||
<div className="card mt-4">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Not set up yet</h3>
|
||||
<h3 className="card-title">{t("Not set up yet")}</h3>
|
||||
</div>
|
||||
<div className="list-group list-group-flush">
|
||||
{notSetUp.map((n) => (
|
||||
|
||||
+16
-15
@@ -27,6 +27,7 @@ import { toast } from "../utils/toast";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import { BrandTag } from "../components/BrandIcon";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const PROVIDER_LABELS: Record<DnsProviderType, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -364,7 +365,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onClick={exportProvidersCsv}
|
||||
disabled={!providers || providers.length === 0}
|
||||
>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
@@ -372,7 +373,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<DnsProviderSummary>
|
||||
label="Name"
|
||||
label={t("Name")}
|
||||
sortKeyName="name"
|
||||
activeKey={providerSortKey}
|
||||
direction={providerSortDir}
|
||||
@@ -386,13 +387,13 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onSort={requestProviderSort}
|
||||
/>
|
||||
<SortableTh<DnsProviderSummary>
|
||||
label="Status"
|
||||
label={t("Status")}
|
||||
sortKeyName="enabled"
|
||||
activeKey={providerSortKey}
|
||||
direction={providerSortDir}
|
||||
onSort={requestProviderSort}
|
||||
/>
|
||||
<th className="w-1">Actions</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -412,7 +413,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
</td>
|
||||
<td>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => removeProvider(p)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -436,7 +437,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<>
|
||||
{" "}
|
||||
<button className="btn btn-link p-0 align-baseline" onClick={() => setManagingProviders(true)}>
|
||||
Add one
|
||||
{t("Add one")}
|
||||
</button>
|
||||
.
|
||||
</>
|
||||
@@ -475,7 +476,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onClick={exportZonesCsv}
|
||||
disabled={!sortedZones || sortedZones.length === 0}
|
||||
>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -500,7 +501,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<tr>
|
||||
<SortableTh<DnsZone> label="Zone" sortKeyName="name" activeKey={zoneSortKey} direction={zoneSortDir} onSort={requestZoneSort} />
|
||||
<SortableTh<DnsZone>
|
||||
label="Records"
|
||||
label={t("Records")}
|
||||
sortKeyName="recordCount"
|
||||
activeKey={zoneSortKey}
|
||||
direction={zoneSortDir}
|
||||
@@ -555,7 +556,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onClick={exportRecordsCsv}
|
||||
disabled={!sortedRecords || sortedRecords.length === 0}
|
||||
>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-outline-secondary me-2" onClick={syncZone} disabled={syncing}>
|
||||
@@ -603,7 +604,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
</datalist>
|
||||
</div>
|
||||
<div className="col-3">
|
||||
<label className="form-label">Name</label>
|
||||
<label className="form-label">{t("Name")}</label>
|
||||
<input
|
||||
className="form-control"
|
||||
required
|
||||
@@ -659,7 +660,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
{editingRecordId ? "Save changes" : "Add record"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setRecordForm(null)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -670,7 +671,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<DnsRecord> label="Type" sortKeyName="type" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
<SortableTh<DnsRecord> label="Name" sortKeyName="name" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
<SortableTh<DnsRecord> label={t("Name")} sortKeyName="name" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
<SortableTh<DnsRecord>
|
||||
label="Content"
|
||||
sortKeyName="content"
|
||||
@@ -679,7 +680,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
onSort={requestRecordSort}
|
||||
/>
|
||||
<SortableTh<DnsRecord> label="TTL" sortKeyName="ttl" activeKey={recordSortKey} direction={recordSortDir} onSort={requestRecordSort} />
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -695,10 +696,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm" onClick={() => startEditRecord(r)}>
|
||||
Edit
|
||||
{t("Edit")}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-danger" onClick={() => removeRecord(r)}>
|
||||
Delete
|
||||
{t("Delete")}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -22,10 +22,11 @@ import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
|
||||
import { useRowDetail } from "../hooks/useRowDetail";
|
||||
import { EmptyRow } from "../components/EmptyState";
|
||||
import DockerVulnerabilities from "./DockerVulnerabilities";
|
||||
import { t } from "../i18n";
|
||||
|
||||
function updateBadge(c: DockhandContainer) {
|
||||
if (c.updateAvailable === null) return <span className="text-secondary">—</span>;
|
||||
if (!c.updateAvailable) return <span className="badge bg-green-lt text-green">Up to date</span>;
|
||||
if (!c.updateAvailable) return <span className="badge bg-green-lt text-green">{t("Up to date")}</span>;
|
||||
return (
|
||||
<span className="badge bg-yellow-lt text-yellow" title={c.newerVersion ?? undefined}>
|
||||
Update available
|
||||
@@ -254,7 +255,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
</select>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
{t("Export CSV")}
|
||||
</button>
|
||||
{canEdit && (
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={checkForUpdates} disabled={checkingUpdates}>
|
||||
@@ -274,7 +275,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableTh<DockhandContainer> label="Container" sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer> label={t("Container")} sortKeyName="name" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer>
|
||||
label="Host"
|
||||
sortKeyName="environmentName"
|
||||
@@ -282,8 +283,8 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
<SortableTh<DockhandContainer> label="Image" sortKeyName="image" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer> label="Status" sortKeyName="state" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer> label={t("Image")} sortKeyName="image" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer> label={t("Status")} sortKeyName="state" activeKey={sortKey} direction={sortDir} onSort={requestSort} />
|
||||
<SortableTh<DockhandContainer>
|
||||
label="Update"
|
||||
sortKeyName="updateAvailable"
|
||||
@@ -291,7 +292,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
direction={sortDir}
|
||||
onSort={requestSort}
|
||||
/>
|
||||
{canEdit && <th className="w-1">Actions</th>}
|
||||
{canEdit && <th className="w-1">{t("Actions")}</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -317,14 +318,14 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
onClick={() => containerAction(c, "restart")}
|
||||
disabled={actingOnContainer === c.id}
|
||||
>
|
||||
Restart
|
||||
{t("Restart")}
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-outline-danger"
|
||||
onClick={() => containerAction(c, "stop")}
|
||||
disabled={actingOnContainer === c.id}
|
||||
>
|
||||
Stop
|
||||
{t("Stop")}
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
@@ -333,7 +334,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
onClick={() => containerAction(c, "start")}
|
||||
disabled={actingOnContainer === c.id}
|
||||
>
|
||||
Start
|
||||
{t("Start")}
|
||||
</button>
|
||||
)}
|
||||
{user.role === "admin" && (c.problem || c.leftAlone) && (
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Link } from "react-router-dom";
|
||||
import { api, type DockhandVulnerabilitiesResponse, type DockhandVulnerabilityEnvironment } from "../api/client";
|
||||
import TimeAgo from "../components/TimeAgo";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const count = (v: number | null) => (v === null ? "—" : v.toLocaleString());
|
||||
|
||||
@@ -51,7 +52,7 @@ function Host({ env, imageAgeDays }: { env: DockhandVulnerabilityEnvironment; im
|
||||
<th>Package</th>
|
||||
<th>Installed</th>
|
||||
<th>Fixed in</th>
|
||||
<th>Image</th>
|
||||
<th>{t("Image")}</th>
|
||||
<th>Used by</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -118,7 +119,7 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
|
||||
From the scans Dockhand has already run on its images (it scans when it is told to — nothing is scanned from here). An image that was never scanned is not known to be clean.{" "}
|
||||
{data.alerts ? (
|
||||
<>
|
||||
<strong>Critical</strong> findings are an alert — see <Link to="/alerts">Alerts</Link>;{" "}
|
||||
<strong>{t("Critical")}</strong> findings are an alert — see <Link to="/alerts">{t("Alerts")}</Link>;{" "}
|
||||
{data.highThreshold > 0 ? (
|
||||
<>
|
||||
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">Settings → Notifications</Link>); medium and low are only shown here.
|
||||
|
||||
@@ -10,6 +10,7 @@ import { formatBytes } from "./settings/StorageSettings";
|
||||
import { readableError } from "../utils/errors";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import FigureHistory from "../components/FigureHistory";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const KIND_NAMES: Record<DownloadClient["kind"], string> = { qbittorrent: "qBittorrent", sabnzbd: "SABnzbd" };
|
||||
const SHOWN = 25;
|
||||
@@ -40,11 +41,11 @@ function durationText(seconds: number): string {
|
||||
|
||||
function Badge({ c }: { c: DownloadClient }) {
|
||||
if (!c.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
|
||||
if (!c.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
|
||||
if (!c.state) return <span className="badge bg-secondary-lt text-secondary">{t("Not read yet")}</span>;
|
||||
if (!c.fresh) return <span className="badge bg-yellow-lt text-yellow">Can’t be read</span>;
|
||||
if (c.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
|
||||
if (c.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
|
||||
return <span className="badge bg-green-lt text-green">In order</span>;
|
||||
if (c.problems.some((x) => x.severity === "critical")) return <span className="badge bg-red-lt text-red">{t("Needs a look")}</span>;
|
||||
if (c.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">{t("Needs a look")}</span>;
|
||||
return <span className="badge bg-green-lt text-green">{t("In order")}</span>;
|
||||
}
|
||||
|
||||
function Tile({ label, value, sub, warn }: { label: string; value: string; sub?: string | null; warn?: boolean }) {
|
||||
@@ -68,7 +69,7 @@ function ItemsTable({ items, stuck }: { items: DownloadItem[]; stuck: Set<string
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>{t("Name")}</th>
|
||||
<th>State</th>
|
||||
<th>Progress</th>
|
||||
<th>Speed</th>
|
||||
@@ -168,7 +169,7 @@ function Card({ c, canRead, onRead }: { c: DownloadClient; canRead: boolean; onR
|
||||
)}
|
||||
{c.kind === "qbittorrent" ? (
|
||||
<Tile
|
||||
label="Network"
|
||||
label={t("Network")}
|
||||
value={s.connection === null ? "—" : s.connection}
|
||||
sub={s.connection === "firewalled" ? "no incoming connections — it still works" : s.connection === "disconnected" ? "no peers or DHT" : null}
|
||||
warn={s.connection === "disconnected"}
|
||||
@@ -261,10 +262,10 @@ export default function Downloads({ user }: { user: CurrentUser }) {
|
||||
const canRead = user.role === "admin" || user.role === "operator";
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">Download clients</h2>
|
||||
<h2 className="page-title">{t("Download clients")}</h2>
|
||||
<PageIntro>
|
||||
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">Integrations</Link>) — nothing is added, paused or removed. <strong>Downloads that are stuck</strong>, <strong>no connection</strong>, <strong>a queue left paused or getting nothing</strong> and{" "}
|
||||
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">Alerts</Link>. What Sonarr, Radarr and the others think of their downloads is on <Link to="/media">Media managers</Link>.
|
||||
qBittorrent and SABnzbd, read every few minutes (see <Link to="/integrations">{t("Integrations")}</Link>) — nothing is added, paused or removed. <strong>Downloads that are stuck</strong>, <strong>no connection</strong>, <strong>a queue left paused or getting nothing</strong> and{" "}
|
||||
<strong>a disk nearly full</strong> are alerts — see <Link to="/alerts">{t("Alerts")}</Link>. What Sonarr, Radarr and the others think of their downloads is on <Link to="/media">{t("Media managers")}</Link>.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { confirmDialog } from "../utils/dialogs";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { toast } from "../utils/toast";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
|
||||
const STATE: Record<DuplicatiBackup["state"], { label: string; cls: string }> = {
|
||||
ok: { label: "In order", cls: "bg-green-lt text-green" },
|
||||
@@ -84,7 +85,7 @@ function History({ backup, onClose }: { backup: DuplicatiBackup; onClose: () =>
|
||||
<table className="table table-vcenter table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>When</th>
|
||||
<th>{t("When")}</th>
|
||||
<th>Result</th>
|
||||
<th className="text-end">Took</th>
|
||||
<th className="text-end">Size</th>
|
||||
@@ -175,7 +176,7 @@ function Address({ path, name, onDone }: { path: string; name: string; onDone: (
|
||||
<code>send-http-level=All</code> matters: Duplicati otherwise only reports problems, and a backup that quietly stops reporting could not be told from one that works. Each backup shows up here after its next run.
|
||||
</div>
|
||||
<button className="btn btn-sm" onClick={onDone}>
|
||||
Done
|
||||
{t("Done")}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
@@ -270,7 +271,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<PageIntro>
|
||||
Whether the backups Duplicati makes are being made. Duplicati tells this app how each backup went (its own <em>send-http-url</em> option), so nothing here calls Duplicati and no password for it is kept. A backup that <strong>fails</strong>,
|
||||
or has <strong>not succeeded for longer than it should</strong>, is an alert — see <Link to="/alerts">Alerts</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job’s warnings to see what they said, and switch on <em>Alert on warnings</em> for the jobs where they matter.
|
||||
or has <strong>not succeeded for longer than it should</strong>, is an alert — see <Link to="/alerts">{t("Alerts")}</Link>. A run that finishes with <strong>warnings</strong> still counts as a good backup; open a job’s warnings to see what they said, and switch on <em>Alert on warnings</em> for the jobs where they matter.
|
||||
</PageIntro>
|
||||
<ErrorNotice error={error} />
|
||||
{fresh && <Address path={fresh.path} name={fresh.name} onDone={() => setFresh(null)} />}
|
||||
@@ -283,7 +284,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<div className="card-body row g-3">
|
||||
<div className="col-md-5">
|
||||
<label className="form-label" htmlFor="dup-name">
|
||||
Name
|
||||
{t("Name")}
|
||||
</label>
|
||||
<input id="dup-name" className="form-control" required maxLength={100} placeholder="e.g. Jackie" value={name} onChange={(e) => setName(e.target.value)} />
|
||||
</div>
|
||||
@@ -307,7 +308,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
{busy ? "Adding…" : "Add and show its address"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => setAdding(false)}>
|
||||
Cancel
|
||||
{t("Cancel")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -349,7 +350,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
{isAdmin && (
|
||||
<button className="btn btn-sm btn-outline-danger ms-auto" onClick={() => void removeSource(s.id, s.name)} aria-label={`Remove ${s.name}`}>
|
||||
Remove
|
||||
{t("Remove")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -379,7 +380,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<th className="text-end">Changed</th>
|
||||
<th>Expected every</th>
|
||||
<th>State</th>
|
||||
<th className="w-1">Actions</th>
|
||||
<th className="w-1">{t("Actions")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -425,7 +426,7 @@ export default function Duplicati({ user }: { user: CurrentUser }) {
|
||||
<td>
|
||||
<div className="btn-list flex-nowrap">
|
||||
<button className="btn btn-sm" onClick={() => setHistory(b)}>
|
||||
History
|
||||
{t("History")}
|
||||
</button>
|
||||
{canEdit && (
|
||||
<>
|
||||
|
||||
Loaded 100 of 168 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user