From 4fd74c3a19d4bc2c7e457e458aff1a7df528f3ab Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 9 Sep 2024 17:04:02 +0100 Subject: [PATCH] Add new access selection UI for tables and views --- .../bbui/src/InlineAlert/InlineAlert.svelte | 1 + packages/bbui/src/List/ListItem.svelte | 9 +- .../buttons/ManageAccessButton.svelte | 195 +++++++++++++++++- .../backend/DataTable/modals/EditRoles.svelte | 5 +- .../DataTable/modals/ManageAccessModal.svelte | 127 ------------ .../_components/Component/InfoDisplay.svelte | 35 ++-- packages/builder/src/stores/builder/roles.js | 19 +- 7 files changed, 239 insertions(+), 152 deletions(-) delete mode 100644 packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte diff --git a/packages/bbui/src/InlineAlert/InlineAlert.svelte b/packages/bbui/src/InlineAlert/InlineAlert.svelte index 3b98936f62..edfa760eb8 100644 --- a/packages/bbui/src/InlineAlert/InlineAlert.svelte +++ b/packages/bbui/src/InlineAlert/InlineAlert.svelte @@ -8,6 +8,7 @@ export let onConfirm = undefined export let buttonText = "" export let cta = false + $: icon = selectIcon(type) // if newlines used, convert them to different elements $: split = message.split("\n") diff --git a/packages/bbui/src/List/ListItem.svelte b/packages/bbui/src/List/ListItem.svelte index 2b1f6b030f..abcdf2cc6e 100644 --- a/packages/bbui/src/List/ListItem.svelte +++ b/packages/bbui/src/List/ListItem.svelte @@ -8,6 +8,7 @@ export let url = null export let hoverable = false export let showArrow = false + export let selected = false
{#if icon} @@ -43,7 +45,7 @@ diff --git a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte index 6cec28de1d..e46a2aa3dc 100644 --- a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte @@ -17,7 +17,7 @@ let basePermissions = [] let selectedRole = BASE_ROLE let errors = [] - let builtInRoles = ["Admin", "Power", "Basic", "Public"] + let builtInRoles = ["App admin", "App power user", "App user", "Public user"] let validRegex = /^[a-zA-Z0-9_]*$/ // Don't allow editing of public role $: editableRoles = $roles.filter(role => role._id !== "PUBLIC") @@ -108,6 +108,9 @@ } const getRoleNameError = name => { + if (builtInRoles.includes(name)) { + return null + } const hasUniqueRoleName = !otherRoles ?.map(role => role.name) ?.includes(name) diff --git a/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte deleted file mode 100644 index bc5c437c57..0000000000 --- a/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte +++ /dev/null @@ -1,127 +0,0 @@ - - -Specify the minimum access level role for this data. -
- - - {#each Object.keys(computedPermissions) as level} - -