1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

cards and ids in their own sections on tab

This commit is contained in:
Kyle Spearrin
2017-11-24 14:51:35 -05:00
parent 3eff62787c
commit 10f33245c4
3 changed files with 54 additions and 27 deletions

View File

@@ -7,7 +7,8 @@ export class CurrentController {
i18n: any;
pageDetails: any = [];
loaded: boolean = false;
otherCiphers: any = [];
cardCiphers: any = [];
identityCiphers: any = [];
loginCiphers: any = [];
url: any;
domain: any;
@@ -119,22 +120,32 @@ export class CurrentController {
this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes).then((ciphers: any[]) => {
const loginCiphers: any = [];
const otherCiphers: any = [];
const cardCiphers: any = [];
const identityCiphers: any = [];
ciphers.forEach((cipher) => {
if (cipher.type === CipherType.Login) {
loginCiphers.push(cipher);
} else {
otherCiphers.push(cipher);
const sortedCiphers = this.$filter('orderBy')(ciphers,
[this.sortUriMatch, this.sortLastUsed, 'name', 'subTitle']);
sortedCiphers.forEach((cipher: any) => {
switch (cipher.type) {
case CipherType.Login:
loginCiphers.push(cipher);
break;
case CipherType.Card:
cardCiphers.push(cipher);
break;
case CipherType.Identity:
identityCiphers.push(cipher);
break;
default:
break;
}
});
this.$timeout(() => {
this.loginCiphers = this.$filter('orderBy')(
loginCiphers,
[this.sortUriMatch, this.sortLastUsed, 'name', 'subTitle'],
);
this.otherCiphers = this.$filter('orderBy')(otherCiphers, [this.sortLastUsed, 'name', 'subTitle']);
this.loginCiphers = loginCiphers;
this.cardCiphers = cardCiphers;
this.identityCiphers = identityCiphers;
this.loaded = true;
});
});