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:
parent
0eff4ed6a3
commit
de4d704929
|
@ -21,6 +21,7 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
||||||
private List<UUID> grants;
|
private List<UUID> grants;
|
||||||
private List<UUID> collaborators;
|
private List<UUID> collaborators;
|
||||||
private List<UUID> datasetTemplates;
|
private List<UUID> datasetTemplates;
|
||||||
|
private List<UUID> groupIds;
|
||||||
|
|
||||||
public boolean getAllVersions() {
|
public boolean getAllVersions() {
|
||||||
return allVersions;
|
return allVersions;
|
||||||
|
@ -105,4 +106,11 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
||||||
public void setDatasetTemplates(List<UUID> datasetTemplates) {
|
public void setDatasetTemplates(List<UUID> datasetTemplates) {
|
||||||
this.datasetTemplates = datasetTemplates;
|
this.datasetTemplates = datasetTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UUID> getGroupIds() {
|
||||||
|
return groupIds;
|
||||||
|
}
|
||||||
|
public void setGroupIds(List<UUID> groupIds) {
|
||||||
|
this.groupIds = groupIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
||||||
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
||||||
if (!criteria.getAllVersions())
|
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)));
|
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())
|
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
|
||||||
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
|
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
|
||||||
/*if (criteria.getRole() != null) {
|
/*if (criteria.getRole() != null) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
|
||||||
private String grantId;
|
private String grantId;
|
||||||
private Date finalizedAt;
|
private Date finalizedAt;
|
||||||
private Date dmpPublishedAt;
|
private Date dmpPublishedAt;
|
||||||
|
private int version;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -148,6 +149,13 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
|
||||||
this.dmpPublishedAt = dmpPublishedAt;
|
this.dmpPublishedAt = dmpPublishedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
public void setVersion(int version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetListingModel fromDataModel(Dataset entity) {
|
public DatasetListingModel fromDataModel(Dataset entity) {
|
||||||
this.id = entity.getId().toString();
|
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.services = LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()));
|
||||||
this.finalizedAt = entity.getFinalizedAt();
|
this.finalizedAt = entity.getFinalizedAt();
|
||||||
this.dmpPublishedAt = entity.getDmp().getPublishedAt();
|
this.dmpPublishedAt = entity.getDmp().getPublishedAt();
|
||||||
|
this.version = entity.getDmp().getVersion();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,5 @@ export interface DatasetListingModel {
|
||||||
modified: Date;
|
modified: Date;
|
||||||
finalizedAt: Date;
|
finalizedAt: Date;
|
||||||
dmpPublishedAt?: Date;
|
dmpPublishedAt?: Date;
|
||||||
|
version: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,10 @@ export class DatasetCriteria extends BaseCriteria {
|
||||||
public status?: Number;
|
public status?: Number;
|
||||||
public dmpIds?: string[] = [];
|
public dmpIds?: string[] = [];
|
||||||
public tags?: ExternalSourceItemModel[] = [];
|
public tags?: ExternalSourceItemModel[] = [];
|
||||||
public allVersions?: boolean;
|
public allVersions?: boolean = true;
|
||||||
public role?: number;
|
public role?: number;
|
||||||
public organisations?: string[] = [];
|
public organisations?: string[] = [];
|
||||||
public collaborators?: string[] = [];
|
public collaborators?: string[] = [];
|
||||||
public datasetTemplates?: string[] = [];
|
public datasetTemplates?: string[] = [];
|
||||||
|
public groupIds?: string[] = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<div class="col-10 gray-container">
|
<div class="col-10 gray-container">
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-DMP' | translate}}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-DMP' | translate}}</h6>
|
||||||
<mat-form-field>
|
<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 }}"
|
placeholder="{{'CRITERIA.DATA-SETS.SELECT-DMP' | translate }}"
|
||||||
[configuration]="dmpAutoCompleteConfiguration">
|
[configuration]="dmpAutoCompleteConfiguration">
|
||||||
</app-multiple-auto-complete>
|
</app-multiple-auto-complete>
|
||||||
|
@ -47,6 +47,13 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- End of Related DMP Filters -->
|
<!-- 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 -->
|
<!-- Related Grant Filters -->
|
||||||
<div class="col-10 gray-container">
|
<div class="col-10 gray-container">
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-GRANT' | translate}}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-GRANT' | translate}}</h6>
|
||||||
|
|
|
@ -52,14 +52,15 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
|
|
||||||
public formGroup = new FormBuilder().group({
|
public formGroup = new FormBuilder().group({
|
||||||
like: new FormControl(),
|
like: new FormControl(),
|
||||||
dmpIds: new FormControl(),
|
groupIds: new FormControl(),
|
||||||
grants: new FormControl(),
|
grants: new FormControl(),
|
||||||
status: new FormControl(),
|
status: new FormControl(),
|
||||||
role: new FormControl(),
|
role: new FormControl(),
|
||||||
organisations: new FormControl(),
|
organisations: new FormControl(),
|
||||||
collaborators: new FormControl(),
|
collaborators: new FormControl(),
|
||||||
datasetTemplates: new FormControl(),
|
datasetTemplates: new FormControl(),
|
||||||
tags: new FormControl()
|
tags: new FormControl(),
|
||||||
|
allVersions: new FormControl()
|
||||||
});
|
});
|
||||||
|
|
||||||
tagsAutoCompleteConfiguration = {
|
tagsAutoCompleteConfiguration = {
|
||||||
|
@ -133,7 +134,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
this.formGroup.get('like').valueChanges
|
this.formGroup.get('like').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => this.controlModified());
|
.subscribe(x => this.controlModified());
|
||||||
this.formGroup.get('dmpIds').valueChanges
|
this.formGroup.get('groupIds').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => this.controlModified());
|
.subscribe(x => this.controlModified());
|
||||||
this.formGroup.get('grants').valueChanges
|
this.formGroup.get('grants').valueChanges
|
||||||
|
@ -154,17 +155,21 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
this.formGroup.get('datasetTemplates').valueChanges
|
this.formGroup.get('datasetTemplates').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => this.controlModified());
|
.subscribe(x => this.controlModified());
|
||||||
|
this.formGroup.get('allVersions').valueChanges
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(x => this.controlModified());
|
||||||
// if (this.criteria == null) { this.criteria = {}; }
|
// if (this.criteria == null) { this.criteria = {}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
setCriteria(criteria: DatasetCriteria): void {
|
setCriteria(criteria: DatasetCriteria): void {
|
||||||
this.formGroup.get('like').patchValue(criteria.like);
|
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('grants').patchValue(criteria.grants);
|
||||||
this.formGroup.get('status').patchValue(criteria.status);
|
this.formGroup.get('status').patchValue(criteria.status);
|
||||||
this.formGroup.get('role').patchValue(criteria.role);
|
this.formGroup.get('role').patchValue(criteria.role);
|
||||||
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
|
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
|
||||||
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
|
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
|
||||||
|
this.formGroup.get('allVersions').patchValue(criteria.allVersions);
|
||||||
// this.criteria = criteria;
|
// this.criteria = criteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,9 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
if (value.dmpIds) {
|
if (value.dmpIds) {
|
||||||
request.criteria.dmpIds = value.dmpIds.map(x => x.id);
|
request.criteria.dmpIds = value.dmpIds.map(x => x.id);
|
||||||
}
|
}
|
||||||
|
if (value.groupIds) {
|
||||||
|
request.criteria.groupIds = value.groupIds.map(x => x.groupId);
|
||||||
|
}
|
||||||
if (value.grants) {
|
if (value.grants) {
|
||||||
request.criteria.grants = value.grants.map(x => x.id);
|
request.criteria.grants = value.grants.map(x => x.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,12 @@
|
||||||
<div matTooltip="{{ dataset.profile }}" class="chip ml-2 mr-2">{{ dataset.profile }}</div>
|
<div matTooltip="{{ dataset.profile }}" class="chip ml-2 mr-2">{{ dataset.profile }}</div>
|
||||||
</div>
|
</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">
|
<div class="col-auto about-item ml-auto">
|
||||||
<p *ngIf="isDraft">{{'DATASET-LISTING.COLUMNS.LAST-EDITED' | translate}} {{ dataset.modified | date: "shortDate"}}</p>
|
<p *ngIf="isDraft">{{'DATASET-LISTING.COLUMNS.LAST-EDITED' | translate}} {{ dataset.modified | date: "shortDate"}}</p>
|
||||||
|
|
Loading…
Reference in New Issue