Fixing issue with multi-tenancy and groups UI - apps with multi-tenancy enabled did not appear correctly and could not be added.

This commit is contained in:
Michael Drury 2022-09-26 22:33:11 +01:00
parent 61952f15af
commit d60c5fd806
4 changed files with 7 additions and 6 deletions

View File

@ -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 @@
<StatusLight
square
color={RoleUtils.getRoleColour(
group.roles[apps.getProdAppID(app.appId)]
group.roles[apps.getProdAppID(app.devId)]
)}
>
{getRoleLabel(app.appId)}
{getRoleLabel(app.devId)}
</StatusLight>
</div>
<Icon
on:click={e => {
groups.actions.removeApp(
groupId,
apps.getProdAppID(app.appId)
apps.getProdAppID(app.devId)
)
e.stopPropagation()
}}

View File

@ -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)

View File

@ -27,7 +27,6 @@
icon: "UserGroup",
color: "var(--spectrum-global-color-blue-600)",
users: [],
apps: [],
roles: {},
}

View File

@ -21,6 +21,8 @@ const getProdAppID = appId => {
} else if (!appId.startsWith("app")) {
rest = appId
separator = "_"
} else {
return appId
}
return `app${separator}${rest}`
}