diff --git a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte index 847238e7cb..f13a3f2e6e 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte @@ -21,9 +21,9 @@ StatusLight, } from "@budibase/bbui" import { onMount } from "svelte" - import { fetchData } from "helpers" import { users, auth, groups, apps } from "stores/portal" + import { roles } from "stores/backend" import { Constants } from "@budibase/frontend-core" import ForceResetPasswordModal from "./_components/ForceResetPasswordModal.svelte" import { RoleUtils } from "@budibase/frontend-core" @@ -40,6 +40,7 @@ let selectedGroups = [] let allAppList = [] let user + let loaded = false $: fetchUser(userId) $: fullName = $userFetch?.data?.firstName @@ -125,6 +126,11 @@ return email.substring(0, 2) } + const getRoleLabel = roleId => { + const role = $roles.find(x => x._id === roleId) + return role?.name || "Custom role" + } + function getHighestRole(roles) { let highestRole let highestRoleNumber = 0 @@ -205,162 +211,166 @@ function addAll() {} onMount(async () => { try { - await groups.actions.init() - await apps.load() + await Promise.all([groups.actions.init(), apps.load(), roles.fetch()]) + loaded = true } catch (error) { - notifications.error("Error getting User groups") + notifications.error("Error getting user groups") } }) - - -
- $goto("./")} size="S" icon="ArrowLeft"> - Back - -
-
- -
+{#if loaded} + +
-
- -
- {nameLabel} - {$userFetch?.data?.email} + $goto("./")} size="S" icon="ArrowLeft"> + Back + +
+ + +
+
+
+ +
+ {nameLabel} + {$userFetch?.data?.email} +
-
-
- - - - - Force Password Reset - Delete - -
-
- - -
-
- - -
-
- - -
- - {#if userId !== $auth.user._id} -
- - - +
+
+ + +
+ + {#if userId !== $auth.user._id} +
+ +