Hub 2.4.0: demo sites, and demo data loaded from the Hub
Mark a Cross Events install as a demo site, then load a demo set (small, events, ministry, multicampus) with a seed-demo job (agent 1.2.0+, crosscode demo: backup, demo data, restart). Typing the short name for both. Deployment.isDemo (migration), contracts 1.7.0 vendored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.3.3",
|
||||
"version": "2.4.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.3.3",
|
||||
"version": "2.4.0",
|
||||
"dependencies": {
|
||||
"lucide-react": "^0.536.0",
|
||||
"next": "^15.5.24",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.3.3",
|
||||
"version": "2.4.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3200",
|
||||
|
||||
@@ -28,6 +28,7 @@ export default function DeploymentPage() {
|
||||
const [upd, setUpd] = useState({ version: "", at: toInput(new Date(Date.now() + 5 * H)), emergency: false, reason: "", totp: "" });
|
||||
const [adopt, setAdopt] = useState({ eventsDir: "", version: "", address: "", at: toInput(new Date(Date.now() + 5 * H)) });
|
||||
const [un, setUn] = useState({ at: toInput(new Date(Date.now() + 7 * 24 * H)), totp: "", confirm: "" });
|
||||
const [demo, setDemo] = useState({ profile: "events", confirm: "", markConfirm: "" });
|
||||
|
||||
const load = useCallback(() => api<Detail>(`/api/admin/deployments/${id}`).then(setD).catch(e => setMsg({ type: "err", text: errorText(e) })), [id]);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
@@ -107,6 +108,36 @@ export default function DeploymentPage() {
|
||||
</form>
|
||||
)}
|
||||
|
||||
{x.product === "events" && ["live", "waiting_for_proxy"].includes(x.status) && (
|
||||
<div className="card space-y-3">
|
||||
<h2 className="font-medium">Demo site</h2>
|
||||
{!x.isDemo ? (
|
||||
<form className="grid gap-3 md:grid-cols-[1fr_auto] md:items-end" onSubmit={e => { e.preventDefault(); act(`/api/admin/deployments/${x.id}/demo`, { isDemo: true, confirm: demo.markConfirm }, "Marked as a demo site."); }}>
|
||||
<p className="text-sm text-slate-500 md:col-span-2">A demo site's data can be replaced with demo data from here. Only mark sites used for showing Cross Events, never a church's real site.</p>
|
||||
<div><label className="label" htmlFor="d-m">Type {x.shortName}</label><input id="d-m" className="input" value={demo.markConfirm} onChange={e => setDemo({ ...demo, markConfirm: e.target.value })} /></div>
|
||||
<button className="btn-secondary" disabled={demo.markConfirm !== x.shortName}>Mark as a demo site</button>
|
||||
</form>
|
||||
) : (
|
||||
<>
|
||||
<form className="grid gap-3 md:grid-cols-3 md:items-end" onSubmit={e => { e.preventDefault(); if (window.confirm(`Replace ALL of ${x.shortName}'s data with the "${demo.profile}" demo? A backup is taken first; one admin account is kept.`)) act(`/api/admin/deployments/${x.id}/seed-demo`, { profile: demo.profile, confirm: demo.confirm }, "Queued: the agent loads the demo data on its next poll (see Jobs below). You get an email when it's done."); }}>
|
||||
<p className="text-sm text-slate-500 md:col-span-3">Replaces everything (events, people, payments) with a demo set, keeping the site settings and {x.adminEmail || "the site's first admin"}. Demo logins use the password Demo@1234.</p>
|
||||
<div><label className="label" htmlFor="d-p">Demo</label>
|
||||
<select id="d-p" className="input" value={demo.profile} onChange={e => setDemo({ ...demo, profile: e.target.value })}>
|
||||
<option value="small">Small church: the essentials</option>
|
||||
<option value="events">Events and conferences</option>
|
||||
<option value="ministry">Weekly ministry: courses, kids, volunteers</option>
|
||||
<option value="multicampus">Three campuses</option>
|
||||
</select>
|
||||
</div>
|
||||
<div><label className="label" htmlFor="d-c">Type {x.shortName}</label><input id="d-c" className="input" value={demo.confirm} onChange={e => setDemo({ ...demo, confirm: e.target.value })} /></div>
|
||||
<button className="btn-danger" disabled={demo.confirm !== x.shortName}>Load demo data</button>
|
||||
</form>
|
||||
<button type="button" className="text-sm text-slate-500 underline" onClick={() => act(`/api/admin/deployments/${x.id}/demo`, { isDemo: false }, "No longer a demo site.")}>It isn't a demo site any more</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="card overflow-x-auto">
|
||||
<h2 className="font-medium">Jobs</h2>
|
||||
<table className="mt-3 w-full text-sm">
|
||||
|
||||
@@ -137,7 +137,7 @@ export default function InstallsPage() {
|
||||
<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></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>
|
||||
<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>
|
||||
))}</tbody>
|
||||
</table>
|
||||
{!list.length && <p className="mt-2 text-sm text-slate-500">No installs on servers yet.</p>}
|
||||
|
||||
@@ -21,7 +21,7 @@ export type ServerSummary = {
|
||||
|
||||
export type Deployment = {
|
||||
id: string; serverId: string; customerId: string; installId: string | null; product: string; shortName: string; domain: string;
|
||||
webPort: number; apiPort: number; status: string; version: string | null; adminName: string | null; adminEmail: string | null;
|
||||
webPort: number; apiPort: number; status: string; version: string | null; adminName: string | null; adminEmail: string | null; isDemo?: boolean;
|
||||
liveAt: string | null; createdAt: string;
|
||||
server?: { id: string; name: string }; customer?: { id: string; name: string };
|
||||
install?: { id: string; version: string | null; lastHeartbeatAt: string | null; url: string } | null;
|
||||
|
||||
Reference in New Issue
Block a user