// --------------------------------------------------------------------------- // settings / AdminPane.tsx — THE LOOPABLE ADMIN PLANE (wave 19, owner item 13 / // R3+R4, contract C2). // // The one surface in this product that looks ACROSS tenants: who our customers // are, how many people use each workspace, what they have built in it, whether // their data sources are alive, and what the automation fleet costs. // // SELF-CONTAINED BY CONTRACT (C2). It fetches its own data via // `platformAdminApi` and takes ONE prop, so mounting it is a rail entry plus a // line in the pane switch — `SettingsModal.tsx` is another session's file this // wave and must not have to learn anything about this pane's data. // // ⚠ THE PROP IS TYPED STRUCTURALLY, not as `SessionUser` from `../shell/session`. // The mount site passes the shell's session user (a wider object), which // satisfies this shape by structural typing — and this pane therefore imports // nothing from the shell, which is what the wave's cross-fence rule asks for // while `session.ts` is open on another desk. // // ⛔ EVERY NUMBER HERE IS THE SERVER'S, AND EVERY NUMBER DRILLS. Clicking a count // opens the rows it was computed from — the same collector, projected twice // ([[no-unverifiable-aggregates]]). A count that could not be READ renders as an // its cause, never as a zero: "this customer has no databases" and // "we could not look" are different facts and the pane refuses to conflate them. // // DESIGN: sentence-case micro-labels (R6 — no caps in app chrome), short noun // headers, tabular figures right-aligned, hairlines not shadows, tokens only, // no emojis (DESIGN.md §2–§4). // --------------------------------------------------------------------------- import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react"; import { API_V1, CREDENTIALS, TOAST_EVENT, UNAUTHORIZED_EVENT } from "../apiContract"; import { useEscapeClose } from "../ui/useEscapeClose"; import "../signup/signup.css"; import type { AutomationRow, ConnectorRow, DatabaseRow, FleetCost, Overview, PlatformUser, ReleasesPayload, SignupRequest, TenantRow, } from "./platformAdminApi"; import { getAutomations, getAws, getReleases, getConnectors, getDatabases, getOverview, getUsers, getSignupRequests, approveSignupRequest, declineSignupRequest, } from "./platformAdminApi"; // --- formatting ------------------------------------------------------------- const int = (n: number) => n.toLocaleString(); /** A count that may be unknown. `null` is NOT zero — see the api module's header. */ function Count({ n, why }: { n: number | null | undefined; why?: string }) { if (n === null || n === undefined) return ( Unknown ); return <>{int(n)}; } /** "3 days ago" for a stamp, "never" for an absent one. Never a fabricated date. * * ⛔ ONLY FOR OFFSET-BEARING STAMPS. `Date.parse` reads a stamp with no zone as * BROWSER-LOCAL, so running a container-local timestamp through this reports the * viewer's UTC offset as elapsed time — hours of error in a column people scan, * and a future-dated stamp that renders as "just now" indefinitely. Everything * this pane passes here (`last_login`, `last_active`, `generatedAt`) is written * with an explicit offset; the automation engine's `lastRunAt` is NOT, so it is * rendered verbatim instead. */ function ago(stamp: string): string { if (!stamp) return "never"; const t = Date.parse(stamp.includes("T") ? stamp : stamp.replace(" ", "T")); if (Number.isNaN(t)) return stamp; const mins = Math.floor((Date.now() - t) / 60000); if (mins < 2) return "just now"; if (mins < 60) return `${mins} minutes ago`; const hours = Math.floor(mins / 60); if (hours < 24) return `${hours} hour${hours === 1 ? "" : "s"} ago`; const days = Math.floor(hours / 24); if (days < 60) return `${days} day${days === 1 ? "" : "s"} ago`; return `${Math.floor(days / 30)} months ago`; } type DrillKind = "users" | "databases" | "connectors" | "automations"; const DRILL_NOUN: Record = { users: "People", databases: "Databases", connectors: "Data sources", automations: "Automations", }; /** The loading shape — a skeleton, not a spinner (DESIGN.md §4). */ function Skeleton({ rows = 3 }: { rows?: number }) { return (
{Array.from({ length: rows }, (_, i) => ( ); } type NeonMetric = "transfer_gb" | "compute_hours" | "storage_gib"; type NeonNumbers = Record; interface NeonUsage { available: boolean; cause: string | null; read_at: string; period: { start: string; end: string }; usage: NeonNumbers; allowance: Record; share: NeonNumbers; rate: Record; projection: { transfer: number | null; compute: number | null; storage: number | null; total: number | null; currency: string; cause: string | null; basis: Record; }; samples: { at: string; transfer_bytes: number; compute_seconds: number; storage_bytes: number; period_start: string }[]; sampler: { every_s: number; last_at: string | null; pending: number; persisted: string | null; cause: string | null }; alarm: { level: "red"; message: string; test: boolean } | null; guards: { ok: boolean; message: string } | null; } async function getNeon(): Promise<{ ok: true; data: NeonUsage } | { ok: false; message: string }> { try { const response = await fetch(`${API_V1}/platform-admin/neon`, { credentials: CREDENTIALS }); if (!response.ok) { return { ok: false, message: response.status === 403 ? "Neon usage is only available to platform operators." : response.status === 401 ? "Sign in to read Neon usage." : `Neon usage could not be loaded (HTTP ${response.status}).` }; } const data = await response.json() as NeonUsage; if (typeof data?.available !== "boolean") return { ok: false, message: "The Neon usage response could not be read." }; return { ok: true, data }; } catch { return { ok: false, message: "The Neon usage service could not be reached or its response could not be read." }; } } const neonNumber = (value: number) => value.toLocaleString(undefined, { maximumFractionDigits: 2 }); const neonDate = (value: string) => new Date(value).toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric", timeZone: "UTC" }); const neonTime = (value: string) => new Date(value).toLocaleString(undefined, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", timeZone: "UTC" }); const neonMoney = (value: number) => value.toLocaleString(undefined, { style: "currency", currency: "USD" }); function NeonCard({ data, error, onRetry }: { data: NeonUsage | null; error: string; onRetry: () => void }) { const metrics: { key: NeonMetric; label: string; unit: string }[] = [ { key: "transfer_gb", label: "Transfer", unit: "GB" }, { key: "compute_hours", label: "Compute", unit: "CU-hours" }, { key: "storage_gib", label: "Storage", unit: "GiB" }, ]; const cause = error || (data && !data.available ? data.cause || "Neon usage could not be read." : ""); return (

Neon

{cause ?
Could not read Neon usage.
: !data ? : ( <> {data.alarm ? (

{data.alarm.test && !data.alarm.message.startsWith("TEST ") ? "TEST " : ""}{data.alarm.message}

) : null}

{neonDate(data.period.start)} to {neonDate(data.period.end)} (UTC, end exclusive). {" "}Project totals include staging and production. Read {neonTime(data.read_at)} UTC.

{metrics.map(({ key, label, unit }) => (
{label} {data.usage[key] === null ? "This total could not be read" : `${neonNumber(data.usage[key])} ${unit}`} of {neonNumber(data.allowance[key])} {unit} {data.share[key] === null ? "; usage share could not be read" : ` · ${neonNumber(data.share[key] * 100)}% used`}
))}

GB per day: {data.rate.transfer_gb.per_day === null ? data.rate.transfer_gb.cause : neonNumber(data.rate.transfer_gb.per_day)}

Projected bill: {data.projection.total === null ? data.projection.cause : `${neonMoney(data.projection.total)} at period end`}

{data.projection.total !== null ? ( <>

{metrics.map(({ key, label }) => `${label}: ${data.projection.basis[key]}`).join(". ")}.

Transfer {neonMoney(data.projection.transfer!)} · Compute {neonMoney(data.projection.compute!)} {" "}· Storage {neonMoney(data.projection.storage!)}. Compute is billed from the first CU-hour.

) : null}
Sample history
{data.samples.length ? (
{[...data.samples].reverse().map((sample) => ( ))}
Time (UTC) Transfer (GB) Compute (CU-hours) Storage (GiB)
{neonTime(sample.at)} {neonNumber(sample.transfer_bytes / 1e9)} {neonNumber(sample.compute_seconds / 3600)} {neonNumber(sample.storage_bytes / 2 ** 30)}
) :

No sample history is available yet.

}

{data.sampler.every_s > 0 ? `Sampled every ${neonNumber(data.sampler.every_s / 3600)} hours. ` : ""} {data.sampler.persisted ? `History saved ${neonTime(data.sampler.persisted)} UTC. ` : ""} {data.sampler.pending > 0 ? `${data.sampler.pending} samples awaiting storage. ` : ""} {data.sampler.cause}

)} {data?.guards ? (

{data.guards.message}

) : null}
); } interface DigitalOceanUsage { available: boolean; cause: string | null; read_at: string; cluster: { available: boolean; cause: string | null; source: string; read_at: string; name: string | null; size: string | null; num_nodes: number | null; region: string | null; status: string | null; }; fixed_price: { monthly_usd: number | null; source: string | null; read_at: string; cause: string | null }; balance: { available: boolean; cause: string | null; source: string; read_at: string; month_to_date_usage: number | null; account_balance: number | null; month_to_date_balance: number | null; generated_at: string | null; }; billing: { available: boolean; cause: string | null; source: string; read_at: string; has_more?: boolean }; billing_history: { date: string; description: string; amount: number; type: string }[]; sampler: { every_s: number; last_at: string | null; persisted: string | null; cause: string | null }; alarm: { level: "red"; message: string; test: boolean } | null; alarm_cause: string | null; } async function getDigitalOcean(): Promise<{ ok: true; data: DigitalOceanUsage } | { ok: false; message: string }> { try { const response = await fetch(`${API_V1}/platform-admin/do`, { credentials: CREDENTIALS }); if (!response.ok) { return { ok: false, message: response.status === 403 ? "DigitalOcean usage is only available to platform operators." : response.status === 401 ? "Sign in to read DigitalOcean usage." : `DigitalOcean usage could not be loaded (HTTP ${response.status}).` }; } const data = await response.json() as DigitalOceanUsage; if (typeof data?.available !== "boolean" || !data.cluster || !data.balance || !data.fixed_price || !data.billing || !Array.isArray(data.billing_history) || !data.sampler) return { ok: false, message: "The DigitalOcean usage response could not be read." }; return { ok: true, data }; } catch { return { ok: false, message: "The DigitalOcean usage service could not be reached or its response could not be read." }; } } // Provider labels are also screen copy. Preserve their meaning using words for ranges. const doText = (value: string) => value.replace(/\u2014/g, "; ").replace(/\u2013/g, " to "); const doTime = (value: string) => `${new Date(value).toLocaleString(undefined, { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", timeZone: "UTC" })} UTC`; function DigitalOceanCard({ data, error, onRetry }: { data: DigitalOceanUsage | null; error: string; onRetry: () => void }) { const cause = error || (data && !data.available ? data.cause || "DigitalOcean usage could not be read." : ""); return (

