Truncate access review roles with badge list
Long role strings in the access review table broke row layout when drivers joined many roles into one comma-separated value. Expose roles as a string array in GraphQL by splitting the stored role at the API layer, and render the first three roles as badges with a "+X more" popover for the rest. Closes ENG-459. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
@@ -78,7 +78,7 @@ func (d *MetabaseDriver) ListAccounts(ctx context.Context) ([]AccountRecord, err
|
||||
record := AccountRecord{
|
||||
Email: u.Email,
|
||||
FullName: metabaseFullName(u),
|
||||
Role: metabaseRole(u.IsSuperuser),
|
||||
Roles: metabaseRoles(u.IsSuperuser),
|
||||
Active: new(u.IsActive),
|
||||
IsAdmin: u.IsSuperuser,
|
||||
ExternalID: strconv.Itoa(u.ID),
|
||||
@@ -176,12 +176,12 @@ func metabaseFullName(u metabaseUser) string {
|
||||
return strings.TrimSpace(strings.Join([]string{u.FirstName, u.LastName}, " "))
|
||||
}
|
||||
|
||||
func metabaseRole(isSuperuser bool) string {
|
||||
func metabaseRoles(isSuperuser bool) []string {
|
||||
if isSuperuser {
|
||||
return "Admin"
|
||||
return []string{"Admin"}
|
||||
}
|
||||
|
||||
return "User"
|
||||
return []string{"User"}
|
||||
}
|
||||
|
||||
// metabaseNameResolver resolves the Metabase site name by querying
|
||||
|
||||
Reference in New Issue
Block a user