Fix stale data in group details page, fix role colour in group app access

This commit is contained in:
Andrew Kingston 2022-08-01 13:04:58 +01:00
parent 08849395f1
commit 9ae11bcb49
1 changed files with 91 additions and 83 deletions

View File

@ -18,9 +18,10 @@
import { users, apps, groups } from "stores/portal"
import { onMount } from "svelte"
import { RoleUtils } from "@budibase/frontend-core"
import { roles } from "../../../../../stores/backend"
import { roles } from "stores/backend"
export let groupId
let popoverAnchor
let popover
let searchTerm = ""
@ -28,6 +29,7 @@
let prevSearch = undefined,
search = undefined
let pageInfo = createPaginationStore()
let loaded = false
$: page = $pageInfo.page
$: fetchUsers(page, search)
@ -113,18 +115,22 @@
onMount(async () => {
try {
await groups.actions.init()
await apps.load()
await roles.fetch()
await Promise.all([groups.actions.init(), apps.load(), roles.fetch()])
loaded = true
} catch (error) {
notifications.error("Error fetching User Group data")
notifications.error("Error fetching user group data")
}
})
</script>
<Layout noPadding>
{#if loaded}
<Layout noPadding>
<div>
<ActionButton on:click={() => $goto("../groups")} size="S" icon="ArrowLeft">
<ActionButton
on:click={() => $goto("../groups")}
size="S"
icon="ArrowLeft"
>
Back
</ActionButton>
</div>
@ -177,7 +183,8 @@
>
<Heading weight="light" size="XS">Apps</Heading>
<div style="margin-top: var(--spacing-xs)">
<Body size="S">Manage apps that this User group has been assigned to</Body
<Body size="S"
>Manage apps that this User group has been assigned to</Body
>
</div>
</div>
@ -193,7 +200,7 @@
<div class="title ">
<StatusLight
square
color={RoleUtils.getRoleColour(group.roles[app.appId])}
color={RoleUtils.getRoleColour(group.roles[`app_${app.appId}`])}
>
{getRoleLabel(app.appId)}
</StatusLight>
@ -204,7 +211,8 @@
<ListItem icon="UserGroup" title="No apps" />
{/if}
</List>
</Layout>
</Layout>
{/if}
<style>
.text-padding {