From 3e9a73e5770638e79fbc3055e999707d00f7b60e Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 19 Nov 2024 14:02:13 +0000 Subject: [PATCH 1/4] Remove all traces of legacy custom layouts --- packages/backend-core/src/events/backfill.ts | 3 - .../src/events/publishers/index.ts | 1 - .../src/events/publishers/layout.ts | 26 --- .../src/events/publishers/screen.ts | 2 - .../tests/core/utilities/mocks/events.ts | 3 - .../settings/controls/LayoutSelect.svelte | 14 -- packages/builder/src/dataBinding.js | 9 +- .../_components/Screen/GeneralPanel.svelte | 15 -- packages/builder/src/stores/builder/index.js | 4 - .../builder/src/stores/builder/layouts.js | 77 --------- .../builder/src/stores/builder/screens.js | 14 -- .../src/stores/builder/tests/screens.test.js | 5 - .../client/src/components/ClientApp.svelte | 23 +-- .../client/src/components/Component.svelte | 2 - .../src/components/{app => }/Layout.svelte | 6 +- packages/client/src/components/Router.svelte | 83 +++++++--- packages/client/src/components/app/index.js | 1 - packages/client/src/index.js | 1 - packages/client/src/stores/components.js | 9 -- packages/client/src/stores/screens.js | 74 +-------- packages/frontend-core/src/api/index.js | 2 - packages/frontend-core/src/api/layouts.js | 23 --- .../server/src/api/controllers/application.ts | 59 ------- packages/server/src/api/controllers/layout.ts | 55 ------- .../controllers/static/templates/preview.hbs | 1 - packages/server/src/api/routes/index.ts | 2 - packages/server/src/api/routes/layout.ts | 16 -- .../src/api/routes/tests/layout.spec.js | 59 ------- packages/server/src/constants/layouts.ts | 149 ------------------ packages/server/src/constants/screens.ts | 2 - .../src/migrations/functions/backfill/app.ts | 9 -- .../functions/backfill/app/layouts.ts | 29 ---- .../server/src/migrations/tests/index.spec.ts | 1 - .../server/src/tests/utilities/controllers.ts | 1 - .../server/src/tests/utilities/structures.ts | 6 - packages/types/src/api/web/index.ts | 1 - packages/types/src/api/web/layout.ts | 5 - packages/types/src/documents/app/index.ts | 1 - packages/types/src/documents/app/layout.ts | 11 -- packages/types/src/sdk/events/backfill.ts | 1 - packages/types/src/sdk/events/event.ts | 4 - packages/types/src/sdk/events/index.ts | 1 - packages/types/src/sdk/events/layout.ts | 9 -- 43 files changed, 70 insertions(+), 749 deletions(-) delete mode 100644 packages/backend-core/src/events/publishers/layout.ts delete mode 100644 packages/builder/src/components/design/settings/controls/LayoutSelect.svelte delete mode 100644 packages/builder/src/stores/builder/layouts.js rename packages/client/src/components/{app => }/Layout.svelte (98%) delete mode 100644 packages/frontend-core/src/api/layouts.js delete mode 100644 packages/server/src/api/controllers/layout.ts delete mode 100644 packages/server/src/api/routes/layout.ts delete mode 100644 packages/server/src/api/routes/tests/layout.spec.js delete mode 100644 packages/server/src/constants/layouts.ts delete mode 100644 packages/server/src/migrations/functions/backfill/app/layouts.ts delete mode 100644 packages/types/src/api/web/layout.ts delete mode 100644 packages/types/src/documents/app/layout.ts delete mode 100644 packages/types/src/sdk/events/layout.ts diff --git a/packages/backend-core/src/events/backfill.ts b/packages/backend-core/src/events/backfill.ts index c8025a8e4e8..d415e9e765e 100644 --- a/packages/backend-core/src/events/backfill.ts +++ b/packages/backend-core/src/events/backfill.ts @@ -105,9 +105,6 @@ const CUSTOM_PROPERTY_SUFFIX: any = { [Event.DATASOURCE_CREATED]: (properties: DatasourceCreatedEvent) => { return properties.datasourceId }, - [Event.LAYOUT_CREATED]: (properties: LayoutCreatedEvent) => { - return properties.layoutId - }, [Event.QUERY_CREATED]: (properties: QueryCreatedEvent) => { return properties.queryId }, diff --git a/packages/backend-core/src/events/publishers/index.ts b/packages/backend-core/src/events/publishers/index.ts index 9c92b80499e..52651454480 100644 --- a/packages/backend-core/src/events/publishers/index.ts +++ b/packages/backend-core/src/events/publishers/index.ts @@ -6,7 +6,6 @@ export { default as datasource } from "./datasource" export { default as email } from "./email" export { default as ai } from "./ai" export { default as license } from "./license" -export { default as layout } from "./layout" export { default as org } from "./org" export { default as query } from "./query" export { default as role } from "./role" diff --git a/packages/backend-core/src/events/publishers/layout.ts b/packages/backend-core/src/events/publishers/layout.ts deleted file mode 100644 index 6abb2260494..00000000000 --- a/packages/backend-core/src/events/publishers/layout.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { publishEvent } from "../events" -import { - Event, - Layout, - LayoutCreatedEvent, - LayoutDeletedEvent, -} from "@budibase/types" - -async function created(layout: Layout, timestamp?: string | number) { - const properties: LayoutCreatedEvent = { - layoutId: layout._id as string, - } - await publishEvent(Event.LAYOUT_CREATED, properties, timestamp) -} - -async function deleted(layoutId: string) { - const properties: LayoutDeletedEvent = { - layoutId, - } - await publishEvent(Event.LAYOUT_DELETED, properties) -} - -export default { - created, - deleted, -} diff --git a/packages/backend-core/src/events/publishers/screen.ts b/packages/backend-core/src/events/publishers/screen.ts index df486029e8e..21d2c79a13a 100644 --- a/packages/backend-core/src/events/publishers/screen.ts +++ b/packages/backend-core/src/events/publishers/screen.ts @@ -8,7 +8,6 @@ import { async function created(screen: Screen, timestamp?: string | number) { const properties: ScreenCreatedEvent = { - layoutId: screen.layoutId, screenId: screen._id as string, roleId: screen.routing.roleId, audited: { @@ -20,7 +19,6 @@ async function created(screen: Screen, timestamp?: string | number) { async function deleted(screen: Screen) { const properties: ScreenDeletedEvent = { - layoutId: screen.layoutId, screenId: screen._id as string, roleId: screen.routing.roleId, audited: { diff --git a/packages/backend-core/tests/core/utilities/mocks/events.ts b/packages/backend-core/tests/core/utilities/mocks/events.ts index 96f351de106..93d5de68e4b 100644 --- a/packages/backend-core/tests/core/utilities/mocks/events.ts +++ b/packages/backend-core/tests/core/utilities/mocks/events.ts @@ -47,9 +47,6 @@ beforeAll(async () => { jest.spyOn(events.email, "SMTPCreated") jest.spyOn(events.email, "SMTPUpdated") - jest.spyOn(events.layout, "created") - jest.spyOn(events.layout, "deleted") - jest.spyOn(events.org, "nameUpdated") jest.spyOn(events.org, "logoUpdated") jest.spyOn(events.org, "platformURLUpdated") diff --git a/packages/builder/src/components/design/settings/controls/LayoutSelect.svelte b/packages/builder/src/components/design/settings/controls/LayoutSelect.svelte deleted file mode 100644 index a7966eb6712..00000000000 --- a/packages/builder/src/components/design/settings/controls/LayoutSelect.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - -