Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all traces of legacy custom layouts #15033

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/backend-core/src/events/backfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
AutomationCreatedEvent,
AutomationStepCreatedEvent,
DatasourceCreatedEvent,
LayoutCreatedEvent,
QueryCreatedEvent,
RoleCreatedEvent,
ScreenCreatedEvent,
Expand Down Expand Up @@ -105,9 +104,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
},
Expand Down
1 change: 0 additions & 1 deletion packages/backend-core/src/events/publishers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 0 additions & 26 deletions packages/backend-core/src/events/publishers/layout.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/backend-core/src/events/publishers/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down
3 changes: 0 additions & 3 deletions packages/backend-core/tests/core/utilities/mocks/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions packages/builder/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ export const UNEDITABLE_USER_FIELDS = [
"lastName",
]

export const LAYOUT_NAMES = {
MASTER: {
PRIVATE: "layout_private_master",
PUBLIC: "layout_private_master",
},
}

// one or more word characters and whitespace
export const APP_NAME_REGEX = /^[\w\s]+$/
// zero or more non-whitespace characters
Expand Down
9 changes: 2 additions & 7 deletions packages/builder/src/dataBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
componentStore,
screenStore,
appStore,
layoutStore,
queries as queriesStores,
tables as tablesStore,
roles as rolesStore,
Expand Down Expand Up @@ -1240,13 +1239,9 @@ export const getAllStateVariables = () => {
return Array.from(bindingSet)
}

// Get all component containing assets
export const getAllAssets = () => {
// Get all component containing assets
let allAssets = []
allAssets = allAssets.concat(get(layoutStore).layouts || [])
allAssets = allAssets.concat(get(screenStore).screens || [])

return allAssets
return get(screenStore).screens || []
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Helpers,
Input,
Checkbox,
Banner,
Select,
notifications,
} from "@budibase/bbui"
Expand Down Expand Up @@ -72,7 +71,6 @@
props: {
options: ["Extra small", "Small", "Medium", "Large", "Max"],
placeholder: "Default",
disabled: !!screen.layoutId,
},
},
{
Expand Down Expand Up @@ -149,22 +147,8 @@
notifications.error("Error saving screen settings")
}
}

const removeCustomLayout = async () => {
return screenStore.removeCustomLayout(get(selectedScreen))
}
</script>

{#if $selectedScreen.layoutId}
<Banner
type="warning"
extraButtonText="Detach custom layout"
extraButtonAction={removeCustomLayout}
showCloseButton={false}
>
This screen uses a custom layout, which is deprecated
</Banner>
{/if}
{#each screenSettings as setting (setting.key)}
<PropertyControl
control={setting.control}
Expand Down
4 changes: 0 additions & 4 deletions packages/builder/src/stores/builder/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { layoutStore } from "./layouts.js"
import { appStore } from "./app.js"
import { componentStore, selectedComponent } from "./components"
import { navigationStore } from "./navigation.js"
Expand Down Expand Up @@ -34,7 +33,6 @@ import { appPublished } from "./published"

export {
componentTreeNodesStore,
layoutStore,
appStore,
componentStore,
navigationStore,
Expand Down Expand Up @@ -74,7 +72,6 @@ export const reset = () => {
builderStore.reset()
screenStore.reset()
componentStore.reset()
layoutStore.reset()
navigationStore.reset()
rowActions.reset()
}
Expand Down Expand Up @@ -109,7 +106,6 @@ export const initialise = async pkg => {
themeStore.syncAppTheme(application)
snippets.syncMetadata(application)
screenStore.syncAppScreens(pkg)
layoutStore.syncAppLayouts(pkg)
resetBuilderHistory()
await refreshBuilderData()
}
77 changes: 0 additions & 77 deletions packages/builder/src/stores/builder/layouts.js

This file was deleted.

14 changes: 0 additions & 14 deletions packages/builder/src/stores/builder/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Helpers } from "@budibase/bbui"
import { RoleUtils, Utils } from "@budibase/frontend-core"
import { findAllMatchingComponents } from "helpers/components"
import {
layoutStore,
appStore,
componentStore,
navigationStore,
Expand Down Expand Up @@ -35,7 +34,6 @@ export class ScreenStore extends BudiStore {
this.syncScreenData = this.syncScreenData.bind(this)
this.updateSetting = this.updateSetting.bind(this)
this.sequentialScreenPatch = this.sequentialScreenPatch.bind(this)
this.removeCustomLayout = this.removeCustomLayout.bind(this)

this.history = createHistoryStore({
getDoc: id => get(this.store).screens?.find(screen => screen._id === id),
Expand Down Expand Up @@ -436,18 +434,6 @@ export class ScreenStore extends BudiStore {
}
}

// Move to layouts store
async removeCustomLayout(screen) {
// Pull relevant settings from old layout, if required
const layout = get(layoutStore).layouts.find(x => x._id === screen.layoutId)
const patchFn = screen => {
screen.layoutId = null
screen.showNavigation = layout?.props.navigation !== "None"
screen.width = layout?.props.width || "Large"
}
await this.patch(patchFn, screen._id)
}

/**
* Parse the entire screen component tree and ensure settings are valid
* and up-to-date. Ensures stability after a product update.
Expand Down
5 changes: 0 additions & 5 deletions packages/builder/src/stores/builder/tests/screens.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const COMP_PREFIX = "@budibase/standard-components"
vi.mock("stores/builder", async () => {
const mockAppStore = writable()
const mockComponentStore = writable()
const mockLayoutStore = writable()

const componentStore = {
getDefinition: vi.fn(),
Expand All @@ -42,10 +41,6 @@ vi.mock("stores/builder", async () => {
componentStore,
appStore,
navigationStore,
layoutStore: {
update: mockLayoutStore.update,
subscribe: mockComponentStore.subscribe,
},
}
})

Expand Down
23 changes: 2 additions & 21 deletions packages/client/src/components/ClientApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ErrorSVG from "@budibase/frontend-core/assets/error.svg"
import { Constants, CookieUtils } from "@budibase/frontend-core"
import { getThemeClassNames } from "@budibase/shared-core"
import Component from "./Component.svelte"
import Router from "./Router.svelte"
import SDK from "sdk"
import {
featuresStore,
Expand Down Expand Up @@ -206,20 +206,6 @@
</Body>
</Layout>
</div>
{:else if !$screenStore.activeLayout}
<div class="error">
<Layout justifyItems="center" gap="S">
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html ErrorSVG}
<Heading size="L">
Something went wrong rendering your app
</Heading>
<Body size="S">
Get in touch with support if this issue
persists
</Body>
</Layout>
</div>
{:else if embedNoScreens}
<div class="error">
<Layout justifyItems="center" gap="S">
Expand All @@ -232,12 +218,7 @@
</div>
{:else}
<CustomThemeWrapper>
{#key $screenStore.activeLayout._id}
<Component
isLayout
instance={$screenStore.activeLayout.props}
/>
{/key}
<Router />

<!-- Layers on top of app -->
<NotificationDisplay />
Expand Down
2 changes: 0 additions & 2 deletions packages/client/src/components/Component.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

export let instance = {}
export let parent = null
export let isLayout = false
export let isRoot = false
export let isBlock = false

Expand Down Expand Up @@ -158,7 +157,6 @@
$: draggable =
!inDragPath &&
interactive &&
!isLayout &&
!isRoot &&
!isBlock &&
definition?.draggable !== false
Expand Down
Loading
Loading