mirror of
https://github.com/bitwarden/browser
synced 2026-01-31 00:33:33 +00:00
added 'All items' filter
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
<bit-nav-item
|
||||
icon="bwi-filter"
|
||||
[forceActiveStyles]="activeFilter()?.selectedCipherTypeNode?.node?.id === 'AllItems'"
|
||||
(click)="applyAllItemsFilter()"
|
||||
[text]="'allItems' | i18n"
|
||||
[attr.aria-pressed]="activeFilter()?.selectedCipherTypeNode?.node?.id === 'AllItems'"
|
||||
[appA11yTitle]="'allItems' | i18n"
|
||||
/>
|
||||
@for (typeFilter of typeFilters$ | async; track typeFilter) {
|
||||
<bit-nav-item
|
||||
[icon]="typeFilter.node.icon"
|
||||
[forceActiveStyles]="activeFilter()?.selectedCipherTypeNode.node.type === typeFilter.node.type"
|
||||
(click)="applyFilter(typeFilter)"
|
||||
(click)="applyTypeFilter(typeFilter)"
|
||||
[text]="typeFilter.node.name"
|
||||
[attr.aria-pressed]="activeFilter()?.selectedCipherTypeNode.node.type === typeFilter.node.type"
|
||||
[appA11yTitle]="typeFilter.node.name"
|
||||
|
||||
@@ -5,6 +5,7 @@ import { map, shareReplay } from "rxjs";
|
||||
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
|
||||
import { RestrictedItemTypesService } from "@bitwarden/common/vault/services/restricted-item-types.service";
|
||||
import { NavigationModule, A11yTitleDirective } from "@bitwarden/components";
|
||||
import { I18nPipe } from "@bitwarden/ui-common";
|
||||
import { VaultFilter, CipherTypeFilter } from "@bitwarden/vault";
|
||||
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
||||
@@ -12,7 +13,7 @@ import { VaultFilter, CipherTypeFilter } from "@bitwarden/vault";
|
||||
@Component({
|
||||
selector: "app-type-filter",
|
||||
templateUrl: "type-filter.component.html",
|
||||
imports: [CommonModule, A11yTitleDirective, NavigationModule],
|
||||
imports: [CommonModule, A11yTitleDirective, NavigationModule, I18nPipe],
|
||||
})
|
||||
export class TypeFilterComponent {
|
||||
private restrictedItemTypesService: RestrictedItemTypesService = inject(
|
||||
@@ -22,7 +23,7 @@ export class TypeFilterComponent {
|
||||
protected readonly cipherTypes = input<TreeNode<CipherTypeFilter>>();
|
||||
protected readonly activeFilter = input<VaultFilter>();
|
||||
|
||||
protected applyFilter(cipherType: TreeNode<CipherTypeFilter>) {
|
||||
protected applyTypeFilter(cipherType: TreeNode<CipherTypeFilter>) {
|
||||
const filter = this.activeFilter();
|
||||
|
||||
if (filter) {
|
||||
@@ -30,6 +31,14 @@ export class TypeFilterComponent {
|
||||
}
|
||||
}
|
||||
|
||||
protected applyAllItemsFilter() {
|
||||
const filter = this.activeFilter();
|
||||
|
||||
if (filter) {
|
||||
filter.selectedCipherTypeNode = this.cipherTypes();
|
||||
}
|
||||
}
|
||||
|
||||
protected typeFilters$ = this.restrictedItemTypesService.restricted$.pipe(
|
||||
map((restrictedItemTypes) =>
|
||||
// Filter out restricted item types from the typeFilters array
|
||||
|
||||
Reference in New Issue
Block a user