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:
Ludovic Vielle
2026-06-12 18:23:04 +02:00
parent bf20ca1a90
commit 8094e7cfd0
80 changed files with 768 additions and 378 deletions

View File

@@ -67,7 +67,7 @@ func (d *OpenAIDriver) ListAccounts(ctx context.Context) ([]AccountRecord, error
record := AccountRecord{
Email: u.Email,
FullName: u.Name,
Role: openaiRole(u.Role),
Roles: openaiRoles(u.Role),
Active: new(!u.Disabled),
IsAdmin: u.Role == "owner",
ExternalID: u.ID,
@@ -134,13 +134,17 @@ func (d *OpenAIDriver) fetchUsers(ctx context.Context, after string) (*openaiUse
return &resp, nil
}
func openaiRole(role string) string {
func openaiRoles(role string) []string {
if role == "" {
return []string{}
}
switch role {
case "owner":
return "Owner"
return []string{"Owner"}
case "reader":
return "Reader"
return []string{"Reader"}
default:
return "Member"
return []string{"Member"}
}
}