From e9297ee1c710948a10d8f4b297a9d10f2d017653 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 2 Dec 2020 14:49:43 +0000 Subject: [PATCH] E2E working --- .../AppPreview/iframeTemplate.html | 14 ++----------- .../ComponentTree.svelte | 7 ++++++- .../ScreenDropdownMenu.svelte | 16 +++++++++++++- .../userInterface/FrontendNavigatePane.svelte | 9 +++----- .../components/userInterface/Layout.svelte | 21 ++++++++----------- 5 files changed, 35 insertions(+), 32 deletions(-) diff --git a/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.html b/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.html index 4478011a73..247f2f4284 100644 --- a/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.html +++ b/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.html @@ -21,21 +21,11 @@ // Extract data from message const { selectedComponentId, layout, screen } = JSON.parse(event.data) - - // Update selected component style - if (selectedComponentStyle) { - document.head.removeChild(selectedComponentStyle) - } - selectedComponentStyle = document.createElement("style"); - document.head.appendChild(selectedComponentStyle) - var selectedCss = '[data-bb-id="' + selectedComponentId + '"]' + '{border:2px solid #0055ff !important;}' - selectedComponentStyle.appendChild(document.createTextNode(selectedCss)) // Set some flags so the app knows we're in the builder - window["##BUDIBASE_IN_BUILDER##"] = true; - window["##BUDIBASE_PREVIEW_LAYOUT##"] = layout; - window["##BUDIBASE_PREVIEW_SCREEN##"] = screen; window["##BUDIBASE_IN_BUILDER##"] = true + window["##BUDIBASE_PREVIEW_LAYOUT##"] = layout + window["##BUDIBASE_PREVIEW_SCREEN##"] = screen window["##BUDIBASE_SELECTED_COMPONENT_ID##"] = selectedComponentId window["##BUDIBASE_PREVIEW_ID##"] = Math.random() diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte index d36cdacc11..a9771f9f95 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte @@ -6,6 +6,7 @@ import ComponentDropdownMenu from "../ComponentDropdownMenu.svelte" import NavItem from "components/common/NavItem.svelte" + export let layout export let components = [] export let currentComponent export let onSelect = () => {} @@ -23,7 +24,11 @@ const path = store.actions.components.findRoute(component) // Go to correct URL - $goto(`./screens/:screen/${path}`) + if (layout) { + $goto(`./layouts/:layout/${path}`) + } else { + $goto(`./screens/:screen/${path}`) + } } const dragstart = component => e => { diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte index f716b94351..a7b20f2f59 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte @@ -3,12 +3,13 @@ import { store, allScreens } from "builderStore" import { notifier } from "builderStore/store/notifications" import ConfirmDialog from "components/common/ConfirmDialog.svelte" - import { DropdownMenu } from "@budibase/bbui" + import { DropdownMenu, Modal, ModalContent } from "@budibase/bbui" import { DropdownContainer, DropdownItem } from "components/common/Dropdowns" export let screen let confirmDeleteDialog + let editLayoutDialog let dropdown let anchor @@ -29,6 +30,10 @@ icon="ri-delete-bin-line" title="Delete" on:click={() => confirmDeleteDialog.show()} /> + editLayoutDialog.show()} /> @@ -39,6 +44,15 @@ okText="Delete Screen" onOk={deleteScreen} /> + + + Choose a layout for your screen + + +