From bd02c789663221eb34ff3dacbe5d40b0405d5848 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Mon, 28 Dec 2020 12:31:30 +0100 Subject: [PATCH] fix the filter pipe --- src-ui/src/app/pipes/filter.pipe.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src-ui/src/app/pipes/filter.pipe.ts b/src-ui/src/app/pipes/filter.pipe.ts index a982e9019..8465f1533 100644 --- a/src-ui/src/app/pipes/filter.pipe.ts +++ b/src-ui/src/app/pipes/filter.pipe.ts @@ -1,17 +1,18 @@ import { Pipe, PipeTransform } from '@angular/core'; import { ToggleableItem } from 'src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component'; +import { MatchingModel } from '../data/matching-model'; @Pipe({ name: 'filter' }) export class FilterPipe implements PipeTransform { - transform(toggleableItems: ToggleableItem[], searchText: string): any[] { - if (!toggleableItems) return []; - if (!searchText) return toggleableItems; + transform(items: MatchingModel[], searchText: string): any[] { + if (!items) return []; + if (!searchText) return items; - return toggleableItems.filter(toggleableItem => { - return Object.keys(toggleableItem.item).some(key => { - return String(toggleableItem.item[key]).toLowerCase().includes(searchText.toLowerCase()); + return items.filter(item => { + return Object.keys(item).some(key => { + return String(item[key]).toLowerCase().includes(searchText.toLowerCase()); }); }); }