From 10f33245c40c310ed2137539b0e1975242c9c080 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 24 Nov 2017 14:51:35 -0500 Subject: [PATCH] cards and ids in their own sections on tab --- src/_locales/en/messages.json | 6 +++ src/popup/app/current/current.component.html | 40 ++++++++++++-------- src/popup/app/current/current.component.ts | 35 +++++++++++------ 3 files changed, 54 insertions(+), 27 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index e6d027f75f..ba25706e00 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -971,5 +971,11 @@ }, "refresh": { "message": "Refresh" + }, + "cards": { + "message": "Cards" + }, + "identities": { + "message": "Identities" } } diff --git a/src/popup/app/current/current.component.html b/src/popup/app/current/current.component.html index 07d8083a1c..cfce2c25d6 100644 --- a/src/popup/app/current/current.component.html +++ b/src/popup/app/current/current.component.html @@ -18,12 +18,11 @@ {{$ctrl.i18n.typeLogins}}
- +

{{$ctrl.i18n.autoFillInfo}}

@@ -31,18 +30,29 @@
-
+
- {{$ctrl.i18n.other}} + {{$ctrl.i18n.cards}}
-
{{$ctrl.i18n.noItemsInList}}
- + + +
+
+
+
+ {{$ctrl.i18n.identities}} +
+
+
diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index 99a651b36e..6cbf384cec 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -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; }); });