mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
fix error in console (#17468)
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -1,36 +1,33 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
import { ChangeDetectionStrategy, Component, computed, input } from "@angular/core";
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Component, Input, OnChanges } from "@angular/core";
|
|
||||||
|
|
||||||
import { SelectionReadOnlyRequest } from "@bitwarden/common/admin-console/models/request/selection-read-only.request";
|
import { SelectionReadOnlyRequest } from "@bitwarden/common/admin-console/models/request/selection-read-only.request";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
|
|
||||||
import { GroupView } from "../../core";
|
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({
|
@Component({
|
||||||
selector: "app-group-badge",
|
selector: "app-group-badge",
|
||||||
templateUrl: "group-name-badge.component.html",
|
templateUrl: "group-name-badge.component.html",
|
||||||
standalone: false,
|
standalone: false,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class GroupNameBadgeComponent implements OnChanges {
|
export class GroupNameBadgeComponent {
|
||||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
|
readonly selectedGroups = input<SelectionReadOnlyRequest[]>([]);
|
||||||
// eslint-disable-next-line @angular-eslint/prefer-signals
|
readonly allGroups = input<GroupView[]>([]);
|
||||||
@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[];
|
|
||||||
|
|
||||||
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) {}
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user