Fix role display for groups and update status light
This commit is contained in:
parent
6e31e69528
commit
08849395f1
|
@ -18,6 +18,7 @@
|
||||||
import { users, apps, groups } from "stores/portal"
|
import { users, apps, groups } from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { RoleUtils } from "@budibase/frontend-core"
|
import { RoleUtils } from "@budibase/frontend-core"
|
||||||
|
import { roles } from "../../../../../stores/backend"
|
||||||
|
|
||||||
export let groupId
|
export let groupId
|
||||||
let popoverAnchor
|
let popoverAnchor
|
||||||
|
@ -104,10 +105,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRoleLabel = appId => {
|
||||||
|
const roleId = group?.roles?.[`app_${appId}`]
|
||||||
|
const role = $roles.find(x => x._id === roleId)
|
||||||
|
return role?.name || "Custom role"
|
||||||
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
try {
|
try {
|
||||||
await groups.actions.init()
|
await groups.actions.init()
|
||||||
await apps.load()
|
await apps.load()
|
||||||
|
await roles.fetch()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error fetching User Group data")
|
notifications.error("Error fetching User Group data")
|
||||||
}
|
}
|
||||||
|
@ -184,11 +192,11 @@
|
||||||
>
|
>
|
||||||
<div class="title ">
|
<div class="title ">
|
||||||
<StatusLight
|
<StatusLight
|
||||||
|
square
|
||||||
color={RoleUtils.getRoleColour(group.roles[app.appId])}
|
color={RoleUtils.getRoleColour(group.roles[app.appId])}
|
||||||
/>
|
>
|
||||||
<div style="margin-left: var(--spacing-s);">
|
{getRoleLabel(app.appId)}
|
||||||
<Body size="XS">{group.roles[app.appId]}</Body>
|
</StatusLight>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
Loading…
Reference in New Issue