Compare commits
3 Commits
9cc42c57e9
...
5f3ab00009
Author | SHA1 | Date |
---|---|---|
Bernaldo Mihasi | 5f3ab00009 | |
Bernaldo Mihasi | beac6be706 | |
Bernaldo Mihasi | fbad63ee76 |
|
@ -1633,7 +1633,13 @@ public class DataManagementPlanManager {
|
|||
|
||||
wordBuilder.fillFooter(dmpEntity, null, document, false);
|
||||
|
||||
String fileName = "DMP_" + dmpEntity.getGrant().getLabel();
|
||||
String fileName;
|
||||
if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getLabel() != null) {
|
||||
fileName = "DMP_" + dmpEntity.getGrant().getLabel();
|
||||
}
|
||||
else {
|
||||
fileName = "DMP_" + dmpEntity.getLabel();
|
||||
}
|
||||
if (versioned) {
|
||||
fileName += "_" + dmpEntity.getVersion();
|
||||
}
|
||||
|
@ -1882,7 +1888,12 @@ public class DataManagementPlanManager {
|
|||
writer.close();
|
||||
FileEnvelope fileEnvelope = new FileEnvelope();
|
||||
fileEnvelope.setFile(xmlFile);
|
||||
if (dmp.getGrant() != null && dmp.getGrant().getLabel() != null) {
|
||||
fileEnvelope.setFilename("DMP_" + dmp.getGrant().getLabel() + "_" + dmp.getVersion() + ".xml");
|
||||
}
|
||||
else {
|
||||
fileEnvelope.setFilename("DMP_" + dmp.getLabel() + "_" + dmp.getVersion() + ".xml");
|
||||
}
|
||||
|
||||
return fileEnvelope;
|
||||
}
|
||||
|
@ -1900,7 +1911,13 @@ public class DataManagementPlanManager {
|
|||
.collect(Collectors.toSet()));
|
||||
String result = rdaManager.convertToRDA(dmp);
|
||||
|
||||
String fileName = "DMP_" + dmp.getGrant().getLabel() + "_" + dmp.getVersion();
|
||||
String fileName;
|
||||
if (dmp.getGrant() != null && dmp.getGrant().getLabel() != null) {
|
||||
fileName = "DMP_" + dmp.getGrant().getLabel() + "_" + dmp.getVersion();
|
||||
}
|
||||
else {
|
||||
fileName = "DMP_" + dmp.getLabel() + "_" + dmp.getVersion();
|
||||
}
|
||||
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "").replace(" ", "_").replace(",", "_");
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
File file = new File(this.environment.getProperty("temp.temp") + uuid + ".json");
|
||||
|
|
|
@ -39,7 +39,9 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
|
|||
this.setFinalizedAt(entity.getFinalizedAt());
|
||||
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
|
||||
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()): null);
|
||||
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
|
||||
if (entity.getDmp() != null && entity.getDmp().getGrant() != null) {
|
||||
this.setGrant(entity.getDmp().getGrant().getLabel());
|
||||
}
|
||||
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
|
||||
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
|
||||
this.setPublic(entity.getDmp().isPublic());
|
||||
|
@ -58,7 +60,9 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
|
|||
this.setFinalizedAt(entity.getFinalizedAt());
|
||||
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
|
||||
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()) : null);
|
||||
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
|
||||
if (entity.getDmp() != null && entity.getDmp().getGrant() != null) {
|
||||
this.setGrant(entity.getDmp().getGrant().getLabel());
|
||||
}
|
||||
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
|
||||
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
|
||||
return this;
|
||||
|
|
|
@ -51,7 +51,9 @@ public class RecentDmpModel extends RecentActivityModel<DMP, RecentDmpModel> {
|
|||
this.setVersion(entity.getVersion());
|
||||
this.datasets = entity.getDataset().stream().map(dataset -> new DatasetUrlListing().fromDataModel(dataset)).collect(Collectors.toList());
|
||||
this.setFinalizedAt(entity.getFinalizedAt());
|
||||
if (entity.getGrant() != null) {
|
||||
this.setGrant(entity.getGrant().getLabel());
|
||||
}
|
||||
this.groupId = entity.getGroupId();
|
||||
this.setPublic(entity.isPublic());
|
||||
this.setPublishedAt(entity.getPublishedAt());
|
||||
|
|
|
@ -275,8 +275,10 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
|||
this.project.getExistProject().fromDataModel(entity.getProject());
|
||||
this.associatedUsers = entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList());
|
||||
this.users = entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList());
|
||||
if (entity.getGrant() != null) {
|
||||
this.funder = new FunderDMPEditorModel();
|
||||
this.funder.getExistFunder().fromDataModel(entity.getGrant().getFunder());
|
||||
}
|
||||
this.extraProperties = entity.getExtraProperties() != null ? new org.json.JSONObject(entity.getExtraProperties()).toMap() : null;
|
||||
|
||||
return this;
|
||||
|
|
|
@ -174,9 +174,11 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
entity.setVersion(this.getVersion());
|
||||
|
||||
entity.setDataset(this.getDatasets().stream().map(DatasetUrlListing::toDataModel).collect(Collectors.toCollection(LinkedHashSet::new)));
|
||||
if (this.getGrant() != null && !this.getGrant().isEmpty()) {
|
||||
Grant grant = new Grant();
|
||||
grant.setLabel(this.getGrant());
|
||||
entity.setGrant(grant);
|
||||
}
|
||||
entity.setUsers(this.getUsers().stream().map(UserInfoListingModel::toDataModel).collect(Collectors.toSet()));
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -173,9 +173,11 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
|
|||
entity.setFinalizedAt(this.getFinalizedAt());
|
||||
entity.setStatus(Integer.valueOf(this.getStatus()).shortValue());
|
||||
DMP dmp = new DMP();
|
||||
if (this.getGrant() != null && !this.getGrant().isEmpty()) {
|
||||
Grant grant = new Grant();
|
||||
grant.setLabel(this.getGrant());
|
||||
dmp.setGrant(grant);
|
||||
}
|
||||
dmp.setLabel(this.getDmp());
|
||||
dmp.setId(UUID.fromString(this.getDmpId()));
|
||||
dmp.setPublishedAt(this.getDmpPublishedAt());
|
||||
|
|
|
@ -162,7 +162,9 @@ public class DmpRDAExportModel {
|
|||
dmpRda.ethical_issues_exist = "unknown";
|
||||
dmpRda.language = "en";
|
||||
dmpRda.modified = formatter.format(new Date());
|
||||
if (entity.getGrant() != null) {
|
||||
dmpRda.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
|
||||
}
|
||||
dmpRda.title = entity.getLabel();
|
||||
|
||||
return dmpRda;
|
||||
|
|
|
@ -157,9 +157,11 @@ public class DataManagementPlanPublicListingModel implements DataModel<DMP, Data
|
|||
entity.setPublishedAt(this.getPublishedAt());
|
||||
entity.setVersion(this.getVersion());
|
||||
|
||||
if (this.getGrant() != null) {
|
||||
Grant grant = new Grant();
|
||||
grant.setLabel(this.getGrant());
|
||||
entity.setGrant(grant);
|
||||
}
|
||||
entity.setUsers(this.getUsers().stream().map(UserInfoPublicModel::toDataModel).collect(Collectors.toSet()));
|
||||
entity.setResearchers(this.getResearchers().stream().map(ResearcherPublicModel::toDataModel).collect(Collectors.toSet()));
|
||||
return entity;
|
||||
|
|
|
@ -126,7 +126,9 @@ public class DatasetPublicListingModel implements DataModel<Dataset, DatasetPubl
|
|||
this.label = entity.getLabel();
|
||||
this.createdAt = entity.getCreated();
|
||||
this.modifiedAt = entity.getModified();
|
||||
this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "";
|
||||
if(entity.getDmp() != null && entity.getDmp().getGrant() != null) {
|
||||
this.grant = entity.getDmp().getGrant().getLabel();
|
||||
}
|
||||
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
|
||||
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : "";
|
||||
this.profile = entity.getProfile() != null ? new DatasetProfilePublicModel().fromDataModel(entity.getProfile()) : null;
|
||||
|
@ -153,9 +155,11 @@ public class DatasetPublicListingModel implements DataModel<Dataset, DatasetPubl
|
|||
entity.setFinalizedAt(this.getFinalizedAt());
|
||||
entity.setStatus(Dataset.Status.FINALISED.getValue());
|
||||
DMP dmp = new DMP();
|
||||
if (this.getGrant() != null && !this.getGrant().isEmpty()) {
|
||||
Grant grant = new Grant();
|
||||
grant.setLabel(this.getGrant());
|
||||
dmp.setGrant(grant);
|
||||
}
|
||||
dmp.setLabel(this.getDmp());
|
||||
dmp.setId(UUID.fromString(this.getDmpId()));
|
||||
dmp.setPublishedAt(this.getDmpPublishedAt());
|
||||
|
|
|
@ -16,7 +16,7 @@ export interface DmpModel {
|
|||
id: string;
|
||||
label: string;
|
||||
groupId: String;
|
||||
profile: String;
|
||||
profile: DmpProfile;
|
||||
version: number;
|
||||
status: DmpStatus;
|
||||
lockable: boolean;
|
||||
|
@ -38,3 +38,9 @@ export interface DmpModel {
|
|||
extraProperties: Map<String, any>;
|
||||
language: String;
|
||||
}
|
||||
|
||||
|
||||
export interface DmpProfile {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
|
@ -178,7 +178,7 @@
|
|||
<div class="col-2">
|
||||
<mat-form-field>
|
||||
<mat-label>Description</mat-label>
|
||||
<input matInput type="text" name="description" forehmControlName="description">
|
||||
<input matInput type="text" name="description" formControlName="description">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="centered-row-item col-1">
|
||||
|
@ -247,7 +247,7 @@
|
|||
<div class="col-4">
|
||||
<mat-form-field>
|
||||
<mat-label>Max Multiplicity</mat-label>
|
||||
<input matInput type="number" min="0" name="maxMultiplicity" formControlName="maxMultiplicity">
|
||||
<input matInput type="number" min="1" name="maxMultiplicity" formControlName="maxMultiplicity">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -63,8 +63,10 @@
|
|||
<div class="profile-form">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="{{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" [compareWith]="compareWith" formControlName="profile">
|
||||
<mat-option *ngFor="let profile of availableProfiles" [value]="profile" (click)="checkMinMax($event, profile)">
|
||||
<mat-option *ngFor="let profile of availableProfiles" [value]="profile">
|
||||
<div (click)="checkMinMax($event, profile)">
|
||||
{{profile.label}}
|
||||
</div>
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="formGroup.get('profile').hasError('backendError')">{{formGroup.get('profile').getError('backendError').message}}</mat-error>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
|
@ -8,9 +8,8 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { DmpProfileService } from '@app/core/services/dmp/dmp-profile.service';
|
||||
import { DatasetWizardEditorModel } from '../dataset-wizard-editor.model';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-editor-component',
|
||||
|
@ -51,6 +50,7 @@ export class DatasetEditorComponent extends BaseComponent {
|
|||
};
|
||||
|
||||
checkMinMax(event, profile: DatasetProfileModel) {
|
||||
event.stopPropagation();
|
||||
const dmpSectionIndex = this.formGroup.get('dmpSectionIndex').value;
|
||||
const blueprintId = this.formGroup.get('dmp').value.profile.id;
|
||||
this.dmpProfileService.getSingleBlueprint(blueprintId)
|
||||
|
@ -68,20 +68,24 @@ export class DatasetEditorComponent extends BaseComponent {
|
|||
}
|
||||
}
|
||||
if(count === foundTemplate.maxMultiplicity){
|
||||
event.stopPropagation();
|
||||
this.dialog.open(ConfirmationDialogComponent, {
|
||||
data:{
|
||||
message: 'MAX DATASETS USING TEMPLATE',
|
||||
confirmButton: 'RETURN',
|
||||
cancelButton: 'CANCEL'
|
||||
},
|
||||
maxWidth:'30em'
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(confirm=>{})
|
||||
this.dialog.open(PopupNotificationDialogComponent, {
|
||||
data: {
|
||||
title: 'Max datasets using this template.',
|
||||
message: 'Select another profile.'
|
||||
}, maxWidth: '30em'
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.formGroup.get('profile').setValue(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.formGroup.get('profile').setValue(profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.formGroup.get('profile').setValue(profile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -289,6 +289,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
|||
restoreFocus: false,
|
||||
data: {
|
||||
availableProfiles: this.availableDescriptionTemplates,
|
||||
datasetFormGroup: this.formGroup
|
||||
},
|
||||
panelClass: 'custom-modalbox'
|
||||
});
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
<mat-form-field class="col-md-12">
|
||||
<mat-select placeholder="{{'DATASET-CREATE-WIZARD.PREFILL-STEP.PROFILE'| translate}}" [required]="true" [compareWith]="compareWith" formControlName="profile">
|
||||
<mat-option *ngFor="let profile of data.availableProfiles" [value]="profile">
|
||||
<div (click)="checkMinMax($event, profile)">
|
||||
{{profile.label}}
|
||||
</div>
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="prefillForm.get('profile').hasError('backendError')">{{prefillForm.get('profile').getError('backendError').message}}</mat-error>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, Inject, OnInit} from "@angular/core";
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog";
|
||||
import {map, takeUntil} from "rxjs/operators";
|
||||
import {ProgressIndicationService} from "@app/core/services/progress-indication/progress-indication-service";
|
||||
import {BaseComponent} from "@common/base/base.component";
|
||||
|
@ -8,6 +8,9 @@ import {Observable, of} from "rxjs";
|
|||
import {Prefilling} from "@app/core/model/dataset/prefilling";
|
||||
import {PrefillingService} from "@app/core/services/prefilling.service";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import { DatasetProfileModel } from "@app/core/model/dataset/dataset-profile";
|
||||
import { DmpProfileService } from "@app/core/services/dmp/dmp-profile.service";
|
||||
import { PopupNotificationDialogComponent } from "@app/library/notification/popup/popup-notification.component";
|
||||
|
||||
@Component({
|
||||
selector: 'prefill-dataset-component',
|
||||
|
@ -23,6 +26,8 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit {
|
|||
|
||||
constructor(public dialogRef: MatDialogRef<PrefillDatasetComponent>,
|
||||
private prefillingService: PrefillingService,
|
||||
private dmpProfileService: DmpProfileService,
|
||||
private dialog: MatDialog,
|
||||
private progressIndicationService: ProgressIndicationService,
|
||||
private fb: FormBuilder,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
|
@ -39,7 +44,7 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit {
|
|||
prefill: this.fb.control(null, Validators.required)
|
||||
})
|
||||
if(this.data.availableProfiles && this.data.availableProfiles.length === 1) {
|
||||
this.prefillForm.get('profile').patchValue(this.data.availableProfiles[0]);
|
||||
this.addProfileIfUsedLessThanMax(this.data.availableProfiles[0]);
|
||||
}
|
||||
this.prefillAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDatasets.bind(this),
|
||||
|
@ -50,6 +55,79 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit {
|
|||
};
|
||||
}
|
||||
|
||||
addProfileIfUsedLessThanMax(profile: DatasetProfileModel) {
|
||||
const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value;
|
||||
const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id;
|
||||
this.dmpProfileService.getSingleBlueprint(blueprintId)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => {
|
||||
const section = result.definition.sections[dmpSectionIndex];
|
||||
if(section.hasTemplates){
|
||||
const foundTemplate = section.descriptionTemplates.find(template => template.descriptionTemplateId === profile.id);
|
||||
if (foundTemplate !== undefined) {
|
||||
let count = 0;
|
||||
if(this.data.datasetFormGroup.get('dmp').value.datasets != null){
|
||||
for(let dataset of this.data.datasetFormGroup.get('dmp').value.datasets){
|
||||
if(dataset.dmpSectionIndex === dmpSectionIndex && dataset.profile.id === foundTemplate.descriptionTemplateId){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(count < foundTemplate.maxMultiplicity){
|
||||
this.prefillForm.get('profile').patchValue(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.prefillForm.get('profile').patchValue(profile);
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.prefillForm.get('profile').patchValue(profile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
checkMinMax(event, profile: DatasetProfileModel) {
|
||||
event.stopPropagation();
|
||||
const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value;
|
||||
const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id;
|
||||
this.dmpProfileService.getSingleBlueprint(blueprintId)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => {
|
||||
const section = result.definition.sections[dmpSectionIndex];
|
||||
if(section.hasTemplates){
|
||||
const foundTemplate = section.descriptionTemplates.find(template => template.descriptionTemplateId === profile.id);
|
||||
if (foundTemplate !== undefined) {
|
||||
let count = 0;
|
||||
if(this.data.datasetFormGroup.get('dmp').value.datasets != null){
|
||||
for(let dataset of this.data.datasetFormGroup.get('dmp').value.datasets){
|
||||
if(dataset.dmpSectionIndex === dmpSectionIndex && dataset.profile.id === foundTemplate.descriptionTemplateId){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(count === foundTemplate.maxMultiplicity){
|
||||
this.dialog.open(PopupNotificationDialogComponent, {
|
||||
data: {
|
||||
title: 'Max datasets using this template.',
|
||||
message: 'Select another profile.'
|
||||
}, maxWidth: '30em'
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.prefillForm.get('profile').setValue(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.prefillForm.get('profile').setValue(profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.prefillForm.get('profile').setValue(profile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public compareWith(object1: any, object2: any) {
|
||||
return object1 && object2 && object1.id === object2.id;
|
||||
}
|
||||
|
|
|
@ -68,8 +68,10 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="dataset.grant">
|
||||
<div class="row header">{{'DMP-OVERVIEW.GRANT' | translate}}</div>
|
||||
<div class="row dataset-label">{{ dataset.grant.label }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row header">{{'DMP-OVERVIEW.RESEARCHERS' | translate}}</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -53,7 +53,7 @@ export class DmpEditorModel {
|
|||
|
||||
fromModel(item: DmpModel): DmpEditorModel {
|
||||
this.id = item.id;
|
||||
this.profile = item.profile;
|
||||
this.profile = item.profile.id;
|
||||
this.label = item.label;
|
||||
this.groupId = item.groupId;
|
||||
this.version = item.version;
|
||||
|
|
|
@ -608,6 +608,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => {
|
||||
if (result && !result.cancelled) {
|
||||
if(!this.checkIfAnyProfileIsUsedLessThanMin(data)) {
|
||||
|
||||
var datasetsToBeFinalized: DatasetsToBeFinalized = {
|
||||
uuids: result.datasetsToBeFinalized
|
||||
};
|
||||
|
@ -633,12 +635,44 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
error => this.onUpdateCallbackError(error)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private checkIfAnyProfileIsUsedLessThanMin(dmpModel: DmpModel): boolean {
|
||||
const blueprintId = dmpModel.profile.id;
|
||||
this.dmpProfileService.getSingleBlueprint(blueprintId)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => {
|
||||
result.definition.sections.forEach(section => {
|
||||
if(section.hasTemplates){
|
||||
section.descriptionTemplates.forEach(template => {
|
||||
if(template.minMultiplicity > 0) {
|
||||
let count = 0;
|
||||
dmpModel.datasets.filter(dataset => dataset.dmpSectionIndex === (section.ordinal - 1)).forEach(dataset => {
|
||||
if(dataset.profile.id === template.descriptionTemplateId){
|
||||
count++;
|
||||
}
|
||||
})
|
||||
if(count < template.minMultiplicity){
|
||||
this.dialog.open(PopupNotificationDialogComponent, {
|
||||
data: {
|
||||
title: 'Min(' + template.minMultiplicity + ') datasets needed using this template.',
|
||||
message: 'Add dataset.'
|
||||
}, maxWidth: '30em'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// newVersion(id: String, label: String) {
|
||||
// let url = this.router.createUrlTree(['/plans/new_version/', id, { dmpLabel: label }])
|
||||
// window.open(url.toString(), '_blank')
|
||||
|
|
|
@ -43,7 +43,7 @@ export class DmpWizardEditorModel {
|
|||
|
||||
fromModel(item: DmpModel): DmpWizardEditorModel {
|
||||
this.id = item.id;
|
||||
this.profile = item.profile;
|
||||
this.profile = item.profile.id;
|
||||
this.label = item.label;
|
||||
this.groupId = item.groupId;
|
||||
this.version = item.version;
|
||||
|
|
Loading…
Reference in New Issue