Merge pull request #14901 from Budibase/fix/user-page-loading
Fixing user page loading
This commit is contained in:
commit
7508621dfd
|
@ -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>
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue