This commit is contained in:
Diamantis Tziotzios 2023-11-03 13:24:01 +02:00
parent 44dab9c19a
commit 9fed92dbcb
22 changed files with 669 additions and 631 deletions

View File

@ -77,7 +77,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
query.where((builder, root) -> root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators())); query.where((builder, root) -> root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
} }
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) { if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) {
query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("id").in(criteria.getDatasetTemplates())); query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("datasetprofile").get("id").in(criteria.getDatasetTemplates()));
} }
if (criteria.getGrantStatus() != null) { if (criteria.getGrantStatus() != null) {
if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue())) if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))

View File

@ -1,5 +1,6 @@
package eu.eudat.logic.managers; package eu.eudat.logic.managers;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration; import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
@ -67,6 +68,7 @@ import eu.eudat.models.data.userinfo.UserListingModel;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.types.Authorities; import eu.eudat.types.Authorities;
import eu.eudat.types.MetricNames; import eu.eudat.types.MetricNames;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun; import org.apache.poi.xwpf.usermodel.XWPFRun;
@ -144,6 +146,7 @@ public class DataManagementPlanManager {
public DataTableData<DataManagementPlanListingModel> getPaged(DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal, String fieldsGroup) throws Exception { public DataTableData<DataManagementPlanListingModel> getPaged(DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal, String fieldsGroup) throws Exception {
UUID principalID = principal.getId(); UUID principalID = principal.getId();
List<Dmp> dmps = null; List<Dmp> dmps = null;
QueryableList<DMP> items = null; QueryableList<DMP> items = null;
QueryableList<DMP> authItems = null; QueryableList<DMP> authItems = null;
Long totalData = 0L; Long totalData = 0L;
@ -1360,103 +1363,104 @@ public class DataManagementPlanManager {
dmpBlueprintModel.fromDataModel(dmpProfile); dmpBlueprintModel.fromDataModel(dmpProfile);
DataManagementPlanBlueprint dmpBlueprint = dmpBlueprintModel.getDefinition(); DataManagementPlanBlueprint dmpBlueprint = dmpBlueprintModel.getDefinition();
for(Section section: dmpBlueprint.getSections()){ for(Section section: dmpBlueprint.getSections()){
wordBuilder.addParagraphContent("Section " + section.getOrdinal(), document, ParagraphStyle.HEADER1, BigInteger.ZERO, 0); wordBuilder.addParagraphContent(section.getOrdinal() + ". " + section.getLabel(), document, ParagraphStyle.HEADER1, BigInteger.ZERO, 0);
XWPFParagraph sectionInfoParagraph = document.createParagraph(); // XWPFParagraph sectionInfoParagraph = document.createParagraph();
sectionInfoParagraph.setSpacingBetween(1.0); // sectionInfoParagraph.setSpacingBetween(1.0);
XWPFRun runSectionTitle = sectionInfoParagraph.createRun(); // XWPFRun runSectionTitle = sectionInfoParagraph.createRun();
runSectionTitle.setText("Title: "); // runSectionTitle.setText("Title: ");
runSectionTitle.setColor("000000"); // runSectionTitle.setColor("000000");
XWPFRun runSectionTitleText = sectionInfoParagraph.createRun(); // XWPFRun runSectionTitleText = sectionInfoParagraph.createRun();
runSectionTitleText.setText(section.getLabel()); // runSectionTitleText.setText(section.getLabel());
runSectionTitleText.setColor("116a78"); // runSectionTitleText.setColor("116a78");
XWPFParagraph sectionDescriptionParagraph = document.createParagraph(); // XWPFParagraph sectionDescriptionParagraph = document.createParagraph();
XWPFRun runSectionDescription = sectionDescriptionParagraph.createRun(); // XWPFRun runSectionDescription = sectionDescriptionParagraph.createRun();
runSectionDescription.setText("Description: "); // runSectionDescription.setText("Description: ");
runSectionDescription.setColor("000000"); // runSectionDescription.setColor("000000");
XWPFRun runSectionDescriptionText = sectionDescriptionParagraph.createRun(); // XWPFRun runSectionDescriptionText = sectionDescriptionParagraph.createRun();
runSectionDescriptionText.setText(section.getDescription()); // runSectionDescriptionText.setText(section.getDescription());
runSectionDescriptionText.setColor("116a78"); // runSectionDescriptionText.setColor("116a78");
wordBuilder.addParagraphContent("Section Fields", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0); //wordBuilder.addParagraphContent("Section Fields", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
section.getFields().sort(Comparator.comparingInt(FieldModel::getOrdinal)); section.getFields().sort(Comparator.comparingInt(FieldModel::getOrdinal));
for(FieldModel field: section.getFields()){ for(FieldModel field: section.getFields()){
if(field.getCategory() == FieldCategory.SYSTEM){ if(field.getCategory() == FieldCategory.SYSTEM){
SystemField systemField = field.toSystemField(); SystemField systemField = field.toSystemField();
if (systemField.getType() == SystemFieldType.LANGUAGE) continue;
XWPFParagraph systemFieldParagraph = document.createParagraph(); XWPFParagraph systemFieldParagraph = document.createParagraph();
systemFieldParagraph.setSpacingBetween(1.0); // systemFieldParagraph.setSpacingBetween(1.0);
XWPFRun runSyStemFieldTitle = systemFieldParagraph.createRun(); XWPFRun runSyStemFieldTitle = systemFieldParagraph.createRun();
runSyStemFieldTitle.setText("Title: "); runSyStemFieldTitle.setText(systemField.getLabel() +": ");
runSyStemFieldTitle.setColor("000000"); runSyStemFieldTitle.setColor("000000");
XWPFRun runSystemFieldTitleText = systemFieldParagraph.createRun(); // XWPFRun runSystemFieldTitleText = systemFieldParagraph.createRun();
runSystemFieldTitleText.setText(systemField.getLabel()); // runSystemFieldTitleText.setText(systemField.getLabel());
runSystemFieldTitleText.setColor("116a78"); // runSystemFieldTitleText.setColor("116a78");
if(systemField.getDescription() != null && !systemField.getDescription().isEmpty()){ // if(systemField.getDescription() != null && !systemField.getDescription().isEmpty()){
XWPFParagraph systemFieldDescription = document.createParagraph(); // XWPFParagraph systemFieldDescription = document.createParagraph();
systemFieldDescription.setSpacingBetween(1.0); // systemFieldDescription.setSpacingBetween(1.0);
XWPFRun runSyStemFieldDescription = systemFieldDescription.createRun(); // XWPFRun runSyStemFieldDescription = systemFieldDescription.createRun();
runSyStemFieldDescription.setText("Description: "); // runSyStemFieldDescription.setText("Description: ");
runSyStemFieldDescription.setColor("000000"); // runSyStemFieldDescription.setColor("000000");
XWPFRun runSystemFieldDescriptionText = systemFieldDescription.createRun(); // XWPFRun runSystemFieldDescriptionText = systemFieldDescription.createRun();
runSystemFieldDescriptionText.setText(systemField.getDescription()); // runSystemFieldDescriptionText.setText(systemField.getDescription());
runSystemFieldDescriptionText.setColor("116a78"); // runSystemFieldDescriptionText.setColor("116a78");
} // }
XWPFParagraph systemFieldInput = document.createParagraph(); // XWPFParagraph systemFieldInput = document.createParagraph();
systemFieldInput.setSpacingBetween(1.0); // systemFieldInput.setSpacingBetween(1.0);
XWPFRun runInput = systemFieldInput.createRun(); // XWPFRun runInput = systemFieldInput.createRun();
runInput.setText("Input: "); // runInput.setText("Input: ");
runInput.setColor("000000"); // runInput.setColor("000000");
switch (systemField.getType()) { switch (systemField.getType()) {
case TEXT: case TEXT:
XWPFRun runTitle = systemFieldInput.createRun(); XWPFRun runTitle = systemFieldParagraph.createRun();
runTitle.setText(dmpEntity.getLabel()); runTitle.setText(dmpEntity.getLabel());
runTitle.setColor("116a78"); runTitle.setColor("116a78");
break; break;
case HTML_TEXT: case HTML_TEXT:
XWPFRun runDescription = systemFieldInput.createRun(); wordBuilder.addParagraphContent(dmpEntity.getDescription(), document, ParagraphStyle.HTML, BigInteger.ZERO, 0);
runDescription.setText(dmpEntity.getDescription());
runDescription.setColor("116a78");
break; break;
case RESEARCHERS: case RESEARCHERS:
for(Researcher researcher: dmpEntity.getResearchers()){ for(Researcher researcher: dmpEntity.getResearchers()){
XWPFRun runResearcher = systemFieldInput.createRun(); XWPFRun runResearcher = systemFieldParagraph.createRun();
runResearcher.addBreak();
runResearcher.setText("" + researcher.getLabel()); runResearcher.setText("" + researcher.getLabel());
runResearcher.setColor("116a78"); runResearcher.setColor("116a78");
} }
break; break;
case ORGANIZATIONS: case ORGANIZATIONS:
for(Organisation organisation: dmpEntity.getOrganisations()){ for(Organisation organisation: dmpEntity.getOrganisations()){
XWPFRun runOrganisation = systemFieldInput.createRun(); XWPFRun runOrganisation = systemFieldParagraph.createRun();
runOrganisation.addBreak();
runOrganisation.setText("" + organisation.getLabel()); runOrganisation.setText("" + organisation.getLabel());
runOrganisation.setColor("116a78"); runOrganisation.setColor("116a78");
} }
break; break;
case LANGUAGE: // case LANGUAGE:
XWPFRun runLanguage = systemFieldInput.createRun(); // XWPFRun runLanguage = systemFieldParagraph.createRun();
runLanguage.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("language").toString()); // runLanguage.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("language").toString());
runLanguage.setColor("116a78"); // runLanguage.setColor("116a78");
break; // break;
case CONTACT: case CONTACT:
XWPFRun runContact = systemFieldInput.createRun(); XWPFRun runContact = systemFieldParagraph.createRun();
runContact.setText(dmpEntity.getCreator().getName()); runContact.setText(dmpEntity.getCreator() == null ? "" : dmpEntity.getCreator().getName());
runContact.setColor("116a78"); runContact.setColor("116a78");
break; break;
case FUNDER: case FUNDER:
if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getFunder() != null) { if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getFunder() != null) {
XWPFRun runFunder = systemFieldInput.createRun(); XWPFRun runFunder = systemFieldParagraph.createRun();
runFunder.setText(dmpEntity.getGrant().getFunder().getLabel()); runFunder.setText(dmpEntity.getGrant().getFunder().getLabel());
runFunder.setColor("116a78"); runFunder.setColor("116a78");
} }
break; break;
case GRANT: case GRANT:
if (dmpEntity.getGrant() != null) { if (dmpEntity.getGrant() != null) {
XWPFRun runGrant = systemFieldInput.createRun(); XWPFRun runGrant = systemFieldParagraph.createRun();
runGrant.setText(dmpEntity.getGrant().getLabel()); runGrant.setText(dmpEntity.getGrant().getLabel());
runGrant.setColor("116a78"); runGrant.setColor("116a78");
} }
break; break;
case PROJECT: case PROJECT:
if (dmpEntity.getProject() != null ) { if (dmpEntity.getProject() != null ) {
XWPFRun runProject = systemFieldInput.createRun(); XWPFRun runProject = systemFieldParagraph.createRun();
runProject.setText(dmpEntity.getProject().getLabel()); runProject.setText(dmpEntity.getProject().getLabel());
runProject.setColor("116a78"); runProject.setColor("116a78");
} }
@ -1464,52 +1468,73 @@ public class DataManagementPlanManager {
case LICENSE: case LICENSE:
Map extraProperties = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class); Map extraProperties = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
if (extraProperties.containsKey("license")) { if (extraProperties.containsKey("license")) {
XWPFRun runLicense = systemFieldInput.createRun(); Map<String, String> license = ((Map<String, String>) extraProperties.get("license"));
runLicense.setText(extraProperties.get("license").toString()); if(!StringUtils.isEmpty(license.get("pid"))) {
runLicense.setColor("116a78"); XWPFRun runLicense = systemFieldParagraph.createRun();
runLicense.setText(license.get("pid").toString());
runLicense.setColor("116a78");
}
} }
break; break;
case ACCESS_RIGHTS: case ACCESS_RIGHTS:
Map extraPropertiesMap = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class); Map extraPropertiesMap = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
if (extraPropertiesMap.containsKey("visible")) { if (extraPropertiesMap.containsKey("visible")) {
XWPFRun runAccessRights = systemFieldInput.createRun(); XWPFRun runAccessRights = systemFieldParagraph.createRun();
runAccessRights.setText(extraPropertiesMap.get("visible").toString()); runAccessRights.setText(Boolean.valueOf(extraPropertiesMap.get("visible").toString()) ? "Public" : "Restricted");
runAccessRights.setColor("116a78"); runAccessRights.setColor("116a78");
} }
break; break;
} }
document.createParagraph(); //document.createParagraph();
} }
else if(field.getCategory() == FieldCategory.EXTRA){ else if(field.getCategory() == FieldCategory.EXTRA){
Map dmpProperties = objectMapper.readValue(dmpEntity.getProperties(), HashMap.class);
if (dmpProperties != null && (!dmpProperties.containsKey(field.getId().toString()) || StringUtils.isEmpty((String) dmpProperties.get(field.getId().toString())))) continue;
ExtraField extraField = field.toExtraField(); ExtraField extraField = field.toExtraField();
XWPFParagraph extraFieldParagraph = document.createParagraph(); XWPFParagraph extraFieldParagraph = document.createParagraph();
extraFieldParagraph.setSpacingBetween(1.0); extraFieldParagraph.setSpacingBetween(1.0);
XWPFRun runExtraFieldLabel = extraFieldParagraph.createRun(); XWPFRun runExtraFieldLabel = extraFieldParagraph.createRun();
runExtraFieldLabel.setText(extraField.getLabel()); runExtraFieldLabel.setText(extraField.getLabel() + ": ");
runExtraFieldLabel.setColor("116a78"); runExtraFieldLabel.setColor("000000");
if(extraField.getDescription() != null && !extraField.getDescription().isEmpty()){ // if(extraField.getDescription() != null && !extraField.getDescription().isEmpty()){
XWPFRun runExtraFieldDescription = extraFieldParagraph.createRun(); // XWPFRun runExtraFieldDescription = extraFieldParagraph.createRun();
runExtraFieldDescription.setText(extraField.getDescription()); // runExtraFieldDescription.setText(extraField.getDescription());
runExtraFieldDescription.setColor("116a78"); // runExtraFieldDescription.setColor("116a78");
} // }
XWPFRun runExtraFieldInput = extraFieldParagraph.createRun(); XWPFRun runExtraFieldInput = extraFieldParagraph.createRun();
Map dmpProperties = objectMapper.readValue(dmpEntity.getProperties(), HashMap.class); switch (extraField.getType()) {
if (dmpProperties.containsKey(field.getId()) && dmpProperties.get(field.getId()) != null) { case TEXT:
runExtraFieldInput.setText((String) dmpProperties.get(field.getId())); runExtraFieldInput.setText((String) dmpProperties.get(field.getId().toString()));
runExtraFieldInput.setColor("116a78");
break;
case RICH_TEXT:
wordBuilder.addParagraphContent(dmpProperties.get(field.getId().toString()), document, ParagraphStyle.HTML, BigInteger.ZERO, 0);
// runExtraFieldInput.setText((String) dmpProperties.get(field.getId().toString()));
// runExtraFieldInput.setColor("116a78");
break;
case DATE:
runExtraFieldInput.setText((String) dmpProperties.get(field.getId().toString()));
runExtraFieldInput.setColor("116a78");
break;
case NUMBER:
runExtraFieldInput.setText((String) dmpProperties.get(field.getId().toString()));
runExtraFieldInput.setColor("116a78");
break;
} }
runExtraFieldInput.setColor("116a78");
} }
} }
if(!section.getDescriptionTemplates().isEmpty()){ //if(!section.getDescriptionTemplates().isEmpty()){
wordBuilder.addParagraphContent("Section descriptions", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0); wordBuilder.addParagraphContent("Section descriptions", document, ParagraphStyle.HEADER2, BigInteger.ZERO, 0);
wordBuilder.addParagraphContent("Description Templates", document, ParagraphStyle.HEADER4, BigInteger.ZERO, 0); // wordBuilder.addParagraphContent("Description Templates", document, ParagraphStyle.HEADER4, BigInteger.ZERO, 0);
for(eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate descriptionTemplate: section.getDescriptionTemplates()){ // for(eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DescriptionTemplate descriptionTemplate: section.getDescriptionTemplates()){
XWPFParagraph templateParagraph = document.createParagraph(); // XWPFParagraph templateParagraph = document.createParagraph();
XWPFRun runTemplateLabel = templateParagraph.createRun(); // XWPFRun runTemplateLabel = templateParagraph.createRun();
runTemplateLabel.setText("" + descriptionTemplate.getLabel()); // runTemplateLabel.setText("" + descriptionTemplate.getLabel());
runTemplateLabel.setColor("116a78"); // runTemplateLabel.setColor("116a78");
} // }
final Boolean isFinalized = dmpEntity.getStatus() == DMP.DMPStatus.FINALISED.getValue(); final Boolean isFinalized = dmpEntity.getStatus() == DMP.DMPStatus.FINALISED.getValue();
final Boolean isPublic = dmpEntity.isPublic(); final Boolean isPublic = dmpEntity.isPublic();
@ -1538,7 +1563,7 @@ public class DataManagementPlanManager {
datasetDescriptionParagraph.setStyle("Heading4"); datasetDescriptionParagraph.setStyle("Heading4");
datasetDescriptionParagraph.setSpacingBetween(1.5); datasetDescriptionParagraph.setSpacingBetween(1.5);
XWPFRun datasetDescriptionRun = datasetDescriptionParagraph.createRun(); XWPFRun datasetDescriptionRun = datasetDescriptionParagraph.createRun();
datasetDescriptionRun.setText("Dataset Description"); datasetDescriptionRun.setText("Description");
//datasetDescriptionRun.setColor("2E75B6"); //datasetDescriptionRun.setColor("2E75B6");
//datasetDescriptionRun.setBold(true); //datasetDescriptionRun.setBold(true);
datasetDescriptionRun.setFontSize(15); datasetDescriptionRun.setFontSize(15);
@ -1632,7 +1657,7 @@ public class DataManagementPlanManager {
XWPFParagraph parBreakDataset = document.createParagraph(); XWPFParagraph parBreakDataset = document.createParagraph();
parBreakDataset.setPageBreak(true); parBreakDataset.setPageBreak(true);
}); });
} //}
} }
// // Removes the top empty headings. // // Removes the top empty headings.

