Merge pull request #14901 from Budibase/fix/user-page-loading

Fixing user page loading
This commit is contained in:
Michael Drury 2024-10-29 12:32:33 +00:00 committed by GitHub
commit 7508621dfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View File

@ -71,7 +71,6 @@
]
let userData = []
let invitesLoaded = false
let tenantOwnerLoaded = false
let pendingInvites = []
let parsedInvites = []
@ -100,13 +99,9 @@
$: pendingSchema = getPendingSchema(schema)
$: userData = []
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
$: setEnrichedUsers($fetch.rows, tenantOwnerLoaded)
$: setEnrichedUsers($fetch.rows, tenantOwner)
const setEnrichedUsers = async rows => {
if (!tenantOwnerLoaded) {
enrichedUsers = []
return
}
const setEnrichedUsers = async (rows, owner) => {
enrichedUsers = rows?.map(user => {
let userGroups = []
$groups.forEach(group => {
@ -118,7 +113,9 @@
})
}
})
user.tenantOwnerEmail = tenantOwner?.email
if (owner) {
user.tenantOwnerEmail = owner.email
}
const role = Constants.ExtendedBudibaseRoleOptions.find(
x => x.value === users.getUserRole(user)
)
@ -322,13 +319,22 @@
try {
await groups.actions.init()
groupsLoaded = true
pendingInvites = await users.getInvites()
invitesLoaded = true
tenantOwner = await users.getAccountHolder()
tenantOwnerLoaded = true
} catch (error) {
notifications.error("Error fetching user group data")
}
try {
pendingInvites = await users.getInvites()
invitesLoaded = true
} catch (err) {
notifications.error("Error fetching user invitations")
}
try {
tenantOwner = await users.getAccountHolder()
} catch (err) {
if (err.status !== 404) {
notifications.error("Error fetching account holder")
}
}
})
</script>

View File

@ -32,7 +32,7 @@ export default class UserFetch extends DataFetch {
const { cursor, query } = get(this.store)
let finalQuery
// convert old format to new one - we now allow use of the lucene format
const { appId, paginated, ...rest } = query
const { appId, paginated, ...rest } = query || {}
if (!QueryUtils.hasFilters(query) && rest.email != null) {
finalQuery = { string: { email: rest.email } }
} else {