Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AC-2676] Remove paging logic from GroupsComponent #9705

Merged
merged 23 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3725d2d
Delete unused code
eliykat Jun 17, 2024
b6bf1fe
Remove ngOnInit and ngOnDestroy
eliykat Jun 17, 2024
878dea6
Add TableDataSource and SearchControl
eliykat Jun 17, 2024
0d45667
Remove old search properties, update init logic
eliykat Jun 17, 2024
0994229
First pass at removing paging logic
eliykat Jun 17, 2024
418734b
Resolve FIXME
eliykat Jun 17, 2024
249168a
Implement sorting
eliykat Jun 17, 2024
8951390
Use ToastService
eliykat Jun 17, 2024
510e31c
Implement virtual scroll
eliykat Jun 17, 2024
9dd8d45
Remove unneeded type
eliykat Jun 17, 2024
6d45a6b
Limit search functionality
eliykat Jun 17, 2024
3c6b9aa
Make naming consistent
eliykat Jun 17, 2024
ba0fc4d
Use new table filtering interface
eliykat Jun 19, 2024
215c7b5
Tweak removal logic
eliykat Jun 21, 2024
9296a76
Merge branch 'main' into ac/ac-2676/remove-paging-logic-from-groupscoโ€ฆ
eliykat Jun 23, 2024
eec6e05
Merge branch 'main' into ac/ac-2676/remove-paging-logic-from-groupscoโ€ฆ
eliykat Jun 24, 2024
9c18de0
Merge remote-tracking branch 'origin/main' into ac/ac-2676/remove-pagโ€ฆ
eliykat Jun 26, 2024
fa16d2c
Feature flag new changes
eliykat Jun 26, 2024
810e09f
Merge branch 'main' into ac/ac-2676/remove-paging-logic-from-groupscoโ€ฆ
eliykat Jun 30, 2024
1062936
Update feature flag name
eliykat Jun 30, 2024
8caf81e
Add deprecation notice
eliykat Jun 30, 2024
99e2e28
Merge remote-tracking branch 'origin/main' into ac/ac-2676/remove-pagโ€ฆ
eliykat Jul 2, 2024
a7c724a
Merge branch 'main' into ac/ac-2676/remove-paging-logic-from-groupscoโ€ฆ
eliykat Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ type GroupDetailsRow = {
collectionNames?: string[];
};

