From 914a94b6953c652193a251b7393fc7115a91a77b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 11 May 2022 08:47:24 +0100 Subject: [PATCH] Remove concept of selected access role and refactor logic around assigning roles to new screens --- packages/builder/src/builderStore/index.js | 2 - .../src/builderStore/store/frontend.js | 12 +--- .../_old/ComponentNavigationTree.svelte | 2 +- .../settings/controls/RoleSelect.svelte | 1 + .../_components/ScreenDetailsModal.svelte | 27 ++++---- .../_components/ScreenDropdownMenu.svelte | 2 +- .../_components/ScreenRoleModal.svelte | 66 +++++++++++++++++++ .../screens/_components/ScreenWizard.svelte | 50 +++++--------- 8 files changed, 101 insertions(+), 61 deletions(-) diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 3eb5a89a85..842b193a40 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -59,7 +59,5 @@ export const mainLayout = derived(store, $store => { ) }) -export const selectedAccessRole = writable("BASIC") - // For compatibility export const currentAsset = selectedScreen diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index ff6385c1f4..78e75e9b3f 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -1,12 +1,6 @@ import { get, writable } from "svelte/store" import { cloneDeep } from "lodash/fp" -import { - currentAsset, - mainLayout, - selectedComponent, - selectedAccessRole, - store, -} from "builderStore" +import { currentAsset, mainLayout, selectedComponent } from "builderStore" import { datasources, integrations, @@ -197,10 +191,6 @@ export const getFrontendStore = () => { screens.find(screen => screen._id === screenId) || screens[0] if (!screen) return state - // Update role to the screen's role setting so that it will always - // be visible - selectedAccessRole.set(screen.routing.roleId) - state.currentFrontEndType = FrontendTypes.SCREEN state.selectedScreenId = screen._id state.currentView = "detail" diff --git a/packages/builder/src/components/design/_old/ComponentNavigationTree.svelte b/packages/builder/src/components/design/_old/ComponentNavigationTree.svelte index a2032441c3..ee00e9ba98 100644 --- a/packages/builder/src/components/design/_old/ComponentNavigationTree.svelte +++ b/packages/builder/src/components/design/_old/ComponentNavigationTree.svelte @@ -1,5 +1,5 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte index 90b2649deb..d99b72beef 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte @@ -84,8 +84,8 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenRoleModal.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenRoleModal.svelte index e69de29bb2..adfd6c5edb 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenRoleModal.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenRoleModal.svelte @@ -0,0 +1,66 @@ + + + + Select which level of access you want your screens to have + { - analytics.captureEvent(Events.SCREEN.CREATE_ROLE_UPDATED, { - screenAccessRole, - }) - }} - label="Access" - getOptionLabel={role => role.name} - getOptionValue={role => role._id} - getOptionColor={role => role.color} - options={$roles} - /> - + bind:screenAccessRole + screenUrl={blankScreenUrl} + />