DigitalOcean

{cause ?
Could not read DigitalOcean usage.
: !data ? : ( <> {data.alarm ? (

{data.alarm.test && !data.alarm.message.startsWith("TEST ") ? "TEST " : ""}{doText(data.alarm.message)}

) : null} {data.cluster.available ? (

{doText(data.cluster.name!)} · {doText(data.cluster.size!)} · {data.cluster.num_nodes} {data.cluster.num_nodes === 1 ? " node" : " nodes"} · {doText(data.cluster.region!)} · {doText(data.cluster.status!)}

) :

Cluster: {doText(data.cluster.cause || "The cluster could not be read.")}

}
Fixed price {data.fixed_price.monthly_usd === null ? "Unknown" : `${neonMoney(data.fixed_price.monthly_usd)} a month`} {data.fixed_price.monthly_usd === null ? doText(data.fixed_price.cause || "The fixed price could not be read.") : `${doText(data.fixed_price.source!)}. Read ${doTime(data.fixed_price.read_at)}.`}
Month to date {!data.balance.available || data.balance.month_to_date_usage === null ? "This total could not be read" : neonMoney(data.balance.month_to_date_usage)} {data.balance.available && data.balance.generated_at ? `As of ${doTime(data.balance.generated_at)}.` : doText(data.balance.cause || "The balance snapshot could not be read.")}
{data.balance.available ? (

{doText(data.balance.source)}. Read {doTime(data.balance.read_at)}.

) : null}
Billing history
{!data.billing.available ? (

{doText(data.billing.cause || "Billing history could not be read.")}

) : ( <> {data.billing_history.length ? (
{data.billing_history.map((row, index) => ( ))}
Date (UTC)DescriptionAmount
{neonDate(row.date)}{doText(row.description)} {neonMoney(row.amount)}
) :

No billing history yet

}

{doText(data.billing.source)}. Read {doTime(data.billing.read_at)}. {data.billing.has_more ? " Showing the latest page." : ""}

)} {data.alarm_cause ?

{doText(data.alarm_cause)}

: null}

{data.sampler.every_s > 0 ? `Sampled every ${neonNumber(data.sampler.every_s / 3600)} hours. ` : ""} {data.sampler.persisted ? `History saved ${doTime(data.sampler.persisted)}. ` : ""} {doText(data.sampler.cause || "")}

)}
); } // --- the pane --------------------------------------------------------------- function SignupRequests({ tenants, owner }: { tenants: TenantRow[]; owner: string }) { const [requests, setRequests] = useState(null); const [error, setError] = useState(""); const [notice, setNotice] = useState(""); const [approving, setApproving] = useState(null); const [tenant, setTenant] = useState(""); const [busy, setBusy] = useState(false); const acting = useRef(false); const opener = useRef(null); const picker = useRef(null); const companies = tenants.filter((company) => company.status === "active"); const requestScope = useRef(null); const recordsGeneration = useRef(0); useLayoutEffect(() => { const scope = new AbortController(); requestScope.current = scope; acting.current = false; setBusy(false); const invalidate = () => scope.abort(); window.addEventListener(UNAUTHORIZED_EVENT, invalidate); window.addEventListener("aios:signed-out", invalidate); return () => { scope.abort(); window.removeEventListener(UNAUTHORIZED_EVENT, invalidate); window.removeEventListener("aios:signed-out", invalidate); }; }, [owner]); const load = useCallback(() => { const request = requestScope.current?.signal; if (!request || request.aborted) return; const generation = ++recordsGeneration.current; setRequests(null); setError(""); void getSignupRequests().then((result) => { if (request.aborted || generation !== recordsGeneration.current) return; if (result.ok) setRequests(result.data.requests); else setError(result.message); }); }, []); useEffect(load, [load, owner]); useEffect(() => { if (approving) picker.current?.focus(); }, [approving]); function closePicker() { setApproving(null); setTenant(""); opener.current?.focus(); } useEscapeClose(approving !== null && !busy, closePicker); async function act(id: string, action: "approve" | "decline") { const request = requestScope.current?.signal; if (!request || request.aborted) return; const generation = recordsGeneration.current; if (acting.current || (action === "approve" && !companies.some((company) => company.slug === tenant))) return; acting.current = true; setBusy(true); setError(""); setNotice(""); try { const result = action === "approve" ? await approveSignupRequest(id, tenant) : await declineSignupRequest(id); if (request.aborted || generation !== recordsGeneration.current) return; if (!result.ok) { window.dispatchEvent(new CustomEvent(TOAST_EVENT, { detail: { text: result.message, tone: "error" } })); return; } setRequests((rows) => rows?.filter((row) => row.id !== id) ?? null); setApproving(null); setTenant(""); if (action === "approve" && result.data.request.deliveryStatus === "failed") { window.dispatchEvent(new CustomEvent(TOAST_EVENT, { detail: { text: "Approved. The invitation could not be delivered.", tone: "error" }, })); } else setNotice(action === "decline" ? "Request declined." : "Request approved."); } finally { if (!request.aborted && generation === recordsGeneration.current) { acting.current = false; setBusy(false); } } } return (

