Fixes how DMP versions are fetched when published and adds UI elemets on listings corresponding to that change.
This commit is contained in:
parent
2798fa3a39
commit
18c785cd93
|
@ -12,6 +12,8 @@ public class DataManagementPlanPublicCriteria extends Criteria<DMP> {
|
||||||
public List<UUID> datasetProfile;
|
public List<UUID> datasetProfile;
|
||||||
private List<String> dmpOrganisations;
|
private List<String> dmpOrganisations;
|
||||||
private Integer role;
|
private Integer role;
|
||||||
|
private boolean allVersions;
|
||||||
|
private List<UUID> groupIds;
|
||||||
|
|
||||||
public GrantStateType getGrantStatus() {
|
public GrantStateType getGrantStatus() {
|
||||||
return grantStatus;
|
return grantStatus;
|
||||||
|
@ -47,4 +49,18 @@ public class DataManagementPlanPublicCriteria extends Criteria<DMP> {
|
||||||
public void setRole(Integer role) {
|
public void setRole(Integer role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getAllVersions() {
|
||||||
|
return allVersions;
|
||||||
|
}
|
||||||
|
public void setAllVersions(boolean allVersions) {
|
||||||
|
this.allVersions = allVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UUID> getGroupIds() {
|
||||||
|
return groupIds;
|
||||||
|
}
|
||||||
|
public void setGroupIds(List<UUID> groupIds) {
|
||||||
|
this.groupIds = groupIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,14 @@ public class DataManagmentPlanPublicTableRequest extends TableQuery<DataManageme
|
||||||
query.where((builder, root) -> root.join("associatedDmps").get("id").in(this.getCriteria().datasetProfile));
|
query.where((builder, root) -> root.join("associatedDmps").get("id").in(this.getCriteria().datasetProfile));
|
||||||
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty())
|
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty())
|
||||||
query.where(((builder, root) -> root.join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
query.where(((builder, root) -> root.join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
||||||
|
if (!this.getCriteria().getAllVersions()) {
|
||||||
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
|
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
|
||||||
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("groupId"),
|
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("groupId"),
|
||||||
nestedRoot.get("groupId")), builder1.equal(nestedRoot.get("isPublic"), true)), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
|
nestedRoot.get("groupId")), builder1.equal(nestedRoot.get("isPublic"), true)), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
|
||||||
|
}
|
||||||
|
if (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty()) {
|
||||||
|
query.where((builder, root) -> root.get("groupId").in(this.getCriteria().getGroupIds()));
|
||||||
|
}
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,4 +8,6 @@ export class ExploreDmpCriteriaModel extends BaseCriteria {
|
||||||
public grants: string[] = [];
|
public grants: string[] = [];
|
||||||
public datasetProfile: string[] = [];
|
public datasetProfile: string[] = [];
|
||||||
public dmpOrganisations: string[] = [];
|
public dmpOrganisations: string[] = [];
|
||||||
|
public allVersions: boolean;
|
||||||
|
public groupIds: string[] = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,11 +485,14 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
||||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
dialogRef.afterClosed()
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(result => {
|
||||||
if (result && !result.cancelled) {
|
if (result && !result.cancelled) {
|
||||||
this.formGroup.get('status').setValue(DmpStatus.Finalized);
|
this.formGroup.get('status').setValue(DmpStatus.Finalized);
|
||||||
this.formGroup.get('datasetsToBeFinalized').setValue(result.datasetsToBeFinalized);
|
this.formGroup.get('datasetsToBeFinalized').setValue(result.datasetsToBeFinalized);
|
||||||
this.formSubmit(false);
|
this.formSubmit(false);
|
||||||
|
//this.router.navigate(['/plans/overview/' + this.formGroup.get('id').value]);
|
||||||
dialogRef.close();
|
dialogRef.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,14 @@
|
||||||
<div class="row card-header card-header-plain d-flex">
|
<div class="row card-header card-header-plain d-flex">
|
||||||
<div class="card-desc d-flex flex-column justify-content-center">
|
<div class="card-desc d-flex flex-column justify-content-center">
|
||||||
<h4 class="card-title">{{'DMP-LISTING.TITLE' | translate}} {{titlePrefix}}</h4>
|
<h4 class="card-title">{{'DMP-LISTING.TITLE' | translate}} {{titlePrefix}}</h4>
|
||||||
|
<div *ngIf="allVersions">
|
||||||
|
<span class="all-versions">
|
||||||
|
{{'DMP-LISTING.VIEW-ALL-VERSIONS' | translate}}
|
||||||
|
</span>
|
||||||
|
<span class="dmp-label">
|
||||||
|
{{this.groupLabel}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<!-- <p class="card-category">{{'DMP-LISTING.SUBTITLE' | translate}}</p> -->
|
<!-- <p class="card-category">{{'DMP-LISTING.SUBTITLE' | translate}}</p> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="row ml-auto p-2">
|
<div class="row ml-auto p-2">
|
||||||
|
|
|
@ -51,6 +51,14 @@
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.all-versions {
|
||||||
|
color: #999999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dmp-label {
|
||||||
|
color: #089dbb !important;
|
||||||
|
}
|
||||||
|
|
||||||
// .bot-paginator {
|
// .bot-paginator {
|
||||||
// margin-top: auto;
|
// margin-top: auto;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -38,6 +38,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
||||||
titlePrefix: string;
|
titlePrefix: string;
|
||||||
totalCount: number;
|
totalCount: number;
|
||||||
listingItems: DmpListingModel[] = [];
|
listingItems: DmpListingModel[] = [];
|
||||||
|
allVersions: boolean = false;
|
||||||
|
groupLabel: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dmpService: DmpService,
|
private dmpService: DmpService,
|
||||||
|
@ -72,6 +74,25 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
||||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (params['groupId']) {
|
||||||
|
this.itemId = params['groupId'];
|
||||||
|
this.showGrant = true;
|
||||||
|
const breadCrumbs = [];
|
||||||
|
this.allVersions = true;
|
||||||
|
|
||||||
|
this.language.get('NAV-BAR.MY-DMPS').pipe(takeUntil(this._destroyed)).subscribe(x => {
|
||||||
|
this.breadCrumbs = observableOf([
|
||||||
|
{
|
||||||
|
parentComponentName: null,
|
||||||
|
label: x,
|
||||||
|
url: '/plans'
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
})
|
||||||
|
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||||
|
this.groupLabel = this.route.snapshot.queryParams.groupLabel;
|
||||||
|
this.refresh();
|
||||||
|
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||||
} else {
|
} else {
|
||||||
this.itemId = params['groupId'];
|
this.itemId = params['groupId'];
|
||||||
this.showGrant = true;
|
this.showGrant = true;
|
||||||
|
|
|
@ -385,8 +385,12 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
viewVersions(rowId: String, rowLabel: String) {
|
viewVersions(rowId: String, rowLabel: String) {
|
||||||
|
if (this.dmp.isPublic && !this.isUserOwner) {
|
||||||
|
this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
||||||
|
} else {
|
||||||
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public isAuthenticated(): boolean {
|
public isAuthenticated(): boolean {
|
||||||
return !(!this.authentication.current());
|
return !(!this.authentication.current());
|
||||||
|
|
|
@ -310,7 +310,7 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
|
||||||
const fields: Array<string> = new Array<string>();
|
const fields: Array<string> = new Array<string>();
|
||||||
fields.push('-finalizedAt');
|
fields.push('-finalizedAt');
|
||||||
const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
|
const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
|
||||||
dmpDataTableRequest.criteria = new ExploreDatasetCriteriaModel();
|
dmpDataTableRequest.criteria = new ExploreDmpCriteriaModel();
|
||||||
dmpDataTableRequest.criteria.like = value;
|
dmpDataTableRequest.criteria.like = value;
|
||||||
return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete")
|
return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete")
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,14 @@
|
||||||
<div class="card-header card-header-plain d-flex">
|
<div class="card-header card-header-plain d-flex">
|
||||||
<div class="card-desc d-flex flex-column justify-content-center">
|
<div class="card-desc d-flex flex-column justify-content-center">
|
||||||
<h4 class="card-title">{{'DMP-LISTING.TITLE' | translate}}</h4>
|
<h4 class="card-title">{{'DMP-LISTING.TITLE' | translate}}</h4>
|
||||||
<!-- <p class="card-category">{{'DMP-LISTING.SUBTITLE' | translate}}</p> -->
|
<div *ngIf="allVersions">
|
||||||
|
<span class="all-versions">
|
||||||
|
{{'DMP-LISTING.VIEW-ALL-VERSIONS' | translate}}
|
||||||
|
</span>
|
||||||
|
<span class="dmp-label">
|
||||||
|
{{this.groupLabel}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body table-responsive">
|
<div class="card-body table-responsive">
|
||||||
|
|
|
@ -76,3 +76,11 @@ text-center {
|
||||||
::ng-deep .mat-paginator-navigation-previous {
|
::ng-deep .mat-paginator-navigation-previous {
|
||||||
margin-left: auto !important;
|
margin-left: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.all-versions {
|
||||||
|
color: #999999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dmp-label {
|
||||||
|
color: #089dbb !important;
|
||||||
|
}
|
||||||
|
|
|
@ -24,12 +24,15 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
|
||||||
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
||||||
sort = new MatSort();
|
sort = new MatSort();
|
||||||
|
|
||||||
exploreDmpCriteriaModel: ExploreDmpCriteriaModel;
|
exploreDmpCriteriaModel: ExploreDmpCriteriaModel = new ExploreDmpCriteriaModel();
|
||||||
titlePrefix: string;
|
titlePrefix: string;
|
||||||
totalCount: number;
|
totalCount: number;
|
||||||
listingItems: DmpListingModel[] = [];
|
listingItems: DmpListingModel[] = [];
|
||||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||||
linkToDmpId: string;
|
linkToDmpId: string;
|
||||||
|
groupId: string;
|
||||||
|
allVersions: boolean = false;
|
||||||
|
groupLabel: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dmpService: DmpService,
|
private dmpService: DmpService,
|
||||||
|
@ -43,8 +46,24 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.refresh();
|
this.route.params
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(params => {
|
||||||
|
if (params['groupId']) {
|
||||||
|
this.groupId = params['groupId'];
|
||||||
|
this.exploreDmpCriteriaModel.groupIds.push(this.groupId);
|
||||||
|
this.exploreDmpCriteriaModel.allVersions = true;
|
||||||
|
this.allVersions = true;
|
||||||
|
this.route.queryParams
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(queryParams => {
|
||||||
|
if (queryParams["groupLabel"]) {
|
||||||
|
this.groupLabel = queryParams["groupLabel"];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refresh();
|
||||||
const breadCrumbs = [];
|
const breadCrumbs = [];
|
||||||
breadCrumbs.push({
|
breadCrumbs.push({
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
|
@ -52,6 +71,7 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
|
||||||
url: "/explore-plans"
|
url: "/explore-plans"
|
||||||
})
|
})
|
||||||
this.breadCrumbs = observableOf(breadCrumbs);
|
this.breadCrumbs = observableOf(breadCrumbs);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
@ -76,6 +96,8 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
|
||||||
|
|
||||||
onCriteriaChange(event: ExploreDmpCriteriaModel) {
|
onCriteriaChange(event: ExploreDmpCriteriaModel) {
|
||||||
this.exploreDmpCriteriaModel = event;
|
this.exploreDmpCriteriaModel = event;
|
||||||
|
if (this.allVersions == true) this.exploreDmpCriteriaModel.allVersions = this.allVersions;
|
||||||
|
if (this.groupId) this.exploreDmpCriteriaModel.groupIds.push(this.groupId);
|
||||||
this._paginator.pageIndex = 0;
|
this._paginator.pageIndex = 0;
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,13 @@ const routes: Routes = [
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'versions/:groupId',
|
||||||
|
component: ExploreDmpListingComponent,
|
||||||
|
data: {
|
||||||
|
breadcrumb: true
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'overview/:publicId',
|
path: 'overview/:publicId',
|
||||||
component: DmpOverviewComponent,
|
component: DmpOverviewComponent,
|
||||||
|
|
|
@ -411,7 +411,8 @@
|
||||||
"LEVEL-OF-ACCESS": "Level of Access",
|
"LEVEL-OF-ACCESS": "Level of Access",
|
||||||
"INVOLVED-DATASETS": "Involved Dataset Descriptions",
|
"INVOLVED-DATASETS": "Involved Dataset Descriptions",
|
||||||
"TEMPLATES-INVOLVED": "Dataset Description Templates Involved"
|
"TEMPLATES-INVOLVED": "Dataset Description Templates Involved"
|
||||||
}
|
},
|
||||||
|
"VIEW-ALL-VERSIONS": "All versions of"
|
||||||
},
|
},
|
||||||
"DMP-PUBLIC-LISTING": {
|
"DMP-PUBLIC-LISTING": {
|
||||||
"TITLE": "Published Data Management Plans",
|
"TITLE": "Published Data Management Plans",
|
||||||
|
|
Loading…
Reference in New Issue