diff --git a/server/src/plugins/service-admin-http/routes-ablesign.ts b/server/src/plugins/service-admin-http/routes-ablesign.ts index 1733e89..af07d70 100644 --- a/server/src/plugins/service-admin-http/routes-ablesign.ts +++ b/server/src/plugins/service-admin-http/routes-ablesign.ts @@ -217,7 +217,7 @@ export function registerAbleSignRoutes(app: H3, deps: AdminDeps): void { app.post("/admin/ablesign/:id/delete", async (event) => { const id = getRouterParam(event, "id") ?? ""; await deps.repo.deleteAbleSignAccount(id); - return new Response(null, { status: 302, headers: { location: "/admin/ablesign" } }); + return new Response(null, { status: 302, headers: { location: "/admin/settings" } }); }); app.post("/admin/ablesign/screens/:sid/delete", async (event) => { diff --git a/server/src/plugins/service-admin-http/routes-admin.ts b/server/src/plugins/service-admin-http/routes-admin.ts index dd272d1..c9a1dc1 100644 --- a/server/src/plugins/service-admin-http/routes-admin.ts +++ b/server/src/plugins/service-admin-http/routes-admin.ts @@ -34,6 +34,7 @@ import { renderKioskLabels, renderDisplayLayouts, renderDefaultLayoutSelect, + SettingsPage, } from "../../web-templates/admin-pages.js"; import { discover as onvifDiscover, getEventProperties as onvifGetEventProperties } from "../../shared/onvif.js"; import { generateBundle } from "../../shared/bundle.js"; @@ -2219,6 +2220,14 @@ export function registerAdminRoutes(app: H3, deps: AdminDeps): void { return new Response(null, { status: 302, headers: { location: `/admin/kiosks/${id}` } }); }); + // ---- Settings page ---------------------------------------------------------- + + app.get("/admin/settings", async () => { + const cloudAccounts = await deps.repo.listCloudAccounts(); + const ablesignAccounts = await deps.repo.listAbleSignAccounts(); + return htmlPage(SettingsPage({ cloudAccounts, ablesignAccounts })); + }); + // ---- Tenant switcher fragment (htmx) ---------------------------------------- app.get("/admin/_tenant_switcher", async (event) => { const tenants = await deps.repo.listTenants(); diff --git a/server/src/web-templates/admin-pages.tsx b/server/src/web-templates/admin-pages.tsx index 80d431c..2dbe230 100644 --- a/server/src/web-templates/admin-pages.tsx +++ b/server/src/web-templates/admin-pages.tsx @@ -4380,6 +4380,73 @@ export function TenantEditPage(props: TenantEditPageProps) { ); } +// ---- Settings Page ---------------------------------------------------------- + +interface SettingsPageProps { + cloudAccounts: any[]; + ablesignAccounts: any[]; + error?: string; +} + +export function SettingsPage(props: SettingsPageProps) { + return ( + +

Settings

+ + {props.error ?
{props.error}
: ""} + +
+

AbleSign Account

+ {props.ablesignAccounts.length > 0 ? ( +
+ + + + {props.ablesignAccounts.map((a: any) => ( + + + + + + + ))} + +
NameScreensLast SyncActions
{a.name}{String(a.screen_count ?? 0)}{a.last_sync_at ? formatTime(a.last_sync_at) : "Never"} +
+ +
+
+
+ ) : ( +
+ + + + +
+ )} +
+ +
+

Cloud Camera Accounts

+

+ {"Manage cloud camera integrations at "} + Cloud Cams. +

+
+
+ ); +} + // ---- AbleSign Pages --------------------------------------------------------- interface AbleSignPageProps { diff --git a/server/src/web-templates/layout.tsx b/server/src/web-templates/layout.tsx index 1093b05..b522524 100644 --- a/server/src/web-templates/layout.tsx +++ b/server/src/web-templates/layout.tsx @@ -71,18 +71,17 @@ function Sidebar(props: { activeNav?: string }) { - -
+