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 59e08c5346
commit 451c55ae67
1 changed files with 91 additions and 83 deletions

View File

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