1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-20 16:07:45 +01: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

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

View File

@ -18,12 +18,11 @@
{{$ctrl.i18n.typeLogins}}
</div>
<div class="list-section-items" ng-class="{'list-no-selection': !$ctrl.loginCiphers.length}">
<cipher-items
ng-if="$ctrl.loginCiphers.length"
ciphers="$ctrl.loginCiphers"
on-view="$ctrl.viewCipher(cipher)"
on-selected="$ctrl.fillCipher(cipher)"
selection-title="$ctrl.i18n.autoFill">
<cipher-items ng-if="$ctrl.loginCiphers.length"
ciphers="$ctrl.loginCiphers"
on-view="$ctrl.viewCipher(cipher)"
on-selected="$ctrl.fillCipher(cipher)"
selection-title="$ctrl.i18n.autoFill">
</cipher-items>
<div class="list-section-item" ng-if="!$ctrl.loginCiphers.length">
<p>{{$ctrl.i18n.autoFillInfo}}</p>
@ -31,18 +30,29 @@
</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">
{{$ctrl.i18n.other}}
{{$ctrl.i18n.cards}}
</div>
<div class="list-section-items">
<div class="list-section-item" ng-if="!$ctrl.otherCiphers.length">{{$ctrl.i18n.noItemsInList}}</div>
<cipher-items
ng-if="$ctrl.otherCiphers.length"
ciphers="$ctrl.otherCiphers"
on-view="$ctrl.viewCipher(cipher)"
on-selected="$ctrl.fillCipher(cipher)"
selection-title="$ctrl.i18n.autoFill">
<cipher-items ng-if="$ctrl.cardCiphers.length"
ciphers="$ctrl.cardCiphers"
on-view="$ctrl.viewCipher(cipher)"
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-selected="$ctrl.fillCipher(cipher)"
selection-title="$ctrl.i18n.autoFill">
</cipher-items>
</div>
</div>

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;
});
});