From a16d8f7de7abe63532bcf7452cb7517f9174189a Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Wed, 3 Feb 2021 15:36:15 -0500 Subject: [PATCH] Send search (#258) * fixed text searching sends * fixed text searching sends * cleanup * cleanup --- src/angular/components/send/send.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/angular/components/send/send.component.ts b/src/angular/components/send/send.component.ts index 2d250f2ff4..85843fecca 100644 --- a/src/angular/components/send/send.component.ts +++ b/src/angular/components/send/send.component.ts @@ -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); + } + } }