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

@@ -15,7 +15,11 @@ import { Location } from '@angular/common';
import { CiphersComponent } from './ciphers.component';
import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView';
import { CollectionView } from 'jslib/models/view/collectionView';
import { FolderView } from 'jslib/models/view/folderView';
@Component({
selector: 'app-vault',
@@ -100,6 +104,26 @@ export class VaultComponent implements OnInit {
this.go({ action: this.action, cipherId: this.cipherId });
}
async clearGroupingFilters() {
await this.ciphersComponent.load();
}
async filterFavorites() {
await this.ciphersComponent.load((c) => c.favorite);
}
async filterCipherType(type: CipherType) {
await this.ciphersComponent.load((c) => c.type === type);
}
async filterFolder(folder: FolderView) {
await this.ciphersComponent.load((c) => c.folderId === folder.id);
}
async filterCollection(collection: CollectionView) {
await this.ciphersComponent.load((c) => c.collectionIds.indexOf(collection.id) > -1);
}
private go(queryParams: any) {
const url = this.router.createUrlTree(['vault'], { queryParams: queryParams }).toString();
this.location.go(url);