1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

unassigned collection filtering

This commit is contained in:
Kyle Spearrin 2018-07-03 23:43:57 -04:00
parent 3c45e7dac9
commit db43f817f7
3 changed files with 19 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import {
import { ApiService } from 'jslib/abstractions/api.service'; import { ApiService } from 'jslib/abstractions/api.service';
import { CollectionService } from 'jslib/abstractions/collection.service'; import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
import { UserService } from 'jslib/abstractions/user.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/components/groupings.component'; import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/components/groupings.component';
@ -29,7 +29,7 @@ export class GroupingsComponent extends BaseGroupingsComponent {
searchPlaceholder: string = null; searchPlaceholder: string = null;
constructor(collectionService: CollectionService, folderService: FolderService, constructor(collectionService: CollectionService, folderService: FolderService,
private apiService: ApiService, private userService: UserService) { private apiService: ApiService, private i18nService: I18nService) {
super(collectionService, folderService); super(collectionService, folderService);
} }
@ -57,5 +57,12 @@ export class GroupingsComponent extends BaseGroupingsComponent {
} else { } else {
await super.loadCollections(this.organization.id); await super.loadCollections(this.organization.id);
} }
const unassignedCollection = new CollectionView();
unassignedCollection.name = this.i18nService.t('unassigned');
unassignedCollection.id = 'unassigned';
unassignedCollection.organizationId = this.organization.id;
unassignedCollection.readOnly = true;
this.collections.push(unassignedCollection);
} }
} }

View File

@ -92,7 +92,13 @@ export class VaultComponent implements OnInit {
async filterCollection(collectionId: string, load = false) { async filterCollection(collectionId: string, load = false) {
this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchCollection'); this.groupingsComponent.searchPlaceholder = this.i18nService.t('searchCollection');
const filter = (c: CipherView) => c.collectionIds.indexOf(collectionId) > -1; const filter = (c: CipherView) => {
if (collectionId === 'unassigned') {
return c.collectionIds == null || c.collectionIds.length === 0;
} else {
return c.collectionIds.indexOf(collectionId) > -1;
}
};
if (load) { if (load) {
await this.ciphersComponent.load(filter); await this.ciphersComponent.load(filter);
} else { } else {

View File

@ -150,6 +150,9 @@
"remove": { "remove": {
"message": "Remove" "message": "Remove"
}, },
"unassigned": {
"message": "Unassigned"
},
"noneFolder": { "noneFolder": {
"message": "No Folder", "message": "No Folder",
"description": "This is the folder for uncategorized items" "description": "This is the folder for uncategorized items"