mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-30 12:54:31 +01:00
implement search service
This commit is contained in:
parent
d4d57064a7
commit
a9067f5618
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit 4ca7a9709e9ccd0e67ce09309ae605f2057bf089
|
Subproject commit b724448081a0962d3c3894319502ed380fe40145
|
35
package-lock.json
generated
35
package-lock.json
generated
@ -142,9 +142,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/lunr": {
|
"@types/lunr": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.6.tgz",
|
||||||
"integrity": "sha512-esk3CG25hRtHsVHm+LOjiSFYdw8be3uIY653WUwR43Bro914HSimPgPpqgajkhTJ0awK3RQfaIxP7zvbtCpcyg==",
|
"integrity": "sha512-Bz6fUhX1llTa7ygQJN3ttoVkkrpW7xxSEP7D7OYFO/FCBKqKqruRUZtJzTtYA0GkQX13lxU5u+8LuCviJlAXkQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
@ -4125,14 +4125,12 @@
|
|||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@ -4147,20 +4145,17 @@
|
|||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@ -4277,8 +4272,7 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
@ -4290,7 +4284,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
@ -4305,7 +4298,6 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@ -4424,8 +4416,7 @@
|
|||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
@ -4437,7 +4428,6 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@ -4559,7 +4549,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
@ -6544,9 +6533,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lunr": {
|
"lunr": {
|
||||||
"version": "2.1.6",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.1.tgz",
|
||||||
"integrity": "sha512-ydJpB8CX8cZ/VE+KMaYaFcZ6+o2LruM6NG76VXdflYTgluvVemz1lW4anE+pyBbLvxJHZdvD1Jy/fOqdzAEJog=="
|
"integrity": "sha1-ETYWorYC3cEJMqe/ik5uV+v+zfI="
|
||||||
},
|
},
|
||||||
"magic-string": {
|
"magic-string": {
|
||||||
"version": "0.22.5",
|
"version": "0.22.5",
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
"@angular/compiler-cli": "5.2.0",
|
"@angular/compiler-cli": "5.2.0",
|
||||||
"@ngtools/webpack": "1.10.2",
|
"@ngtools/webpack": "1.10.2",
|
||||||
"@types/lowdb": "^1.0.1",
|
"@types/lowdb": "^1.0.1",
|
||||||
"@types/lunr": "2.1.5",
|
"@types/lunr": "^2.1.6",
|
||||||
"@types/node": "8.0.19",
|
"@types/node": "8.0.19",
|
||||||
"@types/node-forge": "0.7.1",
|
"@types/node-forge": "0.7.1",
|
||||||
"@types/papaparse": "4.1.31",
|
"@types/papaparse": "4.1.31",
|
||||||
@ -246,7 +246,7 @@
|
|||||||
"electron-updater": "3.0.3",
|
"electron-updater": "3.0.3",
|
||||||
"keytar": "4.2.1",
|
"keytar": "4.2.1",
|
||||||
"lowdb": "1.0.0",
|
"lowdb": "1.0.0",
|
||||||
"lunr": "2.1.6",
|
"lunr": "2.3.1",
|
||||||
"node-forge": "0.7.1",
|
"node-forge": "0.7.1",
|
||||||
"nord": "0.2.1",
|
"nord": "0.2.1",
|
||||||
"papaparse": "4.3.5",
|
"papaparse": "4.3.5",
|
||||||
|
@ -37,6 +37,7 @@ import { FolderService } from 'jslib/services/folder.service';
|
|||||||
import { LockService } from 'jslib/services/lock.service';
|
import { LockService } from 'jslib/services/lock.service';
|
||||||
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
|
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
|
||||||
import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service';
|
||||||
|
import { SearchService } from 'jslib/services/search.service';
|
||||||
import { SettingsService } from 'jslib/services/settings.service';
|
import { SettingsService } from 'jslib/services/settings.service';
|
||||||
import { StateService } from 'jslib/services/state.service';
|
import { StateService } from 'jslib/services/state.service';
|
||||||
import { SyncService } from 'jslib/services/sync.service';
|
import { SyncService } from 'jslib/services/sync.service';
|
||||||
@ -64,6 +65,7 @@ import {
|
|||||||
PasswordGenerationService as PasswordGenerationServiceAbstraction,
|
PasswordGenerationService as PasswordGenerationServiceAbstraction,
|
||||||
} from 'jslib/abstractions/passwordGeneration.service';
|
} from 'jslib/abstractions/passwordGeneration.service';
|
||||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from 'jslib/abstractions/platformUtils.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 { SettingsService as SettingsServiceAbstraction } from 'jslib/abstractions/settings.service';
|
||||||
import { StateService as StateServiceAbstraction } from 'jslib/abstractions/state.service';
|
import { StateService as StateServiceAbstraction } from 'jslib/abstractions/state.service';
|
||||||
import { StorageService as StorageServiceAbstraction } from 'jslib/abstractions/storage.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 environmentService = new EnvironmentService(apiService, storageService);
|
||||||
const userService = new UserService(tokenService, storageService);
|
const userService = new UserService(tokenService, storageService);
|
||||||
const settingsService = new SettingsService(userService, storageService);
|
const settingsService = new SettingsService(userService, storageService);
|
||||||
|
export let searchService: SearchService = null;
|
||||||
const cipherService = new CipherService(cryptoService, userService, settingsService,
|
const cipherService = new CipherService(cryptoService, userService, settingsService,
|
||||||
apiService, storageService, i18nService, platformUtilsService);
|
apiService, storageService, i18nService, platformUtilsService, () => searchService);
|
||||||
const folderService = new FolderService(cryptoService, userService, apiService, storageService,
|
const folderService = new FolderService(cryptoService, userService, apiService, storageService,
|
||||||
i18nService, cipherService);
|
i18nService, cipherService);
|
||||||
const collectionService = new CollectionService(cryptoService, userService, storageService, i18nService);
|
const collectionService = new CollectionService(cryptoService, userService, storageService, i18nService);
|
||||||
const lockService = new LockService(cipherService, folderService, collectionService,
|
const lockService = new LockService(cipherService, folderService, collectionService,
|
||||||
cryptoService, platformUtilsService, storageService, messagingService, null);
|
cryptoService, platformUtilsService, storageService, messagingService, null);
|
||||||
|
searchService = new SearchService(cipherService, platformUtilsService);
|
||||||
const syncService = new SyncService(userService, apiService, settingsService,
|
const syncService = new SyncService(userService, apiService, settingsService,
|
||||||
folderService, cipherService, cryptoService, collectionService, storageService, messagingService,
|
folderService, cipherService, cryptoService, collectionService, storageService, messagingService,
|
||||||
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
||||||
@ -181,6 +185,7 @@ export function initFactory(): Function {
|
|||||||
{ provide: StateServiceAbstraction, useValue: stateService },
|
{ provide: StateServiceAbstraction, useValue: stateService },
|
||||||
{ provide: LogServiceAbstraction, useValue: logService },
|
{ provide: LogServiceAbstraction, useValue: logService },
|
||||||
{ provide: ExportServiceAbstraction, useValue: exportService },
|
{ provide: ExportServiceAbstraction, useValue: exportService },
|
||||||
|
{ provide: SearchServiceAbstraction, useValue: searchService },
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: initFactory,
|
useFactory: initFactory,
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<div class="header header-search">
|
<div class="header header-search">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<input type="search" placeholder="{{searchPlaceholder || ('searchVault' | i18n)}}" id="search"
|
<input type="search" placeholder="{{searchPlaceholder || ('searchVault' | i18n)}}" id="search"
|
||||||
[(ngModel)]="searchText" appAutofocus>
|
[(ngModel)]="searchText" (ngModelChange)="search(200)" appAutofocus>
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<ng-container *ngIf="(ciphers | searchCiphers: searchText) as searchedCiphers">
|
<ng-container *ngIf="ciphers">
|
||||||
<div class="list" *ngIf="searchedCiphers.length > 0">
|
<div class="list" *ngIf="ciphers.length > 0">
|
||||||
<a *ngFor="let c of searchedCiphers" appStopClick (click)="selectCipher(c)"
|
<a *ngFor="let c of ciphers" appStopClick (click)="selectCipher(c)"
|
||||||
(contextmenu)="rightClickCipher(c)" href="#" title="{{'viewItem' | i18n}}"
|
(contextmenu)="rightClickCipher(c)" href="#" title="{{'viewItem' | i18n}}"
|
||||||
[ngClass]="{'active': c.id === activeCipherId}">
|
[ngClass]="{'active': c.id === activeCipherId}">
|
||||||
<app-vault-icon [cipher]="c"></app-vault-icon>
|
<app-vault-icon [cipher]="c"></app-vault-icon>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<span class="detail">{{c.subTitle}}</span>
|
<span class="detail">{{c.subTitle}}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="no-items" *ngIf="searchedCiphers.length === 0">
|
<div class="no-items" *ngIf="ciphers.length === 0">
|
||||||
<i class="fa fa-spinner fa-spin fa-3x" *ngIf="!loaded"></i>
|
<i class="fa fa-spinner fa-spin fa-3x" *ngIf="!loaded"></i>
|
||||||
<ng-container *ngIf="loaded">
|
<ng-container *ngIf="loaded">
|
||||||
<i class="fa fa-frown-o fa-4x"></i>
|
<i class="fa fa-frown-o fa-4x"></i>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
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';
|
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',
|
templateUrl: 'ciphers.component.html',
|
||||||
})
|
})
|
||||||
export class CiphersComponent extends BaseCiphersComponent {
|
export class CiphersComponent extends BaseCiphersComponent {
|
||||||
constructor(cipherService: CipherService) {
|
constructor(searchService: SearchService) {
|
||||||
super(cipherService);
|
super(searchService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user