mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 13:23:34 +00:00
[PM-24633] - group collections by org in individual vault filters (#16480)
* group collections by org in individual vault filters * update vault filter * use OrganizationId * fix tests
This commit is contained in:
@@ -28,4 +28,11 @@ export abstract class CollectionService {
|
||||
* Transforms the input CollectionViews into TreeNodes and then returns the Treenode with the specified id
|
||||
*/
|
||||
abstract getNested(collections: CollectionView[], id: string): TreeNode<CollectionView>;
|
||||
|
||||
/*
|
||||
* Groups/keys collections by OrganizationId
|
||||
*/
|
||||
abstract groupByOrganization(
|
||||
collections: CollectionView[],
|
||||
): Map<OrganizationId, CollectionView[]>;
|
||||
}
|
||||
|
||||
@@ -230,8 +230,8 @@ export class DefaultCollectionService implements CollectionService {
|
||||
return all;
|
||||
}
|
||||
|
||||
groupByOrganization(collections: CollectionView[]): Map<string, CollectionView[]> {
|
||||
const groupedByOrg = new Map<string, CollectionView[]>();
|
||||
groupByOrganization(collections: CollectionView[]): Map<OrganizationId, CollectionView[]> {
|
||||
const groupedByOrg = new Map<OrganizationId, CollectionView[]>();
|
||||
collections.map((c) => {
|
||||
const key = c.organizationId;
|
||||
(groupedByOrg.get(key) ?? groupedByOrg.set(key, []).get(key)!).push(c);
|
||||
|
||||
Reference in New Issue
Block a user