Sign-up requests

{error ?
Could not load sign-up requests.
: null} {notice ?

{notice}

: null} {requests === null ? error ? null : : requests.length === 0 ? (

No requests.

) : (
    {requests.map((request) => { const stamp = new Date(request.at); const validTime = !Number.isNaN(stamp.getTime()); return (
  • {request.phone}

    {request.text}

    {approving === request.id ? (
    { event.preventDefault(); void act(request.id, "approve"); }}>
    {companies.length === 0 ?

    No companies available.

    : null}
    ) : null}
  • ); })}
)}
); } export function AdminPane({ user }: { user: { username: string; name: string; role: string } }) { const [ov, setOv] = useState(null); const [err, setErr] = useState(""); const [loading, setLoading] = useState(true); const [fleet, setFleet] = useState<{ rows: AutomationRow[]; cost: FleetCost } | null>(null); const [fleetError, setFleetError] = useState(""); const [drill, setDrill] = useState<{ kind: DrillKind; tenant: string } | null>(null); const [drillRows, setDrillRows] = useState(null); const [drillNote, setDrillNote] = useState(""); const [drillError, setDrillError] = useState(""); const [aws, setAws] = useState<{ text: string; note: string; available: boolean } | null>(null); // Wave 20 (R6): the releases panel. Loaded with the overview rather than on demand — it is // two small Hub reads and the first question an operator opens this pane to answer. const [rel, setRel] = useState(null); const [relError, setRelError] = useState(""); const [awsBusy, setAwsBusy] = useState(false); const [neon, setNeon] = useState(null); const [neonError, setNeonError] = useState(""); const [digitalOcean, setDigitalOcean] = useState(null); const [digitalOceanError, setDigitalOceanError] = useState(""); const load = useCallback(() => { setLoading(true); setErr(""); setOv(null); setFleet(null); setFleetError(""); setRel(null); setRelError(""); setNeon(null); setNeonError(""); setDigitalOcean(null); setDigitalOceanError(""); void getOverview().then((r) => { setLoading(false); if (r.ok) { setOv(r.data); setErr(""); } else setErr(r.message); }); void getAutomations().then((r) => { if (r.ok) setFleet({ rows: r.data.automations, cost: r.data.cost }); else setFleetError(r.message); }); void getReleases().then((r) => { if (r.ok) setRel(r.data); else setRelError(r.message); }); void getNeon().then((r) => { if (r.ok) { setNeon(r.data); setNeonError(""); } else setNeonError(r.message); }); void getDigitalOcean().then((r) => { if (r.ok) { setDigitalOcean(r.data); setDigitalOceanError(""); } else setDigitalOceanError(r.message); }); }, []); useEffect(load, [load]); const openDrill = useCallback((kind: DrillKind, tenant: string) => { setDrill({ kind, tenant }); setDrillRows(null); setDrillNote(""); setDrillError(""); const fetcher = kind === "users" ? getUsers : kind === "databases" ? getDatabases : kind === "connectors" ? getConnectors : getAutomations; void fetcher(tenant || undefined).then((r) => { if (!r.ok) { setDrillRows([]); setDrillError(r.message); return; } const d = r.data as Record; setDrillRows((d[kind] as unknown[]) ?? []); // The server's own honest note travels with the rows rather than being // re-invented here: it is the one that knows WHY a tenant is missing. const errors = (d.errors as Record) ?? {}; const words = Object.entries(errors).map(([t, e]) => `${t}: ${e}`); setDrillNote( [typeof d.stampsNote === "string" ? d.stampsNote : "", ...words] .filter(Boolean) .join(" · ") ); }); }, []); const loadAws = useCallback(() => { setAwsBusy(true); void getAws(7).then((r) => { setAwsBusy(false); if (r.ok) setAws(r.data.report); else setAws({ text: "", note: r.message, available: false }); }); }, []); return (

Loopable admin

Signed in as {user.name}.

{err ?
Could not read the platform overview.
: null} {fleetError ?
Could not read automation costs.
: null} {relError ?
Could not read releases.
: null} {loading ? ( ) : !ov ? null : ( <>
{ov.totals.unknownTenants > 0 ? (

{ov.totals.unknownTenants} workspace {ov.totals.unknownTenants === 1 ? "" : "s"} could not be read, so the totals above exclude {ov.totals.unknownTenants === 1 ? "it" : "them"}.

) : null}
{ov.tenants.map((t) => ( openDrill("users", t.slug)} title={`${t.admins} administrator${t.admins === 1 ? "" : "s"}`} /> openDrill("databases", t.slug)} why={t.errors?.[0]} /> openDrill("databases", t.slug)} why={t.errors?.[0]} /> openDrill("connectors", t.slug)} why={t.errors?.[0]} title={ t.connectorsPaused ? `${t.connectorsPaused} paused` : "none paused" } /> openDrill("automations", t.slug)} why={t.errors?.[0]} title={ t.automationsEnabled != null ? `${t.automationsEnabled} scheduled` : undefined } /> ))}
Workspace Storage People Databases Records Sources Automations
{t.name} {t.slug} {t.status !== "active" ? ` · ${t.status}` : ""} {t.errors && t.errors.length ? ` · ${t.errors[0]}` : ""} {t.storeRepo && t.storeRepo.includes("/") ? "own repository" : t.storePrefix ? "shared repository" : "tenant #0 repository"} {t.keychainLocked ? " · keychain locked" : ""}

