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:
@@ -75,11 +75,18 @@ func (d *GrafanaDriver) ListAccounts(ctx context.Context) ([]AccountRecord, erro
|
||||
continue
|
||||
}
|
||||
|
||||
role := strings.TrimSpace(u.Role)
|
||||
|
||||
roles := []string{}
|
||||
if role != "" {
|
||||
roles = []string{role}
|
||||
}
|
||||
|
||||
record := AccountRecord{
|
||||
Email: email,
|
||||
FullName: strings.TrimSpace(u.Name),
|
||||
Role: strings.TrimSpace(u.Role),
|
||||
IsAdmin: strings.EqualFold(strings.TrimSpace(u.Role), "Admin"),
|
||||
Roles: roles,
|
||||
IsAdmin: strings.EqualFold(role, "Admin"),
|
||||
MFAStatus: coredata.MFAStatusUnknown,
|
||||
AuthMethod: coredata.AccessReviewEntryAuthMethodUnknown,
|
||||
AccountType: coredata.AccessReviewEntryAccountTypeUser,
|
||||
|
||||
Reference in New Issue
Block a user