Search and paging on lists, Settings in tabs, pinned sidebar (1.3.0)
- Installs, Customers, Alerts and the audit log get a search box and 25-per-page paging (Installs also a health filter); install History pages too. - Settings is split into Releases and alerts / Email / Login and security / Audit log tabs, remembered in the URL hash. - The side navigation is sticky at window height, so Sign out no longer scrolls off long pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,9 @@ import { useParams } from "next/navigation";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { ago, bytes, fmtDate, rand } from "@/lib/format";
|
||||
import { usePaged } from "@/lib/paging";
|
||||
import type { Health, InstallEvent, InstallSummary, Licence, Stats } from "@/lib/types";
|
||||
import { Badge, Loading, Message, PageTitle } from "@/components/ui";
|
||||
import { Badge, Loading, Message, PageTitle, Pager } from "@/components/ui";
|
||||
|
||||
type Detail = {
|
||||
id: string; name: string; url: string; version: string | null; protocolVersion: number; timezone: string | null; notes: string | null;
|
||||
@@ -21,7 +22,9 @@ type Detail = {
|
||||
heartbeats: { receivedAt: string; version: string | null; stats: Stats | null }[];
|
||||
};
|
||||
|
||||
const Row = ({ k, v }: { k: string; v: React.ReactNode }) => (
|
||||
const NO_EVENTS: InstallEvent[] = [];
|
||||
|
||||
const Row =({ k, v }: { k: string; v: React.ReactNode }) => (
|
||||
<div className="flex justify-between gap-4 border-b border-slate-100 py-1.5 text-sm last:border-0"><span className="text-slate-500">{k}</span><span className="text-right">{v}</span></div>
|
||||
);
|
||||
|
||||
@@ -34,6 +37,7 @@ export default function InstallPage() {
|
||||
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/installs/${id}`).then(x => { setD(x); setNotes(x.notes || ""); }).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
const history = usePaged(d?.events || NO_EVENTS, id, 20);
|
||||
|
||||
if (!d) return msg ? <Message msg={msg} /> : <Loading />;
|
||||
const h = d.health || {};
|
||||
@@ -134,8 +138,9 @@ export default function InstallPage() {
|
||||
<div className="card mt-6">
|
||||
<h2 className="mb-3 font-semibold">History</h2>
|
||||
{d.events.length === 0 ? <p className="text-sm text-slate-500">Nothing yet.</p> : (
|
||||
<>
|
||||
<ul className="space-y-2 text-sm">
|
||||
{d.events.map(e => (
|
||||
{history.rows.map(e => (
|
||||
<li key={e.id} className="flex flex-wrap items-center gap-2">
|
||||
<span className="w-40 shrink-0 text-xs text-slate-500">{fmtDate(e.createdAt)}</span>
|
||||
<Badge value={e.level} />
|
||||
@@ -144,6 +149,8 @@ export default function InstallPage() {
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="-mx-5 -mb-5 mt-3"><Pager {...history} /></div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user