1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

org vault listing from apis

This commit is contained in:
Kyle Spearrin
2018-07-03 23:33:15 -04:00
parent af43232567
commit ff8c1dfea9
10 changed files with 68 additions and 19 deletions

View File

@@ -19,20 +19,15 @@ export class CiphersComponent {
ciphers: CipherView[] = [];
searchText: string;
searchPlaceholder: string = null;
private filter: (cipher: CipherView) => boolean = null;
protected allCiphers: CipherView[] = [];
protected filter: (cipher: CipherView) => boolean = null;
constructor(protected cipherService: CipherService) { }
async load(filter: (cipher: CipherView) => boolean = null) {
this.filter = filter;
const ciphers = await this.cipherService.getAllDecrypted();
if (this.filter == null) {
this.ciphers = ciphers;
} else {
this.ciphers = ciphers.filter(this.filter);
}
this.allCiphers = await this.cipherService.getAllDecrypted();
this.applyFilter(filter);
this.loaded = true;
}
@@ -42,6 +37,15 @@ export class CiphersComponent {
await this.load(this.filter);
}
async applyFilter(filter: (cipher: CipherView) => boolean = null) {
this.filter = filter;
if (this.filter == null) {
this.ciphers = this.allCiphers;
} else {
this.ciphers = this.allCiphers.filter(this.filter);
}
}
selectCipher(cipher: CipherView) {
this.onCipherClicked.emit(cipher);
}