View File

@ -12,8 +12,8 @@ public class DescriptionTemplate {
private String id; private String id;
private String descriptionTemplateId; private String descriptionTemplateId;
private String label; private String label;
private int minMultiplicity; private Integer minMultiplicity;
private int maxMultiplicity; private Integer maxMultiplicity;
@XmlAttribute(name = "id") @XmlAttribute(name = "id")
public String getId() { public String getId() {
@ -43,20 +43,20 @@ public class DescriptionTemplate {
} }
@XmlAttribute(name = "minMultiplicity") @XmlAttribute(name = "minMultiplicity")
public int getMinMultiplicity() { public Integer getMinMultiplicity() {
return minMultiplicity; return minMultiplicity;
} }
public void setMinMultiplicity(int minMultiplicity) { public void setMinMultiplicity(Integer minMultiplicity) {
this.minMultiplicity = minMultiplicity; this.minMultiplicity = minMultiplicity;
} }
@XmlAttribute(name = "maxMultiplicity") @XmlAttribute(name = "maxMultiplicity")
public int getMaxMultiplicity() { public Integer getMaxMultiplicity() {
return maxMultiplicity; return maxMultiplicity;
} }
public void setMaxMultiplicity(int maxMultiplicity) { public void setMaxMultiplicity(Integer maxMultiplicity) {
this.maxMultiplicity = maxMultiplicity; this.maxMultiplicity = maxMultiplicity;
} }

View File

@ -55,8 +55,8 @@ public class DescriptionTemplate implements XmlSerializable<DescriptionTemplate>
rootElement.setAttribute("id", this.getId().toString()); rootElement.setAttribute("id", this.getId().toString());
rootElement.setAttribute("descriptionTemplateId", this.getDescriptionTemplateId().toString()); rootElement.setAttribute("descriptionTemplateId", this.getDescriptionTemplateId().toString());
rootElement.setAttribute("label", this.label); rootElement.setAttribute("label", this.label);
rootElement.setAttribute("minMultiplicity", String.valueOf(this.minMultiplicity)); if (this.minMultiplicity != null) rootElement.setAttribute("minMultiplicity", String.valueOf(this.minMultiplicity));
rootElement.setAttribute("maxMultiplicity", String.valueOf(this.maxMultiplicity)); if (this.maxMultiplicity != null) rootElement.setAttribute("maxMultiplicity", String.valueOf(this.maxMultiplicity));
return rootElement; return rootElement;
} }

View File

@ -220,6 +220,9 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes['configuration'] && changes['configuration'].isFirstChange) { if (changes['configuration'] && changes['configuration'].isFirstChange) {
this.getSelectedItems(this.value); this.getSelectedItems(this.value);
}
if (changes['value'] && !changes['value'].isFirstChange()) {
this.getSelectedItems(this.value);
} }
} }

View File

@ -12,7 +12,7 @@ export class AuthFieldEditorModel extends FieldDataEditorModel<AuthFieldEditorMo
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup { buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({ const formGroup = this.formBuilder.group({
method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.method')) }], method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.method')) }],
url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.url')) },[Validators.required]], url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.url')) }, [Validators.required]],
body: [{ value: this.body, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.body')) }], body: [{ value: this.body, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.body')) }],
path: [{ value: this.path, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.path')) }, [Validators.required]], path: [{ value: this.path, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.path')) }, [Validators.required]],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.type')) }, [Validators.required]] type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.type')) }, [Validators.required]]
@ -22,11 +22,13 @@ export class AuthFieldEditorModel extends FieldDataEditorModel<AuthFieldEditorMo
} }
fromModel(item: AuthAutoCompleteData): AuthFieldEditorModel { fromModel(item: AuthAutoCompleteData): AuthFieldEditorModel {
this.url = item.url; if (item) {
this.method = item.method; this.url = item.url;
this.body = item.body; this.method = item.method;
this.path = item.path; this.body = item.body;
this.type = item.type; this.path = item.path;
this.type = item.type;
}
return this; return this;
} }

View File

@ -222,7 +222,7 @@
<div class="col-12"> <div class="col-12">
<mat-form-field> <mat-form-field>
<mat-label>Description Templates</mat-label> <mat-label>Description Templates</mat-label>
<app-multiple-auto-complete placeholder="Description Templates" [disabled]="viewOnly" [value]="descriptionTemplatesPerSection[sectionIndex]" [hidePlaceholder]="true" required='false' [configuration]="profilesAutoCompleteConfiguration" (optionRemoved)="onRemoveTemplate($event, sectionIndex)" (optionSelected)="onOptionSelected($event, sectionIndex)"> <app-multiple-auto-complete placeholder="Description Templates" [disabled]="viewOnly" [value]="descriptionTemplatesPerSection[sectionIndex]" [hidePlaceholder]="true" required='false' [configuration]="profilesAutoCompleteConfiguration" (optionRemoved)="onRemoveTemplate($event, sectionIndex)" (optionActionClicked)="onPreviewTemplate($event, sectionIndex)" (optionSelected)="onOptionSelected($event, sectionIndex)">
</app-multiple-auto-complete> </app-multiple-auto-complete>
<!-- <button matSuffix class="input-btn" (click)="allAvailableProfiles($event)"> <!-- <button matSuffix class="input-btn" (click)="allAvailableProfiles($event)">
<mat-icon class="icon-btn">view_list</mat-icon> <mat-icon class="icon-btn">view_list</mat-icon>

View File

