diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index ad1b5ec7f8..001bf43b50 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -104,7 +104,7 @@ userInfoModal.show()}> - Update user information + My profile - import { PickerDropdown } from "@budibase/bbui" - import { groups } from "stores/portal" - import { createEventDispatcher } from "svelte" - - const dispatch = createEventDispatcher() - - let filter = null - $: filteredGroups = !filter - ? $groups - : $groups.filter(group => - group.name?.toLowerCase().includes(filter.toLowerCase()) - ) - - $: optionSections = { - groups: { - data: filteredGroups, - getLabel: group => group.name, - getValue: group => group._id, - getIcon: group => group.icon, - getColour: group => group.color, - }, - } - - $: onChange = selected => { - const { detail } = selected - if (!detail || Object.keys(detail).length == 0) { - dispatch("change", null) - return - } - - const groupSelected = $groups.find(x => x._id === detail) - const appRoleIds = groupSelected?.roles - ? Object.keys(groupSelected?.roles) - : [] - dispatch("change", appRoleIds) - } - - - { - filter = null - }} -/> diff --git a/packages/builder/src/pages/builder/portal/overview/[appId]/access/_components/AssignmentModal.svelte b/packages/builder/src/pages/builder/portal/overview/[appId]/access/_components/AssignmentModal.svelte index 0cb8085bb0..37143e25c1 100644 --- a/packages/builder/src/pages/builder/portal/overview/[appId]/access/_components/AssignmentModal.svelte +++ b/packages/builder/src/pages/builder/portal/overview/[appId]/access/_components/AssignmentModal.svelte @@ -14,6 +14,8 @@ export let app export let appUsers = [] + export let showUsers = false + export let showGroups = false const dispatch = createEventDispatcher() const usersFetch = fetchData({ @@ -41,7 +43,8 @@ $: availableGroups = getAvailableGroups($groups, app.appId, search, data) $: valid = data?.length && !data?.some(x => !x.id?.length || !x.role?.length) $: optionSections = { - ...($licensing.groupsEnabled && + ...(showGroups && + $licensing.groupsEnabled && availableGroups.length && { ["User groups"]: { data: availableGroups, @@ -51,13 +54,15 @@ getColour: group => group.color, }, }), - users: { - data: availableUsers, - getLabel: user => user.email, - getValue: user => user._id, - getIcon: user => user.icon, - getColour: user => user.color, - }, + ...(showUsers && { + users: { + data: availableUsers, + getLabel: user => user.email, + getValue: user => user._id, + getIcon: user => user.icon, + getColour: user => user.color, + }, + }), } const addData = async appData => { @@ -185,7 +190,7 @@ {/if}
- Add email + Add more
diff --git a/packages/builder/src/pages/builder/portal/overview/[appId]/access/index.svelte b/packages/builder/src/pages/builder/portal/overview/[appId]/access/index.svelte index c17efdb075..43eea4aaa6 100644 --- a/packages/builder/src/pages/builder/portal/overview/[appId]/access/index.svelte +++ b/packages/builder/src/pages/builder/portal/overview/[appId]/access/index.svelte @@ -36,7 +36,7 @@ }, role: { displayName: "Access", - width: "160px", + width: "150px", borderLeft: true, }, } @@ -50,6 +50,8 @@ let assignmentModal let appGroups let appUsers + let showAddUsers = false + let showAddGroups = false $: app = $overview.selectedApp $: devAppId = app.devId @@ -153,6 +155,18 @@ await usersFetch.refresh() } + const showUsersModal = () => { + showAddUsers = true + showAddGroups = false + assignmentModal.show() + } + + const showGroupsModal = () => { + showAddUsers = false + showAddGroups = true + assignmentModal.show() + } + setContext("roles", { updateRole, removeRole, @@ -178,7 +192,7 @@
Users - +
Groups - +
- +