Read {ago(ov.generatedAt)} in {ov.tookMs} ms.{" "} {ov.totals.orphanUsers > 0 ? `${ov.totals.orphanUsers} account${ ov.totals.orphanUsers === 1 ? "" : "s" } belong to a workspace this deployment no longer knows. ` : ""}

{drill ? (

{DRILL_NOUN[drill.kind]} {drill.tenant ? `: ${drill.tenant}` : ""}

{drillError ?
Could not read these rows.
: drillRows === null ? ( ) : drillRows.length === 0 ? (

Nothing here yet.

) : ( )} {drillNote ?

{drillNote}

: null}
) : null} {!fleet && !fleetError ?

Automation cost

: fleet ? (
{/* Named for what it SHOWS. The fleet's rows live one level down, behind the Automations count — this section is the cost and the reasoning behind it, so calling it "fleet" would promise a table that is deliberately not here. */}

Automation cost

{fleet.rows.filter((a) => a.enabled).length} automations of {fleet.rows.length} {`, ${fleet.cost.nativeSchedules} exact schedule${fleet.cost.nativeSchedules === 1 ? "" : "s"}`} {fleet.cost.fleetRunsPerDay ? `, about ${fleet.cost.fleetRunsPerDay} runs a day` : ""} {fleet.cost.unknownCadence ? ` (${fleet.cost.unknownCadence} on a custom cadence, not counted)` : ""} . {fleet.cost.basis}

) : null} {/* ── Wave 20 (owner item 12 / R6): what is running where ────────────────── READ-ONLY BY RULING. The operator sees both environments and every cut release; moving one is a CLI command, printed below rather than wired to a button, so no browser session can rewrite production. */}

