From 0ae161173ada4c47952a7e31a9d5eddb31d4c788 Mon Sep 17 00:00:00 2001 From: Mitchell R Date: Thu, 21 May 2026 12:04:11 +0200 Subject: [PATCH] feat(admin): clone layout with cells, labels, and display attachments Adds Clone Layout button to layout edit page. Duplicates the layout with all cells, label bindings, and display attachments. Name gets "(copy)" suffix with dedup. --- server/src/plugins/service-admin-http/routes-admin.ts | 7 +++++++ server/src/web-templates/admin-pages.tsx | 3 +++ 2 files changed, 10 insertions(+) diff --git a/server/src/plugins/service-admin-http/routes-admin.ts b/server/src/plugins/service-admin-http/routes-admin.ts index a8d6320..bd588a3 100644 --- a/server/src/plugins/service-admin-http/routes-admin.ts +++ b/server/src/plugins/service-admin-http/routes-admin.ts @@ -1093,6 +1093,13 @@ export function registerAdminRoutes(app: H3, deps: AdminDeps): void { return new Response(null, { status: 302, headers: { location: `/admin/layouts/${layoutId}` } }); }); + app.post("/admin/layouts/:id/clone", (event) => { + const id = Number(getRouterParam(event, "id")); + const clone = deps.repo.cloneLayout(id); + notifyKiosks(); + return new Response(null, { status: 302, headers: { location: `/admin/layouts/${clone.id}` } }); + }); + app.post("/admin/layouts/:id/delete", (event) => { const id = Number(getRouterParam(event, "id")); deps.repo.deleteLayout(id); diff --git a/server/src/web-templates/admin-pages.tsx b/server/src/web-templates/admin-pages.tsx index 6cbca76..654dbf8 100644 --- a/server/src/web-templates/admin-pages.tsx +++ b/server/src/web-templates/admin-pages.tsx @@ -2422,6 +2422,9 @@ export function LayoutEditPage(props: LayoutEditPageProps) { Back +
+ +
Grid: {String(gridCols)}x{String(gridRows)}, {String(cells.length)} cell{cells.length !== 1 ? "s" : ""}