* refactor: 💡 initial changes for updating breadcrumbs to use hds * refactor: 💡 add breadcrumbs to all paths * refactor: 💡 add more hds breadcrumbs to remaining paths * refactor: 💡 remove BreadCrumbs from templates * refactor: 💡 remove breadcrumb only controller files * test: 💍 remove unnused test files & add missing tests * test: 💍 update tests * test: 💍 add missing scope in test * test: 💍 fix test * refactor: 💡 remove icons * refactor: 💡 remove addon and use service instead * docs: ✏️ add comment to breadcrumb service * test: 💍 update service unit test * docs: ✏️ add comments to breadcrumb components * Update ui/admin/app/components/breadcrumbs/container/index.js Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
30 lines
740 B
JavaScript
30 lines
740 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import Controller from '@ember/controller';
|
|
|
|
export default class ScopesScopeGroupsGroupAddMembersController extends Controller {
|
|
// =services
|
|
|
|
// =attributes
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|