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:
parent
3c45e7dac9
commit
db43f817f7
@ -8,7 +8,7 @@ import {
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { CollectionService } from 'jslib/abstractions/collection.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';
|
||||
|
||||
@ -29,7 +29,7 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
||||
searchPlaceholder: string = null;
|
||||
|
||||
constructor(collectionService: CollectionService, folderService: FolderService,
|
||||
private apiService: ApiService, private userService: UserService) {
|
||||
private apiService: ApiService, private i18nService: I18nService) {
|
||||
super(collectionService, folderService);
|
||||
}
|
||||
|
||||
@ -57,5 +57,12 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,13 @@ export class VaultComponent implements OnInit {
|
||||
|
||||
async filterCollection(collectionId: string, load = false) {
|
||||
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) {
|
||||
await this.ciphersComponent.load(filter);
|
||||
} else {
|
||||
|
@ -150,6 +150,9 @@
|
||||
"remove": {
|
||||
"message": "Remove"
|
||||
},
|
||||
"unassigned": {
|
||||
"message": "Unassigned"
|
||||
},
|
||||
"noneFolder": {
|
||||
"message": "No Folder",
|
||||
"description": "This is the folder for uncategorized items"
|
||||
|
Loading…
Reference in New Issue
Block a user