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

+12 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
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 TimeAgo from "../components/TimeAgo";
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 cost = s?.cost ?? null;
const gb = (s?.volumes ?? []).reduce((sum, v) => sum + v.size, 0);
@@ -112,7 +113,10 @@ function Card({ p }: { p: HetznerProject }) {
<h3 className="card-title">
{p.name} <Badge p={p} />
</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 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>}
@@ -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. */
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 [error, setError] = useState<string | null>(null);
useEffect(() => {
@@ -342,7 +348,7 @@ export default function Hetzner() {
void load();
const t = setInterval(load, 60_000);
return () => clearInterval(t);
}, []);
}, [tick]);
return (
<>
<h2 className="page-title">Hetzner Cloud</h2>
@@ -359,7 +365,7 @@ export default function Hetzner() {
</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)} />)}
</>
);
}