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
+
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenWizard.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenWizard.svelte
index 23ede1cd11..e08cff68bd 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenWizard.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenWizard.svelte
@@ -2,13 +2,15 @@
import ScreenDetailsModal from "./ScreenDetailsModal.svelte"
import NewScreenModal from "./NewScreenModal.svelte"
import DatasourceModal from "./DatasourceModal.svelte"
+ import ScreenRoleModal from "./ScreenRoleModal.svelte"
import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl"
- import { Modal, ModalContent, Select, notifications } from "@budibase/bbui"
- import { store, selectedAccessRole } from "builderStore"
+ import { Modal, notifications } from "@budibase/bbui"
+ import { store } from "builderStore"
import analytics, { Events } from "analytics"
import { get } from "svelte/store"
import getTemplates from "builderStore/store/screenTemplates"
- import { tables, roles } from "stores/backend"
+ import { tables } from "stores/backend"
+ import { Roles } from "constants/backend"
let pendingScreen
@@ -19,10 +21,9 @@
let screenAccessRoleModal
// Cache variables for workflow
- let screenAccessRole = $selectedAccessRole + ""
+ let screenAccessRole = Roles.BASIC
let selectedTemplates = null
let blankScreenUrl = null
-
let screenMode = null
// External handler to show the screen wizard
@@ -30,10 +31,9 @@
selectedTemplates = null
blankScreenUrl = null
screenMode = null
-
- newScreenModal.show()
- // Reset state when showing modal again
pendingScreen = null
+ screenAccessRole = Roles.BASIC
+ newScreenModal.show()
}
// Creates an array of screens, checking and sanitising their URLs
@@ -58,9 +58,11 @@
screen.routing.route = sanitizeUrl(screen.routing.route)
// Use the currently selected role
+ if (!screenAccessRole) {
+ console.log("NO ROLE")
+ return
+ }
screen.routing.roleId = screenAccessRole
- ? screenAccessRole
- : get(selectedAccessRole) || "BASIC"
// Create the screen
await store.actions.screens.save(screen)
@@ -90,7 +92,7 @@
// Checks if any screens exist in the store with the given route and
// currently selected role
const hasExistingUrl = url => {
- const roleId = get(selectedAccessRole) || "BASIC"
+ const roleId = screenAccessRole
const screens = get(store).screens.filter(s => s.routing.roleId === roleId)
return !!screens.find(s => s.routing?.route === url)
}
@@ -115,7 +117,7 @@
const confirmScreenSelection = async mode => {
screenMode = mode
- if (mode == "autoCreate") {
+ if (mode === "autoCreate") {
datasourceModal.show()
} else {
let templates = getTemplates($store, $tables.list)
@@ -198,28 +200,12 @@
-
- Select which level of access you want your screens to have
-
+ bind:screenAccessRole
+ screenUrl={blankScreenUrl}
+ />