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:
@@ -107,19 +107,20 @@ func (d *DatadogDriver) ListAccounts(ctx context.Context) ([]AccountRecord, erro
|
||||
active := !u.Attributes.Disabled
|
||||
|
||||
var (
|
||||
role string
|
||||
roles []string
|
||||
isAdmin bool
|
||||
)
|
||||
|
||||
for _, r := range u.Relationships.Roles.Data {
|
||||
name := roleNames[r.ID]
|
||||
if role == "" {
|
||||
role = name
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
roles = append(roles, name)
|
||||
|
||||
if strings.Contains(strings.ToLower(name), "admin") {
|
||||
isAdmin = true
|
||||
role = name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ func (d *DatadogDriver) ListAccounts(ctx context.Context) ([]AccountRecord, erro
|
||||
records = append(records, AccountRecord{
|
||||
Email: u.Attributes.Email,
|
||||
FullName: u.Attributes.Name,
|
||||
Role: role,
|
||||
Roles: roles,
|
||||
JobTitle: u.Attributes.Title,
|
||||
Active: &active,
|
||||
IsAdmin: isAdmin,
|
||||
|
||||
Reference in New Issue
Block a user