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:
@@ -96,7 +96,7 @@ func (d *LinearDriver) ListAccounts(ctx context.Context) ([]AccountRecord, error
|
||||
record := AccountRecord{
|
||||
Email: u.Email,
|
||||
FullName: u.Name,
|
||||
Role: linearRole(u.Admin, u.Guest),
|
||||
Roles: linearRoles(u.Admin, u.Guest),
|
||||
Active: new(u.Active),
|
||||
IsAdmin: u.Admin,
|
||||
ExternalID: u.ID,
|
||||
@@ -200,13 +200,13 @@ query AccessReviewLinearUsers($after: String) {
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func linearRole(admin, guest bool) string {
|
||||
func linearRoles(admin, guest bool) []string {
|
||||
switch {
|
||||
case admin:
|
||||
return "Admin"
|
||||
return []string{"Admin"}
|
||||
case guest:
|
||||
return "Guest"
|
||||
return []string{"Guest"}
|
||||
default:
|
||||
return "Member"
|
||||
return []string{"Member"}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user