On "My Dataset Descriptions" the Dataset descriptions will also show their DMP Version and can be filtered to show from all DMP Versions or the latest one

This commit is contained in:
George Kalampokis 2020-01-17 13:36:00 +02:00
parent 0eff4ed6a3
commit de4d704929
9 changed files with 48 additions and 6 deletions

View File

@ -21,6 +21,7 @@ public class DatasetCriteria extends Criteria<Dataset> {
private List<UUID> grants;
private List<UUID> collaborators;
private List<UUID> datasetTemplates;
private List<UUID> groupIds;
public boolean getAllVersions() {
return allVersions;
@ -105,4 +106,11 @@ public class DatasetCriteria extends Criteria<Dataset> {
public void setDatasetTemplates(List<UUID> datasetTemplates) {
this.datasetTemplates = datasetTemplates;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
}

View File

@ -43,6 +43,8 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
if (!criteria.getAllVersions())
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"), query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
query.where((builder, root) -> root.get("dmp").get("groupId").in(criteria.getGroupIds()));
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
/*if (criteria.getRole() != null) {

View File

@ -28,6 +28,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private String grantId;
private Date finalizedAt;
private Date dmpPublishedAt;
private int version;
public String getId() {
return id;
@ -148,6 +149,13 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.dmpPublishedAt = dmpPublishedAt;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
@Override
public DatasetListingModel fromDataModel(Dataset entity) {
this.id = entity.getId().toString();
@ -167,6 +175,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.services = LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()));
this.finalizedAt = entity.getFinalizedAt();
this.dmpPublishedAt = entity.getDmp().getPublishedAt();
this.version = entity.getDmp().getVersion();
return this;
}

View File

@ -16,4 +16,5 @@ export interface DatasetListingModel {
modified: Date;
finalizedAt: Date;
dmpPublishedAt?: Date;
version: number;
}

View File

@ -6,9 +6,10 @@ export class DatasetCriteria extends BaseCriteria {
public status?: Number;
public dmpIds?: string[] = [];
public tags?: ExternalSourceItemModel[] = [];
public allVersions?: boolean;
public allVersions?: boolean = true;
public role?: number;
public organisations?: string[] = [];
public collaborators?: string[] = [];
public datasetTemplates?: string[] = [];
public groupIds?: string[] = [];
}

View File

@ -39,7 +39,7 @@
<div class="col-10 gray-container">
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-DMP' | translate}}</h6>
<mat-form-field>
<app-multiple-auto-complete [formControl]="formGroup.get('dmpIds')"
<app-multiple-auto-complete [formControl]="formGroup.get('groupIds')"
placeholder="{{'CRITERIA.DATA-SETS.SELECT-DMP' | translate }}"
[configuration]="dmpAutoCompleteConfiguration">
</app-multiple-auto-complete>
@ -47,6 +47,13 @@
</div>
<!-- End of Related DMP Filters -->
<!-- All Versions Filter-->
<div class="col-10 gray-container" >
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ALL-VERSIONS'| translate}}</h6>
<mat-slide-toggle [formControl]="formGroup.get('allVersions')"></mat-slide-toggle>
</div>
<!-- End of All Versions Filter-->
<!-- Related Grant Filters -->
<div class="col-10 gray-container">
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-GRANT' | translate}}</h6>

View File

@ -52,14 +52,15 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
public formGroup = new FormBuilder().group({
like: new FormControl(),
dmpIds: new FormControl(),
groupIds: new FormControl(),
grants: new FormControl(),
status: new FormControl(),
role: new FormControl(),
organisations: new FormControl(),
collaborators: new FormControl(),
datasetTemplates: new FormControl(),
tags: new FormControl()
tags: new FormControl(),
allVersions: new FormControl()
});
tagsAutoCompleteConfiguration = {
@ -133,7 +134,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
this.formGroup.get('dmpIds').valueChanges
this.formGroup.get('groupIds').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
this.formGroup.get('grants').valueChanges
@ -154,17 +155,21 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
this.formGroup.get('datasetTemplates').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
this.formGroup.get('allVersions').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
// if (this.criteria == null) { this.criteria = {}; }
}
setCriteria(criteria: DatasetCriteria): void {
this.formGroup.get('like').patchValue(criteria.like);
this.formGroup.get('dmpIds').patchValue(criteria.dmpIds);
this.formGroup.get('groupIds').patchValue(criteria.groupIds);
this.formGroup.get('grants').patchValue(criteria.grants);
this.formGroup.get('status').patchValue(criteria.status);
this.formGroup.get('role').patchValue(criteria.role);
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
this.formGroup.get('allVersions').patchValue(criteria.allVersions);
// this.criteria = criteria;
}

View File

@ -113,6 +113,9 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
if (value.dmpIds) {
request.criteria.dmpIds = value.dmpIds.map(x => x.id);
}
if (value.groupIds) {
request.criteria.groupIds = value.groupIds.map(x => x.groupId);
}
if (value.grants) {
request.criteria.grants = value.grants.map(x => x.id);
}

View File

@ -59,6 +59,12 @@
<div matTooltip="{{ dataset.profile }}" class="chip ml-2 mr-2">{{ dataset.profile }}</div>
</div>
</div>
<div class="row">
<mat-icon matTooltip="{{'DATASET-LISTING.TOOLTIP.VERSION' | translate}}" class="col-auto gray-icon pr-0 pt-2">
history
</mat-icon>
<h4 class="col mt-2 ml-1 mr-3 p-1">{{ dataset.version }}</h4>
</div>
<div class="col-auto about-item ml-auto">
<p *ngIf="isDraft">{{'DATASET-LISTING.COLUMNS.LAST-EDITED' | translate}} {{ dataset.modified | date: "shortDate"}}</p>