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:
1 parent
d980c12a04
commit
d88a24b33a
9 files changed
+72
-38
No files matched your search
+5
-5
@@ -184,16 +184,16 @@ function Shelled({ user }: { user: CurrentUser }) {
|
||||
<Route path="/n8n" element={<N8n />} />
|
||||
<Route path="/netbox" element={<NetBox />} />
|
||||
<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="/media" element={<Media user={user} />} />
|
||||
<Route path="/downloads" element={<Downloads user={user} />} />
|
||||
<Route path="/hetzner-robot" element={<HetznerRobot user={user} />} />
|
||||
<Route path="/versions" element={<Versions user={user} />} />
|
||||
<Route path="/adguard" element={<AdguardHome />} />
|
||||
<Route path="/technitium" element={<TechnitiumDns />} />
|
||||
<Route path="/grafana" element={<Grafana />} />
|
||||
<Route path="/speedtest" element={<Speedtest />} />
|
||||
<Route path="/adguard" element={<AdguardHome user={user} />} />
|
||||
<Route path="/technitium" element={<TechnitiumDns user={user} />} />
|
||||
<Route path="/grafana" element={<Grafana user={user} />} />
|
||||
<Route path="/speedtest" element={<Speedtest user={user} />} />
|
||||
<Route path="/costs" element={<Costs user={user} />} />
|
||||
<Route path="/service-levels" element={<Navigate to="/alert-settings?view=levels" replace />} />
|
||||
<Route path="/duplicati" element={<Duplicati user={user} />} />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
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 TimeAgo from "../components/TimeAgo";
|
||||
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 st = s?.stats ?? null;
|
||||
const lists = s?.filters?.lists ?? [];
|
||||
@@ -64,7 +65,10 @@ function Card({ a }: { a: AdguardInstance }) {
|
||||
<h3 className="card-title">
|
||||
{a.name} <span className="text-secondary fw-normal">{s?.version ?? ""}</span> <Badge a={a} />
|
||||
</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 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>}
|
||||
@@ -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. */
|
||||
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 [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
@@ -156,7 +162,7 @@ export default function AdguardHome() {
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
}, [tick]);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">AdGuard Home</h2>
|
||||
@@ -173,7 +179,7 @@ export default function AdguardHome() {
|
||||
</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)} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Fragment, useEffect, useState } from "react";
|
||||
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 EmptyState from "../components/EmptyState";
|
||||
import TimeAgo from "../components/TimeAgo";
|
||||
@@ -357,7 +358,10 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
|
||||
<h3 className="card-title">
|
||||
{a.name} <Badge a={a} />
|
||||
</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 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>}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
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 TimeAgo from "../components/TimeAgo";
|
||||
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 rules = s?.rules ?? null;
|
||||
const firing = rules?.items.filter((r) => r.state === "firing") ?? [];
|
||||
@@ -44,7 +45,10 @@ function Card({ g }: { g: GrafanaInstance }) {
|
||||
<h3 className="card-title">
|
||||
{g.name} <span className="text-secondary fw-normal">{s?.version ?? ""}</span> <Badge g={g} />
|
||||
</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 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>}
|
||||
@@ -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. */
|
||||
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 [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
@@ -139,7 +145,7 @@ export default function Grafana() {
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
}, [tick]);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">Grafana</h2>
|
||||
@@ -156,7 +162,7 @@ export default function Grafana() {
|
||||
</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)} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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)} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
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 RangeSelect from "../components/RangeSelect";
|
||||
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 latest = st?.latest ?? null;
|
||||
const dl = s.expected.downloadMbps;
|
||||
@@ -97,7 +98,10 @@ function Card({ s }: { s: SpeedtestInfo }) {
|
||||
<h3 className="card-title">
|
||||
{s.name} <Badge s={s} />
|
||||
</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 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>}
|
||||
@@ -143,7 +147,9 @@ function Card({ s }: { s: SpeedtestInfo }) {
|
||||
}
|
||||
|
||||
/** 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 [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
@@ -158,7 +164,7 @@ export default function Speedtest() {
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
}, [tick]);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">Speedtest</h2>
|
||||
@@ -174,7 +180,7 @@ export default function Speedtest() {
|
||||
</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)} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
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 TimeAgo from "../components/TimeAgo";
|
||||
import { BlockSkeleton } from "../components/Skeleton";
|
||||
@@ -71,7 +72,7 @@ const HOW: { key: "cached" | "recursive" | "authoritative" | "blocked" | "droppe
|
||||
{ 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 st = s?.stats ?? null;
|
||||
const cacheMax = s?.settings.cacheMaximumEntries ?? null;
|
||||
@@ -82,7 +83,10 @@ function Card({ a }: { a: TechnitiumInstance }) {
|
||||
<h3 className="card-title">
|
||||
{a.name} <span className="text-secondary fw-normal">{s?.version ? `v${s.version}` : ""}</span> <Badge a={a} />
|
||||
</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 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>}
|
||||
@@ -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. */
|
||||
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 [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
@@ -238,7 +244,7 @@ export default function TechnitiumDns() {
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
}, [tick]);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">Technitium DNS</h2>
|
||||
@@ -255,7 +261,7 @@ export default function TechnitiumDns() {
|
||||
</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)} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user