bug fixes: 1) when creating description template type check only for non deleted types, 2) dmp docx/pdf export: check if system fields exist 3) when creating/updating dmp check if value for extra fields is set, 4) when unchecking the 'Description Templates' checkbox in the blueprint editor, clear any templates selected

This commit is contained in:
Bernaldo Mihasi 2023-10-02 13:57:00 +03:00 committed by Diamantis Tziotzios
parent 09dcf5328d
commit 4373bf4b00
4 changed files with 45 additions and 21 deletions

View File

@ -1435,29 +1435,41 @@ public class DataManagementPlanManager {
runContact.setColor("116a78");
break;
case FUNDER:
if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getFunder() != null) {
XWPFRun runFunder = systemFieldInput.createRun();
runFunder.setText(dmpEntity.getGrant().getFunder().getLabel());
runFunder.setColor("116a78");
}
break;
case GRANT:
if (dmpEntity.getGrant() != null) {
XWPFRun runGrant = systemFieldInput.createRun();
runGrant.setText(dmpEntity.getGrant().getLabel());
runGrant.setColor("116a78");
}
break;
case PROJECT:
if (dmpEntity.getProject() != null ) {
XWPFRun runProject = systemFieldInput.createRun();
runProject.setText(dmpEntity.getProject().getLabel());
runProject.setColor("116a78");
}
break;
case LICENSE:
Map extraProperties = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
if (extraProperties.containsKey("license")) {
XWPFRun runLicense = systemFieldInput.createRun();
runLicense.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("license").toString());
runLicense.setText(extraProperties.get("license").toString());
runLicense.setColor("116a78");
}
break;
case ACCESS_RIGHTS:
Map extraPropertiesMap = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
if (extraPropertiesMap.containsKey("visible")) {
XWPFRun runAccessRights = systemFieldInput.createRun();
runAccessRights.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("visible").toString());
runAccessRights.setText(extraPropertiesMap.get("visible").toString());
runAccessRights.setColor("116a78");
}
break;
}
document.createParagraph();
@ -1475,7 +1487,10 @@ public class DataManagementPlanManager {
runExtraFieldDescription.setColor("116a78");
}
XWPFRun runExtraFieldInput = extraFieldParagraph.createRun();
runExtraFieldInput.setText(extraField.getLabel());
Map dmpProperties = objectMapper.readValue(dmpEntity.getProperties(), HashMap.class);
if (dmpProperties.containsKey(field.getId()) && dmpProperties.get(field.getId()) != null) {
runExtraFieldInput.setText((String) dmpProperties.get(field.getId()));
}
runExtraFieldInput.setColor("116a78");
}
}

View File

@ -381,10 +381,12 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
if (this.properties != null) {
this.extraFields = new ArrayList<>();
this.properties.forEach((id, value) -> {
if (value != null) {
ExtraFieldModel extraField = new ExtraFieldModel();
extraField.setId(id);
extraField.setValue(value.toString());
this.extraFields.add(extraField);
}
});
}
if (entity.getUsers() != null && entity.getUsers().stream().anyMatch(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())))

View File

@ -206,7 +206,7 @@
<div class="col-12">
<div class="row">
<div class="col-12">
<mat-checkbox formControlName="hasTemplates">
<mat-checkbox formControlName="hasTemplates" (change)="checkForProfiles($event, sectionIndex)">
Description Templates
</mat-checkbox>
</div>

View File

@ -175,6 +175,13 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
}
}
checkForProfiles(event, sectionIndex: number) {
if (event.checked === false) {
this.descriptionTemplatesPerSection[sectionIndex] = new Array<DatasetProfileModel>();
this.descriptionTemplatesArray(sectionIndex).clear();
}
}
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
const request = new DataTableRequest<DatasetProfileCriteria>(null, null, { fields: ['+label'] });
const criteria = new DatasetProfileCriteria();