6 changed files with 31 additions and 7 deletions
@ -0,0 +1,18 @@ |
|||||||
|
import { Pipe, PipeTransform } from "@angular/core"; |
||||||
|
|
||||||
|
import { CipherView } from "@bitwarden/common/models/view/cipher.view"; |
||||||
|
|
||||||
|
import { NewVaultFilterModel } from "./vault-filter.model"; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: "cipherFilter", |
||||||
|
}) |
||||||
|
export class CipherFilterPipe implements PipeTransform { |
||||||
|
transform(ciphers: CipherView[], ...[filter]: [NewVaultFilterModel]) { |
||||||
|
if (filter.collectionId) { |
||||||
|
return ciphers.filter((c) => c.collectionIds.includes(filter.collectionId)); |
||||||
|
} |
||||||
|
|
||||||
|
return ciphers; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
export interface NewVaultFilterModel { |
||||||
|
collectionId?: string; |
||||||
|
} |
||||||
Loading…
Reference in new issue