Speedtest Tracker, Costs, "Having trouble" on status pages, grouped Integrations and Dashboard
- Speedtest Tracker integration: charts, alerts for a slow line (median of the last three tests under a share of what is paid for) and for failing tests. - Costs page (Records): things paid for by hand plus Hetzner's estimate, totals per currency, bills rolled forward into Coming up as Renewals. - Status pages: a "Having trouble" state for things that answer but have an open alert; Speedtest reads as the internet. - Integrations page and kind picker grouped like the sidebar (one shared types file); Notifications "What to send" shown one group at a time; Dashboard integration sections follow the menu groups, with tiles for integrations that have no widget. - Docs, tests, and ROLES.md menu table brought up to date. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
78822346b1
commit
f86661f6c9
49 files changed
+18156
-238
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useMyWork } from "../hooks/useMyWork";
|
||||
import { isValidElement, useEffect, useState, type ReactNode } from "react";
|
||||
import { Fragment, isValidElement, useEffect, useState, type ReactNode } from "react";
|
||||
import { IconArrowLeft, IconArrowRight, IconEye, IconEyeOff } from "@tabler/icons-react";
|
||||
import TimeAgo from "../components/TimeAgo";
|
||||
import WhatChanged from "../components/WhatChanged";
|
||||
@@ -24,6 +24,7 @@ import StatusStrip from "../components/StatusStrip";
|
||||
import SetupGuide, { type SetupStep } from "../components/SetupGuide";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { WidgetSkeleton } from "../components/Skeleton";
|
||||
import { TYPE_GROUPS, TYPE_LABELS, TYPE_PAGES } from "../utils/integrationTypes";
|
||||
import type { Agenda, Heartbeat } from "../api/client";
|
||||
|
||||
const DNS_TYPE_COLORS: Record<string, string> = {
|
||||
@@ -238,6 +239,16 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
|
||||
);
|
||||
}
|
||||
|
||||
/** What each group of integrations is, in a line — the groups are the sidebar's. */
|
||||
const GROUP_HINTS: Record<string, string> = {
|
||||
infrastructure: "The systems your servers and containers run on.",
|
||||
apps: "The apps you run, and whether each is working.",
|
||||
backups: "Where backups are kept and checked.",
|
||||
network: "Network equipment, proxies and address records.",
|
||||
monitoring: "What watches the rest.",
|
||||
automation: "Runs, tickets and workflows.",
|
||||
};
|
||||
|
||||
const WIDGETS: { type: IntegrationType; label: string }[] = [
|
||||
{ type: "proxmox", label: "Proxmox" },
|
||||
{ type: "synology", label: "Synology NAS" },
|
||||
@@ -345,6 +356,8 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
const { editing } = useDashboardLayout();
|
||||
const problemsFirst = useProblemsFirst();
|
||||
const [integrations, setIntegrations] = useState<IntegrationSummary[] | null>(null);
|
||||
// How many alerts each integration has open that nobody has put aside, for the tiles of the integrations that have no widget of their own.
|
||||
const [integrationAlerts, setIntegrationAlerts] = useState<Map<number, { count: number; critical: boolean }>>(new Map());
|
||||
const [tailscaleSummary, setTailscaleSummary] = useState<TailscaleDevicesResponse["summary"] | null>(null);
|
||||
const [tailscaleExtra, setTailscaleExtra] = useState<TailscaleExtra | null>(null);
|
||||
const [giteaSummary, setGiteaSummary] = useState<GiteaSummary | null>(null);
|
||||
@@ -419,6 +432,20 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
|
||||
useEffect(() => {
|
||||
api.integrations.list().then((res) => setIntegrations(res.integrations));
|
||||
api.alerts
|
||||
.list()
|
||||
.then((report) => {
|
||||
const found = new Map<number, { count: number; critical: boolean }>();
|
||||
for (const a of report.alerts) {
|
||||
if (a.silenced || a.severity === "info" || a.target?.type !== "integration") continue;
|
||||
const entry = found.get(a.target.id) ?? { count: 0, critical: false };
|
||||
entry.count++;
|
||||
if (a.severity === "critical") entry.critical = true;
|
||||
found.set(a.target.id, entry);
|
||||
}
|
||||
setIntegrationAlerts(found);
|
||||
})
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -1107,12 +1134,11 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</WidgetCard>
|
||||
</div>
|
||||
|
||||
<SectionHeader
|
||||
title="Integrations"
|
||||
hint="Live status widgets for Proxmox, Synology, Semaphore, Tailscale, Gitea, Dockhand, Uptime Kuma, Proxmox Backup Server, and osTicket will appear here as each integration is connected."
|
||||
/>
|
||||
<div className="row row-cards">
|
||||
{WIDGETS.map(({ type, label }) => {
|
||||
{TYPE_GROUPS.filter((group) => integrations?.some((i) => group.types.includes(i.type))).map((group) => (
|
||||
<Fragment key={group.id}>
|
||||
<SectionHeader title={group.label} hint={GROUP_HINTS[group.id]} />
|
||||
<div className="row row-cards">
|
||||
{WIDGETS.filter(({ type }) => group.types.includes(type)).map(({ type, label }) => {
|
||||
const integration = integrations?.find((i) => i.type === type && i.enabled);
|
||||
const isLiveTailscale = type === "tailscale" && integration && tailscaleSummary;
|
||||
const isLiveGitea = type === "gitea" && integration && giteaSummary;
|
||||
@@ -1363,7 +1389,46 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
</WidgetCard>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{/* The integrations with no widget of their own get a small tile: whether they work, how many alerts are open, and where to look. */}
|
||||
{(integrations ?? [])
|
||||
.filter((i) => group.types.includes(i.type) && !WIDGETS.some((w) => w.type === i.type))
|
||||
.sort((a, b) => a.name.localeCompare(b.name))
|
||||
.map((i) => {
|
||||
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>
|
||||
) : failing || alerts?.critical ? (
|
||||
<span className="badge bg-red-lt text-red">{failing ? "Failing" : "Needs a look"}</span>
|
||||
) : alerts ? (
|
||||
<span className="badge bg-yellow-lt text-yellow">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>
|
||||
);
|
||||
return (
|
||||
<WidgetCard key={i.id} label={i.name === TYPE_LABELS[i.type] ? i.name : `${TYPE_LABELS[i.type]}: ${i.name}`} badge={badge}>
|
||||
<div className="text-secondary">
|
||||
{failing
|
||||
? `Its last ${i.health?.consecutiveFailures ?? 0} calls failed.`
|
||||
: alerts
|
||||
? `${alerts.count} open ${alerts.count === 1 ? "alert" : "alerts"}.`
|
||||
: i.enabled
|
||||
? "Nothing open."
|
||||
: "Switched off under Integrations."}
|
||||
</div>
|
||||
{i.enabled && (
|
||||
<div className="mt-2">
|
||||
<Link to={TYPE_PAGES[i.type]}>Open {TYPE_LABELS[i.type]}</Link>
|
||||
</div>
|
||||
)}
|
||||
</WidgetCard>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
|
||||
{notSetUp.length > 0 && (
|
||||
<div className="card mt-4">
|
||||
|
||||
Reference in new issue
Block a user