1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

group filtering

This commit is contained in:
Kyle Spearrin
2018-01-26 23:32:03 -05:00
parent f8aba3cc17
commit 375f2a1e02
5 changed files with 127 additions and 22 deletions

View File

@@ -21,16 +21,28 @@ export class CiphersComponent implements OnInit {
@Output() onAddCipher = new EventEmitter();
ciphers: CipherView[] = [];
private filter: (cipher: CipherView) => boolean = null;
constructor(private cipherService: CipherService) {
}
async ngOnInit() {
await this.loadCiphers();
await this.load();
}
async load(filter: (cipher: CipherView) => boolean = null) {
this.filter = filter;
let ciphers = await this.cipherService.getAllDecrypted();
if (this.filter == null) {
this.ciphers = ciphers;
} else {
this.ciphers = ciphers.filter(this.filter);
}
}
async refresh() {
await this.loadCiphers();
await this.load(this.filter);
}
updateCipher(cipher: CipherView) {
@@ -54,8 +66,4 @@ export class CiphersComponent implements OnInit {
addCipher() {
this.onAddCipher.emit();
}
private async loadCiphers() {
this.ciphers = await this.cipherService.getAllDecrypted();
}
}