@ -219,10 +219,12 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
section.hasTemplates = false; section.hasTemplates = false;
this.sectionsArray().push(section.buildForm()); this.sectionsArray().push(section.buildForm());
this.systemFieldListPerSection.push(new Array()); this.systemFieldListPerSection.push(new Array());
this.descriptionTemplatesPerSection.push(new Array());
} }
removeSection(sectionIndex: number): void { removeSection(sectionIndex: number): void {
this.systemFieldListPerSection.splice(sectionIndex, 1); this.systemFieldListPerSection.splice(sectionIndex, 1);
this.descriptionTemplatesPerSection.splice(sectionIndex, 1);
this.sectionsArray().removeAt(sectionIndex); this.sectionsArray().removeAt(sectionIndex);
this.sectionsArray().controls.forEach((section, index) => { this.sectionsArray().controls.forEach((section, index) => {
section.get('ordinal').setValue(index + 1); section.get('ordinal').setValue(index + 1);
@ -274,6 +276,7 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
} }
selectedFieldType(type: SystemFieldType, sectionIndex: number): void { selectedFieldType(type: SystemFieldType, sectionIndex: number): void {
if (this.systemFieldDisabled(type, sectionIndex)) return;
let index = this.systemFieldListPerSection[sectionIndex].indexOf(type); let index = this.systemFieldListPerSection[sectionIndex].indexOf(type);
if (index == -1) { if (index == -1) {
this.systemFieldListPerSection[sectionIndex].push(type); this.systemFieldListPerSection[sectionIndex].push(type);
@ -371,6 +374,8 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
this.sectionsArray().controls.forEach((section, index) => { this.sectionsArray().controls.forEach((section, index) => {
section.get('ordinal').setValue(index + 1); section.get('ordinal').setValue(index + 1);
}); });
moveItemInArray(this.systemFieldListPerSection, event.previousIndex, event.currentIndex);
moveItemInArray(this.descriptionTemplatesPerSection, event.previousIndex, event.currentIndex);
} }
moveItemInFormArray(formArray: FormArray, fromIndex: number, toIndex: number): void { moveItemInFormArray(formArray: FormArray, fromIndex: number, toIndex: number): void {
@ -394,36 +399,30 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
foundIndex !== -1 && this.descriptionTemplatesArray(sectionIndex).removeAt(foundIndex); foundIndex !== -1 && this.descriptionTemplatesArray(sectionIndex).removeAt(foundIndex);
} }
// onPreviewTemplate(event, sectionIndex: number) { onPreviewTemplate(event, sectionIndex: number) {
// const dialogRef = this.dialog.open(DatasetPreviewDialogComponent, { const dialogRef = this.dialog.open(DatasetPreviewDialogComponent, {
// width: '590px', width: '590px',
// minHeight: '200px', minHeight: '200px',
// restoreFocus: false, restoreFocus: false,
// data: { data: {
// template: event template: event
// }, },
// panelClass: 'custom-modalbox' panelClass: 'custom-modalbox'
// }); });
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
// if (result) { if (result) {
// let profiles = this.sectionsArray().at(sectionIndex).get('descriptionTemplates').value;//this.formGroup.get('profiles').value; const profile: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor();
// const profile: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor(); profile.id = Guid.create().toString();
// profile.id = Guid.create().toString(); profile.descriptionTemplateId = event.id;
// profile.descriptionTemplateId = event.id; profile.label = event.label;
// profile.label = event.label; this.descriptionTemplatesArray(sectionIndex).push(profile.buildForm());
// profiles.push(profile.buildForm());
// this.sectionsArray().at(sectionIndex).get('descriptionTemplates').setValue(profiles);//this.formGroup.get('profiles').setValue(profiles); const items = this.descriptionTemplatesPerSection[sectionIndex];
// this.profilesAutoCompleteConfiguration = { items.push({id: event.id, label: event.label, description: ""});
// filterFn: this.filterProfiles.bind(this), this.descriptionTemplatesPerSection[sectionIndex] = [...items];
// initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), }
// displayFn: (item) => item['label'], });
// titleFn: (item) => item['label'], }
// subtitleFn: (item) => item['description'],
// popupItemActionIcon: 'visibility'
// };
// }
// });
// }
onOptionSelected(item, sectionIndex){ onOptionSelected(item, sectionIndex){
const profile: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor(); const profile: DescriptionTemplatesInSectionEditor = new DescriptionTemplatesInSectionEditor();

View File

@ -74,7 +74,7 @@ export class DatasetCopyDialogueComponent {
map(result => { map(result => {
this.dmpModel = result this.dmpModel = result
this.dmpModel.profiles.forEach((element) => { this.dmpModel.profiles.forEach((element) => {
if (element.id == this.data.datasetProfileId) { if (element.descriptionTemplateId == this.data.datasetProfileId) {
this.data.datasetProfileExist = true; this.data.datasetProfileExist = true;
} }
}) })

View File

@ -1,67 +1,67 @@
import {ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core'; import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import {AbstractControl, FormArray, FormControl, FormGroup} from '@angular/forms'; import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms';
import {MatDialog} from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import {MatSnackBar} from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import {ActivatedRoute, Router} from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {DatasetStatus} from '@app/core/common/enum/dataset-status'; import { DatasetStatus } from '@app/core/common/enum/dataset-status';
import {DmpStatus} from '@app/core/common/enum/dmp-status'; import { DmpStatus } from '@app/core/common/enum/dmp-status';
import {DataTableRequest} from '@app/core/model/data-table/data-table-request'; import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
import {DatasetProfileModel} from '@app/core/model/dataset/dataset-profile'; import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
import {DmpModel} from '@app/core/model/dmp/dmp'; import { DmpModel } from '@app/core/model/dmp/dmp';
import {DmpListingModel} from '@app/core/model/dmp/dmp-listing'; import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
import {DatasetProfileCriteria} from '@app/core/query/dataset-profile/dataset-profile-criteria'; import { DatasetProfileCriteria } from '@app/core/query/dataset-profile/dataset-profile-criteria';
import {DmpCriteria} from '@app/core/query/dmp/dmp-criteria'; import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
import {RequestItem} from '@app/core/query/request-item'; import { RequestItem } from '@app/core/query/request-item';
import {DatasetWizardService} from '@app/core/services/dataset-wizard/dataset-wizard.service'; import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
import {DmpService} from '@app/core/services/dmp/dmp.service'; import { DmpService } from '@app/core/services/dmp/dmp.service';
import { import {
ExternalSourcesConfigurationService ExternalSourcesConfigurationService
} from '@app/core/services/external-sources/external-sources-configuration.service'; } from '@app/core/services/external-sources/external-sources-configuration.service';
import {ExternalSourcesService} from '@app/core/services/external-sources/external-sources.service'; import { ExternalSourcesService } from '@app/core/services/external-sources/external-sources.service';
import { import {
SnackBarNotificationLevel, SnackBarNotificationLevel,
UiNotificationService UiNotificationService
} from '@app/core/services/notification/ui-notification-service'; } from '@app/core/services/notification/ui-notification-service';
import {SingleAutoCompleteConfiguration} from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { import {
DatasetCopyDialogueComponent DatasetCopyDialogueComponent
} from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component'; } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import {DatasetWizardEditorModel} from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item'; import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import {IBreadCrumbComponent} from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent'; import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
import {DatasetDescriptionFormEditorModel} from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
import { import {
Link, Link,
LinkToScroll, LinkToScroll,
TableOfContents TableOfContents
} from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents'; } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents';
import {FormService} from '@common/forms/form-service'; import { FormService } from '@common/forms/form-service';
import { import {
FormValidationErrorsDialogComponent FormValidationErrorsDialogComponent
} from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component'; } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
import {ValidationErrorModel} from '@common/forms/validation/error-model/validation-error-model'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import {ConfirmationDialogComponent} from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import {TranslateService} from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver'; import * as FileSaver from 'file-saver';
import {interval, Observable, of as observableOf} from 'rxjs'; import { interval, Observable, of as observableOf } from 'rxjs';
import {catchError, debounceTime, filter, map, takeUntil} from 'rxjs/operators'; import { catchError, debounceTime, filter, map, takeUntil } from 'rxjs/operators';
import {LockService} from '@app/core/services/lock/lock.service'; import { LockService } from '@app/core/services/lock/lock.service';
import {Location} from '@angular/common'; import { Location } from '@angular/common';
import {LockModel} from '@app/core/model/lock/lock.model'; import { LockModel } from '@app/core/model/lock/lock.model';
import {Guid} from '@common/types/guid'; import { Guid } from '@common/types/guid';
import {isNullOrUndefined} from '@app/utilities/enhancers/utils'; import { isNullOrUndefined } from '@app/utilities/enhancers/utils';
import {AuthService} from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import {ConfigurationService} from '@app/core/services/configuration/configuration.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import {SaveType} from '@app/core/common/enum/save-type'; import { SaveType } from '@app/core/common/enum/save-type';
import {DatasetWizardModel} from '@app/core/model/dataset/dataset-wizard'; import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
import {MatomoService} from '@app/core/services/matomo/matomo-service'; import { MatomoService } from '@app/core/services/matomo/matomo-service';
import {HttpClient} from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import {VisibilityRulesService} from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service'; import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service';
import {PopupNotificationDialogComponent} from '@app/library/notification/popup/popup-notification.component'; import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import {CheckDeactivateBaseComponent} from '@app/library/deactivate/deactivate.component'; import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
import {PrefillDatasetComponent} from "@app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component"; import { PrefillDatasetComponent } from "@app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component";
import {ToCEntry, ToCEntryType} from "@app/ui/misc/dataset-description-form/dataset-description.component"; import { ToCEntry, ToCEntryType } from "@app/ui/misc/dataset-description-form/dataset-description.component";
import {dispatchFakeEvent} from "@angular/cdk/testing/testbed/fake-events"; import { dispatchFakeEvent } from "@angular/cdk/testing/testbed/fake-events";
import { DmpDatasetProfile } from '@app/core/model/dmp/dmp-dataset-profile/dmp-dataset-profile'; import { DmpDatasetProfile } from '@app/core/model/dmp/dmp-dataset-profile/dmp-dataset-profile';
import { DmpProfileService } from '@app/core/services/dmp/dmp-profile.service'; import { DmpProfileService } from '@app/core/services/dmp/dmp-profile.service';
import { DatasetService } from '@app/core/services/dataset/dataset.service'; import { DatasetService } from '@app/core/services/dataset/dataset.service';
@ -202,63 +202,63 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.getSingle(this.itemId) this.datasetWizardService.getSingle(this.itemId)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => { this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => {
this.lockStatus = lockStatus; this.lockStatus = lockStatus;
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
this.dmpSectionIndex = this.datasetWizardModel.dmpSectionIndex; this.dmpSectionIndex = this.datasetWizardModel.dmpSectionIndex;
this.needsUpdate(); this.needsUpdate();
this.breadCrumbs = observableOf([ this.breadCrumbs = observableOf([
{ {
parentComponentName: null, parentComponentName: null,
label: this.datasetWizardModel.label, label: this.datasetWizardModel.label,
url: '/datasets/edit/' + this.datasetWizardModel.id, url: '/datasets/edit/' + this.datasetWizardModel.id,
notFoundResolver: [ notFoundResolver: [
{ {
parentComponentName: null, parentComponentName: null,
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS').toUpperCase(), label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS').toUpperCase(),
url: '/datasets' url: '/datasets'
}, },
] ]
}]); }]);
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
let profiles = this.datasetWizardModel.dmp.profiles.filter(profile => profile.data.dmpSectionIndex.includes(this.datasetWizardModel.dmpSectionIndex)); let profiles = this.datasetWizardModel.dmp.profiles.filter(profile => profile.data.dmpSectionIndex.includes(this.datasetWizardModel.dmpSectionIndex));
for(var profile of profiles){ for (var profile of profiles) {
this.availableDescriptionTemplates.push({id: profile.descriptionTemplateId, label: profile.label, description: ""}) this.addToAvailableDescriptionTemplates(this.availableDescriptionTemplates, { id: profile.descriptionTemplateId, label: profile.label, description: "" });
} }
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === DatasetStatus.Finalized || lockStatus) { if (this.datasetWizardModel.status === DatasetStatus.Finalized || lockStatus) {
this.formGroup.disable(); this.formGroup.disable();
this.viewOnly = true; this.viewOnly = true;
} }
if (!lockStatus && !isNullOrUndefined(this.authService.current())) { if (!lockStatus && !isNullOrUndefined(this.authService.current())) {
this.lock = new LockModel(data.id, this.authService.current()); this.lock = new LockModel(data.id, this.authService.current());
this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => {
this.lock.id = Guid.parse(result); this.lock.id = Guid.parse(result);
interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock()); interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock());
}); });
} }
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP. // if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
this.loadDatasetProfiles(); this.loadDatasetProfiles();
this.registerFormListeners(); this.registerFormListeners();
if (lockStatus) { if (lockStatus) {
this.dialog.open(PopupNotificationDialogComponent, { this.dialog.open(PopupNotificationDialogComponent, {
data: { data: {
title: this.language.instant('DATASET-WIZARD.LOCKED.TITLE'), title: this.language.instant('DATASET-WIZARD.LOCKED.TITLE'),
message: this.language.instant('DATASET-WIZARD.LOCKED.MESSAGE') message: this.language.instant('DATASET-WIZARD.LOCKED.MESSAGE')
}, maxWidth: '30em' }, maxWidth: '30em'
}); });
} }
if(this.finalize && !this.lockStatus && !this.viewOnly) { if (this.finalize && !this.lockStatus && !this.viewOnly) {
setTimeout(() => { setTimeout(() => {
this.saveFinalize(); this.saveFinalize();
}, 0); }, 0);
} }
// this.availableProfiles = this.datasetWizardModel.dmp.profiles; // this.availableProfiles = this.datasetWizardModel.dmp.profiles;
}); });
}, },
error => { error => {
switch (error.status) { switch (error.status) {
case 403: case 403:
@ -284,53 +284,53 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardModel.dmpSectionIndex = this.dmpSectionIndex; this.datasetWizardModel.dmpSectionIndex = this.dmpSectionIndex;
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
let profiles = this.datasetWizardModel.dmp.profiles.filter(profile => profile.data.dmpSectionIndex.includes(this.dmpSectionIndex)); let profiles = this.datasetWizardModel.dmp.profiles.filter(profile => profile.data.dmpSectionIndex.includes(this.dmpSectionIndex));
for(var profile of profiles){ for (var profile of profiles) {
this.availableDescriptionTemplates.push({id: profile.descriptionTemplateId, label: profile.label, description: ""}) this.addToAvailableDescriptionTemplates(this.availableDescriptionTemplates, { id: profile.descriptionTemplateId, label: profile.label, description: "" });
} }
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
this.formGroup.get('dmp').disable(); this.formGroup.get('dmp').disable();
this.dmpProfileService.getSingleBlueprint(data.profile.id) this.dmpProfileService.getSingleBlueprint(data.profile.id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(result => { .subscribe(result => {
const request: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest<DatasetProfileCriteria>(null, null, null); const request: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest<DatasetProfileCriteria>(null, null, null);
request.criteria = new DatasetProfileCriteria(); request.criteria = new DatasetProfileCriteria();
request.criteria.ids = []; request.criteria.ids = [];
result.definition.sections[this.dmpSectionIndex].descriptionTemplates.forEach(template => request.criteria.ids.push(template.descriptionTemplateId)); result.definition.sections[this.dmpSectionIndex].descriptionTemplates.forEach(template => request.criteria.ids.push(template.descriptionTemplateId));
this.availableDescriptionTemplates.forEach(template => request.criteria.ids.push(template.id)); this.availableDescriptionTemplates.forEach(template => request.criteria.ids.push(template.id));
this.datasetService.getDatasetProfilesWithPrefilling(request) this.datasetService.getDatasetProfilesWithPrefilling(request)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(items => { .subscribe(items => {
items.forEach(template => { items.forEach(template => {
if(template.enablePrefilling){ if (template.enablePrefilling) {
this.availableDescriptionTemplatesForPrefilling.push({id: template.id, label: template.label, description: ''}); this.addToAvailableDescriptionTemplates(this.availableDescriptionTemplatesForPrefilling, { id: template.id, label: template.label, description: '' });
}
})
if (this.availableDescriptionTemplatesForPrefilling.length > 0) {
const dialogRef = this.dialog.open(PrefillDatasetComponent, {
width: '590px',
minHeight: '200px',
restoreFocus: false,
data: {
availableProfiles: this.availableDescriptionTemplatesForPrefilling,
datasetFormGroup: this.formGroup
},
panelClass: 'custom-modalbox'
});
dialogRef.afterClosed().subscribe(result => {
if(result) {
this.datasetWizardModel = this.datasetWizardModel.fromModel(result);
this.datasetWizardModel.dmp = data;
this.datasetWizardModel.dmpSectionIndex = this.dmpSectionIndex;
this.formGroup = this.datasetWizardModel.buildForm();
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
this.formGroup.get('dmp').disable();
this.loadDatasetProfiles();
this.registerFormListeners();
} }
}) })
} if (this.availableDescriptionTemplatesForPrefilling.length > 0) {
}); const dialogRef = this.dialog.open(PrefillDatasetComponent, {
width: '590px',
minHeight: '200px',
restoreFocus: false,
data: {
availableProfiles: this.availableDescriptionTemplatesForPrefilling,
datasetFormGroup: this.formGroup
},
panelClass: 'custom-modalbox'
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.datasetWizardModel = this.datasetWizardModel.fromModel(result);
this.datasetWizardModel.dmp = data;
this.datasetWizardModel.dmpSectionIndex = this.dmpSectionIndex;
this.formGroup = this.datasetWizardModel.buildForm();
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
this.formGroup.get('dmp').disable();
this.loadDatasetProfiles();
this.registerFormListeners();
}
})
}
});
}); });
this.loadDatasetProfiles(); this.loadDatasetProfiles();
this.registerFormListeners(); this.registerFormListeners();
@ -419,11 +419,11 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.isNew = false; this.isNew = false;
this.datasetWizardService.getSinglePublic(this.publicId) this.datasetWizardService.getSinglePublic(this.publicId)
.pipe(takeUntil(this._destroyed)).pipe( .pipe(takeUntil(this._destroyed)).pipe(
catchError((error: any) => { catchError((error: any) => {
this.uiNotificationService.snackBarNotification(error.error.message, SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(error.error.message, SnackBarNotificationLevel.Error);
this.router.navigate(['/datasets/publicEdit/' + this.publicId]); this.router.navigate(['/datasets/publicEdit/' + this.publicId]);
return observableOf(null); return observableOf(null);
})) }))
.subscribe(data => { .subscribe(data => {
if (data) { if (data) {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
@ -506,6 +506,13 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
} }
addToAvailableDescriptionTemplates(list: DatasetProfileModel[], item: DatasetProfileModel) {
if (list.some(x => x.id === item.id)) {
list.splice(list.findIndex(x => x.id === item.id), 1)
}
list.push(item);
}
// private _listenersSubscription:Subscription = new Subscription(); // private _listenersSubscription:Subscription = new Subscription();
registerFormListeners() { registerFormListeners() {
// const dmpSubscription = // const dmpSubscription =
@ -593,7 +600,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
searchDmp(query: string): Observable<DmpListingModel[]> { searchDmp(query: string): Observable<DmpListingModel[]> {
const fields: Array<string> = new Array<string>(); const fields: Array<string> = new Array<string>();
fields.push('-created'); fields.push('-created');
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, {fields: fields}); const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria(); dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = query; dmpDataTableRequest.criteria.like = query;
dmpDataTableRequest.criteria.status = DmpStatus.Draft; dmpDataTableRequest.criteria.status = DmpStatus.Draft;
@ -724,12 +731,12 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.hasChanges = false; this.hasChanges = false;
this.datasetIsOnceSaved = true; this.datasetIsOnceSaved = true;
this.onCallbackSuccess(data, saveType); this.onCallbackSuccess(data, saveType);
if(onSuccess) { if (onSuccess) {
onSuccess(); onSuccess();
} }
}, },
error => { error => {
if(onError) { if (onError) {
onError(); onError();
} }
this.onCallbackError(error) this.onCallbackError(error)
@ -747,9 +754,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
else if (key === 'email') { else if (key === 'email') {
errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.EMAIL')); errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.EMAIL'));
} else if (key === 'min') { } else if (key === 'min') {
errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.MIN-VALUE', {'min': formControl.getError('min').min})); errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.MIN-VALUE', { 'min': formControl.getError('min').min }));
} else if (key === 'max') { } else if (key === 'max') {
errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.MAX-VALUE', {'max': formControl.getError('max').max})); errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.MAX-VALUE', { 'max': formControl.getError('max').max }));
} else { } else {
errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + formControl.errors[key].message); errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + name + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + formControl.errors[key].message);
} }
@ -904,27 +911,27 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
filter(x => x), filter(x => x),
takeUntil(this._destroyed) takeUntil(this._destroyed)
).subscribe(result => { ).subscribe(result => {
if (result) { if (result) {
// if (!this.isFormValid()) { return; } // if (!this.isFormValid()) { return; }
this.formGroup.get('status').setValue(DatasetStatus.Draft); this.formGroup.get('status').setValue(DatasetStatus.Draft);
this.submit(SaveType.finalize, () => { this.submit(SaveType.finalize, () => {
this.viewOnly = false; this.viewOnly = false;
this.datasetWizardModel.status = DatasetStatus.Draft; this.datasetWizardModel.status = DatasetStatus.Draft;
setTimeout(x => { setTimeout(x => {
this.formGroup = null; this.formGroup = null;
});
setTimeout(x => {
this.formGroup = this.datasetWizardModel.buildForm();
this.registerFormListeners();
});
}, () => {
this.formGroup.get('status').setValue(DatasetStatus.Finalized);
this.viewOnly = true;
}); });
setTimeout(x => { } else {
this.formGroup = this.datasetWizardModel.buildForm(); this.saving = false;
this.registerFormListeners(); }
}); });
}, () => {
this.formGroup.get('status').setValue(DatasetStatus.Finalized);
this.viewOnly = true;
});
} else {
this.saving = false;
}
});
} }
@ -1009,7 +1016,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
document.getElementById('stepper-options').scrollTop = this.tocScrollTop; document.getElementById('stepper-options').scrollTop = this.tocScrollTop;
}, 500); }, 500);
this.saving = false; this.saving = false;
if(this.isNew) { if (this.isNew) {
this.reloadDateset(this.datasetWizardModel.id); this.reloadDateset(this.datasetWizardModel.id);
} }
// this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); }); // this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); });
@ -1040,7 +1047,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.downloadPDF(id) this.datasetWizardService.downloadPDF(id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(response => { .subscribe(response => {
const blob = new Blob([response.body], {type: 'application/pdf'}); const blob = new Blob([response.body], { type: 'application/pdf' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename); FileSaver.saveAs(blob, filename);
@ -1052,7 +1059,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.downloadDOCX(id) this.datasetWizardService.downloadDOCX(id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(response => { .subscribe(response => {
const blob = new Blob([response.body], {type: 'application/msword'}); const blob = new Blob([response.body], { type: 'application/msword' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename); FileSaver.saveAs(blob, filename);
@ -1065,7 +1072,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.downloadXML(id) this.datasetWizardService.downloadXML(id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(response => { .subscribe(response => {
const blob = new Blob([response.body], {type: 'application/xml'}); const blob = new Blob([response.body], { type: 'application/xml' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename); FileSaver.saveAs(blob, filename);
@ -1186,7 +1193,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
.subscribe(result => { .subscribe(result => {
if (result && result.datasetProfileExist) { if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id const newDmpId = result.formControl.value.id
this.router.navigate(['/datasets/copy/' + result.datasetId], {queryParams: {newDmpId: newDmpId}}); this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
} }
}); });
} }
@ -1238,9 +1245,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
getEntryVisibleFieldSets(entry: ToCEntry): ToCEntry[] { getEntryVisibleFieldSets(entry: ToCEntry): ToCEntry[] {
let fieldSets = []; let fieldSets = [];
if(entry.type === ToCEntryType.FieldSet && !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id)) { if (entry.type === ToCEntryType.FieldSet && !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id)) {
fieldSets.push(entry); fieldSets.push(entry);
} else if(entry.type !== ToCEntryType.FieldSet) { } else if (entry.type !== ToCEntryType.FieldSet) {
entry.subEntries.forEach(subEntry => { entry.subEntries.forEach(subEntry => {
fieldSets = fieldSets.concat(this.getEntryVisibleFieldSets(subEntry)); fieldSets = fieldSets.concat(this.getEntryVisibleFieldSets(subEntry));
}); });
@ -1248,13 +1255,13 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
return fieldSets; return fieldSets;
} }
get visibleFieldSets(): ToCEntry[]{ get visibleFieldSets(): ToCEntry[] {
let fieldSets = []; let fieldSets = [];
let arrays= this.table0fContents?this.table0fContents.tocentries. let arrays = this.table0fContents ? this.table0fContents.tocentries.
filter(entry => !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id)).map(entry => { filter(entry => !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id)).map(entry => {
return this.getEntryVisibleFieldSets(entry); return this.getEntryVisibleFieldSets(entry);
}) })
:[]; : [];
arrays.forEach(array => { arrays.forEach(array => {
fieldSets = fieldSets.concat(array); fieldSets = fieldSets.concat(array);
}); });
@ -1262,11 +1269,11 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
getFirstFieldSet(entry: ToCEntry): ToCEntry { getFirstFieldSet(entry: ToCEntry): ToCEntry {
if(entry.type === ToCEntryType.FieldSet && !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id)) { if (entry.type === ToCEntryType.FieldSet && !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id)) {
return entry; return entry;
} else { } else {
let subEntries = entry.subEntries.filter(subEntry => !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === subEntry.id)); let subEntries = entry.subEntries.filter(subEntry => !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === subEntry.id));
if(subEntries.length > 0) { if (subEntries.length > 0) {
return this.getFirstFieldSet(subEntries[0]); return this.getFirstFieldSet(subEntries[0]);
} else { } else {
return null; return null;
@ -1275,11 +1282,11 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
public changeStep(selected: ToCEntry = null, execute: boolean = true) { public changeStep(selected: ToCEntry = null, execute: boolean = true) {
if(execute) { if (execute) {
if(selected) { if (selected) {
let fieldSet = this.getFirstFieldSet(selected); let fieldSet = this.getFirstFieldSet(selected);
let index = this.visibleFieldSets.findIndex(entry => entry.id === fieldSet.id); let index = this.visibleFieldSets.findIndex(entry => entry.id === fieldSet.id);
this.step = index + (selected.type === ToCEntryType.FieldSet?1:0.5); this.step = index + (selected.type === ToCEntryType.FieldSet ? 1 : 0.5);
} else { } else {
this.step = 0; this.step = 0;
this.resetScroll(); this.resetScroll();
@ -1303,7 +1310,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
public previousStep() { public previousStep() {
if (this.step > 0) { if (this.step > 0) {
this.step = Math.ceil(this.step - 1); this.step = Math.ceil(this.step - 1);
if(this.step >= 1) { if (this.step >= 1) {
let entry = this.visibleFieldSets[this.step - 1]; let entry = this.visibleFieldSets[this.step - 1];
this.table0fContents.onToCentrySelected(entry, false); this.table0fContents.onToCentrySelected(entry, false);
this.scroll(entry); this.scroll(entry);

View File

@ -83,7 +83,7 @@
</div> </div>
<div class="col-auto formForStep0" id="editor-form" *ngIf="this.step === 0 && this.isNew"> <div class="col-auto formForStep0" id="editor-form" *ngIf="this.step === 0 && this.isNew">
<div class="col-12 blueprint-section" [hidden]="this.step !== 0"> <div class="col-12 blueprint-section" [hidden]="this.step !== 0">
<div class="input-form"> <div class="">
<div class="heading2">0.1 Title of DMP *</div> <div class="heading2">0.1 Title of DMP *</div>
<mat-form-field> <mat-form-field>
<mat-label>Title</mat-label> <mat-label>Title</mat-label>
@ -94,13 +94,13 @@
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> --> {{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
<div class="input-form"> <div class="">
<div class="heading2">0.2 Description of DMP *</div> <div class="heading2">0.2 Description of DMP *</div>
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" <rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'"
[placeholder]="'Fill with description'" [required]="true"> [placeholder]="'Fill with description'" [required]="true">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
<div class="dmp-blueprint-form" style="margin-top: 3%;"> <div class="" style="margin-top: 3%;">
<div class="heading2">0.3 Blueprint of DMP *</div> <div class="heading2">0.3 Blueprint of DMP *</div>
<mat-form-field> <mat-form-field>
<mat-label>Select blueprint</mat-label> <mat-label>Select blueprint</mat-label>
@ -110,7 +110,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-5"> <div class="col-5">
<button mat-button class="action-btn" [disabled]="selectedDmpBlueprintDefinition == null" (click)="selectBlueprint()">Next</button> <button mat-button class="action-btn" [disabled]="selectedDmpBlueprintDefinition == null || !(formGroup.get('label').valid && formGroup.get('description').valid)" (click)="selectBlueprint()">Next</button>
</div> </div>
<div class="col-7" *ngIf="formGroup.get('profile').value == null || (formGroup.get('profile').value && formGroup.get('profile').value.id !== defaultBlueprintId)"> <div class="col-7" *ngIf="formGroup.get('profile').value == null || (formGroup.get('profile').value && formGroup.get('profile').value.id !== defaultBlueprintId)">
<div class="row"> <div class="row">
@ -138,7 +138,7 @@
<div *ngFor="let field of section.fields; let j=index"> <div *ngFor="let field of section.fields; let j=index">
<div class="heading">{{i + 1}}.{{j + 1}} {{field.label}}<span *ngIf="field.required">*</span></div> <div class="heading">{{i + 1}}.{{j + 1}} {{field.label}}<span *ngIf="field.required">*</span></div>
<div *ngIf="field.description != null && field.description.length > 0" class="hint">{{field.description}}</div> <div *ngIf="field.description != null && field.description.length > 0" class="hint">{{field.description}}</div>
<div class="input-form"> <div class="">
<div *ngIf="field.category === 'SYSTEM'"> <div *ngIf="field.category === 'SYSTEM'">
<div *ngIf="field.type == 0"> <div *ngIf="field.type == 0">
<mat-form-field> <mat-form-field>
@ -305,7 +305,7 @@
<div class="col-12 card" *ngIf="section.hasTemplates"> <div class="col-12 card" *ngIf="section.hasTemplates">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="input-form"> <div class="">
<div class="heading">Description templates</div> <div class="heading">Description templates</div>
<mat-form-field> <mat-form-field>
<mat-label>{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}</mat-label> <mat-label>{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}</mat-label>

View File

@ -357,13 +357,13 @@ a:hover {
} }
.input-form { .input-form {
text-align: left; // text-align: left;
font-weight: 400; // font-weight: 400;
font-size: 16px; // font-size: 16px;
letter-spacing: 0.15px; // letter-spacing: 0.15px;
color: #7d7d7d; // color: #7d7d7d;
opacity: 1; // opacity: 1;
margin-bottom: 1rem; // margin-bottom: 1rem;
} }
.insert-manually { .insert-manually {

View File

@ -64,9 +64,9 @@ interface Visible {
} }
@Component({ @Component({
selector: 'app-dmp-editor-blueprint', selector: 'app-dmp-editor-blueprint',
templateUrl: './dmp-editor-blueprint.component.html', templateUrl: './dmp-editor-blueprint.component.html',
styleUrls: ['./dmp-editor-blueprint.component.scss'] styleUrls: ['./dmp-editor-blueprint.component.scss']
}) })
export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent implements OnInit { export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent implements OnInit {
@ -84,7 +84,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
hasChanges = false; hasChanges = false;
isDiscarded = false; isDiscarded = false;
isCreateNew = false; isCreateNew = false;
isCreateNewProject = false; isCreateNewProject = false;
isCreateNewFunder = false; isCreateNewFunder = false;
@ -148,11 +148,11 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
private dialog: MatDialog, private dialog: MatDialog,
private lockService: LockService, private lockService: LockService,
private matomoService: MatomoService private matomoService: MatomoService
) { ) {
super(); super();
} }
ngOnInit(): void { ngOnInit(): void {
this.matomoService.trackPageView('DMP Editor'); this.matomoService.trackPageView('DMP Editor');
this.route.params this.route.params
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
@ -184,7 +184,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
this.checkForFunder(); this.checkForFunder();
this.checkForProject(); this.checkForProject();
this.buildExtraFields(); this.buildExtraFields();
this.formGroup.get('profile').setValue(result.id); this.formGroup.get('profile').setValue(result);
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length; this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
this.step = 1; this.step = 1;
this.addProfiles(); this.addProfiles();
@ -214,16 +214,16 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
this.formGroup.get('extraProperties').get('language').patchValue('en'); this.formGroup.get('extraProperties').get('language').patchValue('en');
} }
try{ try {
const profiles = this.formGroup.get('profiles').value as DmpDatasetProfile[]; const profiles = this.formGroup.get('profiles').value as DmpDatasetProfile[];
profiles.sort((a,b)=>a.label.localeCompare(b.label)); profiles.sort((a, b) => a.label.localeCompare(b.label));
}catch{ } catch {
console.info('Could not sort profiles'); console.info('Could not sort profiles');
} }
} }
}); });
this.profilesAutoCompleteConfiguration = { this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this), filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
@ -232,84 +232,87 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
subtitleFn: (item) => item['description'], subtitleFn: (item) => item['description'],
popupItemActionIcon: 'visibility' popupItemActionIcon: 'visibility'
}; };
} }
private getItem(itemId: String) { private getItem(itemId: String) {
this.dmpService.getSingle(itemId).pipe(map(data => data as DmpModel)) this.dmpService.getSingle(itemId).pipe(map(data => data as DmpModel))
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(async data => { .subscribe(async data => {
this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => { this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => {
this.lockStatus = lockStatus; this.lockStatus = lockStatus;
this.dmp = new DmpEditorModel(); this.dmp = new DmpEditorModel();
this.dmp.grant = new GrantTabModel(); this.dmp.grant = new GrantTabModel();
this.dmp.project = new ProjectFormModel(); this.dmp.project = new ProjectFormModel();
this.dmp.funder = new FunderFormModel(); this.dmp.funder = new FunderFormModel();
this.dmp.extraProperties = new ExtraPropertiesFormModel(); this.dmp.extraProperties = new ExtraPropertiesFormModel();
this.dmp.fromModel(data); this.dmp.fromModel(data);
this.formGroup = this.dmp.buildForm(); this.formGroup = this.dmp.buildForm();
this.datasets = this.formGroup.get('datasets') as FormArray; this.datasets = this.formGroup.get('datasets') as FormArray;
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
if (!isNullOrUndefined(this.formGroup.get('profile').value)) { if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
this.dmpProfileService.getSingleBlueprint(this.formGroup.get('profile').value) this.dmpProfileService.getSingleBlueprint(this.formGroup.get('profile').value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(result => { .subscribe(result => {
this.selectedDmpBlueprintDefinition = result.definition; this.selectedDmpBlueprintDefinition = result.definition;
this.checkForGrant(); this.checkForGrant();
this.checkForFunder(); this.checkForFunder();
this.checkForProject(); this.checkForProject();
this.buildExtraFields(); this.buildExtraFields();
this.formGroup.get('profile').setValue(result.id); this.formGroup.get('profile').setValue(result);
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length; this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
this.step = 1; this.step = 1;
this.addProfiles(this.dmp.profiles); this.sectionTemplates = new Array<Array<DatasetProfileModel>>();
}); this.addProfiles(this.dmp.profiles);
} });
this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
this.setIsUserOwner();
if (!this.isUserOwner) {
if(this.isUserMember()){
this.router.navigate(['plans', 'overview', itemId]);
return;
} }
this.isFinalized = true; this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
this.formGroup.disable();
}
if (this.dmp.status === DmpStatus.Finalized || lockStatus) { this.setIsUserOwner();
this.isFinalized = true; if (!this.isUserOwner) {
this.formGroup.disable();
}
if (this.authService.current() != null) { if (this.isUserMember()) {
if (!lockStatus) { this.router.navigate(['plans', 'overview', itemId]);
this.lock = new LockModel(data.id, this.getUserFromDMP()); return;
}
this.isFinalized = true;
this.formGroup.disable();
}
this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { if (this.dmp.status === DmpStatus.Finalized || lockStatus) {
this.lock.id = Guid.parse(result); this.isFinalized = true;
interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock()); this.formGroup.disable();
}
if (this.authService.current() != null) {
if (!lockStatus) {
this.lock = new LockModel(data.id, this.getUserFromDMP());
this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => {
this.lock.id = Guid.parse(result);
interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock());
});
}
}
this.associatedUsers = data.associatedUsers;
this.people = data.users;
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => {
this.formChanged();
});
if (this.lockStatus) {
this.dialog.open(PopupNotificationDialogComponent, {
data: {
title: this.language.instant('DMP-EDITOR.LOCKED.TITLE'),
message: this.language.instant('DMP-EDITOR.LOCKED.MESSAGE')
}, maxWidth: '30em'
}); });
} }
} });
this.associatedUsers = data.associatedUsers;
this.people = data.users;
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => {
this.formChanged();
});
if(this.lockStatus){
this.dialog.open(PopupNotificationDialogComponent,{data:{
title:this.language.instant('DMP-EDITOR.LOCKED.TITLE'),
message:this.language.instant('DMP-EDITOR.LOCKED.MESSAGE')
}, maxWidth:'30em'});
}
}); });
});
} }
extraFieldsArray(): FormArray { extraFieldsArray(): FormArray {
@ -319,15 +322,15 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
setIsUserOwner() { setIsUserOwner() {
if (this.dmp) { if (this.dmp) {
const principal: Principal = this.authService.current(); const principal: Principal = this.authService.current();
this.isUserOwner = !!this.dmp.users.find(x => (x.role === Role.Owner) && (x.id === principal.id) ); this.isUserOwner = !!this.dmp.users.find(x => (x.role === Role.Owner) && (x.id === principal.id));
} }
} }
isUserMember(): boolean{ isUserMember(): boolean {
try{ try {
const principal: Principal = this.authService.current(); const principal: Principal = this.authService.current();
return !!this.dmp.users.find(x => (x.role === Role.Member) && (x.id === principal.id) ); return !!this.dmp.users.find(x => (x.role === Role.Member) && (x.id === principal.id));
}catch{ } catch {
return false; return false;
} }
} }
@ -420,7 +423,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
this.saving = true; this.saving = true;
this.formService.touchAllFormFields(this.formGroup); this.formService.touchAllFormFields(this.formGroup);
if(!this._isDMPDescriptionValid()){ if (!this._isDMPDescriptionValid()) {
const errmess = this._buildDMPDescriptionErrorMessages(); const errmess = this._buildDMPDescriptionErrorMessages();
this.showValidationErrorsDialog(undefined, errmess); this.showValidationErrorsDialog(undefined, errmess);
this.hintErrors = true; this.hintErrors = true;
@ -438,13 +441,15 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
selectDefaultBlueprint() { selectDefaultBlueprint() {
this.dmpProfileService.getSingleBlueprint(this.defaultBlueprintId) this.dmpProfileService.getSingleBlueprint(this.defaultBlueprintId)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(result => { .subscribe(result => {
this.selectedDmpBlueprintDefinition = result.definition; this.selectedDmpBlueprintDefinition = result.definition;
this.formGroup.get('profile').setValue(result.id); this.formGroup.get('profile').setValue(result);
this.maxStep = this.selectedDmpBlueprintDefinition.sections.length; this.maxStep = this.selectedDmpBlueprintDefinition.sections.length;
this.nextStep(); if (this.formGroup.get('label').valid && this.formGroup.get('description').valid) {
}); this.nextStep();
}
});
} }
selectBlueprint() { selectBlueprint() {
@ -485,7 +490,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
addDataset(dmpSectionIndex: number) { addDataset(dmpSectionIndex: number) {
this.saving = true; this.saving = true;
if(!this._isDMPDescriptionValid()){ if (!this._isDMPDescriptionValid()) {
const errmess = this._buildDMPDescriptionErrorMessages(); const errmess = this._buildDMPDescriptionErrorMessages();
this.showValidationErrorsDialog(undefined, errmess); this.showValidationErrorsDialog(undefined, errmess);
this.hintErrors = true; this.hintErrors = true;
@ -581,7 +586,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
// On save keep editor position // On save keep editor position
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
if (dmp) { if (dmp) {
if(this.isNew){ if (this.isNew) {
this.router.navigate(['/plans', 'edit', dmp.id]); this.router.navigate(['/plans', 'edit', dmp.id]);
} }
this.getItem(dmp.id); this.getItem(dmp.id);
@ -619,10 +624,10 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
this.saving = false; this.saving = false;
} }
editDataset(id: string, isNew: boolean, showModal:boolean = false) { editDataset(id: string, isNew: boolean, showModal: boolean = false) {
if(showModal){ if (showModal) {
const dialogRef = this.dialog.open(DmpToDatasetDialogComponent, { const dialogRef = this.dialog.open(DmpToDatasetDialogComponent, {
width: '500px', width: '500px',
autoFocus: false, autoFocus: false,
@ -637,7 +642,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
} }
}); });
}else{ } else {
if (isNew) { if (isNew) {
this.router.navigate(['/datasets', 'new', id, this.dmpSectionIndex]); this.router.navigate(['/datasets', 'new', id, this.dmpSectionIndex]);
} else { } else {
@ -688,38 +693,38 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
//checks if the dpm is valid not taking into account the datasets validity //checks if the dpm is valid not taking into account the datasets validity
private _isDMPDescriptionValid():boolean{ private _isDMPDescriptionValid(): boolean {
const form: FormGroup = this.formGroup; const form: FormGroup = this.formGroup;
if(form.controls){ if (form.controls) {
return Object.keys(form.controls) return Object.keys(form.controls)
.map(controlName=>{//get validity of each control .map(controlName => {//get validity of each control
if(controlName === 'datasets'){//we dont care if datasets are valid if (controlName === 'datasets') {//we dont care if datasets are valid
return true; return true;
} }
return !form.get(controlName).invalid;//!! in case the control is disabled, we consider it valid return !form.get(controlName).invalid;//!! in case the control is disabled, we consider it valid
}) })
.reduce((isFormValid,isControlValid)=>{//aggregate validities .reduce((isFormValid, isControlValid) => {//aggregate validities
return isControlValid && isFormValid; return isControlValid && isFormValid;
}, true); }, true);
} }
return true; return true;
} }
private showValidationErrorsDialog(projectOnly?: boolean, errmess?: string[]) { private showValidationErrorsDialog(projectOnly?: boolean, errmess?: string[]) {
if(errmess){ if (errmess) {
const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, { const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, {
disableClose: true, disableClose: true,
autoFocus: false, autoFocus: false,
restoreFocus: false, restoreFocus: false,
data: { data: {
errorMessages:errmess, errorMessages: errmess,
projectOnly: projectOnly projectOnly: projectOnly
}, },
}); });
}else{ } else {
const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, { const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, {
disableClose: true, disableClose: true,
autoFocus: false, autoFocus: false,
@ -733,10 +738,10 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
private _buildDMPDescriptionErrorMessages(): string[]{//not including datasets private _buildDMPDescriptionErrorMessages(): string[] {//not including datasets
const errmess: string[] = []; const errmess: string[] = [];
Object.keys(this.formGroup.controls).forEach(controlName=>{ Object.keys(this.formGroup.controls).forEach(controlName => {
if(controlName != 'datasets' && this.formGroup.get(controlName).invalid){ if (controlName != 'datasets' && this.formGroup.get(controlName).invalid) {
errmess.push(...this._buildErrorMessagesForAbstractControl(this.formGroup.get(controlName), controlName)); errmess.push(...this._buildErrorMessagesForAbstractControl(this.formGroup.get(controlName), controlName));
} }
}) })
@ -745,16 +750,16 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
// takes as an input an abstract control and gets its error messages[] // takes as an input an abstract control and gets its error messages[]
private _buildErrorMessagesForAbstractControl(aControl: AbstractControl, controlName: string):string[]{ private _buildErrorMessagesForAbstractControl(aControl: AbstractControl, controlName: string): string[] {
const errmess:string[] = []; const errmess: string[] = [];
if(aControl.invalid){ if (aControl.invalid) {
if(aControl.errors){ if (aControl.errors) {
//check if has placeholder //check if has placeholder
if( (<any>aControl).nativeElement !== undefined && (<any>aControl).nativeElement !== null){ if ((<any>aControl).nativeElement !== undefined && (<any>aControl).nativeElement !== null) {
const placeholder = this._getPlaceHolder(aControl); const placeholder = this._getPlaceHolder(aControl);
if(placeholder){ if (placeholder) {
controlName = placeholder; controlName = placeholder;
} }
} }
@ -765,19 +770,19 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
/*in case the aControl is FormControl then the it should have provided its error messages above. /*in case the aControl is FormControl then the it should have provided its error messages above.
No need to check case of FormControl below*/ No need to check case of FormControl below*/
if(aControl instanceof FormGroup){ if (aControl instanceof FormGroup) {
const fg = aControl as FormGroup; const fg = aControl as FormGroup;
//check children //check children
Object.keys(fg.controls).forEach(controlName=>{ Object.keys(fg.controls).forEach(controlName => {
errmess.push(...this._buildErrorMessagesForAbstractControl(fg.get(controlName), controlName)); errmess.push(...this._buildErrorMessagesForAbstractControl(fg.get(controlName), controlName));
}); });
}else if(aControl instanceof FormArray){ } else if (aControl instanceof FormArray) {
const fa = aControl as FormArray; const fa = aControl as FormArray;
fa.controls.forEach((control,index)=>{ fa.controls.forEach((control, index) => {
errmess.push(... this._buildErrorMessagesForAbstractControl(control, `${controlName} --> ${index+1}`)); errmess.push(... this._buildErrorMessagesForAbstractControl(control, `${controlName} --> ${index + 1}`));
}); });
} }
@ -821,23 +826,23 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
return this.dmpService.searchDMPProfiles(request); return this.dmpService.searchDMPProfiles(request);
} }
registerFormEventsForDmpBlueprint(): void { registerFormEventsForDmpBlueprint(): void {
this.formGroup.get('profile').valueChanges this.formGroup.get('profile').valueChanges
.pipe( .pipe(
takeUntil(this._destroyed)) takeUntil(this._destroyed))
.subscribe(Option => { .subscribe(Option => {
if (Option instanceof Object) { if (Option instanceof Object) {
this.selectedDmpBlueprintDefinition = Option.definition; this.selectedDmpBlueprintDefinition = Option.definition;
this.checkForGrant(); this.checkForGrant();
this.checkForFunder(); this.checkForFunder();
this.checkForProject(); this.checkForProject();
this.buildExtraFields(); this.buildExtraFields();
this.addProfiles(); this.addProfiles();
} }
else { else {
this.selectedDmpBlueprintDefinition = null; this.selectedDmpBlueprintDefinition = null;
} }
}) })
} }
private buildExtraFields(): void { private buildExtraFields(): void {
@ -848,7 +853,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
extraField.id = field.id; extraField.id = field.id;
if (!isNullOrUndefined(this.dmp.extraFields)) { if (!isNullOrUndefined(this.dmp.extraFields)) {
let found = this.dmp.extraFields.find(f => f.id === field.id); let found = this.dmp.extraFields.find(f => f.id === field.id);
if(found !== undefined) { if (found !== undefined) {
extraField.value = found.value; extraField.value = found.value;
} }
} }
@ -905,27 +910,27 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
private addProfiles(profiles?: DmpDatasetProfile[]) { private addProfiles(profiles?: DmpDatasetProfile[]) {
for(let i = 0; i < this.selectedDmpBlueprintDefinition.sections.length; i++){ for (let i = 0; i < this.selectedDmpBlueprintDefinition.sections.length; i++) {
this.sectionTemplates.push(new Array<DatasetProfileModel>()); this.sectionTemplates.push(new Array<DatasetProfileModel>());
} }
const templates: Array<DmpDatasetProfile> = new Array<DmpDatasetProfile>(); const templates: Array<DmpDatasetProfile> = new Array<DmpDatasetProfile>();
this.selectedDmpBlueprintDefinition.sections.forEach(section => { this.selectedDmpBlueprintDefinition.sections.forEach(section => {
if (profiles !== undefined) { if (profiles !== undefined) {
profiles.filter(profile => profile.data.dmpSectionIndex.includes(section.ordinal - 1)).forEach(profile => this.sectionTemplates[section.ordinal - 1].push({id: profile.descriptionTemplateId, label: profile.label, description: ""})); profiles.filter(profile => profile.data.dmpSectionIndex.includes(section.ordinal - 1)).forEach(profile => this.sectionTemplates[section.ordinal - 1].push({ id: profile.descriptionTemplateId, label: profile.label, description: "" }));
} }
else { else {
section.descriptionTemplates.forEach(template => { section.descriptionTemplates.forEach(template => {
this.sectionTemplates[section.ordinal - 1].push({id: template.descriptionTemplateId, label: template.label, description: ""}) this.sectionTemplates[section.ordinal - 1].push({ id: template.descriptionTemplateId, label: template.label, description: "" })
let found: DmpDatasetProfile = templates.find(dmpDatasetProfile => dmpDatasetProfile.descriptionTemplateId == template.descriptionTemplateId); let found: DmpDatasetProfile = templates.find(dmpDatasetProfile => dmpDatasetProfile.descriptionTemplateId == template.descriptionTemplateId);
if (found === undefined) { if (found === undefined) {
let data: DmpDatasetProfileSectionsFormModel= new DmpDatasetProfileSectionsFormModel(); let data: DmpDatasetProfileSectionsFormModel = new DmpDatasetProfileSectionsFormModel();
data.dmpSectionIndex.push(section.ordinal - 1); data.dmpSectionIndex.push(section.ordinal - 1);
let id = null; let id = null;
if (profiles !== undefined) { if (profiles !== undefined) {
let existedProfile = profiles.find(profile => profile.descriptionTemplateId == template.descriptionTemplateId); let existedProfile = profiles.find(profile => profile.descriptionTemplateId == template.descriptionTemplateId);
if (existedProfile !== undefined) { if (existedProfile !== undefined) {
id = existedProfile.id; id = existedProfile.id;
} }
} }
let profile: DmpDatasetProfile = { let profile: DmpDatasetProfile = {
id: id, id: id,
@ -942,10 +947,10 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
}); });
(profiles !== undefined) ? this.formGroup.get('profiles').setValue(profiles) : this.formGroup.get('profiles').setValue(templates); (profiles !== undefined) ? this.formGroup.get('profiles').setValue(profiles) : this.formGroup.get('profiles').setValue(templates);
} }
dmpBlueprintAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { dmpBlueprintAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
filterFn: this.dmpBlueprintSearch.bind(this), filterFn: this.dmpBlueprintSearch.bind(this),
initialItems: (extraData) => this.dmpBlueprintSearch(''), initialItems: (extraData) => this.dmpBlueprintSearch(''),
displayFn: (item) => item['label'], displayFn: (item) => item['label'],
@ -961,7 +966,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
return this.dmpProfileService.getPagedBlueprint(request).pipe(map(x => x.data)); return this.dmpProfileService.getPagedBlueprint(request).pipe(map(x => x.data));
} }
getLanguageInfos(): LanguageInfo[] { getLanguageInfos(): LanguageInfo[] {
return this.languageInfoService.getLanguageInfoValues(); return this.languageInfoService.getLanguageInfoValues();
} }
@ -977,7 +982,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
return associates; return associates;
} }
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = { organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterOrganisations.bind(this), filterFn: this.filterOrganisations.bind(this),
initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
displayFn: (item) => item['name'], displayFn: (item) => item['name'],
@ -992,7 +997,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
subtitleFn: (item) => item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) subtitleFn: (item) => item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE'))
}; };
// Researchers // Researchers
filterResearchers(value: string): Observable<ExternalSourceItemModel[]> { filterResearchers(value: string): Observable<ExternalSourceItemModel[]> {
return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } }); return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } });
} }
@ -1060,7 +1065,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
}); });
} }
showToggleButton() { showToggleButton() {
return (!this.isFinalized && this.isUserOwner) || this.isClone; return (!this.isFinalized && this.isUserOwner) || this.isClone;
} }
@ -1104,7 +1109,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
}; };
} }
else{ else {
this.sectionTemplates[sectionIndex] = this.sectionTemplates[sectionIndex].filter(sectionProfile => sectionProfile.id !== event.id); this.sectionTemplates[sectionIndex] = this.sectionTemplates[sectionIndex].filter(sectionProfile => sectionProfile.id !== event.id);
profiles = profiles.filter(sectionProfile => sectionProfile.descriptionTemplateId !== event.id); profiles = profiles.filter(sectionProfile => sectionProfile.descriptionTemplateId !== event.id);
this.formGroup.get('profiles').setValue(profiles); this.formGroup.get('profiles').setValue(profiles);
@ -1114,18 +1119,18 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
addProfile(event, sectionIndex: number) { addProfile(event, sectionIndex: number) {
const profiles = this.formGroup.get('profiles').value as DmpDatasetProfile[]; const profiles = this.formGroup.get('profiles').value as DmpDatasetProfile[];
let found = profiles.find((value) => value.id === event.id); let found = profiles.find((value) => value.id === event.id);
if(found !== undefined) { if (found !== undefined) {
if(found.data.dmpSectionIndex.indexOf(sectionIndex) === -1){ if (found.data.dmpSectionIndex.indexOf(sectionIndex) === -1) {
found.data.dmpSectionIndex.push(sectionIndex); found.data.dmpSectionIndex.push(sectionIndex);
} }
else{ else {
this.sectionTemplates[sectionIndex].pop(); this.sectionTemplates[sectionIndex].pop();
} }
} }
else{ else {
let dmpDatasetProfileSection: DmpDatasetProfileSectionsFormModel = new DmpDatasetProfileSectionsFormModel(); let dmpDatasetProfileSection: DmpDatasetProfileSectionsFormModel = new DmpDatasetProfileSectionsFormModel();
dmpDatasetProfileSection.dmpSectionIndex = [sectionIndex]; dmpDatasetProfileSection.dmpSectionIndex = [sectionIndex];
profiles.push({id: null, descriptionTemplateId: event.id, label: event.label, data: dmpDatasetProfileSection}); profiles.push({ id: null, descriptionTemplateId: event.id, label: event.label, data: dmpDatasetProfileSection });
} }
this.formGroup.get('profiles').setValue(profiles); this.formGroup.get('profiles').setValue(profiles);
} }
@ -1143,19 +1148,14 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) { if (result) {
this.addProfile(event, sectionIndex); this.addProfile(event, sectionIndex);
this.profilesAutoCompleteConfiguration = { const items = this.sectionTemplates[sectionIndex];
filterFn: this.filterProfiles.bind(this), items.push({id: event.id, label: event.label, description: ""});
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), this.sectionTemplates[sectionIndex] = [...items];
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description'],
popupItemActionIcon: 'visibility'
};
} }
}); });
} }
onOptionSelected(event, sectionIndex: number){ onOptionSelected(event, sectionIndex: number) {
try{ try {
this.addProfile(event, sectionIndex); this.addProfile(event, sectionIndex);
// const profileCounts: Map<String, number> = new Map<String, number>(); // const profileCounts: Map<String, number> = new Map<String, number>();
// profiles.forEach((value) => profileCounts.set(value.id, (profileCounts.get(value.id) !== undefined ? profileCounts.get(value.id): 0 ) + 1)); // profiles.forEach((value) => profileCounts.set(value.id, (profileCounts.get(value.id) !== undefined ? profileCounts.get(value.id): 0 ) + 1));
@ -1168,7 +1168,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
// }); // });
// duplicateProfiles.forEach((value) => profiles.splice(profiles.lastIndexOf(value), 1)); // duplicateProfiles.forEach((value) => profiles.splice(profiles.lastIndexOf(value), 1));
// profiles.sort((a,b)=> a.label.localeCompare(b.label)); // profiles.sort((a,b)=> a.label.localeCompare(b.label));
}catch{ } catch {
console.info('Could not sort Dataset Templates') console.info('Could not sort Dataset Templates')
} }
} }

View File

@ -1,54 +1,54 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import { Location } from '@angular/common';
import {MatDialog} from '@angular/material/dialog'; import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import {ActivatedRoute, Params, Router} from '@angular/router'; import { FormGroup } from '@angular/forms';
import {DatasetStatus} from '@app/core/common/enum/dataset-status'; import { MatDialog } from '@angular/material/dialog';
import {DmpStatus} from '@app/core/common/enum/dmp-status'; import { ActivatedRoute, Params, Router } from '@angular/router';
import {Principal} from '@app/core/model/auth/principal'; import { DatasetStatus } from '@app/core/common/enum/dataset-status';
import {DatasetOverviewModel} from '@app/core/model/dataset/dataset-overview'; import { DmpStatus } from '@app/core/common/enum/dmp-status';
import {DatasetsToBeFinalized} from '@app/core/model/dataset/datasets-toBeFinalized'; import { Role } from "@app/core/common/enum/role";
import {DmpOverviewModel} from '@app/core/model/dmp/dmp-overview'; import { Principal } from '@app/core/model/auth/principal';
import {UserInfoListingModel} from '@app/core/model/user/user-info-listing'; import { DatasetOverviewModel } from '@app/core/model/dataset/dataset-overview';
import {AuthService} from '@app/core/services/auth/auth.service'; import { DatasetsToBeFinalized } from '@app/core/model/dataset/datasets-toBeFinalized';
import {DmpService} from '@app/core/services/dmp/dmp.service'; import { DepositConfigurationModel } from '@app/core/model/deposit/deposit-configuration';
import { DmpModel } from '@app/core/model/dmp/dmp';
import { DmpBlueprintDefinition, SystemFieldType } from '@app/core/model/dmp/dmp-blueprint/dmp-blueprint';
import { DmpOverviewModel } from '@app/core/model/dmp/dmp-overview';
import { DoiModel } from '@app/core/model/doi/doi';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { VersionListingModel } from '@app/core/model/version/version-listing.model';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { DepositRepositoriesService } from '@app/core/services/deposit-repositories/deposit-repositories.service';
import { DmpProfileService } from '@app/core/services/dmp/dmp-profile.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { import {
SnackBarNotificationLevel, SnackBarNotificationLevel,
UiNotificationService UiNotificationService
} from '@app/core/services/notification/ui-notification-service'; } from '@app/core/services/notification/ui-notification-service';
import {ConfirmationDialogComponent} from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import { import {
DmpFinalizeDialogComponent, DmpFinalizeDialogComponent,
DmpFinalizeDialogInput, DmpFinalizeDialogInput,
DmpFinalizeDialogOutput DmpFinalizeDialogOutput
} from '@app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component'; } from '@app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component';
import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item'; import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import {BaseComponent} from '@common/base/base.component'; import { isNullOrUndefined } from '@app/utilities/enhancers/utils';
import {TranslateService} from '@ngx-translate/core'; import { BaseComponent } from '@common/base/base.component';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver'; import * as FileSaver from 'file-saver';
import {Observable, of as observableOf} from 'rxjs'; import { Observable, of as observableOf } from 'rxjs';
import {map, takeUntil} from 'rxjs/operators'; import { map, takeUntil } from 'rxjs/operators';
import {Role} from "@app/core/common/enum/role"; import { CloneDialogComponent } from '../clone/clone-dialog/clone-dialog.component';
import {DmpInvitationDialogComponent} from '../invitation/dmp-invitation-dialog.component'; import { DmpEditorModel } from '../editor/dmp-editor.model';
import {ConfigurationService} from '@app/core/services/configuration/configuration.service'; import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model';
import {Location} from '@angular/common'; import { FunderFormModel } from '../editor/grant-tab/funder-form-model';
import {FormGroup} from '@angular/forms'; import { GrantTabModel } from '../editor/grant-tab/grant-tab-model';
import {LockService} from '@app/core/services/lock/lock.service'; import { ProjectFormModel } from '../editor/grant-tab/project-form-model';
import {VersionListingModel} from '@app/core/model/version/version-listing.model'; import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation-dialog.component';
import {CloneDialogComponent} from '../clone/clone-dialog/clone-dialog.component'; import { StartNewDmpDialogComponent } from '../start-new-dmp-dialogue/start-new-dmp-dialog.component';
import {DmpModel} from '@app/core/model/dmp/dmp';
import {DmpEditorModel} from '../editor/dmp-editor.model';
import {FunderFormModel} from '../editor/grant-tab/funder-form-model';
import {ProjectFormModel} from '../editor/grant-tab/project-form-model';
import {GrantTabModel} from '../editor/grant-tab/grant-tab-model';
import {ExtraPropertiesFormModel} from '../editor/general-tab/extra-properties-form.model';
import {StartNewDmpDialogComponent} from '../start-new-dmp-dialogue/start-new-dmp-dialog.component';
import {MatomoService} from '@app/core/services/matomo/matomo-service';
import {PopupNotificationDialogComponent} from '@app/library/notification/popup/popup-notification.component';
import {DepositRepositoriesService} from '@app/core/services/deposit-repositories/deposit-repositories.service';
import {DepositConfigurationModel} from '@app/core/model/deposit/deposit-configuration';
import {DoiModel} from '@app/core/model/doi/doi';
import {isNullOrUndefined} from '@app/utilities/enhancers/utils';
import { DmpBlueprintDefinition, FieldCategory, SystemFieldType } from '@app/core/model/dmp/dmp-blueprint/dmp-blueprint';
import { DmpProfileService } from '@app/core/services/dmp/dmp-profile.service';
@Component({ @Component({
selector: 'app-dmp-overview', selector: 'app-dmp-overview',
@ -113,7 +113,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.dmp = data; this.dmp = data;
if(!this.hasDoi()) { if (!this.hasDoi()) {
this.selectedModel = this.dmp.dois[0]; this.selectedModel = this.dmp.dois[0];
} }
this.checkLockStatus(this.dmp.id); this.checkLockStatus(this.dmp.id);
@ -140,7 +140,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.dmp = data; this.dmp = data;
if(!this.hasDoi()) { if (!this.hasDoi()) {
this.selectedModel = this.dmp.dois[0]; this.selectedModel = this.dmp.dois[0];
} }
// this.checkLockStatus(this.dmp.id); // this.checkLockStatus(this.dmp.id);
@ -160,12 +160,12 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} }
}); });
this.depositRepositoriesService.getAvailableRepos() this.depositRepositoriesService.getAvailableRepos()
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
repos => { repos => {
this.depositRepos = repos; this.depositRepos = repos;
}, },
error => this.depositRepos = []); error => this.depositRepos = []);
} }
onFetchingDeletedCallbackError(redirectRoot: string) { onFetchingDeletedCallbackError(redirectRoot: string) {
@ -211,7 +211,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmpModel.status = DmpStatus.Draft; this.dmpModel.status = DmpStatus.Draft;
this.formGroup = this.dmpModel.buildForm(); this.formGroup = this.dmpModel.buildForm();
if (!isNullOrUndefined(this.formGroup.get('profile').value)) { if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
this.dmpProfileService.getSingleBlueprint(this.formGroup.get('profile').value) this.dmpProfileService.getSingleBlueprint(this.formGroup.get('profile').value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(result => { .subscribe(result => {
@ -220,7 +220,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.checkForProject(result.definition); this.checkForProject(result.definition);
}); });
} }
if (!isNewVersion) { if (!isNewVersion) {
this.formGroup.get('label').setValue(this.dmp.label + " New"); this.formGroup.get('label').setValue(this.dmp.label + " New");
} }
@ -572,7 +572,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.depositRepos.filter(repo => !this.dmp.dois.find(doi => doi.repositoryId === repo.repositoryId)); return this.depositRepos.filter(repo => !this.dmp.dois.find(doi => doi.repositoryId === repo.repositoryId));
} }
moreDeposit(){ moreDeposit() {
return (this.dmp.dois.length < this.depositRepos.length); return (this.dmp.dois.length < this.depositRepos.length);
} }
@ -617,17 +617,17 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => { complete => {
if(extraProperties.visible){ if (extraProperties.visible) {
//this.publish(this.dmp.id); //this.publish(this.dmp.id);
this.dmpService.publish(this.dmp.id) this.dmpService.publish(this.dmp.id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(() => { .subscribe(() => {
//this.hasPublishButton = false; //this.hasPublishButton = false;
this.dmp.status = DmpStatus.Finalized; this.dmp.status = DmpStatus.Finalized;
this.onUpdateCallbackSuccess(); this.onUpdateCallbackSuccess();
}); });
} }
else{ else {
this.dmp.status = DmpStatus.Finalized; this.dmp.status = DmpStatus.Finalized;
this.onUpdateCallbackSuccess(); this.onUpdateCallbackSuccess();
} }
@ -648,22 +648,22 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.dmpProfileService.getSingleBlueprint(blueprintId) return this.dmpProfileService.getSingleBlueprint(blueprintId)
.pipe(map(result => { .pipe(map(result => {
return result.definition.sections.some(section => { return result.definition.sections.some(section => {
if(!section.hasTemplates) if (!section.hasTemplates)
return false; return false;
return section.descriptionTemplates.some(template => { return section.descriptionTemplates.some(template => {
if(!(template.minMultiplicity > 0)) if (!(template.minMultiplicity > 0))
return false; return false;
let count = 0; let count = 0;
dmpModel.datasets.filter(dataset => dataset.dmpSectionIndex === (section.ordinal - 1)).forEach(dataset => { dmpModel.datasets.filter(dataset => dataset.dmpSectionIndex === (section.ordinal - 1)).forEach(dataset => {
if(dataset.profile.id === template.descriptionTemplateId){ if (dataset.profile.id === template.descriptionTemplateId) {
count++; count++;
} }
}) })
if(count < template.minMultiplicity){ if (count < template.minMultiplicity) {
this.dialog.open(PopupNotificationDialogComponent, { this.dialog.open(PopupNotificationDialogComponent, {
data: { data: {
title: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.TITLE', {'minMultiplicity': template.minMultiplicity}), title: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.TITLE', { 'minMultiplicity': template.minMultiplicity }),
message: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.MESSAGE', ) message: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.MESSAGE',)
}, maxWidth: '30em' }, maxWidth: '30em'
}); });
return true; return true;
@ -735,7 +735,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.router.navigate(['/datasets', 'new', this.dmp.id]); this.router.navigate(['/datasets', 'new', this.dmp.id]);
} }
selectDoi(doiModel: DoiModel){ selectDoi(doiModel: DoiModel) {
this.selectedModel = doiModel; this.selectedModel = doiModel;
const foundIdx = this.dmp.dois.findIndex(el => el.id == doiModel.id); const foundIdx = this.dmp.dois.findIndex(el => el.id == doiModel.id);
this.dmp.dois.splice(foundIdx, 1); this.dmp.dois.splice(foundIdx, 1);
@ -744,17 +744,17 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
createDoiLink(doiModel: DoiModel): string { createDoiLink(doiModel: DoiModel): string {
const repository = this.depositRepos.find(r => r.repositoryId == doiModel.repositoryId); const repository = this.depositRepos.find(r => r.repositoryId == doiModel.repositoryId);
if(typeof repository !== "undefined"){ if (typeof repository !== "undefined") {
if(doiModel.repositoryId == "Zenodo"){ if (doiModel.repositoryId == "Zenodo") {
const doiarr = doiModel.doi.split('.'); const doiarr = doiModel.doi.split('.');
const id = doiarr[doiarr.length - 1]; const id = doiarr[doiarr.length - 1];
return repository.repositoryRecordUrl + id; return repository.repositoryRecordUrl + id;
} }
else{ else {
return repository.repositoryRecordUrl + doiModel.doi; return repository.repositoryRecordUrl + doiModel.doi;
} }
} }
else{ else {
return ""; return "";
} }
} }
@ -857,11 +857,13 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed)) this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => { .subscribe(lockStatus => {
this.lockStatus = lockStatus this.lockStatus = lockStatus
if(lockStatus){ if (lockStatus) {
this.dialog.open(PopupNotificationDialogComponent,{data:{ this.dialog.open(PopupNotificationDialogComponent, {
title:this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.TITLE'), data: {
message:this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.MESSAGE') title: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.TITLE'),
}, maxWidth:'30em'}); message: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.MESSAGE')
}, maxWidth: '30em'
});
} }
}); });
} }

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Bestehenden DMP auswählen" "PLACEHOLDER": "Bestehenden DMP auswählen"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }

View File

@ -142,7 +142,7 @@
"DATASETCREATEWIZARD": "Add Dataset (Wizard)", "DATASETCREATEWIZARD": "Add Dataset (Wizard)",
"GRANTS": "My Grants", "GRANTS": "My Grants",
"DMP-BLUEPRINTS": "DMP Blueprints", "DMP-BLUEPRINTS": "DMP Blueprints",
"DATASET-PROFILES": "Dataset Templates", "DATASET-PROFILES": "Description Templates",
"DESCRIPTION-TYPES": "Description Types", "DESCRIPTION-TYPES": "Description Types",
"USERS": "Users", "USERS": "Users",
"PROFILE": "My Profile", "PROFILE": "My Profile",
@ -159,8 +159,8 @@
"DMP-BLUEPRINT-NEW": "New DMP Blueprint", "DMP-BLUEPRINT-NEW": "New DMP Blueprint",
"DMP-BLUEPRINT-CLONE": "New Clone of DMP Blueprint", "DMP-BLUEPRINT-CLONE": "New Clone of DMP Blueprint",
"DMP-BLUEPRINT-EDIT": "Edit DMP Blueprint", "DMP-BLUEPRINT-EDIT": "Edit DMP Blueprint",
"DATASET-PROFILES-NEW": "New Dataset Template", "DATASET-PROFILES-NEW": "New Description Template",
"DATASET-PROFILES-EDIT": "Edit Dataset Template", "DATASET-PROFILES-EDIT": "Edit Description Template",
"DESCRIPTION-TYPE-NEW": "New Description Type", "DESCRIPTION-TYPE-NEW": "New Description Type",
"DESCRIPTION-TYPE-EDIT": "Edit Description Type", "DESCRIPTION-TYPE-EDIT": "Edit Description Type",
"EXPLORE-PLANS-OVERVIEW": "Published DMP Overview", "EXPLORE-PLANS-OVERVIEW": "Published DMP Overview",
@ -168,8 +168,8 @@
"DMP-PUBLIC-EDIT": "View Published DMP", "DMP-PUBLIC-EDIT": "View Published DMP",
"DATASET-COPY": "Copy Dataset", "DATASET-COPY": "Copy Dataset",
"DATASET-UPDATE": "Update Dataset", "DATASET-UPDATE": "Update Dataset",
"DATASET-PROFILES-NEW-VERSION": "New Version of Dataset Template", "DATASET-PROFILES-NEW-VERSION": "New Version of Description Template",
"DATASET-PROFILES-CLONE": "New Clone of Dataset Template", "DATASET-PROFILES-CLONE": "New Clone of Description Template",
"LANGUAGE-EDITOR": "Language Editor", "LANGUAGE-EDITOR": "Language Editor",
"GUIDE-EDITOR": "User Guide Editor", "GUIDE-EDITOR": "User Guide Editor",
"LANGUAGE": "Language", "LANGUAGE": "Language",
@ -231,7 +231,7 @@
"DESCRIPTION": "Description", "DESCRIPTION": "Description",
"PUBLIC-DATASETS": "Explore {{ APP_NAME_CAPS }}", "PUBLIC-DATASETS": "Explore {{ APP_NAME_CAPS }}",
"USERS": "Users", "USERS": "Users",
"DATASETS-ADMIN": "Dataset Templates", "DATASETS-ADMIN": "Description Templates",
"DMP-BLUEPRINTS": "DMP Blueprints", "DMP-BLUEPRINTS": "DMP Blueprints",
"ABOUT": "About", "ABOUT": "About",
"MY-DATASET-DESCRIPTIONS": "MY DATASETS", "MY-DATASET-DESCRIPTIONS": "MY DATASETS",
@ -691,7 +691,7 @@
}, },
"LEVEL-OF-ACCESS": "Level of Access", "LEVEL-OF-ACCESS": "Level of Access",
"INVOLVED-DATASETS": "Involved Datasets", "INVOLVED-DATASETS": "Involved Datasets",
"TEMPLATES-INVOLVED": "Dataset Templates Involved" "TEMPLATES-INVOLVED": "Description Templates Involved"
}, },
"VIEW-ALL-VERSIONS": "All versions of", "VIEW-ALL-VERSIONS": "All versions of",
"EMPTY-LIST": "Nothing here yet." "EMPTY-LIST": "Nothing here yet."
@ -705,7 +705,7 @@
"TOOLTIP": { "TOOLTIP": {
"PUBLISHED": "Public access - Closed DMP", "PUBLISHED": "Public access - Closed DMP",
"INVOLVED-DATASETS": "Involved Datasets", "INVOLVED-DATASETS": "Involved Datasets",
"TEMPLATES-INVOLVED": "Dataset Templates Involved" "TEMPLATES-INVOLVED": "Description Templates Involved"
}, },
"EMPTY-LIST": "Nothing here yet." "EMPTY-LIST": "Nothing here yet."
}, },
@ -733,7 +733,7 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "Dataset Information", "TITLE": "Dataset Information",
"DMP": "Data Management Plan", "DMP": "Data Management Plan",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"SUB-TITLE": "Created At: " "SUB-TITLE": "Created At: "
}, },
"SECOND-STEP": { "SECOND-STEP": {
@ -773,7 +773,7 @@
"MESSAGES": { "MESSAGES": {
"DATASET-NOT-FOUND": "Dataset does not exist", "DATASET-NOT-FOUND": "Dataset does not exist",
"DATASET-NOT-ALLOWED": "You have no access to this Dataset", "DATASET-NOT-ALLOWED": "You have no access to this Dataset",
"SUCCESS-UPDATE-DATASET-PROFILE": "Dataset Template updated successfully", "SUCCESS-UPDATE-DATASET-PROFILE": "Description Template updated successfully",
"MISSING-FIELDS": "There are some required fields left unfilled. Please check the DMP and make sure that all required questions are answered and URLs are provided with valid input. (Missing fields are marked in red color)", "MISSING-FIELDS": "There are some required fields left unfilled. Please check the DMP and make sure that all required questions are answered and URLs are provided with valid input. (Missing fields are marked in red color)",
"NO-FILES-SELECTED": "There is no selected file to upload", "NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.", "LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
@ -782,8 +782,8 @@
}, },
"UPLOAD": { "UPLOAD": {
"UPLOAD-XML": "Import", "UPLOAD-XML": "Import",
"UPLOAD-XML-FILE-TITLE": "Import Dataset Template", "UPLOAD-XML-FILE-TITLE": "Import Description Template",
"UPLOAD-XML-NAME": "Name Of Dataset Template", "UPLOAD-XML-NAME": "Name Of Description Template",
"UPLOAD-XML-IMPORT": "File", "UPLOAD-XML-IMPORT": "File",
"UPLOAD-XML-FILE-CANCEL": "Cancel" "UPLOAD-XML-FILE-CANCEL": "Cancel"
}, },
@ -801,7 +801,7 @@
"COPY": "Copy", "COPY": "Copy",
"CANCEL": "Cancel", "CANCEL": "Cancel",
"NEXT": "Next", "NEXT": "Next",
"ERROR-MESSAGE": "Does not contain this Dataset Template" "ERROR-MESSAGE": "Does not contain this Description Template"
}, },
"LOCKED":{ "LOCKED":{
"TITLE":"Dataset is locked", "TITLE":"Dataset is locked",
@ -823,7 +823,7 @@
"TOOLTIP": { "TOOLTIP": {
"LEVEL-OF-ACCESS": "Level of Access", "LEVEL-OF-ACCESS": "Level of Access",
"INVOLVED-DATASETS": "Involved Datasets", "INVOLVED-DATASETS": "Involved Datasets",
"TEMPLATES-INVOLVED": "Dataset Templates Involved" "TEMPLATES-INVOLVED": "Description Templates Involved"
}, },
"ERROR": { "ERROR": {
"DELETED-DMP": "The requested DMP is deleted", "DELETED-DMP": "The requested DMP is deleted",
@ -916,7 +916,7 @@
}, },
"DMP": "DMP", "DMP": "DMP",
"GRANT": "Grant", "GRANT": "Grant",
"TEMPLATES-INVOLVED": "Dataset Template", "TEMPLATES-INVOLVED": "Description Template",
"VERSION": "DMP Version", "VERSION": "DMP Version",
"PART-OF": "Part of", "PART-OF": "Part of",
"TO-DMP": "To DMP", "TO-DMP": "To DMP",
@ -930,7 +930,7 @@
"FINALIZED": "Private access - Closed Dataset", "FINALIZED": "Private access - Closed Dataset",
"DMP": "DMP", "DMP": "DMP",
"GRANT": "Grant", "GRANT": "Grant",
"TEMPLATES-INVOLVED": "Dataset Template" "TEMPLATES-INVOLVED": "Description Template"
}, },
"EMPTY-LIST": "Nothing here yet." "EMPTY-LIST": "Nothing here yet."
}, },
@ -992,7 +992,7 @@
}, },
"PLACEHOLDER": "Dataset Title", "PLACEHOLDER": "Dataset Title",
"DATASET-PROFILE": { "DATASET-PROFILE": {
"SELECT": "Select Dataset Template" "SELECT": "Select Description Template"
}, },
"SNACK-BAR": { "SNACK-BAR": {
"SUCCESSFUL-CREATION": "Imported Successfully", "SUCCESSFUL-CREATION": "Imported Successfully",
@ -1072,7 +1072,7 @@
"NEW": "New Data Management Plan", "NEW": "New Data Management Plan",
"EDIT": "Edit", "EDIT": "Edit",
"EDIT-DMP": "Editing DMP", "EDIT-DMP": "Editing DMP",
"ADD-DATASET": "Adding dataset", "ADD-DATASET": "Adding description",
"EDIT-DESCRIPTION": "Editing Description", "EDIT-DESCRIPTION": "Editing Description",
"CLONE-DMP": "Clone", "CLONE-DMP": "Clone",
"NEW-VERSION": "New Version", "NEW-VERSION": "New Version",
@ -1092,7 +1092,7 @@
"AUTHORS": "Authors", "AUTHORS": "Authors",
"TEMPLATES": "Templates", "TEMPLATES": "Templates",
"TEMPLATE": "DMP Template", "TEMPLATE": "DMP Template",
"DATASET-TEMPLATES": "Related Dataset Templates", "DATASET-TEMPLATES": "Related Description Templates",
"SELECT-TEMPLATE": "Select a template to describe your descriptions", "SELECT-TEMPLATE": "Select a template to describe your descriptions",
"PROFILE": "DMP Template", "PROFILE": "DMP Template",
"PROJECT": "Project", "PROJECT": "Project",
@ -1284,8 +1284,8 @@
"RELATED-DMP": "Related DMPs", "RELATED-DMP": "Related DMPs",
"SELECT-COLLABORATORS": "Select Collaborators", "SELECT-COLLABORATORS": "Select Collaborators",
"RELATED-COLLABORATORS": "Related Collaborators", "RELATED-COLLABORATORS": "Related Collaborators",
"SELECT-DATASET-TEMPLATES": "Select Dataset Templates", "SELECT-DATASET-TEMPLATES": "Select Description Templates",
"RELATED-DATASET-TEMPLATES": "Related Dataset Templates", "RELATED-DATASET-TEMPLATES": "Related Description Templates",
"ALL-VERSIONS": "From All Versions" "ALL-VERSIONS": "From All Versions"
}, },
"DMP": { "DMP": {
@ -1294,8 +1294,8 @@
"SELECT-GRANTS": "Select Grants", "SELECT-GRANTS": "Select Grants",
"SELECT-COLLABORATORS": "Select Collaborators", "SELECT-COLLABORATORS": "Select Collaborators",
"RELATED-COLLABORATORS": "Related Collaborators", "RELATED-COLLABORATORS": "Related Collaborators",
"SELECT-DATASET-TEMPLATES": "Select Dataset Templates", "SELECT-DATASET-TEMPLATES": "Select Description Templates",
"RELATED-DATASET-TEMPLATES": "Related Dataset Templates" "RELATED-DATASET-TEMPLATES": "Related Description Templates"
}, },
"BLUEPRINT": { "BLUEPRINT": {
"LIKE": "Search", "LIKE": "Search",
@ -1362,7 +1362,7 @@
}, },
"VERSION-DIALOG": { "VERSION-DIALOG": {
"ABOUT": "Versioning is automated.", "ABOUT": "Versioning is automated.",
"QUESTION": "It seems your Dataset Template is outdated. Do you want to update it to the latest version?" "QUESTION": "It seems your Description Template is outdated. Do you want to update it to the latest version?"
}, },
"ERRORS":{ "ERRORS":{
"ERROR-OCCURED": "An error occurred.", "ERROR-OCCURED": "An error occurred.",
@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Pick an existing DMP" "PLACEHOLDER": "Pick an existing DMP"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }
@ -1932,15 +1932,15 @@
}, },
"SECOND-STEP": { "SECOND-STEP": {
"TITLE": "DMP Profile", "TITLE": "DMP Profile",
"ABOUT": "A Data Management Plan consists of a set of questions that you should answer with a level of detail appropriate to the grant or with relevance to the purpose that you are creating the DMP. Contents of each DMP vary depending on the selected Dataset Template(s) which contain(s) a set of tailored questions in response to policy requirements of funders, institutions, research communities.", "ABOUT": "A Data Management Plan consists of a set of questions that you should answer with a level of detail appropriate to the grant or with relevance to the purpose that you are creating the DMP. Contents of each DMP vary depending on the selected Description Template(s) which contain(s) a set of tailored questions in response to policy requirements of funders, institutions, research communities.",
"NEW-TITLE": "", "NEW-TITLE": "",
"DMP-NAME": "DMP For Grant : ", "DMP-NAME": "DMP For Grant : ",
"FIELDS": { "FIELDS": {
"NAME": "Title of the DMP", "NAME": "Title of the DMP",
"DESCRIPTION": "Summary", "DESCRIPTION": "Summary",
"DESCRIPTION-HINT": "Briefly describe the context and purpose of the DMP", "DESCRIPTION-HINT": "Briefly describe the context and purpose of the DMP",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PROFILE-HINT": "Select a template to describe your Dataset(s). If you want to select multiple Dataset Templates use \"New DMP (Expert)\". You can also add new Datasets at any time after the DMP creation.", "PROFILE-HINT": "Select a template to describe your Dataset(s). If you want to select multiple Description Templates use \"New DMP (Expert)\". You can also add new Datasets at any time after the DMP creation.",
"HELP": "If you can't find a template or if you want to create a personalized template for your institution, research community or training needs, please contact us." "HELP": "If you can't find a template or if you want to create a personalized template for your institution, research community or training needs, please contact us."
} }
}, },

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Seleccione un PGD existente" "PLACEHOLDER": "Seleccione un PGD existente"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Επιλέξτε ένα Σχέδιο Διαχείρισης Δεδομένων από τη συλλογή σας" "PLACEHOLDER": "Επιλέξτε ένα Σχέδιο Διαχείρισης Δεδομένων από τη συλλογή σας"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Selecione um PGD existente" "PLACEHOLDER": "Selecione um PGD existente"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Vybrať existujúci DMP." "PLACEHOLDER": "Vybrať existujúci DMP."
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Odaberite postojeći Plan" "PLACEHOLDER": "Odaberite postojeći Plan"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }

View File

@ -1390,13 +1390,13 @@
"PLACEHOLDER": "Mevcut olan bir VYP seçin" "PLACEHOLDER": "Mevcut olan bir VYP seçin"
}, },
"PREFILL-STEP": { "PREFILL-STEP": {
"TITLE": "Initialize your Dataset", "TITLE": "Initialize your Description",
"PREFILL": "Prefill", "PREFILL": "Prefill",
"OR": "OR", "OR": "OR",
"HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", "HINT": "Select an entry from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.",
"MANUALLY": "Manually", "MANUALLY": "Manually",
"PROFILE": "Dataset Template", "PROFILE": "Description Template",
"PREFILLED-DATASET": "Prefilled Dataset", "PREFILLED-DATASET": "Prefilled Description",
"SEARCH": "Start typing to search for a dataset or software", "SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next" "NEXT": "Next"
} }