1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

fix error in console (#17468)

This commit is contained in:
Brandon Treston
2025-11-19 13:32:50 -05:00
committed by GitHub
parent 0912d1abe8
commit 28dc244fd3
2 changed files with 19 additions and 22 deletions

View File

@@ -1 +1 @@
<bit-badge-list [items]="groupNames" [maxItems]="3" variant="secondary"></bit-badge-list>
<bit-badge-list [items]="groupNames()" [maxItems]="3" variant="secondary"></bit-badge-list>

View File

@@ -1,36 +1,33 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Component, Input, OnChanges } from "@angular/core";
import { ChangeDetectionStrategy, Component, computed, input } from "@angular/core";
import { SelectionReadOnlyRequest } from "@bitwarden/common/admin-console/models/request/selection-read-only.request";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { GroupView } from "../../core";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "app-group-badge",
templateUrl: "group-name-badge.component.html",
standalone: false,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class GroupNameBadgeComponent implements OnChanges {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() selectedGroups: SelectionReadOnlyRequest[];
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() allGroups: GroupView[];
export class GroupNameBadgeComponent {
readonly selectedGroups = input<SelectionReadOnlyRequest[]>([]);
readonly allGroups = input<GroupView[]>([]);
protected groupNames: string[] = [];
protected readonly groupNames = computed(() => {
const allGroups = this.allGroups();
if (!allGroups) {
return [];
}
return this.selectedGroups()
.map((g) => {
return allGroups.find((o) => o.id === g.id)?.name;
})
.filter((name): name is string => name !== undefined)
.sort(this.i18nService.collator.compare);
});
constructor(private i18nService: I18nService) {}
ngOnChanges() {
this.groupNames = this.selectedGroups
.map((g) => {
return this.allGroups.find((o) => o.id === g.id)?.name;
})
.sort(this.i18nService.collator.compare);
}
}