Releases

{relError ? null : !rel ? ( ) : ( <> {rel.environments.map((e) => ( {/* ⚠ An unreadable version is a NOTE, never a blank. A blank cell in a column headed "Version" reads as "nothing is deployed", which about a production environment is the worst available way to be wrong. */} {/* The Space ID as TEXT, not a link: the server deliberately builds no URL (portability C1 — a host literal in runtime code hard-codes the current host into a process designed to move). */} ))}
Environment Version Stage Space
{e.env === "live" ? "Live (pinned)" : "Staging (follows the tree)"}{e.version || {e.note || "unknown"}} {e.stage || "Stage could not be read"}{e.space}
{rel.releases.length ? ( {rel.releases.map((r) => ( ))}
Release Commit Cut What shipped
{r.version} {r.sha} {r.date} {r.subject}
) : (

No tagged releases were readable from either Space.

)}

To move Live to another version, or roll it back, run:{" "} {rel.promote}

)}

AWS cron

{awsBusy ? : !aws ? (

The external tick that wakes this app on schedule. Reading its usage runs a live CloudWatch query and takes a few seconds.{" "}

) : aws.available ? (
{aws.text}
) : (
Could not read AWS usage.
)}
)}
); } function Total({ label, value, hint }: { label: string; value: string; hint?: string }) { // A tooltip nobody can see is a tooltip nobody reads: the label carries a // dotted underline exactly when there is something behind it. return (
{label} {value}
); } /** A numeric cell that opens its own rows. Unknown counts are not clickable — * there is nothing to drill INTO when the read failed, and a button that opens * an empty table would read as "none". */ function DrillCell({ n, onOpen, why, title, }: { n: number | null | undefined; onOpen: () => void; why?: string; title?: string; }) { if (n === null || n === undefined) return ( ); return ( ); } function DrillTable({ kind, rows }: { kind: DrillKind; rows: unknown[] }) { if (kind === "users") { const rs = rows as PlatformUser[]; return (
{rs.map((u) => ( ))}
Person Workspace Role Last sign-in Last active
{u.name} {u.username} {u.email ? ` · ${u.email}` : ""} {u.active ? "" : " · deactivated"} {u.tenant} {u.role} {u.platformAdmin ? " · platform" : ""} {ago(u.lastLogin)} {ago(u.lastActive)}
); } if (kind === "databases") { const rs = rows as DatabaseRow[]; return (
{rs.map((d) => ( ))}
Database Workspace Built from Fields Records
{d.label} {d.key} {d.createdBy ? ` · ${d.createdBy}` : ""} {d.tenant} {d.source} {int(d.fields)} {int(d.rowCount)}
); } if (kind === "connectors") { const rs = rows as ConnectorRow[]; return (
{rs.map((c) => ( ))}
Source Workspace Kind Status
{c.label} {c.source === "env" ? "environment credentials" : "keychain"} {c.tenant} {c.type} {c.paused ? "paused" : c.active ? "serving" : "stored"}
); } const rs = rows as AutomationRow[]; return (
{rs.map((a) => ( ))}
Automation Workspace Schedule Runs a day Last run
{a.name} {a.kind} {a.failedRetained ? ` · ${a.failedRetained} of the last ${a.runsRetained} runs failed` : ""} {a.tenant} {a.enabled ? a.cron || "scheduled" : "paused"} {a.enabled ? (a.runsPerDay === null ? "custom" : a.runsPerDay) : "Disabled"} {/* Verbatim, not relative: the engine writes this stamp with no zone (`automation_engine._iso()` is naive local-to-container), so "x hours ago" would be wrong by the viewer's offset. */} {a.lastRunAt ? a.lastRunAt.replace("T", " ") : "never"}
); } export default AdminPane;