/**
* @deprecated To be replaced with NewGroupsComponent which significantly refactors this component.
* The GroupsComponentRefactor flag switches between the old and new components; this component will be removed when
* the feature flag is removed.
*/
@Component({
selector: "app-org-groups",
templateUrl: "groups.component.html",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<app-header>
<bit-search
[placeholder]="'searchGroups' | i18n"
[formControl]="searchControl"
class="tw-w-80"
></bit-search>
<button bitButton type="button" buttonType="primary" (click)="add()">
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
{{ "newGroup" | i18n }}
</button>
</app-header>

<ng-container *ngIf="loading">
<i
class="bwi bwi-spinner bwi-spin text-muted"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
<span class="sr-only">{{ "loading" | i18n }}</span>
</ng-container>
<ng-container *ngIf="!loading">
<p *ngIf="!dataSource.filteredData.length">{{ "noGroupsInList" | i18n }}</p>
<!-- The padding on the bottom of the cdk-virtual-scroll-viewport element is required to prevent table row content
from overflowing the <main> element. -->
<cdk-virtual-scroll-viewport scrollWindow [itemSize]="rowHeight" class="tw-pb-8">
<bit-table *ngIf="dataSource.filteredData.length" [dataSource]="dataSource">
<ng-container header>
<tr>
<th bitCell class="tw-w-20">
<input
type="checkbox"
bitCheckbox
class="tw-mr-2"
(change)="toggleAllVisible($event)"
id="selectAll"
/>
<label class="tw-mb-0 !tw-font-bold !tw-text-muted" for="selectAll">{{
"all" | i18n
}}</label>
</th>
<th bitCell bitSortable="name" default>{{ "name" | i18n }}</th>
<th bitCell>{{ "collections" | i18n }}</th>
<th bitCell class="tw-w-10">
<button
[bitMenuTriggerFor]="headerMenu"
type="button"
bitIconButton="bwi-ellipsis-v"
size="small"
appA11yTitle="{{ 'options' | i18n }}"
></button>

<bit-menu #headerMenu>
<button type="button" bitMenuItem (click)="deleteAllSelected()">
<span class="tw-text-danger"
><i aria-hidden="true" class="bwi bwi-trash"></i> {{ "delete" | i18n }}</span
>
</button>
</bit-menu>
</th>
</tr>
</ng-container>
<ng-template body let-rows$>
<tr bitRow *cdkVirtualFor="let g of rows$" [ngClass]="rowHeightClass">
<td bitCell (click)="check(g)" class="tw-cursor-pointer">
<input type="checkbox" bitCheckbox [(ngModel)]="g.checked" />
</td>
<td bitCell class="tw-cursor-pointer tw-font-bold" (click)="edit(g)">
<button type="button" bitLink>
{{ g.details.name }}
</button>
</td>
<td bitCell (click)="edit(g, ModalTabType.Collections)" class="tw-cursor-pointer">
<bit-badge-list
[items]="g.collectionNames"
[maxItems]="3"
variant="secondary"
></bit-badge-list>
</td>
<td bitCell>
<button
[bitMenuTriggerFor]="rowMenu"
type="button"
bitIconButton="bwi-ellipsis-v"
size="small"
appA11yTitle="{{ 'options' | i18n }}"
></button>

<bit-menu #rowMenu>
<button type="button" bitMenuItem (click)="edit(g)">
<i aria-hidden="true" class="bwi bwi-pencil-square"></i> {{ "editInfo" | i18n }}
</button>
<button type="button" bitMenuItem (click)="edit(g, ModalTabType.Members)">
<i aria-hidden="true" class="bwi bwi-user"></i> {{ "members" | i18n }}
</button>
<button type="button" bitMenuItem (click)="edit(g, ModalTabType.Collections)">
<i aria-hidden="true" class="bwi bwi-collection"></i> {{ "collections" | i18n }}
</button>
<button type="button" bitMenuItem (click)="delete(g)">
<span class="tw-text-danger"
><i aria-hidden="true" class="bwi bwi-trash"></i> {{ "delete" | i18n }}</span
>
</button>
</bit-menu>
</td>
</tr>
</ng-template>
</bit-table>
</cdk-virtual-scroll-viewport>
</ng-container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
import { Component } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { FormControl } from "@angular/forms";
import { ActivatedRoute } from "@angular/router";
import {

Check warning on line 5 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L1-L5

Added lines #L1 - L5 were not covered by tests
BehaviorSubject,
combineLatest,
concatMap,
from,
lastValueFrom,
map,
switchMap,
tap,
} from "rxjs";
import { debounceTime, first } from "rxjs/operators";

Check warning on line 15 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L15

Added line #L15 was not covered by tests

import { ApiService } from "@bitwarden/common/abstractions/api.service";

Check warning on line 17 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L17

Added line #L17 was not covered by tests
import { ListResponse } from "@bitwarden/common/models/response/list.response";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
import { CollectionData } from "@bitwarden/common/vault/models/data/collection.data";
import { Collection } from "@bitwarden/common/vault/models/domain/collection";

Check warning on line 23 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L19-L23

Added lines #L19 - L23 were not covered by tests
import {
CollectionDetailsResponse,
CollectionResponse,
} from "@bitwarden/common/vault/models/response/collection.response";
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
import { DialogService, TableDataSource, ToastService } from "@bitwarden/components";

Check warning on line 29 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L29

Added line #L29 was not covered by tests

import { InternalGroupService as GroupService, GroupView } from "../core";

Check warning on line 31 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L31

Added line #L31 was not covered by tests

import {

Check warning on line 33 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L33

Added line #L33 was not covered by tests
GroupAddEditDialogResultType,
GroupAddEditTabType,
openGroupAddEditDialog,
} from "./group-add-edit.component";

type GroupDetailsRow = {
/**
* Details used for displaying group information
*/
details: GroupView;

/**
* True if the group is selected in the table
*/
checked?: boolean;

/**
* A list of collection names the group has access to
*/
collectionNames?: string[];
};

/**
* Custom filter predicate that filters the groups table by id and name only.
* This is required because the default implementation searches by all properties, which can unintentionally match
* with members' names (who are assigned to the group) or collection names (which the group has access to).
*/
const groupsFilter = (filter: string) => {
const transformedFilter = filter.trim().toLowerCase();
return (data: GroupDetailsRow) => {
const group = data.details;

Check warning on line 64 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L61-L64

Added lines #L61 - L64 were not covered by tests

return (

Check warning on line 66 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L66

Added line #L66 was not covered by tests
group.id.toLowerCase().indexOf(transformedFilter) != -1 ||
group.name.toLowerCase().indexOf(transformedFilter) != -1
);
};
};

@Component({
templateUrl: "new-groups.component.html",
})
export class NewGroupsComponent {
loading = true;

Check warning on line 77 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L76-L77

Added lines #L76 - L77 were not covered by tests
organizationId: string;

protected dataSource = new TableDataSource<GroupDetailsRow>();
protected searchControl = new FormControl("");

Check warning on line 81 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L80-L81

Added lines #L80 - L81 were not covered by tests

// Fixed sizes used for cdkVirtualScroll
protected rowHeight = 46;
protected rowHeightClass = `tw-h-[46px]`;

Check warning on line 85 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L84-L85

Added lines #L84 - L85 were not covered by tests

protected ModalTabType = GroupAddEditTabType;
private refreshGroups$ = new BehaviorSubject<void>(null);

Check warning on line 88 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L87-L88

Added lines #L87 - L88 were not covered by tests

constructor(
private apiService: ApiService,
private groupService: GroupService,
private route: ActivatedRoute,
private i18nService: I18nService,
private dialogService: DialogService,
private logService: LogService,
private collectionService: CollectionService,
private toastService: ToastService,

Check warning on line 98 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L98

Added line #L98 was not covered by tests
) {
this.route.params

Check warning on line 100 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L100

Added line #L100 was not covered by tests
.pipe(
tap((params) => (this.organizationId = params.organizationId)),

Check warning on line 102 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L102

Added line #L102 was not covered by tests
switchMap(() =>
combineLatest([

Check warning on line 104 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L104

Added line #L104 was not covered by tests
// collectionMap
from(this.apiService.getCollections(this.organizationId)).pipe(
concatMap((response) => this.toCollectionMap(response)),

Check warning on line 107 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L107

Added line #L107 was not covered by tests
),
// groups
this.refreshGroups$.pipe(
switchMap(() => this.groupService.getAll(this.organizationId)),

Check warning on line 111 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L111

Added line #L111 was not covered by tests
),
]),
),
map(([collectionMap, groups]) => {
return groups.map<GroupDetailsRow>((g) => ({

Check warning on line 116 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L116

Added line #L116 was not covered by tests
id: g.id,
name: g.name,
details: g,
checked: false,
collectionNames: g.collections
.map((c) => collectionMap[c.id]?.name)
.sort(this.i18nService.collator?.compare),
}));
}),
takeUntilDestroyed(),
)
.subscribe((groups) => {
this.dataSource.data = groups;
this.loading = false;

Check warning on line 130 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L129-L130

Added lines #L129 - L130 were not covered by tests
});

// Connect the search input to the table dataSource filter input
this.searchControl.valueChanges

Check warning on line 134 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L134

Added line #L134 was not covered by tests
.pipe(debounceTime(200), takeUntilDestroyed())
.subscribe((v) => (this.dataSource.filter = groupsFilter(v)));

Check warning on line 136 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L136

Added line #L136 was not covered by tests

this.route.queryParams.pipe(first(), takeUntilDestroyed()).subscribe((qParams) => {
this.searchControl.setValue(qParams.search);

Check warning on line 139 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L138-L139

Added lines #L138 - L139 were not covered by tests
});
}

async edit(
group: GroupDetailsRow,
startingTabIndex: GroupAddEditTabType = GroupAddEditTabType.Info,
) {
const dialogRef = openGroupAddEditDialog(this.dialogService, {

Check warning on line 147 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L147

Added line #L147 was not covered by tests
data: {
initialTab: startingTabIndex,
organizationId: this.organizationId,
groupId: group != null ? group.details.id : null,
},
});

const result = await lastValueFrom(dialogRef.closed);

Check warning on line 155 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L155

Added line #L155 was not covered by tests

if (result == GroupAddEditDialogResultType.Saved) {
this.refreshGroups$.next();

Check warning on line 158 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L158

Added line #L158 was not covered by tests
} else if (result == GroupAddEditDialogResultType.Deleted) {
this.removeGroup(group);

Check warning on line 160 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L160

Added line #L160 was not covered by tests
}
}

async add() {
await this.edit(null);

Check warning on line 165 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L165

Added line #L165 was not covered by tests
}

async delete(groupRow: GroupDetailsRow) {
const confirmed = await this.dialogService.openSimpleDialog({

Check warning on line 169 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L169

Added line #L169 was not covered by tests
title: groupRow.details.name,
content: { key: "deleteGroupConfirmation" },
type: "warning",
});
if (!confirmed) {
return false;

Check warning on line 175 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L175

Added line #L175 was not covered by tests
}

try {
await this.groupService.delete(this.organizationId, groupRow.details.id);
this.toastService.showToast({

Check warning on line 180 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L178-L180

Added lines #L178 - L180 were not covered by tests
variant: "success",
title: null,
message: this.i18nService.t("deletedGroupId", groupRow.details.name),
});
this.removeGroup(groupRow);

Check warning on line 185 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L185

Added line #L185 was not covered by tests
} catch (e) {
this.logService.error(e);

Check warning on line 187 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L187

Added line #L187 was not covered by tests
}
}

async deleteAllSelected() {
const groupsToDelete = this.dataSource.data.filter((g) => g.checked);

Check warning on line 192 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L192

Added line #L192 was not covered by tests

if (groupsToDelete.length == 0) {
return;

Check warning on line 195 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L195

Added line #L195 was not covered by tests
}

const deleteMessage = groupsToDelete.map((g) => g.details.name).join(", ");
const confirmed = await this.dialogService.openSimpleDialog({

Check warning on line 199 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L198-L199

Added lines #L198 - L199 were not covered by tests
title: {
key: "deleteMultipleGroupsConfirmation",
placeholders: [groupsToDelete.length.toString()],
},
content: deleteMessage,
type: "warning",
});
if (!confirmed) {
return false;

Check warning on line 208 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L208

Added line #L208 was not covered by tests
}

try {
await this.groupService.deleteMany(

Check warning on line 212 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L211-L212

Added lines #L211 - L212 were not covered by tests
this.organizationId,
groupsToDelete.map((g) => g.details.id),

Check warning on line 214 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L214

Added line #L214 was not covered by tests
);
this.toastService.showToast({

Check warning on line 216 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L216

Added line #L216 was not covered by tests
variant: "success",
title: null,
message: this.i18nService.t("deletedManyGroups", groupsToDelete.length.toString()),
});

groupsToDelete.forEach((g) => this.removeGroup(g));

Check warning on line 222 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L222

Added line #L222 was not covered by tests
} catch (e) {
this.logService.error(e);

Check warning on line 224 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L224

Added line #L224 was not covered by tests
}
}

check(groupRow: GroupDetailsRow) {
groupRow.checked = !groupRow.checked;

Check warning on line 229 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L229

Added line #L229 was not covered by tests
}

toggleAllVisible(event: Event) {
this.dataSource.filteredData.forEach(
(g) => (g.checked = (event.target as HTMLInputElement).checked),

Check warning on line 234 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L233-L234

Added lines #L233 - L234 were not covered by tests
);
}

private removeGroup(groupRow: GroupDetailsRow) {
// Assign a new array to dataSource.data to trigger the setters and update the table
this.dataSource.data = this.dataSource.data.filter((g) => g !== groupRow);

Check warning on line 240 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L240

Added line #L240 was not covered by tests
}

private async toCollectionMap(response: ListResponse<CollectionResponse>) {
const collections = response.data.map(
(r) => new Collection(new CollectionData(r as CollectionDetailsResponse)),

Check warning on line 245 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L244-L245

Added lines #L244 - L245 were not covered by tests
);
const decryptedCollections = await this.collectionService.decryptMany(collections);

Check warning on line 247 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L247

Added line #L247 was not covered by tests

// Convert to an object using collection Ids as keys for faster name lookups
const collectionMap: Record<string, CollectionView> = {};
decryptedCollections.forEach((c) => (collectionMap[c.id] = c));

Check warning on line 251 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L250-L251

Added lines #L250 - L251 were not covered by tests

return collectionMap;

Check warning on line 253 in apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/manage/new-groups.component.ts#L253

Added line #L253 was not covered by tests
}
}
Loading
Loading