Fix multiple issues with groups UI due to not correctly accounting for multi-tenant app ID structuer

This commit is contained in:
Andrew Kingston 2022-09-26 14:50:31 +01:00
parent adf951ca8a
commit 9b4d791b5e
2 changed files with 4 additions and 5 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(`app_${app.appId}`)
groups.actions.getGroupAppIds(group).includes(apps.getProdAppID(app.appId))
)
$: {
if (loaded && !group?._id) {
@ -70,7 +70,7 @@
}
const getRoleLabel = appId => {
const roleId = group?.roles?.[`app_${appId}`]
const roleId = group?.roles?.[apps.getProdAppID(appId)]
const role = $roles.find(x => x._id === roleId)
return role?.name || "Custom role"
}
@ -197,7 +197,7 @@
<StatusLight
square
color={RoleUtils.getRoleColour(
group.roles[`app_${app.appId}`]
group.roles[apps.getProdAppID(app.appId)]
)}
>
{getRoleLabel(app.appId)}

View File

@ -39,7 +39,6 @@
$: fixedAppId = apps.getProdAppID(app.devId)
$: availableUsers = getAvailableUsers($usersFetch.rows, appUsers, data)
$: availableGroups = getAvailableGroups($groups, app.appId, search, data)
$: console.log(availableGroups)
$: valid = data?.length && !data?.some(x => !x.id?.length || !x.role?.length)
$: optionSections = {
...($licensing.groupsEnabled &&
@ -115,7 +114,7 @@
return (allGroups || []).filter(group => {
// Filter out assigned groups
const appIds = groups.actions.getGroupAppIds(group)
if (appIds.includes(`app_${appId}`)) {
if (appIds.includes(apps.getProdAppID(appId))) {
return false
}