mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
org vault listing from apis
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ import { CollectionService } from '../../abstractions/collection.service';
|
||||
import { FolderService } from '../../abstractions/folder.service';
|
||||
|
||||
export class GroupingsComponent {
|
||||
@Input() showFolders = true;
|
||||
@Input() showCollections = true;
|
||||
@Input() showFavorites = true;
|
||||
|
||||
@Output() onAllClicked = new EventEmitter();
|
||||
@Output() onFavoritesClicked = new EventEmitter();
|
||||
@Output() onCipherTypeClicked = new EventEmitter<CipherType>();
|
||||
@@ -44,11 +48,22 @@ export class GroupingsComponent {
|
||||
}
|
||||
}
|
||||
|
||||
async loadCollections() {
|
||||
this.collections = await this.collectionService.getAllDecrypted();
|
||||
async loadCollections(organizationId?: string) {
|
||||
if (!this.showCollections) {
|
||||
return;
|
||||
}
|
||||
const collections = await this.collectionService.getAllDecrypted();
|
||||
if (organizationId != null) {
|
||||
this.collections = collections.filter((c) => c.organizationId === organizationId);
|
||||
} else {
|
||||
this.collections = collections;
|
||||
}
|
||||
}
|
||||
|
||||
async loadFolders() {
|
||||
if (!this.showFolders) {
|
||||
return;
|
||||
}
|
||||
this.folders = await this.folderService.getAllDecrypted();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user