From a9067f56188b4c69e82ccf2443d085109ad5bb79 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 13 Aug 2018 09:43:46 -0400 Subject: [PATCH] implement search service --- jslib | 2 +- package-lock.json | 35 ++++++++++------------------ package.json | 4 ++-- src/app/services.module.ts | 7 +++++- src/app/vault/ciphers.component.html | 10 ++++---- src/app/vault/ciphers.component.ts | 6 ++--- 6 files changed, 29 insertions(+), 35 deletions(-) diff --git a/jslib b/jslib index 4ca7a970..b7244480 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 4ca7a9709e9ccd0e67ce09309ae605f2057bf089 +Subproject commit b724448081a0962d3c3894319502ed380fe40145 diff --git a/package-lock.json b/package-lock.json index 7c6f5b8f..6775a595 100644 --- a/package-lock.json +++ b/package-lock.json @@ -142,9 +142,9 @@ } }, "@types/lunr": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.5.tgz", - "integrity": "sha512-esk3CG25hRtHsVHm+LOjiSFYdw8be3uIY653WUwR43Bro914HSimPgPpqgajkhTJ0awK3RQfaIxP7zvbtCpcyg==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.6.tgz", + "integrity": "sha512-Bz6fUhX1llTa7ygQJN3ttoVkkrpW7xxSEP7D7OYFO/FCBKqKqruRUZtJzTtYA0GkQX13lxU5u+8LuCviJlAXkQ==", "dev": true }, "@types/node": { @@ -4125,14 +4125,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4147,20 +4145,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4277,8 +4272,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4290,7 +4284,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4305,7 +4298,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4424,8 +4416,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4437,7 +4428,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4559,7 +4549,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6544,9 +6533,9 @@ } }, "lunr": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.1.6.tgz", - "integrity": "sha512-ydJpB8CX8cZ/VE+KMaYaFcZ6+o2LruM6NG76VXdflYTgluvVemz1lW4anE+pyBbLvxJHZdvD1Jy/fOqdzAEJog==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.1.tgz", + "integrity": "sha1-ETYWorYC3cEJMqe/ik5uV+v+zfI=" }, "magic-string": { "version": "0.22.5", diff --git a/package.json b/package.json index 22183873..2c1d4b1d 100644 --- a/package.json +++ b/package.json @@ -192,7 +192,7 @@ "@angular/compiler-cli": "5.2.0", "@ngtools/webpack": "1.10.2", "@types/lowdb": "^1.0.1", - "@types/lunr": "2.1.5", + "@types/lunr": "^2.1.6", "@types/node": "8.0.19", "@types/node-forge": "0.7.1", "@types/papaparse": "4.1.31", @@ -246,7 +246,7 @@ "electron-updater": "3.0.3", "keytar": "4.2.1", "lowdb": "1.0.0", - "lunr": "2.1.6", + "lunr": "2.3.1", "node-forge": "0.7.1", "nord": "0.2.1", "papaparse": "4.3.5", diff --git a/src/app/services.module.ts b/src/app/services.module.ts index 3f0704d3..d7bf01ad 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -37,6 +37,7 @@ import { FolderService } from 'jslib/services/folder.service'; import { LockService } from 'jslib/services/lock.service'; import { LowdbStorageService } from 'jslib/services/lowdbStorage.service'; import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service'; +import { SearchService } from 'jslib/services/search.service'; import { SettingsService } from 'jslib/services/settings.service'; import { StateService } from 'jslib/services/state.service'; import { SyncService } from 'jslib/services/sync.service'; @@ -64,6 +65,7 @@ import { PasswordGenerationService as PasswordGenerationServiceAbstraction, } from 'jslib/abstractions/passwordGeneration.service'; import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from 'jslib/abstractions/platformUtils.service'; +import { SearchService as SearchServiceAbstraction } from 'jslib/abstractions/search.service'; import { SettingsService as SettingsServiceAbstraction } from 'jslib/abstractions/settings.service'; import { StateService as StateServiceAbstraction } from 'jslib/abstractions/state.service'; import { StorageService as StorageServiceAbstraction } from 'jslib/abstractions/storage.service'; @@ -90,13 +92,15 @@ const apiService = new ApiService(tokenService, platformUtilsService, const environmentService = new EnvironmentService(apiService, storageService); const userService = new UserService(tokenService, storageService); const settingsService = new SettingsService(userService, storageService); +export let searchService: SearchService = null; const cipherService = new CipherService(cryptoService, userService, settingsService, - apiService, storageService, i18nService, platformUtilsService); + apiService, storageService, i18nService, platformUtilsService, () => searchService); const folderService = new FolderService(cryptoService, userService, apiService, storageService, i18nService, cipherService); const collectionService = new CollectionService(cryptoService, userService, storageService, i18nService); const lockService = new LockService(cipherService, folderService, collectionService, cryptoService, platformUtilsService, storageService, messagingService, null); +searchService = new SearchService(cipherService, platformUtilsService); const syncService = new SyncService(userService, apiService, settingsService, folderService, cipherService, cryptoService, collectionService, storageService, messagingService, async (expired: boolean) => messagingService.send('logout', { expired: expired })); @@ -181,6 +185,7 @@ export function initFactory(): Function { { provide: StateServiceAbstraction, useValue: stateService }, { provide: LogServiceAbstraction, useValue: logService }, { provide: ExportServiceAbstraction, useValue: exportService }, + { provide: SearchServiceAbstraction, useValue: searchService }, { provide: APP_INITIALIZER, useFactory: initFactory, diff --git a/src/app/vault/ciphers.component.html b/src/app/vault/ciphers.component.html index 19633e0f..7eac3eac 100644 --- a/src/app/vault/ciphers.component.html +++ b/src/app/vault/ciphers.component.html @@ -1,14 +1,14 @@
- -
- + -
+
diff --git a/src/app/vault/ciphers.component.ts b/src/app/vault/ciphers.component.ts index 83bf1eef..aa5da447 100644 --- a/src/app/vault/ciphers.component.ts +++ b/src/app/vault/ciphers.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; -import { CipherService } from 'jslib/abstractions/cipher.service'; +import { SearchService } from 'jslib/abstractions/search.service'; import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/components/ciphers.component'; @@ -9,7 +9,7 @@ import { CiphersComponent as BaseCiphersComponent } from 'jslib/angular/componen templateUrl: 'ciphers.component.html', }) export class CiphersComponent extends BaseCiphersComponent { - constructor(cipherService: CipherService) { - super(cipherService); + constructor(searchService: SearchService) { + super(searchService); } }