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:
@@ -6,7 +6,8 @@ import { useParams, useRouter } from "next/navigation";
|
||||
import { Plus, Trash2 } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { ago, bytes, fmtDate } from "@/lib/format";
|
||||
import { Loading, Message, PageTitle } from "@/components/ui";
|
||||
import { useServerPaged } from "@/lib/paging";
|
||||
import { Loading, Message, PageTitle, Pager } from "@/components/ui";
|
||||
import { PercentChart, ServersNav, StatusPill, pct, type Deployment, type Job, type ServerSummary } from "@/components/servers";
|
||||
|
||||
type Msg = { type: "ok" | "err"; text: string } | null;
|
||||
@@ -66,6 +67,8 @@ export default function ServerPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const router = useRouter();
|
||||
const [d, setD] = useState<Detail | null>(null);
|
||||
// Hub 2.6.0: every job on this server, a page at a time (it showed the last 25).
|
||||
const jobsPaged = useServerPaged<Job>("/api/admin/jobs", { serverId: String(id) }, r => r.jobs as Job[], 20);
|
||||
const [range, setRange] = useState<"24h" | "7d" | "90d">("24h");
|
||||
const [msg, setMsg] = useState<Msg>(null);
|
||||
const [agentVersion, setAgentVersion] = useState("");
|
||||
@@ -126,7 +129,8 @@ export default function ServerPage() {
|
||||
</div>
|
||||
<div className="card space-y-2 text-sm">
|
||||
<h2 className="font-medium">Actions</h2>
|
||||
<button className="btn-secondary w-full" onClick={() => job("status")}>Check status now</button>
|
||||
<button className="btn-secondary w-full" onClick={() => job("status")}>Check status and find installs</button>
|
||||
<p className="text-xs text-slate-500">Asks the agent what's on the server. A site added there without the Hub (crosscode add, or by hand) is added to Installs and tied to its registration. It also runs by itself once a day when a registered site has no install record here.</p>
|
||||
<div className="flex gap-2"><input className="input" placeholder="agent@1.0.1" value={agentVersion} onChange={e => setAgentVersion(e.target.value)} aria-label="Agent version" /><button className="btn-secondary" disabled={!agentVersion} onClick={() => job("update-agent", { version: agentVersion })}>Update agent</button></div>
|
||||
<button className="btn-danger w-full" onClick={remove}><Trash2 className="h-4 w-4" /> Remove server</button>
|
||||
</div>
|
||||
@@ -157,12 +161,13 @@ export default function ServerPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="card overflow-x-auto">
|
||||
<h2 className="font-medium">Recent jobs</h2>
|
||||
<div className="card overflow-x-auto p-0">
|
||||
<h2 className="px-5 pt-5 font-medium">Jobs</h2>
|
||||
<table className="mt-3 w-full text-sm">
|
||||
<thead><tr className="text-left text-xs text-slate-500"><th className="py-1">Job</th><th>When</th><th>Status</th><th>Result</th></tr></thead>
|
||||
<tbody>{d.jobs.map(j => <tr key={j.id} className="border-t"><td className="py-1.5"><Link className="text-indigo-700 hover:underline" href={`/jobs/${j.id}`}>{j.type}</Link> <span className="text-xs text-slate-500">{String(j.args?.church || "")}</span></td><td>{fmtDate(j.notBefore)}</td><td><StatusPill status={j.status} /></td><td className="max-w-md truncate text-xs text-slate-500">{j.message}</td></tr>)}</tbody>
|
||||
<thead><tr className="text-left text-xs text-slate-500"><th className="px-5 py-1">Job</th><th>When</th><th>Status</th><th>Result</th></tr></thead>
|
||||
<tbody>{(jobsPaged.rows ?? d.jobs).map(j => <tr key={j.id} className="border-t"><td className="px-5 py-1.5"><Link className="text-indigo-700 hover:underline" href={`/jobs/${j.id}`}>{j.type}</Link> <span className="text-xs text-slate-500">{String(j.args?.church || "")}</span></td><td>{fmtDate(j.notBefore)}</td><td><StatusPill status={j.status} /></td><td className="max-w-md truncate pr-5 text-xs text-slate-500">{j.message}</td></tr>)}</tbody>
|
||||
</table>
|
||||
<Pager page={jobsPaged.page} pages={jobsPaged.pages} setPage={jobsPaged.setPage} total={jobsPaged.total} pageSize={jobsPaged.pageSize} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user