From 9d737f76d157551b7b112eed4071292509baee5e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 9 Apr 2018 10:50:28 -0400 Subject: [PATCH] added vault searching --- src/popup2/vault/ciphers.component.html | 6 ++- src/popup2/vault/ciphers.component.ts | 2 + src/popup2/vault/current-tab.component.html | 6 ++- src/popup2/vault/current-tab.component.ts | 4 +- src/popup2/vault/groupings.component.html | 29 ++++++++++-- src/popup2/vault/groupings.component.ts | 16 +++++-- src/scss/base.scss | 49 +++++++++++++++++++++ 7 files changed, 99 insertions(+), 13 deletions(-) diff --git a/src/popup2/vault/ciphers.component.html b/src/popup2/vault/ciphers.component.html index df589f5868..bb4c562512 100644 --- a/src/popup2/vault/ciphers.component.html +++ b/src/popup2/vault/ciphers.component.html @@ -5,8 +5,10 @@ {{'back' | i18n}} -
- {{searchPlaceholder || ('searchVault' | i18n)}} +
-
- {{'currentTab' | i18n}} +
-

{{'loading' | i18n}}

- +
+ + + +

{{'noItemsInList' | i18n}}

+ +
+
+
{{'favorites' | i18n}} @@ -111,4 +120,16 @@
+ +
+

{{'noItemsInList' | i18n}}

+
+
+
+ +
+
+
diff --git a/src/popup2/vault/groupings.component.ts b/src/popup2/vault/groupings.component.ts index 3d6341df44..f1b54c7ac1 100644 --- a/src/popup2/vault/groupings.component.ts +++ b/src/popup2/vault/groupings.component.ts @@ -5,7 +5,10 @@ import { OnDestroy, OnInit, } from '@angular/core'; -import { Router } from '@angular/router'; +import { + ActivatedRoute, + Router, +} from '@angular/router'; import { CipherType } from 'jslib/enums/cipherType'; @@ -36,11 +39,12 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit collectionCounts = new Map(); typeCounts = new Map(); showNoFolderCiphers = false; + searchText: string; constructor(collectionService: CollectionService, folderService: FolderService, private cipherService: CipherService, private router: Router, private ngZone: NgZone, private broadcasterService: BroadcasterService, - private changeDetectorRef: ChangeDetectorRef) { + private changeDetectorRef: ChangeDetectorRef, private route: ActivatedRoute) { super(collectionService, folderService); } @@ -61,7 +65,13 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit }) }); - this.load(); + this.route.queryParams.subscribe(async (params) => { + if (params.searchText) { + this.searchText = params.searchText; + } + + this.load(); + }); } ngOnDestroy() { diff --git a/src/scss/base.scss b/src/scss/base.scss index 15c17e5963..fdd9d844f4 100644 --- a/src/scss/base.scss +++ b/src/scss/base.scss @@ -145,6 +145,41 @@ header { .title { font-weight: bold; } + + .search { + padding: 7px; + width: 100%; + text-align: left; + position: relative; + display: flex; + + .fa { + position: absolute; + top: 15px; + left: 15px; + color: lighten($brand-primary, 30%); + } + + input { + width: 100%; + margin: 0; + background: darken($brand-primary, 8%); + border: none; + color: white; + padding: 5px 10px 5px 30px; + border-radius: $border-radius; + + &:focus { + border-radius: $border-radius; + outline: none; + background: darken($brand-primary, 10%); + } + + &::-webkit-input-placeholder { + color: lighten($brand-primary, 35%); + } + } + } } .content { @@ -232,3 +267,17 @@ content { bottom: 55px; } } + +.no-items { + display: flex; + height: 100%; + flex-direction: column; + justify-content: center; + align-items: center; + text-align: center; + + .fa { + margin-bottom: 10px; + color: $list-icon-color; + } +}