diff --git a/packages/bbui/src/Form/Core/PickerDropdown.svelte b/packages/bbui/src/Form/Core/PickerDropdown.svelte
index 5682a91218..fbe43717ba 100644
--- a/packages/bbui/src/Form/Core/PickerDropdown.svelte
+++ b/packages/bbui/src/Form/Core/PickerDropdown.svelte
@@ -233,7 +233,10 @@
{:else if getPrimaryOptionColour(option, idx)}
-
+
{/if}
{:else if secondaryFieldColour}
-
+
{/if}
@@ -319,6 +323,7 @@
{#if getSecondaryOptionColour(option, idx)}
@@ -351,6 +356,13 @@
min-width: 0;
width: 100%;
}
+ .spectrum-InputGroup :global(.spectrum-Search-input) {
+ border: none;
+ border-bottom: 1px solid var(--spectrum-global-color-gray-300);
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
.override-borders {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte
index 26409ef695..21259c4d84 100644
--- a/packages/builder/src/pages/builder/portal/_layout.svelte
+++ b/packages/builder/src/pages/builder/portal/_layout.svelte
@@ -72,7 +72,7 @@
href: "/builder/portal/manage/groups",
}
- menu.splice(1, 0, item)
+ menu.splice(2, 0, item)
}
if (!$adminStore.cloud) {
diff --git a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte
index 2bcfd85cb6..17c16c639b 100644
--- a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte
+++ b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte
@@ -18,23 +18,44 @@
import { users, apps, groups } from "stores/portal"
import { onMount } from "svelte"
import { RoleUtils } from "@budibase/frontend-core"
+ import { roles } from "stores/backend"
export let groupId
+
let popoverAnchor
let popover
let searchTerm = ""
let selectedUsers = []
- let prevSearch = undefined,
- search = undefined
+ let prevSearch = undefined
let pageInfo = createPaginationStore()
+ let loaded = false
$: page = $pageInfo.page
- $: fetchUsers(page, search)
+ $: fetchUsers(page, searchTerm)
$: group = $groups.find(x => x._id === groupId)
async function addAll() {
- group.users = selectedUsers
+ selectedUsers = [...selectedUsers, ...filtered.map(u => u._id)]
+
+ let reducedUserObjects = filtered.map(u => {
+ return {
+ _id: u._id,
+ email: u.email,
+ }
+ })
+ group.users = [...reducedUserObjects, ...group.users]
+
await groups.actions.save(group)
+
+ $users.data.forEach(async user => {
+ let userToEdit = await users.get(user._id)
+ let userGroups = userToEdit.userGroups || []
+ userGroups.push(groupId)
+ await users.save({
+ ...userToEdit,
+ userGroups,
+ })
+ })
}
async function selectUser(id) {
@@ -97,106 +118,119 @@
prevSearch = search
try {
pageInfo.loading()
- await users.search({ page, search })
+ await users.search({ page, email: search })
pageInfo.fetched($users.hasNextPage, $users.nextPage)
} catch (error) {
notifications.error("Error getting user list")
}
}
+ const getRoleLabel = appId => {
+ const roleId = group?.roles?.[`app_${appId}`]
+ const role = $roles.find(x => x._id === roleId)
+ return role?.name || "Custom role"
+ }
+
onMount(async () => {
try {
- await groups.actions.init()
- await apps.load()
+ await Promise.all([groups.actions.init(), apps.load(), roles.fetch()])
+ loaded = true
} catch (error) {
- notifications.error("Error fetching User Group data")
+ notifications.error("Error fetching user group data")
}
})
-
-
-
$goto("../groups")} size="S" icon="ArrowLeft">
- Back
-
-
-