This commit is contained in:
annampak 2018-02-05 11:44:50 +02:00
commit 49fe557fdc
23 changed files with 204 additions and 117 deletions

View File

@ -1,6 +1,7 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.*;
@ -21,9 +22,14 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
@Override
public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) {
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
if(criteria.getLike()!=null&&!criteria.getLike().isEmpty())query.where((builder, root) -> builder.like(root.get("label"),"%"+criteria.getLike()+"%"));
if(criteria.getPeriodEnd()!=null)query.where((builder, root) -> builder.lessThan(root.get("enddate"),criteria.getPeriodEnd()));
if(criteria.getPeriodStart()!=null)query.where((builder, root) -> builder.greaterThan(root.get("startdate"),criteria.getPeriodStart()));
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
if (criteria.getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), criteria.getPeriodStart()));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getReference()));
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
return query;
}

View File

@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@NamedEntityGraph(
name = "dataManagementPlanListingModel",
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
@NamedAttributeNode("project"), @NamedAttributeNode("profile")}
@NamedAttributeNode("project"), @NamedAttributeNode("profile"),@NamedAttributeNode("dataset")}
),
@NamedEntityGraph(
name = "fullyDetailed",
@ -258,6 +258,7 @@ public class DMP implements Serializable, DataEntity<DMP> {
this.label = entity.getLabel();
this.status = entity.getStatus();
this.created = entity.created;
this.project = entity.getProject();
this.description = entity.getDescription();
this.researchers = entity.getResearchers();
this.organisations = entity.getOrganisations();

View File

@ -106,9 +106,9 @@ public class DataManagementPlanManager {
if (newDmp.getProject() != null) {
Project project = newDmp.getProject();
ProjectCriteria criteria = new ProjectCriteria();
criteria.setLike(project.getReference());
List<eu.eudat.entities.Project> entries = projectDao.getWithCriteria(criteria).toList();
if (entries != null && !entries.isEmpty()) project.setId(entries.get(0).getId());
criteria.setReference(project.getReference());
eu.eudat.entities.Project projectEntity = projectDao.getWithCriteria(criteria).getSingleOrDefault();
if (projectEntity != null) project.setId(projectEntity.getId());
else {
project.setCreationUser(userInfo);
projectDao.createOrUpdate(project);

View File

@ -6,6 +6,8 @@ import eu.eudat.models.helpers.common.Ordering;
import eu.eudat.models.helpers.requests.TableRequest;
import eu.eudat.queryable.QueryableList;
import java.util.Collection;
public class PaginationManager {
public static <T extends DataEntity<T>> QueryableList<T> applyPaging(QueryableList<T> items, TableRequest tableRequest) throws Exception {
@ -18,9 +20,34 @@ public class PaginationManager {
public static <T extends DataEntity<T>> void applyOrder(QueryableList<T> items, TableRequest tableRequest) throws Exception {
ColumnOrderings columnOrderings = tableRequest.getOrderings();
for (Ordering ordering : columnOrderings.getFieldOrderings()) {
if(ordering.getType() == Ordering.OrderByType.ASC) items.orderByAsc(root -> root.get(ordering.getFieldName()));
if(ordering.getType() == Ordering.OrderByType.DESC) items.orderByDesc(root -> root.get(ordering.getFieldName()));
if (ordering.getOrderByType() == Ordering.OrderByType.ASC)
applyAscOrder(items,ordering);
if (ordering.getOrderByType() == Ordering.OrderByType.DESC) {
applyDescOrder(items,ordering);
}
}
return;
}
private static <T extends DataEntity<T>> void applyAscOrder(QueryableList<T> items, Ordering ordering) {
if (ordering.getColumnType() == Ordering.ColumnType.COUNT) {
items.orderBy((builder, root) -> builder.asc(builder.size(root.<Collection>get(ordering.getFieldName()))));
} else if (ordering.getColumnType() == Ordering.ColumnType.JOIN_COLUMN) {
String[] fields = ordering.getFieldName().split(":");
items.orderBy((builder, root) -> builder.asc(root.get(fields[0]).get(fields[1])));
} else {
items.orderBy((builder, root) -> builder.asc(root.get(ordering.getFieldName())));
}
}
private static <T extends DataEntity<T>> void applyDescOrder(QueryableList<T> items, Ordering ordering) {
if (ordering.getColumnType() == Ordering.ColumnType.COUNT) {
items.orderBy((builder, root) -> builder.desc(builder.size(root.<Collection>get(ordering.getFieldName()))));
} else if (ordering.getColumnType() == Ordering.ColumnType.JOIN_COLUMN) {
String[] fields = ordering.getFieldName().split(":");
items.orderBy((builder, root) -> builder.desc(root.get(fields[0]).get(fields[1])));
} else {
items.orderBy((builder, root) -> builder.desc(root.get(ordering.getFieldName())));
}
}
}

View File

@ -7,7 +7,7 @@ import java.util.Date;
public class ProjectCriteria extends Criteria<Project>{
private Date periodStart;
private Date periodEnd;
private String reference;
public Date getPeriodStart() {
return periodStart;
}
@ -23,4 +23,12 @@ public class ProjectCriteria extends Criteria<Project>{
public void setPeriodEnd(Date periodEnd) {
this.periodEnd = periodEnd;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
}

View File

@ -25,8 +25,11 @@ public class ColumnOrderings {
}
private Ordering orderingFromString(String field) throws Exception {
if(field.startsWith("+")) return new Ordering(field.replace("+",""), Ordering.OrderByType.ASC);
else if(field.startsWith("-")) return new Ordering(field.replace("-",""), Ordering.OrderByType.DESC);
else throw new Exception("Unsupported Field Order Type");
Ordering ordering = new Ordering(field);
if(ordering.getFieldName().contains("+")) ordering.fieldName(ordering.getFieldName().replace("+","")).orderByType(Ordering.OrderByType.ASC);
else if(ordering.getFieldName().startsWith("-")) ordering.fieldName(ordering.getFieldName().replace("-","")).orderByType(Ordering.OrderByType.DESC);
if(ordering.getFieldName().contains("|count|")) ordering.fieldName(ordering.getFieldName().replace("|count|","")).columnType(Ordering.ColumnType.COUNT);
else if(ordering.getFieldName().contains("|join|")) ordering.fieldName(ordering.getFieldName().replace("|join|","")).columnType(Ordering.ColumnType.JOIN_COLUMN);
return ordering;
}
}

View File

@ -6,12 +6,16 @@ public class Ordering {
ASC, DESC
}
private String fieldName;
private OrderByType type;
public enum ColumnType {
COUNT, COLUMN , JOIN_COLUMN
}
public Ordering(String fieldName, OrderByType type) {
private String fieldName;
private OrderByType orderByType;
private ColumnType columnType;
public Ordering(String fieldName) {
this.fieldName = fieldName;
this.type = type;
}
public String getFieldName() {
@ -22,11 +26,34 @@ public class Ordering {
this.fieldName = fieldName;
}
public OrderByType getType() {
return type;
public OrderByType getOrderByType() {
return orderByType;
}
public void setType(OrderByType type) {
this.type = type;
public void setOrderByType(OrderByType orderByType) {
this.orderByType = orderByType;
}
public Ordering fieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}
public Ordering orderByType(OrderByType orderByType) {
this.orderByType = orderByType;
return this;
}
public ColumnType getColumnType() {
return columnType;
}
public void setColumnType(ColumnType columnType) {
this.columnType = columnType;
}
public Ordering columnType(ColumnType columnType) {
this.columnType = columnType;
return this;
}
}

View File

@ -18,7 +18,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
private String label;
private String project;
private String profile;
private String researchers;
private String creationTime;
private String organisations;
private String version;
private Integer numOfDatasets;
@ -55,12 +55,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
this.profile = profile;
}
public String getResearchers() {
return researchers;
public String getCreationTime() {
return creationTime;
}
public void setResearchers(String researchers) {
this.researchers = researchers;
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public String getOrganisations() {
@ -94,7 +94,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
this.project = entity.getProject().getLabel();
if(entity.getProfile()!=null)this.profile = entity.getProfile().getLabel();
this.organisations =LabelBuilder.getLabel(new DomainModelConverter<eu.eudat.entities.Organisation,Organisation>().fromDataModel(entity.getOrganisations().stream().collect(Collectors.toList()),Organisation.class));
this.researchers =LabelBuilder.getLabel(new DomainModelConverter<eu.eudat.entities.Researcher,Researcher>().fromDataModel(entity.getResearchers().stream().collect(Collectors.toList()),Researcher.class));
this.creationTime = entity.getCreated().toString();
this.version = ""+entity.getVersion();
this.numOfDatasets = entity.getDataset().size();
}

View File

@ -12,9 +12,6 @@ import eu.eudat.models.dmp.DataManagementPlan;
public class Project implements DataModel<eu.eudat.entities.Project> {
private UUID id;
private List<DataManagementPlan> dmps;
@ -170,7 +167,6 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
this.created = entity.getCreated();
this.modified = entity.getModified();
this.description = entity.getDescription();
}
@Override
@ -179,7 +175,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
entity.setId(this.id);
entity.setAbbreviation(this.abbreviation);
entity.setLabel(this.label);
entity.setReference(this.reference);
entity.setReference(this.reference == null ? "dmp:"+this.label : this.reference);
entity.setUri(this.uri);
entity.setDefinition(this.definition);
entity.setStartdate(this.startDate);

View File

@ -27,9 +27,7 @@ public interface QueryableList<T extends DataEntity<T>> {
QueryableList<T> distinct();
QueryableList<T> orderByAsc(OrderByPredicate<T> predicate);
QueryableList<T> orderByDesc(OrderByPredicate<T> predicate);
QueryableList<T> orderBy(OrderByPredicate<T> predicate);
QueryableList<T> setHints(Set<String> hints);

View File

@ -23,7 +23,7 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
private Class<T> tClass;
private Root<T> root;
private List<SinglePredicate<T>> predicates = new LinkedList<>();
private List<Order> orderings = new LinkedList<>();
private List<OrderByPredicate<T>> orderings = new LinkedList<>();
private List<Selection> fields = new LinkedList<>();
private Integer length;
private Integer offset;
@ -93,13 +93,8 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
return this;
}
public QueryableList<T> orderByAsc(OrderByPredicate<T> predicate) {
this.orderings.add(this.manager.getCriteriaBuilder().asc(predicate.applyPredicate(this.root)));
return this;
}
public QueryableList<T> orderByDesc(OrderByPredicate<T> predicate) {
this.orderings.add(this.manager.getCriteriaBuilder().desc(predicate.applyPredicate(this.root)));
public QueryableList<T> orderBy(OrderByPredicate<T> predicate) {
this.orderings.add(predicate);
return this;
}
@ -120,10 +115,18 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
return predicates.toArray(new Predicate[predicates.size()]);
}
private Order[] generateOrderPredicates(List<OrderByPredicate<T>> orderByPredicates, Root<T> root) {
List<Order> predicates = new LinkedList<>();
for (OrderByPredicate<T> orderPredicate : orderByPredicates) {
predicates.add(orderPredicate.applyPredicate(this.manager.getCriteriaBuilder(), root));
}
return predicates.toArray(new Order[predicates.size()]);
}
public List<T> toList() {
this.query.where(this.generateWherePredicates(this.predicates, this.root));
if (!this.orderings.isEmpty()) this.query.orderBy(this.orderings);
if (!this.orderings.isEmpty()) this.query.orderBy(this.generateOrderPredicates(this.orderings, this.root));
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.offset != null) typedQuery.setFirstResult(this.offset);
if (this.length != null) typedQuery.setMaxResults(this.length);
@ -156,6 +159,8 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
Root<T> criteriaRoot = criteriaQuery.from(this.tClass);
criteriaQuery.where(criteriaRoot.get("id").in(ids));
if (!this.orderings.isEmpty()) criteriaQuery.orderBy(this.generateOrderPredicates(this.orderings, criteriaRoot));
TypedQuery<T> typedQuery = this.manager.createQuery(criteriaQuery);
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
return typedQuery;

View File

@ -6,6 +6,6 @@ import javax.persistence.criteria.Path;
import javax.persistence.criteria.Root;
public interface OrderByPredicate<T> {
Path applyPredicate(Root<T> root);
Order applyPredicate(CriteriaBuilder builder, Root<T> root);
}

View File

@ -7,23 +7,23 @@
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->
<ng-container cdkColumnDef="profile">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
</ng-container>
@ -60,7 +60,7 @@
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>

View File

@ -1,3 +1,4 @@
import { Field } from '../../models/Field';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
@ -84,7 +85,8 @@ export class DatasetListingComponent implements OnInit {
return defaultCriteria;
}
makeItPublic(id:String){debugger;
makeItPublic(id: String) {
debugger;
this.datasetService.makeDatasetPublic(id).subscribe();
}
@ -121,7 +123,9 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize);
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);
})

View File

@ -6,18 +6,18 @@
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="name">
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Project -->
<ng-container cdkColumnDef="project">
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.PROJECT' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|project:label">{{'DMP-LISTING.COLUMNS.PROJECT' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
</ng-container>
@ -28,9 +28,9 @@
</ng-container> -->
<!-- Column Definition: Researchers -->
<ng-container cdkColumnDef="researchers">
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.RESEARCHERS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.researchers}} </mat-cell>
<ng-container cdkColumnDef="creationTime">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.creationTime | date:'shortDate'}} </mat-cell>
</ng-container>
<!-- Column Definition: Organisations -->
@ -41,13 +41,13 @@
<!-- Column Definition: Version -->
<ng-container cdkColumnDef="version">
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="version">{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
</ng-container>
<!-- Column Definition: Datasets(count) -->
<ng-container cdkColumnDef="numOfDatasets">
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.numOfDatasets}}</mat-cell>
</ng-container>

View File

@ -23,12 +23,13 @@ import { Observable } from "rxjs/Observable";
})
export class DataManagementPlanListingComponent implements OnInit {
@ViewChild(MatPaginator) _paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent;
dataSource: DataManagementPlanDataSource | null;
displayedColumns: String[] = ['name', 'project', 'researchers', 'organisations', 'version', 'numOfDatasets', 'actions'];
displayedColumns: String[] = ['name', 'project', 'creationTime', 'organisations', 'version', 'numOfDatasets', 'actions'];
constructor(
private dataManagementPlanService: DataManagementPlanService,
@ -111,7 +112,9 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize);
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);
})

