status filter in dmp more filters

This commit is contained in:
annampak 2017-11-07 14:13:58 +02:00
parent 8305a7e1da
commit d8e41d02c7
4 changed files with 30 additions and 4 deletions

View File

@ -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": {

View File

@ -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,

View File

@ -2,7 +2,7 @@
<!-- <div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]"> -->
<table class="table table-striped customTable" [mfData]="tableData | dmpTableFilter : filterQuery | dmpVersionFilter : versionFilter"
<table class="table table-striped customTable" [mfData]="tableData | dmpTableFilter : filterQuery | dmpVersionFilter : versionFilter |dmpstatusFilter: statusFilter"
#mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead>
<tr class = "rowFilter">
@ -18,8 +18,10 @@
<th class = "rowFilterTopBorder" colspan="3">
<button type="button" class="btn btn-info btnMoreFilters" data-toggle="collapse" data-target="#demo">More filters</button>
<div id="demo" class="collapse">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' />
<input class="form-control" type="number" [(ngModel)]="versionFilter" placeholder='Version'/>
<select class="form-control" [id]="statusid" [(ngModel)]="statusFilter" [name]="statusDropDown" #datasetfield >
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
</select>
</div>
</th>
</tr>

View File

@ -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;
}
}