mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
Roles: only observers, only maintainers (#929)
* User roles render for only team observers and only team maintainers
This commit is contained in:
parent
0f09c2e837
commit
0867c717cf
@ -146,13 +146,26 @@ const generateTeam = (teams: ITeam[], globalRole: string | null): string => {
|
||||
|
||||
const generateRole = (teams: ITeam[], globalRole: string | null): string => {
|
||||
if (globalRole === null) {
|
||||
const listOfRoles: any = teams.map((team) => team.role);
|
||||
|
||||
if (teams.length === 0) {
|
||||
// no global role and no teams
|
||||
return "Unassigned";
|
||||
} else if (teams.length === 1) {
|
||||
// no global role and only one team
|
||||
return stringUtils.capitalize(teams[0].role ?? "");
|
||||
} else if (
|
||||
listOfRoles.every((role: string): boolean => role === "maintainer")
|
||||
) {
|
||||
// only team maintainers
|
||||
return stringUtils.capitalize(teams[0].role ?? "");
|
||||
} else if (
|
||||
listOfRoles.every((role: string): boolean => role === "observer")
|
||||
) {
|
||||
// only team observers
|
||||
return stringUtils.capitalize(teams[0].role ?? "");
|
||||
}
|
||||
|
||||
return "Various"; // no global role and multiple teams
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user