1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

cipher listing titles

This commit is contained in:
Kyle Spearrin
2018-04-09 14:45:35 -04:00
parent a3fc1c8d30
commit 82f3c39167
4 changed files with 57 additions and 4 deletions

View File

@@ -512,6 +512,9 @@
"searchCollection": { "searchCollection": {
"message": "Search collection" "message": "Search collection"
}, },
"searchType": {
"message": "Search type"
},
"noneFolder": { "noneFolder": {
"message": "No Folder", "message": "No Folder",
"description": "This is the folder for uncategorized items" "description": "This is the folder for uncategorized items"
@@ -1015,6 +1018,12 @@
"identities": { "identities": {
"message": "Identities" "message": "Identities"
}, },
"logins": {
"message": "Logins"
},
"secureNotes": {
"message": "Secure Notes"
},
"clear": { "clear": {
"message": "Clear" "message": "Clear"
}, },
@@ -1073,5 +1082,8 @@
}, },
"types": { "types": {
"message": "Types" "message": "Types"
},
"allItems": {
"message": "All Items"
} }
} }

View File

@@ -20,7 +20,8 @@
<ng-container *ngIf="(ciphers | searchCiphers: searchText) as searchedCiphers"> <ng-container *ngIf="(ciphers | searchCiphers: searchText) as searchedCiphers">
<div class="box list only-list" *ngIf="searchedCiphers.length > 0"> <div class="box list only-list" *ngIf="searchedCiphers.length > 0">
<div class="box-header"> <div class="box-header">
Some name here {{groupingTitle}}
<span class="flex-right">{{searchedCiphers.length}}</span>
</div> </div>
<div class="box-content"> <div class="box-content">
<app-ciphers-list [ciphers]="searchedCiphers" title="{{'viewItem' | i18n}}" <app-ciphers-list [ciphers]="searchedCiphers" title="{{'viewItem' | i18n}}"

View File

@@ -11,9 +11,14 @@ import {
Router, Router,
} from '@angular/router'; } from '@angular/router';
import { FolderService } from 'jslib/abstractions/folder.service';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { StateService } from 'jslib/abstractions/state.service'; import { StateService } from 'jslib/abstractions/state.service';
import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView'; import { CipherView } from 'jslib/models/view/cipherView';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@@ -29,6 +34,7 @@ const ComponentId = 'CiphersComponent';
templateUrl: 'ciphers.component.html', templateUrl: 'ciphers.component.html',
}) })
export class CiphersComponent extends BaseCiphersComponent implements OnInit, OnDestroy { export class CiphersComponent extends BaseCiphersComponent implements OnInit, OnDestroy {
groupingTitle: string;
searchText: string; searchText: string;
state: any; state: any;
@@ -36,20 +42,54 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
private router: Router, private location: Location, private router: Router, private location: Location,
private ngZone: NgZone, private broadcasterService: BroadcasterService, private ngZone: NgZone, private broadcasterService: BroadcasterService,
private changeDetectorRef: ChangeDetectorRef, private stateService: StateService, private changeDetectorRef: ChangeDetectorRef, private stateService: StateService,
private popupUtils: PopupUtilsService) { private popupUtils: PopupUtilsService, private i18nService: I18nService,
private folderService: FolderService, private collectionService: CollectionService) {
super(cipherService); super(cipherService);
} }
async ngOnInit() { async ngOnInit() {
this.route.queryParams.subscribe(async (params) => { this.route.queryParams.subscribe(async (params) => {
if (params.type) { if (params.type) {
this.searchPlaceholder = this.i18nService.t('searchType');
const t = parseInt(params.type, null); const t = parseInt(params.type, null);
switch (t) {
case CipherType.Login:
this.groupingTitle = this.i18nService.t('logins');
break;
case CipherType.Card:
this.groupingTitle = this.i18nService.t('cards');
break;
case CipherType.Identity:
this.groupingTitle = this.i18nService.t('identities');
break;
case CipherType.SecureNote:
this.groupingTitle = this.i18nService.t('secureNotes');
break;
default:
break;
}
await super.load((c) => c.type === t); await super.load((c) => c.type === t);
} else if (params.folderId) { } else if (params.folderId) {
await super.load((c) => c.folderId === params.folderId); const folderId = params.folderId === 'none' ? null : params.folderId;
this.searchPlaceholder = this.i18nService.t('searchFolder');
if (folderId != null) {
const folder = await this.folderService.get(folderId);
if (folder != null) {
this.groupingTitle = (await folder.decrypt()).name;
}
} else {
this.groupingTitle = this.i18nService.t('noneFolder');
}
await super.load((c) => c.folderId === folderId);
} else if (params.collectionId) { } else if (params.collectionId) {
this.searchPlaceholder = this.i18nService.t('searchCollection');
const collection = await this.collectionService.get(params.collectionId);
if (collection != null) {
this.groupingTitle = (await collection.decrypt()).name;
}
await super.load((c) => c.collectionIds.indexOf(params.collectionId) > -1); await super.load((c) => c.collectionIds.indexOf(params.collectionId) > -1);
} else { } else {
this.groupingTitle = this.i18nService.t('allItems');
await super.load(); await super.load();
} }

View File

@@ -156,7 +156,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
async selectFolder(folder: FolderView) { async selectFolder(folder: FolderView) {
super.selectFolder(folder); super.selectFolder(folder);
this.router.navigate(['/ciphers'], { queryParams: { folderId: folder.id } }); this.router.navigate(['/ciphers'], { queryParams: { folderId: folder.id || 'none' } });
} }
async selectCollection(collection: CollectionView) { async selectCollection(collection: CollectionView) {