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

@ -971,5 +971,11 @@
}, },
"refresh": { "refresh": {
"message": "Refresh" "message": "Refresh"
},
"cards": {
"message": "Cards"
},
"identities": {
"message": "Identities"
} }
} }

View File

@ -18,8 +18,7 @@
{{$ctrl.i18n.typeLogins}} {{$ctrl.i18n.typeLogins}}
</div> </div>
<div class="list-section-items" ng-class="{'list-no-selection': !$ctrl.loginCiphers.length}"> <div class="list-section-items" ng-class="{'list-no-selection': !$ctrl.loginCiphers.length}">
<cipher-items <cipher-items ng-if="$ctrl.loginCiphers.length"
ng-if="$ctrl.loginCiphers.length"
ciphers="$ctrl.loginCiphers" ciphers="$ctrl.loginCiphers"
on-view="$ctrl.viewCipher(cipher)" on-view="$ctrl.viewCipher(cipher)"
on-selected="$ctrl.fillCipher(cipher)" on-selected="$ctrl.fillCipher(cipher)"
@ -31,15 +30,26 @@
</div> </div>
</div> </div>
</div> </div>
<div class="list-section" ng-class="{'list-no-selection': !$ctrl.otherCiphers.length}"> <div class="list-section" ng-if="$ctrl.cardCiphers.length">
<div class="list-section-header"> <div class="list-section-header">
{{$ctrl.i18n.other}} {{$ctrl.i18n.cards}}
</div> </div>
<div class="list-section-items"> <div class="list-section-items">
<div class="list-section-item" ng-if="!$ctrl.otherCiphers.length">{{$ctrl.i18n.noItemsInList}}</div> <cipher-items ng-if="$ctrl.cardCiphers.length"
<cipher-items ciphers="$ctrl.cardCiphers"
ng-if="$ctrl.otherCiphers.length" on-view="$ctrl.viewCipher(cipher)"
ciphers="$ctrl.otherCiphers" on-selected="$ctrl.fillCipher(cipher)"
selection-title="$ctrl.i18n.autoFill">
</cipher-items>
</div>
</div>
<div class="list-section" ng-if="$ctrl.identityCiphers.length">
<div class="list-section-header">
{{$ctrl.i18n.identities}}
</div>
<div class="list-section-items">
<cipher-items ng-if="$ctrl.identityCiphers.length"
ciphers="$ctrl.identityCiphers"
on-view="$ctrl.viewCipher(cipher)" on-view="$ctrl.viewCipher(cipher)"
on-selected="$ctrl.fillCipher(cipher)" on-selected="$ctrl.fillCipher(cipher)"
selection-title="$ctrl.i18n.autoFill"> selection-title="$ctrl.i18n.autoFill">

View File

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