From d60c5fd806dfe99bfcd18a4590f5f8b4c2b591d2 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Mon, 26 Sep 2022 22:33:11 +0100 Subject: [PATCH] Fixing issue with multi-tenancy and groups UI - apps with multi-tenancy enabled did not appear correctly and could not be added. --- .../pages/builder/portal/manage/groups/[groupId].svelte | 8 ++++---- .../portal/manage/groups/_components/AppAddModal.svelte | 2 +- .../src/pages/builder/portal/manage/groups/index.svelte | 1 - packages/builder/src/stores/portal/apps.js | 2 ++ 4 files changed, 7 insertions(+), 6 deletions(-) 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 92d270931d..5e8fb0d170 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte @@ -42,7 +42,7 @@ $: group = $groups.find(x => x._id === groupId) $: filtered = $users.data $: groupApps = $apps.filter(app => - groups.actions.getGroupAppIds(group).includes(apps.getProdAppID(app.appId)) + groups.actions.getGroupAppIds(group).includes(apps.getProdAppID(app.devId)) ) $: { if (loaded && !group?._id) { @@ -204,17 +204,17 @@ - {getRoleLabel(app.appId)} + {getRoleLabel(app.devId)} { groups.actions.removeApp( groupId, - apps.getProdAppID(app.appId) + apps.getProdAppID(app.devId) ) e.stopPropagation() }} diff --git a/packages/builder/src/pages/builder/portal/manage/groups/_components/AppAddModal.svelte b/packages/builder/src/pages/builder/portal/manage/groups/_components/AppAddModal.svelte index 5d0f06fe73..a8f8fd661f 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/_components/AppAddModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/_components/AppAddModal.svelte @@ -10,13 +10,13 @@ label: app.name, value: app, })) - $: prodAppId = selectedApp ? apps.getProdAppID(selectedApp.appId) : "" $: confirmDisabled = (!selectingRole && !selectedApp) || (selectingRole && !selectedRoleId) let selectedApp, selectedRoleId let selectingRole = false async function appSelected() { + const prodAppId = apps.getProdAppID(selectedApp.devId) if (!selectingRole) { selectingRole = true await roles.fetchByAppId(prodAppId) diff --git a/packages/builder/src/pages/builder/portal/manage/groups/index.svelte b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte index 558e9af8b7..a5707e00dd 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/index.svelte @@ -27,7 +27,6 @@ icon: "UserGroup", color: "var(--spectrum-global-color-blue-600)", users: [], - apps: [], roles: {}, } diff --git a/packages/builder/src/stores/portal/apps.js b/packages/builder/src/stores/portal/apps.js index 41fdc232b7..a83e35e941 100644 --- a/packages/builder/src/stores/portal/apps.js +++ b/packages/builder/src/stores/portal/apps.js @@ -21,6 +21,8 @@ const getProdAppID = appId => { } else if (!appId.startsWith("app")) { rest = appId separator = "_" + } else { + return appId } return `app${separator}${rest}` }