import { useMyWork } from "../hooks/useMyWork"; 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"; import DashboardTodos from "../components/DashboardTodos"; import Hideable, { HideBar, useCardState } from "../components/Hideable"; import { setProblemsFirst, useProblemsFirst } from "../utils/problemsFirst"; import { UNPLACED, moveCard, resetDashboardLayout, setCardHidden, setEditingDashboard, useDashboardLayout } from "../utils/dashboardLayout"; import { Link } from "react-router-dom"; import { api, type CurrentUser, type DomainList, type EndpointCheck, type IntegrationSummary, type IntegrationType, type OsTicketTicketsResponse, type PbsDatastoresResponse, type SecretRecord, type ServerSummary, type TailscaleDevicesResponse, type TechnitiumInstance, } from "../api/client"; import { formatAgo } from "../utils/duration"; 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"; import BrandIcon from "../components/BrandIcon"; import { kindOfLabel } from "../utils/brands"; const DNS_TYPE_COLORS: Record = { A: "#60a5fa", AAAA: "#93c5fd", CNAME: "#c084fc", MX: "#4ade80", TXT: "#fb923c", NS: "#94a3b8", SRV: "#a3e635", CAA: "#f472b6", PTR: "#facc15", }; const SECRET_TYPE_LABELS: Record = { api_token: "API Token", ssl_certificate: "SSL Certificate", password: "Password", generic: "Generic", }; const SECRET_TYPE_COLORS: Record = { api_token: "#6366f1", ssl_certificate: "#22d3ee", password: "#f472b6", generic: "#94a3b8", }; const DOMAIN_STATE_COLORS: Record = { OK: "#4ade80", Expiring: "#fbbf24", Expired: "#f87171", "No date": "#94a3b8", }; const SERVER_STATE_COLORS: Record = { Online: "#4ade80", Offline: "#f87171", "No data": "#94a3b8", }; const MONITOR_STATE_COLORS: Record = { Up: "#4ade80", Down: "#f87171", Pending: "#fbbf24", Maintenance: "#60a5fa", Unknown: "#94a3b8", }; const CONTAINER_STATE_COLORS: Record = { running: "#4ade80", exited: "#f87171", dead: "#f87171", paused: "#fbbf24", restarting: "#60a5fa", }; const TASK_STATUS_COLORS: Record = { success: "#4ade80", error: "#f87171", stopped: "#94a3b8", rejected: "#94a3b8", waiting: "#fbbf24", starting: "#fbbf24", waiting_confirmation: "#fbbf24", confirmed: "#fbbf24", running: "#60a5fa", stopping: "#60a5fa", "never run": "#94a3b8", }; const REPO_STATUS_COLORS: Record = { success: "#4ade80", failure: "#f87171", cancelled: "#94a3b8", skipped: "#94a3b8", waiting: "#fbbf24", queued: "#fbbf24", pending: "#fbbf24", running: "#60a5fa", in_progress: "#60a5fa", "no runs": "#94a3b8", }; const GENERIC_PALETTE = ["#6366f1", "#22d3ee", "#f472b6", "#4ade80", "#fb923c", "#a3e635", "#c084fc", "#facc15", "#60a5fa"]; function paletteColors(labels: string[]): Record { const colors: Record = {}; labels.forEach((label, i) => { colors[label] = GENERIC_PALETTE[i % GENERIC_PALETTE.length]; }); return colors; } function healthColors(labels: string[]): Record { const colors: Record = {}; for (const label of labels) colors[label] = label === "normal" ? "#4ade80" : "#f87171"; return colors; } function SectionHeader({ title, hint }: { title: string; hint?: ReactNode }) { return (

{title}

{hint &&
{hint}
}
); } function breakdownFrom(items: T[], keyOf: (item: T) => string): { label: string; count: number }[] { const counts = new Map(); for (const item of items) { const key = keyOf(item); counts.set(key, (counts.get(key) ?? 0) + 1); } return [...counts.entries()].map(([label, count]) => ({ label, count })).sort((a, b) => b.count - a.count); } function BreakdownBar({ data, colors, compact }: { data: { label: string; count: number }[]; colors: Record; compact?: boolean }) { const total = data.reduce((s, d) => s + d.count, 0); if (total === 0) return null; return (
{data.map((d) => (
))}
{data.map((d) => (
{d.label} {compact ? `(${d.count})` : ({d.count})}
))}
); } function MiniStat({ label, value, accent }: { label: string; value: ReactNode; accent?: string }) { return (
{value}
{label}
); } /** The single card shape shared by every dashboard widget — DNS, Secrets, and each integration — so they all read as one family: a label + status badge, then whatever stats/breakdown that widget has. */ /** Whether a card's status badge says something is wrong: the badges of a card in trouble are red or yellow, so that is what is read. */ function problemOf(badge: ReactNode): "bad" | "warn" | null { if (!isValidElement(badge)) return null; const cls = String((badge.props as { className?: string }).className ?? ""); return /\bbg-red/.test(cls) ? "bad" : /\bbg-yellow/.test(cls) ? "warn" : null; } function WidgetCard({ label, badge, hide, children }: { label: string; badge?: ReactNode; /** Nothing is set up for this yet: it is listed under "Not set up yet" instead of taking a card. */ hide?: boolean; children: ReactNode }) { const { layout, editing } = useDashboardLayout(); const problemsFirst = useProblemsFirst(); if (hide) return null; // The person's own arrangement: cards they hid are gone (shown dimmed while arranging, so they can be brought back), and the // rest follow the order they chose — a card nobody has placed goes last, in the order it was drawn. const hidden = layout.hidden.includes(label); const problem = problemOf(badge); const kind = kindOfLabel(label); if (hidden && !editing) return null; return (
{editing && (
)}
{kind && } {label}
{badge &&
{badge}
}
{children}
); } /** 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 Disabled; if (!t || !t.state) return Not read yet; if (!t.fresh) return Can’t be read; if (t.problems.some((p) => p.severity === "critical")) return Needs a look; if (t.problems.length > 0) return Needs a look; return In order; } const TECHNITIUM_HOW_COLORS: Record = { "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
Switched off under Integrations.
; if (loading) return ; const s = instance?.state ?? null; const open = (
Open Technitium DNS
); if (!instance || !s) { return ( <>
Not read yet.
{open} ); } const st = s.stats; const how = st ? [ { label: "from cache", count: st.cached }, { label: "resolved", count: st.recursive }, { label: "own zones", count: st.authoritative }, { label: "blocked", count: st.blocked }, { label: "dropped", count: st.dropped }, ].filter((d) => d.count > 0) : []; return ( <>
0 ? "#f59e0b" : undefined} />
{how.length > 0 && } {!s.blockingEnabled && s.settings.blockLists.count > 0 &&
Blocking is switched off.
} {!instance.fresh &&
The last read is old, so this may be out of date.
} {instance.problems.slice(0, 2).map((p) => (
{p.message}
))} {instance.problems.length > 2 &&
and {instance.problems.length - 2} more
} {open} ); } /** What each group of integrations is, in a line — the groups are the sidebar's. */ const GROUP_HINTS: Record = { 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" }, { type: "semaphore", label: "Semaphore" }, { type: "tailscale", label: "Tailscale" }, { type: "gitea", label: "Gitea" }, { type: "dockhand", label: "Dockhand / Docker" }, { type: "uptimekuma", label: "Uptime Kuma" }, { type: "pbs", label: "Proxmox Backup Server" }, { type: "osticket", label: "osTicket" }, ]; interface UptimeKumaSummary { up: number; down: number; total: number; matched: number; statusBreakdown: { label: string; count: number }[]; } interface OsTicketSummary { total: number; overdue: number; awaitingReply: number; } interface PbsSummary { datastoreCount: number; failedSnapshotCount: number; unverifiedSnapshotCount: number; } interface GiteaSummary { repoCount: number; privateCount: number; failing: number; statusBreakdown: { label: string; count: number }[]; } interface DockhandSummary { running: number; total: number; hostCount: number; updatesAvailable: number; stateBreakdown: { label: string; count: number }[]; } interface SemaphoreSummary { total: number; failing: number; statusBreakdown: { label: string; count: number }[]; } interface ProxmoxSummary { running: number; total: number; vmCount: number; lxcCount: number; nodeBreakdown: { label: string; count: number }[]; } interface SynologySummary { volumeCount: number; volumesNotNormal: number; disksNotNormal: number; cpuLoadPercent: number | null; memUsedBytes: number | null; memTotalBytes: number | null; diskStatusBreakdown: { label: string; count: number }[]; } interface TailscaleExtra { osBreakdown: { label: string; count: number }[]; } function formatBytes(bytes: number | null): string { if (bytes === null) return "—"; const units = ["B", "KB", "MB", "GB", "TB", "PB"]; let value = bytes; let unit = 0; while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit++; } return `${value.toFixed(1)} ${units[unit]}`; } /** One line above the cards for those who follow things: how many of theirs want a look, and where to see them. Says nothing when none do. */ function MyWorkStrip() { const { work } = useMyWork(); if (!work || work.needsAttention === 0) return null; return (
{work.needsAttention} {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. My work
); } /** The cards down the left of the top of the dashboard, and the to-do list on the right: the names the person hides them by. */ const TOP_LEFT_CARDS = ["Needs attention", "My work", "Since you last looked", "Getting started"]; const TODO_CARD = "To do list"; export default function Dashboard({ user }: { user: CurrentUser }) { const { editing, layout: arranged } = useDashboardLayout(); // The top of the dashboard is two columns while both have something to show; when the person has hidden every card of one, the other takes the whole width. const showTopLeft = editing || TOP_LEFT_CARDS.some((c) => !arranged.hidden.includes(c)); const todoCard = useCardState(TODO_CARD); const problemsFirst = useProblemsFirst(); const [integrations, setIntegrations] = useState(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>(new Map()); // What each Technitium DNS Server says (the same as its page), read once there is one and then every minute. const [technitium, setTechnitium] = useState(null); const [tailscaleSummary, setTailscaleSummary] = useState(null); const [tailscaleExtra, setTailscaleExtra] = useState(null); const [giteaSummary, setGiteaSummary] = useState(null); const [dockhandSummary, setDockhandSummary] = useState(null); const [semaphoreSummary, setSemaphoreSummary] = useState(null); const [proxmoxSummary, setProxmoxSummary] = useState(null); const [synologySummary, setSynologySummary] = useState(null); const [uptimeKumaSummary, setUptimeKumaSummary] = useState(null); const [pbsSummary, setPbsSummary] = useState(null); const [osTicketSummary, setOsTicketSummary] = useState(null); // For the getting-started guide; only an admin can read these, and only an admin has these steps to do. const isAdmin = user.role === "admin"; const [notifyConfigured, setNotifyConfigured] = useState(null); const [userCount, setUserCount] = useState(null); useEffect(() => { if (!isAdmin) return; api.settings .get() .then((res) => { const s = res.settings; setNotifyConfigured(s.gotify.enabled || s.ntfy.enabled || s.telegram.enabled || s.pushover.enabled || s.smtp.enabled || s.webhook.enabled || !!s.webPush?.enabled); }) .catch(() => setNotifyConfigured(null)); api.users .list() .then((res) => setUserCount(res.users.length)) .catch(() => setUserCount(null)); }, [isAdmin]); const [dnsStats, setDnsStats] = useState> | null>(null); const [dnsError, setDnsError] = useState(null); const [secrets, setSecrets] = useState(null); const [serverSummary, setServerSummary] = useState(null); const [serverError, setServerError] = useState(null); const [domainList, setDomainList] = useState(null); const [endpointChecks, setEndpointChecks] = useState(null); const [agenda, setAgenda] = useState(null); const [heartbeatList, setHeartbeatList] = useState(null); const [domainError, setDomainError] = useState(null); useEffect(() => { api.endpoints .list() .then((res) => setEndpointChecks(res.checks)) .catch(() => setEndpointChecks([])); api.agenda .get(30) .then(setAgenda) .catch(() => setAgenda({ generatedAt: "", today: "", items: [], notes: [] })); api.heartbeats .list() .then((res) => setHeartbeatList(res.heartbeats)) .catch(() => setHeartbeatList([])); api.domains .list() .then(setDomainList) .catch((err) => setDomainError(err instanceof Error ? err.message : String(err))); api.servers .summary() .then(setServerSummary) .catch((err) => setServerError(err instanceof Error ? err.message : String(err))); api.dns .stats() .then(setDnsStats) .catch((err) => setDnsError(err instanceof Error ? err.message : String(err))); api.secrets .list() .then((res) => setSecrets(res.secrets)) .catch(() => setSecrets([])); }, []); useEffect(() => { api.integrations.list().then((res) => setIntegrations(res.integrations)); api.alerts .list() .then((report) => { const found = new Map(); 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(() => {}); }, []); const hasTechnitium = integrations?.some((i) => i.type === "technitium") ?? false; useEffect(() => { if (!hasTechnitium) return; const load = () => api.technitium .list() .then((r) => setTechnitium(r.instances)) .catch(() => setTechnitium((current) => current ?? [])); void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); }, [hasTechnitium]); useEffect(() => { const tailscale = integrations?.find((i) => i.type === "tailscale" && i.enabled); if (!tailscale) { setTailscaleSummary(null); return; } api.integrations.tailscale .devices(tailscale.id) .then((res) => { setTailscaleSummary(res.summary); setTailscaleExtra({ osBreakdown: breakdownFrom(res.devices, (d) => d.os || "unknown") }); }) .catch(() => { setTailscaleSummary(null); setTailscaleExtra(null); }); }, [integrations]); useEffect(() => { const gitea = integrations?.find((i) => i.type === "gitea" && i.enabled); if (!gitea) { setGiteaSummary(null); return; } api.integrations.gitea .repos(gitea.id) .then((res) => setGiteaSummary({ repoCount: res.repos.length, privateCount: res.repos.filter((r) => r.private).length, failing: res.repos.filter((r) => r.latestRun?.conclusion === "failure" || r.latestRun?.status === "failure").length, statusBreakdown: breakdownFrom(res.repos, (r) => (r.latestRun ? r.latestRun.conclusion || r.latestRun.status : "no runs")), }), ) .catch(() => setGiteaSummary(null)); }, [integrations]); useEffect(() => { const dockhand = integrations?.find((i) => i.type === "dockhand" && i.enabled); if (!dockhand) { setDockhandSummary(null); return; } api.integrations.dockhand .containers(dockhand.id) .then((res) => setDockhandSummary({ running: res.summary.running, total: res.summary.total, hostCount: new Set(res.containers.map((c) => c.environmentName)).size, updatesAvailable: res.containers.filter((c) => c.updateAvailable).length, stateBreakdown: breakdownFrom(res.containers, (c) => c.state), }), ) .catch(() => setDockhandSummary(null)); }, [integrations]); useEffect(() => { const semaphore = integrations?.find((i) => i.type === "semaphore" && i.enabled); if (!semaphore) { setSemaphoreSummary(null); return; } api.integrations.semaphore .templates(semaphore.id) .then((res) => setSemaphoreSummary({ ...res.summary, statusBreakdown: breakdownFrom(res.templates, (t) => t.lastTask?.status ?? "never run"), }), ) .catch(() => setSemaphoreSummary(null)); }, [integrations]); useEffect(() => { const proxmox = integrations?.find((i) => i.type === "proxmox" && i.enabled); if (!proxmox) { setProxmoxSummary(null); return; } api.integrations.proxmox .guests(proxmox.id) .then((res) => setProxmoxSummary({ running: res.summary.running, total: res.summary.total, vmCount: res.guests.filter((g) => g.type === "qemu").length, lxcCount: res.guests.filter((g) => g.type === "lxc").length, nodeBreakdown: breakdownFrom(res.guests, (g) => g.node), }), ) .catch(() => setProxmoxSummary(null)); }, [integrations]); useEffect(() => { const synology = integrations?.find((i) => i.type === "synology" && i.enabled); if (!synology) { setSynologySummary(null); return; } api.integrations.synology .system(synology.id) .then((sys) => setSynologySummary((prev) => ({ volumeCount: prev?.volumeCount ?? 0, volumesNotNormal: prev?.volumesNotNormal ?? 0, disksNotNormal: prev?.disksNotNormal ?? 0, diskStatusBreakdown: prev?.diskStatusBreakdown ?? [], cpuLoadPercent: sys.cpu.loadPercent, memUsedBytes: sys.memory.usedBytes, memTotalBytes: sys.memory.totalBytes, })), ) .catch(() => {}); api.integrations.synology .storage(synology.id) .then((res) => setSynologySummary((prev) => ({ cpuLoadPercent: prev?.cpuLoadPercent ?? null, memUsedBytes: prev?.memUsedBytes ?? null, memTotalBytes: prev?.memTotalBytes ?? null, volumeCount: res.summary.volumeCount, volumesNotNormal: res.summary.volumesNotNormal, disksNotNormal: res.summary.disksNotNormal, diskStatusBreakdown: breakdownFrom(res.disks, (d) => d.status), })), ) .catch(() => setSynologySummary(null)); }, [integrations]); useEffect(() => { const uptimeKuma = integrations?.find((i) => i.type === "uptimekuma" && i.enabled); if (!uptimeKuma) { setUptimeKumaSummary(null); return; } api.integrations.uptimekuma .monitors(uptimeKuma.id) .then((res) => { const labelFor = (s: string) => s.charAt(0).toUpperCase() + s.slice(1); setUptimeKumaSummary({ up: res.summary.up, down: res.summary.down, total: res.summary.total, matched: res.monitors.filter((m) => m.matchedServer).length, statusBreakdown: breakdownFrom(res.monitors, (m) => labelFor(m.status)), }); }) .catch(() => setUptimeKumaSummary(null)); }, [integrations]); useEffect(() => { const pbs = integrations?.find((i) => i.type === "pbs" && i.enabled); if (!pbs) { setPbsSummary(null); return; } api.integrations.pbs .datastores(pbs.id) .then((res: PbsDatastoresResponse) => setPbsSummary({ datastoreCount: res.summary.datastoreCount, failedSnapshotCount: res.summary.failedSnapshotCount, unverifiedSnapshotCount: res.summary.unverifiedSnapshotCount, }), ) .catch(() => setPbsSummary(null)); }, [integrations]); useEffect(() => { const osticket = integrations?.find((i) => i.type === "osticket" && i.enabled); if (!osticket) { setOsTicketSummary(null); return; } api.integrations.osticket .tickets(osticket.id) .then((res: OsTicketTicketsResponse) => setOsTicketSummary({ total: res.summary.total, overdue: res.summary.overdue, awaitingReply: res.summary.awaitingReply, }), ) .catch(() => setOsTicketSummary(null)); }, [integrations]); const domains = domainList?.domains ?? []; const expiredDomains = domains.filter((d) => d.status === "expired"); const expiringDomains = domains.filter((d) => d.status === "expiring"); const okDomains = domains.filter((d) => d.status === "ok").length; const undatedDomains = domains.filter((d) => d.status === "unknown").length; // A registry that simply doesn't publish expiry dates isn't a failure; anything else that stopped a refresh is. const failingDomainChecks = domains.filter((d) => d.lastCheckError && !/doesn't publish/i.test(d.lastCheckError)).length; const nextDomain = domains .filter((d) => d.expiresAt && d.daysLeft !== null && d.daysLeft >= 0) .sort((a, b) => a.daysLeft! - b.daysLeft!)[0]; const totalSecrets = secrets?.length ?? 0; const expiredSecrets = secrets?.filter((s) => s.status === "expired").length ?? 0; const expiringSecrets = secrets?.filter((s) => s.status === "expiring").length ?? 0; const secretsByType = Object.entries( (secrets ?? []).reduce>((acc, s) => { acc[s.type] = (acc[s.type] ?? 0) + 1; return acc; }, {}), ).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 }, ]; // What the endpoint checks say: the ones that keep failing, and the certificates that are running out. const endpointsDown = (endpointChecks ?? []).filter((c) => c.enabled && c.lastOk === false && c.consecutiveFailures >= c.failuresBeforeAlert); const endpointCerts = (endpointChecks ?? []).filter((c) => c.enabled && c.certExpiresAt && Math.floor((Date.parse(c.certExpiresAt) - Date.now()) / 86_400_000) <= c.warnDays).length; // What is coming up: the nearest dated things (not "updates waiting", which has its own card), and whether any has already passed. // A schedule that repeats weekly is one line (its next time), not one a week. const seenSchedules = new Set(); const soon = (agenda?.items ?? []).filter((i) => { if (i.kind === "updates") return false; const m = /^(schedule|plan):(\d+):/.exec(i.id); const schedule = m ? `${m[1]}:${m[2]}` : null; if (!schedule) return true; if (seenSchedules.has(schedule)) return false; seenSchedules.add(schedule); return true; }); const soonPast = soon.filter((i) => i.daysLeft < 0).length; const soonWeek = soon.filter((i) => i.daysLeft >= 0 && i.daysLeft <= 7).length; // The jobs that report in: late, or said they failed. const beatsWrong = (heartbeatList ?? []).filter((h) => h.state === "late" || h.state === "failed"); // 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 (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" }); } } return ( <>

Dashboard

Wall display
{editing && (
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.
)}

Welcome back, {user.name ?? user.email ?? user.sub}.

{(showTopLeft || todoCard.shown) && (
{showTopLeft && (
{(user.role === "admin" || user.role === "operator") && ( )} {isAdmin && integrations !== null && dnsStats !== null && serverSummary !== null && secrets !== null && notifyConfigured !== null && ( )}
)} {todoCard.shown && (showTopLeft ? (
{todoCard.editing &&
) : (
{todoCard.editing &&
))}
)}
Not configured ) : ( {dnsStats.enabledProviders} enabled ) } > {!dnsStats ? ( ) : dnsStats.totalProviders === 0 ? (
Configure a DNS provider from the DNS page.
) : ( <>
{dnsStats.perProvider.some((p) => p.error) && (
{dnsStats.perProvider .filter((p) => p.error) .map((p) => `${p.name}: ${p.error}`) .join("; ")}
)} {dnsStats.recordsByType.length > 0 && ( ({ label: r.type, count: r.count }))} colors={DNS_TYPE_COLORS} compact /> )} )}
Not configured ) : expiredSecrets > 0 ? ( {expiredSecrets} expired ) : expiringSecrets > 0 ? ( {expiringSecrets} expiring ) : ( All OK ) } > {!secrets ? ( ) : totalSecrets === 0 ? (
Configure a secret from the Secrets page.
) : ( <>
0 ? "#f59e0b" : undefined} />
0 ? "#ef4444" : undefined} />
)}
Not configured ) : serverSummary.offline.length > 0 ? ( {serverSummary.offline.length} offline ) : serverSummary.fullDisks.length > 0 ? ( {serverSummary.fullDisks.length} disk{serverSummary.fullDisks.length === 1 ? "" : "s"} nearly full ) : serverSummary.online > 0 ? ( All online ) : ( No agent data ) } > {!serverSummary ? ( !serverError && ) : serverSummary.total === 0 ? (
Add a server from the Servers page.
) : ( <>
{serverSummary.total}} />
0 ? "#ef4444" : undefined} />
d.count > 0)} colors={SERVER_STATE_COLORS} compact /> {serverSummary.offline.length > 0 && (
Offline:{" "} {serverSummary.offline.slice(0, 3).map((s, i) => ( {i > 0 && ", "} {s.name}{" "} ( {s.inMaintenance ? ", in maintenance" : ""}) ))} {serverSummary.offline.length > 3 && ( <> {" "} +{serverSummary.offline.length - 3} more )}
)} {serverSummary.fullDisks.length > 0 && (
Disk ≥ {serverSummary.thresholds.diskPercent}%:{" "} {serverSummary.fullDisks.slice(0, 3).map((d, i) => ( {i > 0 && ", "} {d.name}{" "} {d.mount} {d.percent}% ))} {serverSummary.fullDisks.length > 3 && +{serverSummary.fullDisks.length - 3} more}
)} {serverSummary.byOs.windows > 0 && (
{serverSummary.byOs.linux} Linux · {serverSummary.byOs.windows} Windows
)} )}
Not configured ) : expiredDomains.length > 0 ? ( {expiredDomains.length} expired ) : expiringDomains.length > 0 ? ( {expiringDomains.length} expiring ) : okDomains > 0 ? ( All OK ) : ( No expiry dates ) } > {!domainList ? ( !domainError && ) : domains.length === 0 ? (
Domains for your DNS zones appear on the Domains page after the next daily check, or add one there.
) : ( <>
{domains.length}} />
0 ? "#f59e0b" : undefined} />
0 ? "#ef4444" : undefined} />
d.count > 0)} colors={DOMAIN_STATE_COLORS} compact /> {expiredDomains.length > 0 && (
Expired:{" "} {expiredDomains.slice(0, 3).map((d, i) => ( {i > 0 && ", "} {d.name} ({Math.abs(d.daysLeft ?? 0)} d ago) ))} {expiredDomains.length > 3 && +{expiredDomains.length - 3} more}
)} {expiringDomains.length > 0 && (
Expiring:{" "} {expiringDomains .slice() .sort((a, b) => a.daysLeft! - b.daysLeft!) .slice(0, 3) .map((d, i) => ( {i > 0 && ", "} {d.name} ({d.daysLeft} d) ))} {expiringDomains.length > 3 && +{expiringDomains.length - 3} more}
)} {nextDomain && nextDomain.status === "ok" && (
Next to expire: {nextDomain.name} in {nextDomain.daysLeft} days ({nextDomain.expiresAt})
)} {failingDomainChecks > 0 && (
{failingDomainChecks} domain{failingDomainChecks === 1 ? "" : "s"} couldn't be refreshed — see the Domains page.
)} )}
0 ? ( {endpointsDown.length} not answering ) : endpointCerts > 0 ? ( {endpointCerts} certificate{endpointCerts === 1 ? "" : "s"} to renew ) : ( All answering ) } > {!endpointChecks ? ( ) : ( <>
c.enabled).length} />
c.enabled && c.lastOk === true).length} />
0 ? "#ef4444" : undefined} />
{endpointsDown.slice(0, 3).map((c) => (
{c.name} — {c.lastMessage}
))}
All checks
)}
0 ? ( {soonPast} past their date ) : soonWeek > 0 ? ( {soonWeek} this week ) : ( Nothing soon ) } > {!agenda ? ( ) : soon.length === 0 ? (
Nothing expires, ends or is planned in the next 30 days.
) : ( <> {soon.slice(0, 5).map((i) => (
{i.daysLeft === 0 ? "today" : i.daysLeft === 1 ? "tomorrow" : i.daysLeft === -1 ? "yesterday" : i.daysLeft > 0 ? `in ${i.daysLeft} days` : `${-i.daysLeft} days ago`} {i.title}
))} {soon.length > 5 &&
+{soon.length - 5} more
} )}
Everything coming up
0 ? ( {beatsWrong.length} not reporting ) : ( All reporting ) } > {!heartbeatList ? ( ) : ( <>
h.enabled).length} />
h.state === "up" || h.state === "running").length} />
0 ? "#ef4444" : undefined} />
{beatsWrong.slice(0, 3).map((h) => (
{h.name} — {h.state === "failed" ? `said it failed${h.lastMessage ? `: ${h.lastMessage}` : ""}` : "hasn't reported in time"}
))}
All heartbeats
)}
{TYPE_GROUPS.filter((group) => integrations?.some((i) => group.types.includes(i.type))).map((group) => (
{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; const isLiveDockhand = type === "dockhand" && integration && dockhandSummary; const isLiveSemaphore = type === "semaphore" && integration && semaphoreSummary; const isLiveProxmox = type === "proxmox" && integration && proxmoxSummary; const isLiveSynology = type === "synology" && integration && synologySummary; const isLiveUptimeKuma = type === "uptimekuma" && integration && uptimeKumaSummary; const isLivePbs = type === "pbs" && integration && pbsSummary; const isLiveOsTicket = type === "osticket" && integration && osTicketSummary; const isLive = isLiveTailscale || isLiveGitea || isLiveDockhand || isLiveSemaphore || isLiveProxmox || isLiveSynology || isLiveUptimeKuma || isLivePbs || isLiveOsTicket; return ( i.type === type)} badge={ isLive ? ( Connected ) : integration ? ( Connecting… ) : ( Not connected ) } > {isLiveTailscale ? ( <>
0 ? "#f59e0b" : undefined} />
0 ? "#f59e0b" : undefined} />
{tailscaleExtra && tailscaleExtra.osBreakdown.length > 0 && ( d.label))} compact /> )} ) : isLiveGitea ? ( <>
0 ? "#ef4444" : undefined} />
{giteaSummary!.statusBreakdown.length > 0 && ( )} ) : isLiveDockhand ? ( <>
0 ? "#f59e0b" : undefined} />
{dockhandSummary!.stateBreakdown.length > 0 && ( )} ) : isLiveSemaphore ? ( <>
0 ? "#ef4444" : undefined} />
{semaphoreSummary!.statusBreakdown.length > 0 && ( )} ) : isLiveProxmox ? ( <>
{proxmoxSummary!.nodeBreakdown.length > 1 && ( d.label))} compact /> )} ) : isLiveSynology ? ( <>
0 ? "#ef4444" : undefined} />
{synologySummary!.memTotalBytes !== null && (
RAM: {formatBytes(synologySummary!.memUsedBytes)} / {formatBytes(synologySummary!.memTotalBytes)}
)} {synologySummary!.diskStatusBreakdown.length > 0 && ( d.label))} compact /> )} ) : isLiveUptimeKuma ? ( <>
0 ? "#ef4444" : undefined} />
{uptimeKumaSummary!.statusBreakdown.length > 0 && ( )} ) : isLivePbs ? (
0 ? "#ef4444" : undefined} />
0 ? "#f59e0b" : undefined} />
) : isLiveOsTicket ? (
0 ? "#ef4444" : undefined} />
0 ? "#f59e0b" : undefined} />
) : (
{integration ? ( ) : ( <> Configure this integration from the Integrations page. )}
)}
); })} {/* 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) && i.type !== "technitium") .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 ? ( Disabled ) : failing || alerts?.critical ? ( {failing ? "Failing" : "Needs a look"} ) : alerts ? ( Needs a look ) : i.health?.status === "ok" ? ( Working ) : ( Not checked yet ); return (
{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."}
{i.enabled && (
Open {TYPE_LABELS[i.type]}
)}
); })} {/* Technitium DNS Server has a widget of its own: the DNS test, the last day's queries and how they were answered, and what is wrong. */} {(integrations ?? []) .filter((i) => group.types.includes(i.type) && i.type === "technitium") .sort((a, b) => a.name.localeCompare(b.name)) .map((i) => { const instance = technitium?.find((x) => x.id === i.id) ?? null; return ( ); })}
))} {notSetUp.length > 0 && (

Not set up yet

{notSetUp.map((n) => ( {n.label} {n.what} ))}
)} ); }