feat: 🎸 add scope filtering to role/add-principals route (#1211)

* feat: 🎸 add scope filtering to role/add-principals route

* fix: 🐛 remove unnecessary helper

* feat: 🎸 add scope filtering to group add-members route
This commit is contained in:
Randall Morey authored and GitHub committed 2022-07-28 17:34:03 -07:00
1 parent f6e1fb0e3b
commit bfc433dc38
7 files changed
+279 -15

No files matched your search

@@ -15,4 +15,21 @@ export default class ScopesScopeGroupsGroupAddMembersController extends Controll
get breadCrumb() {
return this.intl.t('resources.group.messages.add-members.title');
}
/**
* Returns a flat array of scopes, sorted and "grouped by" parent scope,
* beginning with global.
*/
get flatSortedScopes() {
const { scopes } = this.model;
const global = scopes.find((scope) => scope.isGlobal);
const orgsAndProjects = scopes
.filter((scope) => scope.isOrg)
.map((org) => [
org,
...scopes.filter((scope) => scope.scopeID === org.id),
]);
const sorted = [global, ...orgsAndProjects].flat();
return sorted;
}
}