From 4eaa95fc415692453e87073b2830ff64ecc9af81 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 May 2023 11:58:23 +0100 Subject: [PATCH 01/15] Type contexts --- .../src/api/controllers/global/users.ts | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/worker/src/api/controllers/global/users.ts b/packages/worker/src/api/controllers/global/users.ts index d9ebc87517..33335379c0 100644 --- a/packages/worker/src/api/controllers/global/users.ts +++ b/packages/worker/src/api/controllers/global/users.ts @@ -69,9 +69,11 @@ const bulkCreate = async (users: User[], groupIds: string[]) => { return await userSdk.bulkCreate(users, groupIds) } -export const bulkUpdate = async (ctx: any) => { +export const bulkUpdate = async ( + ctx: Ctx +) => { const currentUserId = ctx.user._id - const input = ctx.request.body as BulkUserRequest + const input = ctx.request.body let created, deleted try { if (input.create) { @@ -83,7 +85,7 @@ export const bulkUpdate = async (ctx: any) => { } catch (err: any) { ctx.throw(err.status || 400, err?.message || err) } - ctx.body = { created, deleted } as BulkUserResponse + ctx.body = { created, deleted } } const parseBooleanParam = (param: any) => { @@ -184,15 +186,15 @@ export const destroy = async (ctx: any) => { } } -export const getAppUsers = async (ctx: any) => { - const body = ctx.request.body as SearchUsersRequest +export const getAppUsers = async (ctx: Ctx) => { + const body = ctx.request.body const users = await userSdk.getUsersByAppAccess(body?.appId) ctx.body = { data: users } } -export const search = async (ctx: any) => { - const body = ctx.request.body as SearchUsersRequest +export const search = async (ctx: Ctx) => { + const body = ctx.request.body if (body.paginated === false) { await getAppUsers(ctx) @@ -238,8 +240,8 @@ export const tenantUserLookup = async (ctx: any) => { /* Encapsulate the app user onboarding flows here. */ -export const onboardUsers = async (ctx: any) => { - const request = ctx.request.body as InviteUsersRequest | BulkUserRequest +export const onboardUsers = async (ctx: Ctx) => { + const request = ctx.request.body const isBulkCreate = "create" in request const emailConfigured = await isEmailConfigured() @@ -255,7 +257,7 @@ export const onboardUsers = async (ctx: any) => { } else if (emailConfigured) { onboardingResponse = await inviteMultiple(ctx) } else if (!emailConfigured) { - const inviteRequest = ctx.request.body as InviteUsersRequest + const inviteRequest = ctx.request.body let createdPasswords: any = {} @@ -295,10 +297,10 @@ export const onboardUsers = async (ctx: any) => { } } -export const invite = async (ctx: any) => { - const request = ctx.request.body as InviteUserRequest +export const invite = async (ctx: Ctx) => { + const request = ctx.request.body - let multiRequest = [request] as InviteUsersRequest + let multiRequest = [request] const response = await userSdk.invite(multiRequest) // explicitly throw for single user invite @@ -318,8 +320,8 @@ export const invite = async (ctx: any) => { } } -export const inviteMultiple = async (ctx: any) => { - const request = ctx.request.body as InviteUsersRequest +export const inviteMultiple = async (ctx: Ctx) => { + const request = ctx.request.body ctx.body = await userSdk.invite(request) } @@ -424,7 +426,6 @@ export const inviteAccept = async ( if (err.code === ErrorCode.USAGE_LIMIT_EXCEEDED) { // explicitly re-throw limit exceeded errors ctx.throw(400, err) - return } console.warn("Error inviting user", err) ctx.throw(400, "Unable to create new user, invitation invalid.") From bbd06905189d6f00ab66d691bac5edbcd5f4e6c8 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 May 2023 12:35:58 +0100 Subject: [PATCH 02/15] Type response --- packages/builder/src/stores/portal/groups.js | 2 +- packages/types/src/documents/global/userGroup.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/stores/portal/groups.js b/packages/builder/src/stores/portal/groups.js index eda3961e2b..c7a54c7e6d 100644 --- a/packages/builder/src/stores/portal/groups.js +++ b/packages/builder/src/stores/portal/groups.js @@ -28,7 +28,7 @@ export function createGroupsStore() { // on the backend anyway if (get(licensing).groupsEnabled) { const groups = await API.getGroups() - store.set(groups) + store.set(groups.data) } }, diff --git a/packages/types/src/documents/global/userGroup.ts b/packages/types/src/documents/global/userGroup.ts index fedd8426f0..fa48c1636e 100644 --- a/packages/types/src/documents/global/userGroup.ts +++ b/packages/types/src/documents/global/userGroup.ts @@ -21,3 +21,8 @@ export interface GroupUser { export interface UserGroupRoles { [key: string]: string } + +export interface SearchGroupRequest {} +export interface SearchGroupResponse { + data: UserGroup[] +} From 10fcca92f65fbf61b395e928a445fa7de69d9223 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 May 2023 17:38:04 +0100 Subject: [PATCH 03/15] Paginate users on group views --- .../portal/users/groups/[groupId].svelte | 52 +++++++++---------- packages/frontend-core/src/api/groups.js | 14 +++++ .../frontend-core/src/fetch/GroupUserFetch.js | 50 ++++++++++++++++++ packages/frontend-core/src/fetch/fetchData.js | 2 + .../types/src/documents/global/userGroup.ts | 8 +++ packages/types/src/sdk/db.ts | 1 + 6 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 packages/frontend-core/src/fetch/GroupUserFetch.js diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index 1be019b83e..ccd945fc24 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -11,9 +11,11 @@ ActionMenu, MenuItem, Modal, + Pagination, } from "@budibase/bbui" + import { fetchData } from "@budibase/frontend-core" + import { API } from "api" import UserGroupPicker from "components/settings/UserGroupPicker.svelte" - import { createPaginationStore } from "helpers/pagination" import { users, apps, groups, auth, features } from "stores/portal" import { onMount, setContext } from "svelte" import { roles } from "stores/backend" @@ -28,6 +30,18 @@ export let groupId + const fetchUsers = fetchData({ + API, + datasource: { + type: "groupUser", + }, + options: { + query: { + groupId, + }, + }, + }) + $: userSchema = { email: { width: "1fr", @@ -70,17 +84,12 @@ let popoverAnchor let popover let searchTerm = "" - let prevSearch = undefined - let pageInfo = createPaginationStore() let loaded = false let editModal, deleteModal $: scimEnabled = $features.isScimEnabled $: readonly = !$auth.isAdmin || scimEnabled - $: page = $pageInfo.page - $: fetchUsers(page, searchTerm) $: group = $groups.find(x => x._id === groupId) - $: filtered = $users.data $: groupApps = $apps .filter(app => groups.actions @@ -97,25 +106,6 @@ } } - async function fetchUsers(page, search) { - if ($pageInfo.loading) { - return - } - // need to remove the page if they've started searching - if (search && !prevSearch) { - pageInfo.reset() - page = undefined - } - prevSearch = search - try { - pageInfo.loading() - await users.search({ page, email: search }) - pageInfo.fetched($users.hasNextPage, $users.nextPage) - } catch (error) { - notifications.error("Error getting user list") - } - } - async function deleteGroup() { try { await groups.actions.delete(group) @@ -211,7 +201,7 @@ This user group doesn't have any users
+ + diff --git a/packages/frontend-core/src/api/groups.js b/packages/frontend-core/src/api/groups.js index c27f11e0ea..cbc5bfd72a 100644 --- a/packages/frontend-core/src/api/groups.js +++ b/packages/frontend-core/src/api/groups.js @@ -52,6 +52,20 @@ export const buildGroupsEndpoints = API => { }) }, + /** + * Gets a group users by the group id + */ + getGroupUsers: async ({ id, bookmark }) => { + let url = `/api/global/groups/${id}/users?` + if (bookmark) { + url += `bookmark=${bookmark}` + } + + return await API.get({ + url, + }) + }, + /** * Adds users to a group * @param groupId The group to update diff --git a/packages/frontend-core/src/fetch/GroupUserFetch.js b/packages/frontend-core/src/fetch/GroupUserFetch.js new file mode 100644 index 0000000000..b0ca9a5388 --- /dev/null +++ b/packages/frontend-core/src/fetch/GroupUserFetch.js @@ -0,0 +1,50 @@ +import { get } from "svelte/store" +import DataFetch from "./DataFetch.js" +import { TableNames } from "../constants" + +export default class GroupUserFetch extends DataFetch { + constructor(opts) { + super({ + ...opts, + datasource: { + tableId: TableNames.USERS, + }, + }) + } + + determineFeatureFlags() { + return { + supportsSearch: true, + supportsSort: false, + supportsPagination: true, + } + } + + async getDefinition() { + return { + schema: {}, + } + } + + async getData() { + const { query, cursor } = get(this.store) + try { + const res = await this.API.getGroupUsers({ + id: query.groupId, + bookmark: cursor, + }) + + return { + rows: res?.users || [], + hasNextPage: res?.hasNextPage || false, + cursor: res?.bookmark || null, + } + } catch (error) { + return { + rows: [], + hasNextPage: false, + error, + } + } + } +} diff --git a/packages/frontend-core/src/fetch/fetchData.js b/packages/frontend-core/src/fetch/fetchData.js index 4974816496..c4968eabc0 100644 --- a/packages/frontend-core/src/fetch/fetchData.js +++ b/packages/frontend-core/src/fetch/fetchData.js @@ -6,6 +6,7 @@ import NestedProviderFetch from "./NestedProviderFetch.js" import FieldFetch from "./FieldFetch.js" import JSONArrayFetch from "./JSONArrayFetch.js" import UserFetch from "./UserFetch.js" +import GroupUserFetch from "./GroupUserFetch.js" const DataFetchMap = { table: TableFetch, @@ -13,6 +14,7 @@ const DataFetchMap = { query: QueryFetch, link: RelationshipFetch, user: UserFetch, + groupUser: GroupUserFetch, // Client specific datasource types provider: NestedProviderFetch, diff --git a/packages/types/src/documents/global/userGroup.ts b/packages/types/src/documents/global/userGroup.ts index fa48c1636e..b74e59c020 100644 --- a/packages/types/src/documents/global/userGroup.ts +++ b/packages/types/src/documents/global/userGroup.ts @@ -1,3 +1,4 @@ +import { PaginationResponse } from "../../api" import { Document } from "../document" export interface UserGroup extends Document { @@ -26,3 +27,10 @@ export interface SearchGroupRequest {} export interface SearchGroupResponse { data: UserGroup[] } + +export interface SearchUserGroupResponse extends PaginationResponse { + users: { + _id: any + email: any + }[] +} diff --git a/packages/types/src/sdk/db.ts b/packages/types/src/sdk/db.ts index 2cccd3be6a..58b3b7e5bc 100644 --- a/packages/types/src/sdk/db.ts +++ b/packages/types/src/sdk/db.ts @@ -65,6 +65,7 @@ export type DatabaseQueryOpts = { key?: string keys?: string[] group?: boolean + startkey_docid?: string } export const isDocument = (doc: any): doc is Document => { From 8102c54bc30da8182de5fe94e7ef30962dc538b3 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 09:36:18 +0100 Subject: [PATCH 04/15] Add searching for users back --- .../portal/users/groups/[groupId].svelte | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index ccd945fc24..6e5f337314 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -16,6 +16,7 @@ import { fetchData } from "@budibase/frontend-core" import { API } from "api" import UserGroupPicker from "components/settings/UserGroupPicker.svelte" + import { createPaginationStore } from "helpers/pagination" import { users, apps, groups, auth, features } from "stores/portal" import { onMount, setContext } from "svelte" import { roles } from "stores/backend" @@ -30,7 +31,7 @@ export let groupId - const fetchUsers = fetchData({ + const fetchGroupUsers = fetchData({ API, datasource: { type: "groupUser", @@ -84,12 +85,17 @@ let popoverAnchor let popover let searchTerm = "" + let prevSearch = undefined + let pageInfo = createPaginationStore() let loaded = false let editModal, deleteModal $: scimEnabled = $features.isScimEnabled $: readonly = !$auth.isAdmin || scimEnabled + $: page = $pageInfo.page + $: fetchUsers(page, searchTerm) $: group = $groups.find(x => x._id === groupId) + $: filtered = $users.data $: groupApps = $apps .filter(app => groups.actions @@ -106,6 +112,25 @@ } } + async function fetchUsers(page, search) { + if ($pageInfo.loading) { + return + } + // need to remove the page if they've started searching + if (search && !prevSearch) { + pageInfo.reset() + page = undefined + } + prevSearch = search + try { + pageInfo.loading() + await users.search({ page, email: search }) + pageInfo.fetched($users.hasNextPage, $users.nextPage) + } catch (error) { + notifications.error("Error getting user list") + } + } + async function deleteGroup() { try { await groups.actions.delete(group) @@ -201,7 +226,7 @@ From 2c49232fa85f9de8a47eb167d7a0230ec10fd14b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 09:37:26 +0100 Subject: [PATCH 05/15] Renames --- .../builder/portal/users/groups/[groupId].svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index 6e5f337314..bd5b1b3b07 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -86,14 +86,14 @@ let popover let searchTerm = "" let prevSearch = undefined - let pageInfo = createPaginationStore() + let searchUsersPageInfo = createPaginationStore() let loaded = false let editModal, deleteModal $: scimEnabled = $features.isScimEnabled $: readonly = !$auth.isAdmin || scimEnabled - $: page = $pageInfo.page - $: fetchUsers(page, searchTerm) + $: page = $searchUsersPageInfo.page + $: searchUsers(page, searchTerm) $: group = $groups.find(x => x._id === groupId) $: filtered = $users.data $: groupApps = $apps @@ -112,20 +112,20 @@ } } - async function fetchUsers(page, search) { - if ($pageInfo.loading) { + async function searchUsers(page, search) { + if ($searchUsersPageInfo.loading) { return } // need to remove the page if they've started searching if (search && !prevSearch) { - pageInfo.reset() + searchUsersPageInfo.reset() page = undefined } prevSearch = search try { - pageInfo.loading() + searchUsersPageInfo.loading() await users.search({ page, email: search }) - pageInfo.fetched($users.hasNextPage, $users.nextPage) + searchUsersPageInfo.fetched($users.hasNextPage, $users.nextPage) } catch (error) { notifications.error("Error getting user list") } From 89afec9bfc3c45d775183979f956d61309f2719f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 11:13:09 +0100 Subject: [PATCH 06/15] Refetch users on changes --- .../builder/portal/users/groups/[groupId].svelte | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index bd5b1b3b07..d91c793cf1 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -151,6 +151,7 @@ const removeUser = async id => { await groups.actions.removeUser(groupId, id) + fetchGroupUsers.refresh() } const removeApp = async app => { @@ -218,15 +219,21 @@ labelKey="email" selected={group.users?.map(user => user._id)} list={$users.data} - on:select={e => groups.actions.addUser(groupId, e.detail)} - on:deselect={e => groups.actions.removeUser(groupId, e.detail)} + on:select={async e => { + await groups.actions.addUser(groupId, e.detail) + fetchGroupUsers.refresh() + }} + on:deselect={async e => { + await groups.actions.removeUser(groupId, e.detail) + fetchGroupUsers.refresh() + }} />
Date: Fri, 5 May 2023 11:34:20 +0100 Subject: [PATCH 07/15] Refetch initial data instead of refreshing --- .../src/pages/builder/portal/users/groups/[groupId].svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index d91c793cf1..8acd4959b4 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -95,7 +95,6 @@ $: page = $searchUsersPageInfo.page $: searchUsers(page, searchTerm) $: group = $groups.find(x => x._id === groupId) - $: filtered = $users.data $: groupApps = $apps .filter(app => groups.actions @@ -151,7 +150,7 @@ const removeUser = async id => { await groups.actions.removeUser(groupId, id) - fetchGroupUsers.refresh() + fetchGroupUsers.getInitialData() } const removeApp = async app => { @@ -221,11 +220,11 @@ list={$users.data} on:select={async e => { await groups.actions.addUser(groupId, e.detail) - fetchGroupUsers.refresh() + fetchGroupUsers.getInitialData() }} on:deselect={async e => { await groups.actions.removeUser(groupId, e.detail) - fetchGroupUsers.refresh() + fetchGroupUsers.getInitialData() }} /> From 5e8a2de089b86440f6ba03c373dae7f56fd8f8d9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 12:10:49 +0100 Subject: [PATCH 08/15] Handle cursors on refresh --- .../builder/portal/users/groups/[groupId].svelte | 2 +- packages/frontend-core/src/fetch/DataFetch.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index 8acd4959b4..589df5c599 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -150,7 +150,7 @@ const removeUser = async id => { await groups.actions.removeUser(groupId, id) - fetchGroupUsers.getInitialData() + fetchGroupUsers.refresh() } const removeApp = async app => { diff --git a/packages/frontend-core/src/fetch/DataFetch.js b/packages/frontend-core/src/fetch/DataFetch.js index f68b37dcca..c49d8c29fb 100644 --- a/packages/frontend-core/src/fetch/DataFetch.js +++ b/packages/frontend-core/src/fetch/DataFetch.js @@ -362,13 +362,24 @@ export default class DataFetch { return } this.store.update($store => ({ ...$store, loading: true })) - const { rows, info, error } = await this.getPage() + const { rows, info, error, cursor } = await this.getPage() + + let { cursors } = get(this.store) + const { pageNumber } = get(this.store) + + const currentNextCursor = cursors[pageNumber + 1] + if (currentNextCursor != cursor) { + cursors = cursors.slice(0, pageNumber + 1) + cursors[pageNumber + 1] = cursor + } + this.store.update($store => ({ ...$store, rows, info, loading: false, error, + cursors, })) } From 916edf47d430fcd4a8067870760d4fcd22b607eb Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 13:03:53 +0100 Subject: [PATCH 09/15] Handling last page removed --- packages/frontend-core/src/fetch/DataFetch.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/frontend-core/src/fetch/DataFetch.js b/packages/frontend-core/src/fetch/DataFetch.js index c49d8c29fb..cc931bfe06 100644 --- a/packages/frontend-core/src/fetch/DataFetch.js +++ b/packages/frontend-core/src/fetch/DataFetch.js @@ -369,10 +369,20 @@ export default class DataFetch { const currentNextCursor = cursors[pageNumber + 1] if (currentNextCursor != cursor) { + // If the current cursor changed, all the next pages need to be updated, so we mark them as stale cursors = cursors.slice(0, pageNumber + 1) cursors[pageNumber + 1] = cursor } + if (!rows.length && pageNumber > 0) { + this.store.update($store => ({ + ...$store, + loading: false, + cursors: cursors.slice(0, pageNumber), + })) + return await this.prevPage() + } + this.store.update($store => ({ ...$store, rows, From d79af79bf1b2339ee81e8d41bd03fb052b650823 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 13:05:08 +0100 Subject: [PATCH 10/15] Comment --- packages/frontend-core/src/fetch/DataFetch.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/frontend-core/src/fetch/DataFetch.js b/packages/frontend-core/src/fetch/DataFetch.js index cc931bfe06..18a00c08d5 100644 --- a/packages/frontend-core/src/fetch/DataFetch.js +++ b/packages/frontend-core/src/fetch/DataFetch.js @@ -367,14 +367,8 @@ export default class DataFetch { let { cursors } = get(this.store) const { pageNumber } = get(this.store) - const currentNextCursor = cursors[pageNumber + 1] - if (currentNextCursor != cursor) { - // If the current cursor changed, all the next pages need to be updated, so we mark them as stale - cursors = cursors.slice(0, pageNumber + 1) - cursors[pageNumber + 1] = cursor - } - if (!rows.length && pageNumber > 0) { + // If the full page is gone but we have previous pages, navigate to the previous page this.store.update($store => ({ ...$store, loading: false, @@ -383,6 +377,13 @@ export default class DataFetch { return await this.prevPage() } + const currentNextCursor = cursors[pageNumber + 1] + if (currentNextCursor != cursor) { + // If the current cursor changed, all the next pages need to be updated, so we mark them as stale + cursors = cursors.slice(0, pageNumber + 1) + cursors[pageNumber + 1] = cursor + } + this.store.update($store => ({ ...$store, rows, From 21d0bbcb1ef6f7429883500feedadb2594571e82 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 16:33:28 +0100 Subject: [PATCH 11/15] Update pro ref --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 79bc94b17b..7f134dc875 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 79bc94b17baba885eb20e72f9abba3ac8b9c0eab +Subproject commit 7f134dc8758ca5ba6d7997bc23f1214a6ba8dd57 From f8ccee80df748211e71df22e2138a874c2e7ed78 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 16:50:06 +0100 Subject: [PATCH 12/15] Update pro ref --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 7f134dc875..e3c156628b 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 7f134dc8758ca5ba6d7997bc23f1214a6ba8dd57 +Subproject commit e3c156628b5b67d3c8f3044e64b529405f50610b From e4b0c55aa6175b493b9dcc97921275baf53fe5b4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 20:10:54 +0100 Subject: [PATCH 13/15] Split group users component --- .../portal/users/groups/[groupId].svelte | 159 ++--------------- .../groups/_components/GroupUsers.svelte | 166 ++++++++++++++++++ 2 files changed, 179 insertions(+), 146 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/users/groups/_components/GroupUsers.svelte diff --git a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte index 589df5c599..08c32bfeb9 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/[groupId].svelte @@ -1,62 +1,28 @@ + +
+ Users + {#if !scimEnabled} +
+ +
+ {:else} + + {/if} + + user._id)} + list={$users.data} + on:select={async e => { + await groups.actions.addUser(groupId, e.detail) + fetchGroupUsers.getInitialData() + }} + on:deselect={async e => { + await groups.actions.removeUser(groupId, e.detail) + fetchGroupUsers.getInitialData() + }} + /> + +
+ +
$goto(`../users/${e.detail._id}`)} +> +
+ This user group doesn't have any users +
+
+ + + + From b1f1095c89d41722268b6a78a1ee33fb9786a381 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 5 May 2023 20:21:06 +0100 Subject: [PATCH 14/15] Split components --- .../groups/_components/EditUserPicker.svelte | 59 +++++++++++++++++ .../groups/_components/GroupUsers.svelte | 64 ++----------------- 2 files changed, 64 insertions(+), 59 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/users/groups/_components/EditUserPicker.svelte diff --git a/packages/builder/src/pages/builder/portal/users/groups/_components/EditUserPicker.svelte b/packages/builder/src/pages/builder/portal/users/groups/_components/EditUserPicker.svelte new file mode 100644 index 0000000000..a71634b262 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/users/groups/_components/EditUserPicker.svelte @@ -0,0 +1,59 @@ + + +
+ +
+ + user._id)} + list={$users.data} + on:select={async e => { + await groups.actions.addUser(groupId, e.detail) + onUsersUpdated() + }} + on:deselect={async e => { + await groups.actions.removeUser(groupId, e.detail) + onUsersUpdated() + }} + /> + diff --git a/packages/builder/src/pages/builder/portal/users/groups/_components/GroupUsers.svelte b/packages/builder/src/pages/builder/portal/users/groups/_components/GroupUsers.svelte index ecc896989a..9c18008e44 100644 --- a/packages/builder/src/pages/builder/portal/users/groups/_components/GroupUsers.svelte +++ b/packages/builder/src/pages/builder/portal/users/groups/_components/GroupUsers.svelte @@ -1,18 +1,11 @@