]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / filter.pipe.ts
1 import { Pipe, PipeTransform } from '@angular/core';
2
3 @Pipe({
4 name: 'filter'
5 })
6 export class FilterPipe implements PipeTransform {
7 transform(value: any, args?: any): any {
8 return value.filter((row: any) => {
9 let result = true;
10
11 args.forEach((filter: any): boolean | void => {
12 if (!filter.value) {
13 return undefined;
14 }
15
16 result = result && filter.applyFilter(row, filter.value);
17 if (!result) {
18 return result;
19 }
20 });
21
22 return result;
23 });
24 }
25 }