Add Read now to the AdGuard, Technitium, Grafana, Hetzner Cloud, Game servers and Speedtest pages

Operators and administrators get a Read now button in the card header of each
enabled integration on these six pages, the same as on the media, download
client and Hetzner Robot pages. No server change: all six kinds were already
in the Read-now list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-08 17:31:23 +01:00
1 parent d980c12a04
commit d88a24b33a
9 files changed
+72 -38

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ the dashboard views themselves load fine. (UniFi, Nginx Proxy Manager, Home Assi
### Reading one now ### Reading one now
Every integration has a **Read now** button on the Integrations page (operators and administrators; the pages of Media managers, Download clients and Hetzner Robot have it too, on each card). `POST /api/integrations/{id}/read-now` answers `{ kind, ok, error, at, latencyMs }`: Every integration has a **Read now** button on the Integrations page (operators and administrators; the pages of Media managers, Download clients, Hetzner Robot, Hetzner Cloud, Game servers, AdGuard Home, Technitium DNS, Grafana and Speedtest Tracker have it too, on each card). `POST /api/integrations/{id}/read-now` answers `{ kind, ok, error, at, latencyMs }`:
- **`kind: "stored"`** — the integration has a reading that is kept (everything but the ones below): it is read the way its schedule reads it, stored, and the alerts are worked out again at once. A read that fails says why and leaves what was stored as it was. - **`kind: "stored"`** — the integration has a reading that is kept (everything but the ones below): it is read the way its schedule reads it, stored, and the alerts are worked out again at once. A read that fails says why and leaves what was stored as it was.
- **`kind: "live"`** — Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM and Nginx Proxy Manager keep nothing: their pages and the health pass read them live every time. Here it asks whether the integration answers (the question *Test* asks, with what is saved) and brings its Working/Failing mark up to date; the alerts, which read it live, are worked out again at the next look. - **`kind: "live"`** — Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM and Nginx Proxy Manager keep nothing: their pages and the health pass read them live every time. Here it asks whether the integration answers (the question *Test* asks, with what is saved) and brings its Working/Failing mark up to date; the alerts, which read it live, are worked out again at the next look.
+1 -1
View File
@@ -573,7 +573,7 @@ The page also shows the users, the files and the app updates waiting. Whether it
**App versions** (Operations → App versions). The version each connected application runs — as its integration last read it — against the newest release of it, with how far behind it is (a patch, a minor update, a major version) and how long the newer release has been out. It looks the newest releases up on GitHub once a day, and **that is the only thing this app asks of an address that is not yours, so it is switched off until an administrator switches it on**. A number of days (0 = never) makes a newer release that has been out that long a warning. Sonarr, Radarr, Prowlarr, Lidarr, Readarr, AdGuard Home, Grafana, Jellyfin, Immich, Paperless-ngx, Nextcloud, NetBox, Authentik and Prometheus are compared. See docs/MONITORING.md. **App versions** (Operations → App versions). The version each connected application runs — as its integration last read it — against the newest release of it, with how far behind it is (a patch, a minor update, a major version) and how long the newer release has been out. It looks the newest releases up on GitHub once a day, and **that is the only thing this app asks of an address that is not yours, so it is switched off until an administrator switches it on**. A number of days (0 = never) makes a newer release that has been out that long a warning. Sonarr, Radarr, Prowlarr, Lidarr, Readarr, AdGuard Home, Grafana, Jellyfin, Immich, Paperless-ngx, Nextcloud, NetBox, Authentik and Prometheus are compared. See docs/MONITORING.md.
**Read now** (Integrations → *Read now* on each integration, and on the pages of Media managers, Download clients and Hetzner Robot; operators and administrators). Reads one integration at once instead of waiting for its next turn, and says how it went. An integration that is read on a schedule and stored (most of them) is read the way the schedule reads it, and what it says is judged again at once, so an alert that has cleared clears and a new one appears without waiting. One that is read live (Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM, Nginx Proxy Manager) is asked whether it answers — the question *Test* asks — which also brings its Working/Failing mark up to date. The same integration is not read again within 20 seconds, since some systems limit how often they may be asked (Hetzner Robot allows 200 requests an hour). See INTEGRATIONS.md. **Read now** (Integrations → *Read now* on each integration, and on the card of each integration on its own page — Media managers, Download clients, Hetzner Robot, Hetzner Cloud, Game servers, AdGuard Home, Technitium DNS, Grafana and Speedtest Tracker; operators and administrators). Reads one integration at once instead of waiting for its next turn, and says how it went. An integration that is read on a schedule and stored (most of them) is read the way the schedule reads it, and what it says is judged again at once, so an alert that has cleared clears and a new one appears without waiting. One that is read live (Proxmox, Synology, Tailscale, Gitea, Semaphore, Uptime Kuma, Proxmox Backup Server, osTicket, phpIPAM, Nginx Proxy Manager) is asked whether it answers — the question *Test* asks — which also brings its Working/Failing mark up to date. The same integration is not read again within 20 seconds, since some systems limit how often they may be asked (Hetzner Robot allows 200 requests an hour). See INTEGRATIONS.md.
**Inspect an integration** (Integrations → *Inspect*, administrators). Runs the integration's reader once, now, and shows what each request asked and got back — the **shape** of every answer (the names and kinds of its fields, never the values) — beside what the reader made of it and the fields that came out empty. It is how an integration written from documentation is checked against the real system: an answer with a field the reader did not expect shows up as an empty field. *Copy the report* gives plain text that can be pasted into a message. Each inspection is written to the audit log; nothing is stored or changed. **Inspect an integration** (Integrations → *Inspect*, administrators). Runs the integration's reader once, now, and shows what each request asked and got back — the **shape** of every answer (the names and kinds of its fields, never the values) — beside what the reader made of it and the fields that came out empty. It is how an integration written from documentation is checked against the real system: an answer with a field the reader did not expect shows up as an empty field. *Copy the report* gives plain text that can be pasted into a message. Each inspection is written to the audit log; nothing is stored or changed.
+5 -5
View File
@@ -184,16 +184,16 @@ function Shelled({ user }: { user: CurrentUser }) {
<Route path="/n8n" element={<N8n />} /> <Route path="/n8n" element={<N8n />} />
<Route path="/netbox" element={<NetBox />} /> <Route path="/netbox" element={<NetBox />} />
<Route path="/nextcloud" element={<Nextcloud />} /> <Route path="/nextcloud" element={<Nextcloud />} />
<Route path="/hetzner" element={<Hetzner />} /> <Route path="/hetzner" element={<Hetzner user={user} />} />
<Route path="/game-servers" element={<GameServers user={user} />} /> <Route path="/game-servers" element={<GameServers user={user} />} />
<Route path="/media" element={<Media user={user} />} /> <Route path="/media" element={<Media user={user} />} />
<Route path="/downloads" element={<Downloads user={user} />} /> <Route path="/downloads" element={<Downloads user={user} />} />
<Route path="/hetzner-robot" element={<HetznerRobot user={user} />} /> <Route path="/hetzner-robot" element={<HetznerRobot user={user} />} />
<Route path="/versions" element={<Versions user={user} />} /> <Route path="/versions" element={<Versions user={user} />} />
<Route path="/adguard" element={<AdguardHome />} /> <Route path="/adguard" element={<AdguardHome user={user} />} />
<Route path="/technitium" element={<TechnitiumDns />} /> <Route path="/technitium" element={<TechnitiumDns user={user} />} />
<Route path="/grafana" element={<Grafana />} /> <Route path="/grafana" element={<Grafana user={user} />} />
<Route path="/speedtest" element={<Speedtest />} /> <Route path="/speedtest" element={<Speedtest user={user} />} />
<Route path="/costs" element={<Costs user={user} />} /> <Route path="/costs" element={<Costs user={user} />} />
<Route path="/service-levels" element={<Navigate to="/alert-settings?view=levels" replace />} /> <Route path="/service-levels" element={<Navigate to="/alert-settings?view=levels" replace />} />
<Route path="/duplicati" element={<Duplicati user={user} />} /> <Route path="/duplicati" element={<Duplicati user={user} />} />
+12 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { api, type AdguardInstance } from "../api/client"; import ReadNowButton from "../components/ReadNowButton";
import { api, type CurrentUser, type AdguardInstance } from "../api/client";
import EmptyState from "../components/EmptyState"; import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo"; import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton"; import { BlockSkeleton } from "../components/Skeleton";
@@ -52,7 +53,7 @@ function Counted({ title, items, empty }: { title: string; items: { name: string
); );
} }
function Card({ a }: { a: AdguardInstance }) { function Card({ a, canRead, onRead }: { a: AdguardInstance; canRead: boolean; onRead: () => void }) {
const s = a.state; const s = a.state;
const st = s?.stats ?? null; const st = s?.stats ?? null;
const lists = s?.filters?.lists ?? []; const lists = s?.filters?.lists ?? [];
@@ -64,7 +65,10 @@ function Card({ a }: { a: AdguardInstance }) {
<h3 className="card-title"> <h3 className="card-title">
{a.name} <span className="text-secondary fw-normal">{s?.version ?? ""}</span> <Badge a={a} /> {a.name} <span className="text-secondary fw-normal">{s?.version ?? ""}</span> <Badge a={a} />
</h3> </h3>
<div className="card-actions text-secondary small">{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}</div> <div className="card-actions d-flex align-items-center gap-2 text-secondary small">
{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}
{canRead && a.enabled && <ReadNowButton integrationId={a.id} name={a.name} onDone={onRead} />}
</div>
</div> </div>
<div className="card-body"> <div className="card-body">
{a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>} {a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>}
@@ -141,7 +145,9 @@ function Card({ a }: { a: AdguardInstance }) {
} }
/** AdGuard Home: whether DNS really answers, whether it protects, what it has done and whether its lists are kept up to date. */ /** AdGuard Home: whether DNS really answers, whether it protects, what it has done and whether its lists are kept up to date. */
export default function AdguardHome() { export default function AdguardHome({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
const [tick, setTick] = useState(0);
const [data, setData] = useState<AdguardInstance[] | null>(null); const [data, setData] = useState<AdguardInstance[] | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
@@ -156,7 +162,7 @@ export default function AdguardHome() {
void load(); void load();
const t = setInterval(load, 60_000); const t = setInterval(load, 60_000);
return () => clearInterval(t); return () => clearInterval(t);
}, []); }, [tick]);
return ( return (
<> <>
<h2 className="page-title">AdGuard Home</h2> <h2 className="page-title">AdGuard Home</h2>
@@ -173,7 +179,7 @@ export default function AdguardHome() {
</div> </div>
</div> </div>
)} )}
{data?.map((a) => <Card key={a.id} a={a} />)} {data?.map((a) => <Card key={a.id} a={a} canRead={canRead} onRead={() => setTick((n) => n + 1)} />)}
</> </>
); );
} }
+5 -1
View File
@@ -1,5 +1,6 @@
import { Fragment, useEffect, useState } from "react"; import { Fragment, useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import ReadNowButton from "../components/ReadNowButton";
import { api, type CurrentUser, type FragnetAccount, type FragnetServerInfo, type FragnetSignal } from "../api/client"; import { api, type CurrentUser, type FragnetAccount, type FragnetServerInfo, type FragnetSignal } from "../api/client";
import EmptyState from "../components/EmptyState"; import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo"; import TimeAgo from "../components/TimeAgo";
@@ -357,7 +358,10 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
<h3 className="card-title"> <h3 className="card-title">
{a.name} <Badge a={a} /> {a.name} <Badge a={a} />
</h3> </h3>
<div className="card-actions text-secondary small">{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}</div> <div className="card-actions d-flex align-items-center gap-2 text-secondary small">
{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}
{canAct && a.enabled && <ReadNowButton integrationId={a.id} name={a.name} onDone={reload} />}
</div>
</div> </div>
<div className="card-body"> <div className="card-body">
{a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>} {a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>}
+12 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { api, type GrafanaInstance } from "../api/client"; import ReadNowButton from "../components/ReadNowButton";
import { api, type CurrentUser, type GrafanaInstance } from "../api/client";
import EmptyState from "../components/EmptyState"; import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo"; import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton"; import { BlockSkeleton } from "../components/Skeleton";
@@ -30,7 +31,7 @@ function Tile({ label, value, sub, warn }: { label: string; value: string; sub?:
); );
} }
function Card({ g }: { g: GrafanaInstance }) { function Card({ g, canRead, onRead }: { g: GrafanaInstance; canRead: boolean; onRead: () => void }) {
const s = g.state; const s = g.state;
const rules = s?.rules ?? null; const rules = s?.rules ?? null;
const firing = rules?.items.filter((r) => r.state === "firing") ?? []; const firing = rules?.items.filter((r) => r.state === "firing") ?? [];
@@ -44,7 +45,10 @@ function Card({ g }: { g: GrafanaInstance }) {
<h3 className="card-title"> <h3 className="card-title">
{g.name} <span className="text-secondary fw-normal">{s?.version ?? ""}</span> <Badge g={g} /> {g.name} <span className="text-secondary fw-normal">{s?.version ?? ""}</span> <Badge g={g} />
</h3> </h3>
<div className="card-actions text-secondary small">{g.status ? <>read <TimeAgo value={g.status.at} /></> : "not read yet"}</div> <div className="card-actions d-flex align-items-center gap-2 text-secondary small">
{g.status ? <>read <TimeAgo value={g.status.at} /></> : "not read yet"}
{canRead && g.enabled && <ReadNowButton integrationId={g.id} name={g.name} onDone={onRead} />}
</div>
</div> </div>
<div className="card-body"> <div className="card-body">
{g.status && !g.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {g.status.error ?? "no answer"}.</div>} {g.status && !g.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {g.status.error ?? "no answer"}.</div>}
@@ -124,7 +128,9 @@ function Card({ g }: { g: GrafanaInstance }) {
} }
/** Grafana: which alert rules are firing or cannot be evaluated, and which data sources fail their check. */ /** Grafana: which alert rules are firing or cannot be evaluated, and which data sources fail their check. */
export default function Grafana() { export default function Grafana({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
const [tick, setTick] = useState(0);
const [data, setData] = useState<GrafanaInstance[] | null>(null); const [data, setData] = useState<GrafanaInstance[] | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
@@ -139,7 +145,7 @@ export default function Grafana() {
void load(); void load();
const t = setInterval(load, 60_000); const t = setInterval(load, 60_000);
return () => clearInterval(t); return () => clearInterval(t);
}, []); }, [tick]);
return ( return (
<> <>
<h2 className="page-title">Grafana</h2> <h2 className="page-title">Grafana</h2>
@@ -156,7 +162,7 @@ export default function Grafana() {
</div> </div>
</div> </div>
)} )}
{data?.map((g) => <Card key={g.id} g={g} />)} {data?.map((g) => <Card key={g.id} g={g} canRead={canRead} onRead={() => setTick((n) => n + 1)} />)}
</> </>
); );
} }
+12 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { api, type HetznerProject, type HetznerTrafficForecast } from "../api/client"; import ReadNowButton from "../components/ReadNowButton";
import { api, type CurrentUser, type HetznerProject, type HetznerTrafficForecast } from "../api/client";
import EmptyState from "../components/EmptyState"; import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo"; import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton"; import { BlockSkeleton } from "../components/Skeleton";
@@ -100,7 +101,7 @@ function ServerRow({ s }: { s: NonNullable<HetznerProject["state"]>["servers"][n
); );
} }
function Card({ p }: { p: HetznerProject }) { function Card({ p, canRead, onRead }: { p: HetznerProject; canRead: boolean; onRead: () => void }) {
const s = p.state; const s = p.state;
const cost = s?.cost ?? null; const cost = s?.cost ?? null;
const gb = (s?.volumes ?? []).reduce((sum, v) => sum + v.size, 0); const gb = (s?.volumes ?? []).reduce((sum, v) => sum + v.size, 0);
@@ -112,7 +113,10 @@ function Card({ p }: { p: HetznerProject }) {
<h3 className="card-title"> <h3 className="card-title">
{p.name} <Badge p={p} /> {p.name} <Badge p={p} />
</h3> </h3>
<div className="card-actions text-secondary small">{p.status ? <>read <TimeAgo value={p.status.at} /></> : "not read yet"}</div> <div className="card-actions d-flex align-items-center gap-2 text-secondary small">
{p.status ? <>read <TimeAgo value={p.status.at} /></> : "not read yet"}
{canRead && p.enabled && <ReadNowButton integrationId={p.id} name={p.name} onDone={onRead} />}
</div>
</div> </div>
<div className="card-body"> <div className="card-body">
{p.status && !p.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {p.status.error ?? "no answer"}.</div>} {p.status && !p.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {p.status.error ?? "no answer"}.</div>}
@@ -327,7 +331,9 @@ function Card({ p }: { p: HetznerProject }) {
} }
/** Hetzner Cloud: each project's servers, what is close to its traffic quota, which have backups, and roughly what it all costs. */ /** Hetzner Cloud: each project's servers, what is close to its traffic quota, which have backups, and roughly what it all costs. */
export default function Hetzner() { export default function Hetzner({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
const [tick, setTick] = useState(0);
const [data, setData] = useState<HetznerProject[] | null>(null); const [data, setData] = useState<HetznerProject[] | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
@@ -342,7 +348,7 @@ export default function Hetzner() {
void load(); void load();
const t = setInterval(load, 60_000); const t = setInterval(load, 60_000);
return () => clearInterval(t); return () => clearInterval(t);
}, []); }, [tick]);
return ( return (
<> <>
<h2 className="page-title">Hetzner Cloud</h2> <h2 className="page-title">Hetzner Cloud</h2>
@@ -359,7 +365,7 @@ export default function Hetzner() {
</div> </div>
</div> </div>
)} )}
{data?.map((p) => <Card key={p.id} p={p} />)} {data?.map((p) => <Card key={p.id} p={p} canRead={canRead} onRead={() => setTick((n) => n + 1)} />)}
</> </>
); );
} }
+12 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { api, type SpeedtestHistory, type SpeedtestInfo } from "../api/client"; import ReadNowButton from "../components/ReadNowButton";
import { api, type CurrentUser, type SpeedtestHistory, type SpeedtestInfo } from "../api/client";
import EmptyState from "../components/EmptyState"; import EmptyState from "../components/EmptyState";
import RangeSelect from "../components/RangeSelect"; import RangeSelect from "../components/RangeSelect";
import TimeAgo from "../components/TimeAgo"; import TimeAgo from "../components/TimeAgo";
@@ -86,7 +87,7 @@ function History({ id, name }: { id: number; name: string }) {
); );
} }
function Card({ s }: { s: SpeedtestInfo }) { function Card({ s, canRead, onRead }: { s: SpeedtestInfo; canRead: boolean; onRead: () => void }) {
const st = s.state; const st = s.state;
const latest = st?.latest ?? null; const latest = st?.latest ?? null;
const dl = s.expected.downloadMbps; const dl = s.expected.downloadMbps;
@@ -97,7 +98,10 @@ function Card({ s }: { s: SpeedtestInfo }) {
<h3 className="card-title"> <h3 className="card-title">
{s.name} <Badge s={s} /> {s.name} <Badge s={s} />
</h3> </h3>
<div className="card-actions text-secondary small">{s.status ? <>read <TimeAgo value={s.status.at} /></> : "not read yet"}</div> <div className="card-actions d-flex align-items-center gap-2 text-secondary small">
{s.status ? <>read <TimeAgo value={s.status.at} /></> : "not read yet"}
{canRead && s.enabled && <ReadNowButton integrationId={s.id} name={s.name} onDone={onRead} />}
</div>
</div> </div>
<div className="card-body"> <div className="card-body">
{s.status && !s.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {s.status.error ?? "no answer"}.</div>} {s.status && !s.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {s.status.error ?? "no answer"}.</div>}
@@ -143,7 +147,9 @@ function Card({ s }: { s: SpeedtestInfo }) {
} }
/** Speedtest Tracker: how fast the internet has been, against what it is sold at. */ /** Speedtest Tracker: how fast the internet has been, against what it is sold at. */
export default function Speedtest() { export default function Speedtest({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
const [tick, setTick] = useState(0);
const [data, setData] = useState<SpeedtestInfo[] | null>(null); const [data, setData] = useState<SpeedtestInfo[] | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
@@ -158,7 +164,7 @@ export default function Speedtest() {
void load(); void load();
const t = setInterval(load, 60_000); const t = setInterval(load, 60_000);
return () => clearInterval(t); return () => clearInterval(t);
}, []); }, [tick]);
return ( return (
<> <>
<h2 className="page-title">Speedtest</h2> <h2 className="page-title">Speedtest</h2>
@@ -174,7 +180,7 @@ export default function Speedtest() {
</div> </div>
</div> </div>
)} )}
{data?.map((s) => <Card key={s.id} s={s} />)} {data?.map((s) => <Card key={s.id} s={s} canRead={canRead} onRead={() => setTick((n) => n + 1)} />)}
</> </>
); );
} }
+12 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { api, type TechnitiumInstance } from "../api/client"; import ReadNowButton from "../components/ReadNowButton";
import { api, type CurrentUser, type TechnitiumInstance } from "../api/client";
import EmptyState from "../components/EmptyState"; import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo"; import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton"; import { BlockSkeleton } from "../components/Skeleton";
@@ -71,7 +72,7 @@ const HOW: { key: "cached" | "recursive" | "authoritative" | "blocked" | "droppe
{ key: "dropped", label: "dropped", className: "bg-red" }, { key: "dropped", label: "dropped", className: "bg-red" },
]; ];
function Card({ a }: { a: TechnitiumInstance }) { function Card({ a, canRead, onRead }: { a: TechnitiumInstance; canRead: boolean; onRead: () => void }) {
const s = a.state; const s = a.state;
const st = s?.stats ?? null; const st = s?.stats ?? null;
const cacheMax = s?.settings.cacheMaximumEntries ?? null; const cacheMax = s?.settings.cacheMaximumEntries ?? null;
@@ -82,7 +83,10 @@ function Card({ a }: { a: TechnitiumInstance }) {
<h3 className="card-title"> <h3 className="card-title">
{a.name} <span className="text-secondary fw-normal">{s?.version ? `v${s.version}` : ""}</span> <Badge a={a} /> {a.name} <span className="text-secondary fw-normal">{s?.version ? `v${s.version}` : ""}</span> <Badge a={a} />
</h3> </h3>
<div className="card-actions text-secondary small">{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}</div> <div className="card-actions d-flex align-items-center gap-2 text-secondary small">
{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}
{canRead && a.enabled && <ReadNowButton integrationId={a.id} name={a.name} onDone={onRead} />}
</div>
</div> </div>
<div className="card-body"> <div className="card-body">
{a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>} {a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>}
@@ -223,7 +227,9 @@ function Card({ a }: { a: TechnitiumInstance }) {
} }
/** Technitium DNS Server: whether DNS really answers, whether it blocks, what it has done in the last day, how its zones and block lists are, and how it is doing. */ /** Technitium DNS Server: whether DNS really answers, whether it blocks, what it has done in the last day, how its zones and block lists are, and how it is doing. */
export default function TechnitiumDns() { export default function TechnitiumDns({ user }: { user: CurrentUser }) {
const canRead = user.role === "admin" || user.role === "operator";
const [tick, setTick] = useState(0);
const [data, setData] = useState<TechnitiumInstance[] | null>(null); const [data, setData] = useState<TechnitiumInstance[] | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
@@ -238,7 +244,7 @@ export default function TechnitiumDns() {
void load(); void load();
const t = setInterval(load, 60_000); const t = setInterval(load, 60_000);
return () => clearInterval(t); return () => clearInterval(t);
}, []); }, [tick]);
return ( return (
<> <>
<h2 className="page-title">Technitium DNS</h2> <h2 className="page-title">Technitium DNS</h2>
@@ -255,7 +261,7 @@ export default function TechnitiumDns() {
</div> </div>
</div> </div>
)} )}
{data?.map((a) => <Card key={a.id} a={a} />)} {data?.map((a) => <Card key={a.id} a={a} canRead={canRead} onRead={() => setTick((n) => n + 1)} />)}
</> </>
); );
} }