Hub 2.6.0: paged lists, job status filters, one-product updates, installs found on servers

- Jobs: Succeeded/Cancelled filters, product, type and church search, paged
  on the server; audit log and alerts paged on the server with search;
  every other list paged.
- Updates: one product at a time with its own releases; an Events update
  pins the church's Accounts (or updates it when the release needs it, or
  installs it first); fixes the requirement check comparing an object.
- A status job adds installs found on a server and ties them to their
  registration; unlinked registered sites trigger one (daily); heartbeats
  tie install records too; the install page shows its registration.
13 new tests (209).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 20:09:31 +02:00
co-authored by Claude Opus 5.5
parent ff176681a7
commit de6a14c229
24 changed files with 641 additions and 130 deletions
@@ -1,12 +1,14 @@
"use client";
import React, { useCallback, useEffect, useState } from "react";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { Link2, Plus } from "lucide-react";
import { api, errorText } from "@/lib/api";
import { ago } from "@/lib/format";
import { Loading, Message, PageTitle } from "@/components/ui";
import { matches, usePaged } from "@/lib/paging";
import { PRODUCT_NAMES } from "@/lib/products";
import { Loading, Message, PageTitle, Pager, SearchInput } from "@/components/ui";
import { ServersNav, StatusPill, pct, type Deployment, type ServerSummary } from "@/components/servers";
type Msg = { type: "ok" | "err"; text: string } | null;
@@ -20,6 +22,11 @@ const emptyLink = { installId: "", serverId: "", shortName: "", webPort: "", api
export default function InstallsPage() {
const router = useRouter();
const [list, setList] = useState<Deployment[] | null>(null);
// Hub 2.6.0: which product each install is, a filter for it, a search, and a page at a time.
const [product, setProduct] = useState("");
const [query, setQuery] = useState("");
const shown = useMemo(() => (list || []).filter(d => (!product || d.product === product) && matches(query, d.customer?.name, d.shortName, d.domain, d.server?.name)), [list, product, query]);
const paged = usePaged(shown, `${product}|${query}`);
const [srv, setSrv] = useState<ServerSummary[]>([]);
const [customers, setCustomers] = useState<Customer[]>([]);
const [installs, setInstalls] = useState<InstallRow[]>([]);
@@ -138,14 +145,23 @@ export default function InstallsPage() {
)}
{!list ? <Loading /> : (
<div className="card overflow-x-auto">
<div className="card overflow-x-auto p-0">
<div className="flex flex-wrap gap-2 p-4">
<select className="input w-48" aria-label="Product" value={product} onChange={e => setProduct(e.target.value)}>
<option value="">Every product</option>
<option value="events">{PRODUCT_NAMES.events}</option>
<option value="accounts">{PRODUCT_NAMES.accounts}</option>
</select>
<SearchInput className="w-full sm:w-72" value={query} onChange={setQuery} placeholder="Search a church, domain or server" />
</div>
<table className="w-full text-sm">
<thead><tr className="text-left text-xs text-slate-500"><th className="py-1">Church</th><th>Domain</th><th>Server</th><th>Version</th><th>Last heartbeat</th><th>Status</th></tr></thead>
<tbody>{list.map(d => (
<tr key={d.id} className="border-t"><td className="py-1.5"><Link className="text-indigo-700 hover:underline" href={`/servers/installs/${d.id}`}>{d.customer?.name} ({d.shortName})</Link>{d.isDemo && <span className="ml-1 rounded bg-sky-100 px-1.5 text-xs text-sky-800">demo</span>}</td><td>{d.domain}</td><td>{d.server?.name}</td><td>{d.install?.version || d.version || "–"}</td><td>{ago(d.install?.lastHeartbeatAt)}</td><td><StatusPill status={d.status} /></td></tr>
<thead><tr className="text-left text-xs text-slate-500"><th className="px-4 py-1">Church</th><th>Product</th><th>Domain</th><th>Server</th><th>Version</th><th>Last heartbeat</th><th>Status</th></tr></thead>
<tbody>{paged.rows.map(d => (
<tr key={d.id} className="border-t"><td className="px-4 py-1.5"><Link className="text-indigo-700 hover:underline" href={`/servers/installs/${d.id}`}>{d.customer?.name} ({d.shortName})</Link>{d.isDemo && <span className="ml-1 rounded bg-sky-100 px-1.5 text-xs text-sky-800">demo</span>}</td><td>{PRODUCT_NAMES[d.product as keyof typeof PRODUCT_NAMES] || d.product}</td><td>{d.domain}</td><td>{d.server?.name}</td><td>{d.install?.version || d.version || "–"}</td><td>{d.installId ? ago(d.install?.lastHeartbeatAt) : <span className="text-amber-800">not registered</span>}</td><td><StatusPill status={d.status} /></td></tr>
))}</tbody>
</table>
{!list.length && <p className="mt-2 text-sm text-slate-500">No installs on servers yet.</p>}
{!list.length ? <p className="px-4 py-3 text-sm text-slate-500">No installs on servers yet.</p> : !shown.length && <p className="px-4 py-3 text-sm text-slate-500">No installs match.</p>}
<Pager {...paged} />
</div>
)}
</div>