View File

@ -5,7 +5,7 @@ export class DataManagementPlanListingModel implements Serializable<DataManageme
public label: String;
public project: String;
public profile: String;
public researchers: String;
public creationTime: String;
public organisations: String;
public version: number;
@ -14,7 +14,7 @@ export class DataManagementPlanListingModel implements Serializable<DataManageme
this.label = item.label;
this.project = item.project;
this.profile = item.profile;
this.researchers = item.researchers;
this.creationTime = item.creationTime;
this.organisations = item.organisations;
this.version = item.version;

View File

@ -0,0 +1,3 @@
export class ColumnOrderings{
public fields:Array<string> = new Array();
}

View File

@ -1,13 +1,15 @@
import { ColumnOrderings } from './ColumnOrderings';
import { BaseCriteria } from "../criteria/BaseCriteria";
import { RequestItem } from "../criteria/RequestItem";
export class DataTableRequest<T> extends RequestItem<T> {
offset = 0;
length = 0;
constructor(offset: number, length: number) {
public orderings: ColumnOrderings;
constructor(offset: number, length: number, orderings: ColumnOrderings) {
super();
this.length = length;
this.offset = offset;
this.orderings = orderings;
}
}

View File

@ -7,29 +7,29 @@
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="name">
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'PROJECT-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Αbbreviation -->
<ng-container cdkColumnDef="abbreviation">
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="abbreviation">{{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.abbreviation}} </mat-cell>
</ng-container>
<!-- Column Definition: Start -->
<ng-container cdkColumnDef="start">
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.START' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="startdate">{{'PROJECT-LISTING.COLUMNS.START' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.startDate | date:'shortDate'}} </mat-cell>
</ng-container>
<!-- Column Definition: End -->
<ng-container cdkColumnDef="end">
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.END' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="enddate">{{'PROJECT-LISTING.COLUMNS.END' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.endDate | date:'shortDate'}} </mat-cell>
</ng-container>

View File

@ -93,7 +93,9 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
const request = new DataTableRequest<ProjectCriteria>(startIndex, this._paginator.pageSize);
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
const request = new DataTableRequest<ProjectCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);
})

View File

@ -53,7 +53,9 @@ export class UsersDataSource extends DataSource<UserListingModel> {
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
const request = new DataTableRequest<UserCriteria>(startIndex, this._paginator.pageSize);
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
const request = new DataTableRequest<UserCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.getFormData();
return this._service.getPaged(request);
})

View File

@ -45,7 +45,7 @@
"NAME": "Name",
"PROJECT": "Project",
"PROFILE": "Profile",
"RESEARCHERS": "Researchers",
"CREATION-TIME": "Creation Time",
"ORGANISATIONS": "Organisations",
"VERSION": "Version",
"ACTIONS": "Actions",