1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

Send search (#258)

* fixed text searching sends

* fixed text searching sends

* cleanup

* cleanup
This commit is contained in:
Addison Beck 2021-02-03 15:36:15 -05:00 committed by GitHub
parent 11249e3444
commit a16d8f7de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ import { SendView } from '../../../models/view/sendView';
import { EnvironmentService } from '../../../abstractions/environment.service';
import { I18nService } from '../../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../../abstractions/platformUtils.service';
import { SearchService } from '../../../abstractions/search.service';
import { SendService } from '../../../abstractions/send.service';
import { BroadcasterService } from '../../../angular/services/broadcaster.service';
@ -41,7 +42,8 @@ export class SendComponent implements OnInit {
constructor(protected sendService: SendService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected environmentService: EnvironmentService,
protected broadcasterService: BroadcasterService, protected ngZone: NgZone) { }
protected broadcasterService: BroadcasterService, protected ngZone: NgZone,
protected searchService: SearchService) { }
async ngOnInit() {
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
@ -99,11 +101,13 @@ export class SendComponent implements OnInit {
}
if (timeout == null) {
this.filteredSends = this.sends.filter((s) => this.filter == null || this.filter(s));
this.applyTextSearch();
return;
}
this.searchPending = true;
this.searchTimeout = setTimeout(async () => {
this.filteredSends = this.sends.filter((s) => this.filter == null || this.filter(s));
this.applyTextSearch();
this.searchPending = false;
}, timeout);
}
@ -192,4 +196,10 @@ export class SendComponent implements OnInit {
this.selectedAll = false;
this.selectedType = null;
}
private applyTextSearch() {
if (this.searchText != null) {
this.filteredSends = this.searchService.searchSends(this.filteredSends, this.searchText);
}
}
}