From d8e41d02c7b2a4017ff3988fdcb18f929a39e3be Mon Sep 17 00:00:00 2001 From: annampak Date: Tue, 7 Nov 2017 14:13:58 +0200 Subject: [PATCH] status filter in dmp more filters --- dmp-frontend/.angular-cli.json | 3 +-- dmp-frontend/src/app/app.module.ts | 2 ++ dmp-frontend/src/app/dmps/dmps.html | 6 +++-- .../src/app/pipes/dmp-status-filter.pipe.ts | 23 +++++++++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts diff --git a/dmp-frontend/.angular-cli.json b/dmp-frontend/.angular-cli.json index 4991a0caf..f71ddd6e0 100644 --- a/dmp-frontend/.angular-cli.json +++ b/dmp-frontend/.angular-cli.json @@ -24,8 +24,7 @@ ], "scripts": [ "./../node_modules/bootstrap/dist/js/bootstrap.min.js", - "./assets/xml2json.min.js", - "./assets/jquery.scrollTo.min.js" + "./assets/xml2json.min.js" ], "environmentSource": "environments/environment.ts", "environments": { diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index e9768810f..d708daa68 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -50,6 +50,7 @@ import { DatasetRoutingModule } from './datasets/dataset-routing.module'; import { DmpComponent } from './dmps/dmp.component'; import { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe'; +import { DmpStatusFilterPipe } from './pipes/dmp-status-filter.pipe'; import { DmpVersionFilterPipe } from './pipes/dmp-version-filter.pipe'; import { DmpRoutingModule } from './dmps/dmp-routing.module'; @@ -88,6 +89,7 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen ProjectTableFilterPipe, DmpVersionFilterPipe, + DmpStatusFilterPipe, DmpTableFilterPipe, DatasetTableFilterPipe, DatasetStatusFilterPipe, diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index 2bc8aa4f8..e9417ba04 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -2,7 +2,7 @@ - @@ -18,8 +18,10 @@ diff --git a/dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts b/dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts new file mode 100644 index 000000000..bf4af0093 --- /dev/null +++ b/dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts @@ -0,0 +1,23 @@ +import * as _ from "lodash"; +import { Pipe, PipeTransform } from "@angular/core"; + +@Pipe({ + name: "dmpstatusFilter" +}) +export class DmpStatusFilterPipe implements PipeTransform { + + transform(array: any[], status: number): any { + + if (status) { + + return _.filter(array, row => { + + return ( + row.status == status + ) + }); + + } + return array; + } +} \ No newline at end of file
- +