Merge branch 'Development' of https://code-repo.d4science.org/MaDgiK-CITE/argos into Development

# Conflicts:
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetIdRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DistributionRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/HostRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/KeywordRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LicenseRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/SecurityAndPrivacyRDAMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/TechnicalResourceRDAMapper.java
This commit is contained in:
DESKTOP-4ES9U2E\aldom 2021-12-30 11:28:15 +02:00
commit 16c124cc3d
46 changed files with 780 additions and 389 deletions

View File

@ -41,6 +41,7 @@
<commons-codec.version>1.9</commons-codec.version> <commons-codec.version>1.9</commons-codec.version>
<org.junit.version>4.11</org.junit.version> <org.junit.version>4.11</org.junit.version>
<log4j.version>1.2.17</log4j.version> <log4j.version>1.2.17</log4j.version>
<log4j2.version>2.15.0</log4j2.version>
<slf4j.version>1.7.12</slf4j.version> <slf4j.version>1.7.12</slf4j.version>
<!--<jetty.version>11.0.5 <!--<jetty.version>11.0.5
</jetty.version>--> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ --> </jetty.version>--> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
@ -218,10 +219,10 @@
<version>2.1</version> <version>2.1</version>
</dependency> </dependency>
<dependency> <!--<dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId> <artifactId>hibernate-jpamodelgen</artifactId>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>org.elasticsearch.client</groupId> <groupId>org.elasticsearch.client</groupId>
@ -229,11 +230,11 @@
<version>7.6.0</version> <version>7.6.0</version>
</dependency> </dependency>
<dependency> <!--<dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId> <artifactId>log4j-to-slf4j</artifactId>
<version>2.8.2</version> <version>2.8.2</version>
</dependency> </dependency>-->
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api --> <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency> <dependency>

View File

@ -120,6 +120,7 @@ public class ExportXmlBuilderDatasetProfile {
Element multiplicity = element.createElement("multiplicity"); Element multiplicity = element.createElement("multiplicity");
multiplicity.setAttribute("max", "" + field.getMultiplicity().getMax()); multiplicity.setAttribute("max", "" + field.getMultiplicity().getMax());
multiplicity.setAttribute("min", "" + field.getMultiplicity().getMin()); multiplicity.setAttribute("min", "" + field.getMultiplicity().getMin());
multiplicity.setAttribute("placeholder", field.getMultiplicity().getPlaceholder());
composite.appendChild(multiplicity); composite.appendChild(multiplicity);
} }
if (field.getTitle() != null && !field.getTitle().isEmpty()) { if (field.getTitle() != null && !field.getTitle().isEmpty()) {

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlRootElement;
public class Multiplicity { public class Multiplicity {
private int max; private int max;
private int min; private int min;
private String placeholder;
@XmlAttribute(name = "max") @XmlAttribute(name = "max")
public int getMax() { public int getMax() {
@ -27,10 +28,20 @@ public class Multiplicity {
this.min = min; this.min = min;
} }
@XmlAttribute(name = "placeholder")
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public eu.eudat.models.data.components.commons.Multiplicity toAdminCompositeModelSection() { public eu.eudat.models.data.components.commons.Multiplicity toAdminCompositeModelSection() {
eu.eudat.models.data.components.commons.Multiplicity multiplicityEntity = new eu.eudat.models.data.components.commons.Multiplicity(); eu.eudat.models.data.components.commons.Multiplicity multiplicityEntity = new eu.eudat.models.data.components.commons.Multiplicity();
multiplicityEntity.setMax(max); multiplicityEntity.setMax(max);
multiplicityEntity.setMin(min); multiplicityEntity.setMin(min);
multiplicityEntity.setPlaceholder(placeholder);
return multiplicityEntity; return multiplicityEntity;
} }
} }

View File

@ -4,6 +4,7 @@ public class Multiplicity {
private int min; private int min;
private int max; private int max;
private String placeholder;
public int getMin() { public int getMin() {
return min; return min;
@ -21,5 +22,11 @@ public class Multiplicity {
this.max = max; this.max = max;
} }
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
} }

View File

@ -121,6 +121,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
Element multiplicity = doc.createElement("multiplicity"); Element multiplicity = doc.createElement("multiplicity");
multiplicity.setAttribute("min", "" + this.multiplicity.getMin()); multiplicity.setAttribute("min", "" + this.multiplicity.getMin());
multiplicity.setAttribute("max", "" + this.multiplicity.getMax()); multiplicity.setAttribute("max", "" + this.multiplicity.getMax());
multiplicity.setAttribute("placeholder", this.multiplicity.getPlaceholder());
Element commentField = doc.createElement("commentField"); Element commentField = doc.createElement("commentField");
commentField.setAttribute("hasCommentField", "" + this.hasCommentField); commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
@ -183,6 +184,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min"))); this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max"))); this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
this.multiplicity.setPlaceholder(multiplicity.getAttribute("placeholder"));
return this; return this;
} }

View File

@ -101,12 +101,12 @@ public class GrantId implements Serializable
this.type = type; this.type = type;
} }
@JsonAnyGetter @JsonProperty("additional_properties")
public Map<String, Object> getAdditionalProperties() { public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties; return this.additionalProperties;
} }
@JsonAnySetter @JsonProperty("additional_properties")
public void setAdditionalProperty(String name, Object value) { public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value); this.additionalProperties.put(name, value);
} }

View File

@ -29,23 +29,23 @@ public class DatasetIdRDAMapper {
for (JsonNode node: nodes) { for (JsonNode node: nodes) {
String rdaProperty = node.get("rdaProperty").asText(); String rdaProperty = node.get("rdaProperty").asText();
String rdaValue = node.get("value").asText(); String rdaValue = node.get("value").asText();
if(rdaValue.isEmpty()){ if(rdaValue == null || rdaValue.isEmpty()){
continue; continue;
} }
ObjectMapper mapper = new ObjectMapper();
try {
Map<String, Object> values = mapper.readValue(rdaValue, HashMap.class);
if (!values.isEmpty()) {
values.entrySet().forEach(entry -> finalRDAMap(data, entry.getKey(), (String) entry.getValue()));
} else {
finalRDAMap(data, rdaProperty, rdaValue);
}
} catch (IOException e) {
logger.warn(e.getMessage() + ".Passing value as is");
finalRDAMap(data, rdaProperty, rdaValue); finalRDAMap(data, rdaProperty, rdaValue);
// ObjectMapper mapper = new ObjectMapper(); }
// try {
// Map<String, Object> values = mapper.readValue(rdaValue, HashMap.class);
// if (!values.isEmpty()) {
// values.entrySet().forEach(entry -> finalRDAMap(data, entry.getKey(), (String) entry.getValue()));
// } else {
// finalRDAMap(data, rdaProperty, rdaValue);
// }
// } catch (IOException e) {
// finalRDAMap(data, rdaProperty, rdaValue);
// logger.error(e.getMessage(), e);
// }
} }

View File

@ -79,22 +79,21 @@ public class DatasetRDAMapper {
List<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.metadata"); List<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.metadata");
if (!metadataNodes.isEmpty()) { if (!metadataNodes.isEmpty()) {
rda.setMetadata(MetadataRDAMapper.toRDAList(metadataNodes)); rda.setMetadata(MetadataRDAMapper.toRDAList(metadataNodes));
} }else{
else{
rda.setMetadata(new ArrayList<>()); rda.setMetadata(new ArrayList<>());
} }
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.data_quality_assurance"); List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.data_quality_assurance");
if (!qaNodes.isEmpty()) { if (!qaNodes.isEmpty()) {
List<String> qaList = qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).filter(qaNode -> !qaNode.isEmpty()).collect(Collectors.toList());
rda.setDataQualityAssurance(qaList);
/*rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList())); /*rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList()));
for (int i = 0; i < qaNodes.size(); i++) { for (int i = 0; i < qaNodes.size(); i++) {
rda.setAdditionalProperty("qaId" + (i + 1), qaNodes.get(i).get("id").asText()); rda.setAdditionalProperty("qaId" + (i + 1), qaNodes.get(i).get("id").asText());
}*/ }*/
//rda.setDataQualityAssurance(Collections.singletonList(qaNodes.get(0).get("value").asText())); List<String> qaList = qaNodes.stream()
} .map(qaNode -> qaNode.get("value").asText())
else{ .filter(qaNode -> !qaNode.isEmpty())
.collect(Collectors.toList());
rda.setDataQualityAssurance(qaList);
}else{
rda.setDataQualityAssurance(new ArrayList<>()); rda.setDataQualityAssurance(new ArrayList<>());
} }
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement"); List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
@ -104,8 +103,7 @@ public class DatasetRDAMapper {
List<JsonNode> distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.distribution"); List<JsonNode> distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.distribution");
if (!distributionNodes.isEmpty()) { if (!distributionNodes.isEmpty()) {
rda.setDistribution(DistributionRDAMapper.toRDAList(distributionNodes)); rda.setDistribution(DistributionRDAMapper.toRDAList(distributionNodes));
} }else{
else{
rda.setDistribution(new ArrayList<>()); rda.setDistribution(new ArrayList<>());
} }
List<JsonNode> keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.keyword"); List<JsonNode> keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.keyword");
@ -134,8 +132,7 @@ public class DatasetRDAMapper {
List<JsonNode> securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.security_and_privacy"); List<JsonNode> securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.security_and_privacy");
if (!securityAndPrivacyNodes.isEmpty()) { if (!securityAndPrivacyNodes.isEmpty()) {
rda.setSecurityAndPrivacy(SecurityAndPrivacyRDAMapper.toRDAList(securityAndPrivacyNodes)); rda.setSecurityAndPrivacy(SecurityAndPrivacyRDAMapper.toRDAList(securityAndPrivacyNodes));
} }else{
else{
rda.setSecurityAndPrivacy(new ArrayList<>()); rda.setSecurityAndPrivacy(new ArrayList<>());
} }
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.sensitive_data"); List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.sensitive_data");
@ -147,8 +144,7 @@ public class DatasetRDAMapper {
List<JsonNode> technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.technical_resource"); List<JsonNode> technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.technical_resource");
if (!technicalResourceNodes.isEmpty()) { if (!technicalResourceNodes.isEmpty()) {
rda.setTechnicalResource(TechnicalResourceRDAMapper.toRDAList(technicalResourceNodes)); rda.setTechnicalResource(TechnicalResourceRDAMapper.toRDAList(technicalResourceNodes));
} }else{
else{
rda.setTechnicalResource(new ArrayList<>()); rda.setTechnicalResource(new ArrayList<>());
} }
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.issued"); List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.issued");

View File

@ -1,12 +1,14 @@
package eu.eudat.models.rda.mapper; package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.utilities.helpers.MyStringUtils; import eu.eudat.logic.utilities.helpers.MyStringUtils;
import eu.eudat.logic.utilities.json.JavaToJson; import eu.eudat.logic.utilities.json.JavaToJson;
import eu.eudat.logic.utilities.json.JsonSearcher; import eu.eudat.logic.utilities.json.JsonSearcher;
import eu.eudat.models.rda.Distribution; import eu.eudat.models.rda.Distribution;
import eu.eudat.models.rda.License;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -17,13 +19,14 @@ import java.util.stream.Collectors;
public class DistributionRDAMapper { public class DistributionRDAMapper {
private static final Logger logger = LoggerFactory.getLogger(DistributionRDAMapper.class); private static final Logger logger = LoggerFactory.getLogger(DistributionRDAMapper.class);
public static List<Distribution> toRDAList(List<JsonNode> nodes) throws JsonProcessingException { public static List<Distribution> toRDAList(List<JsonNode> nodes) {
Map<String, Distribution> rdaMap = new HashMap<>(); Map<String, Distribution> rdaMap = new HashMap<>();
for (JsonNode node: nodes) { for (JsonNode node: nodes) {
String rdaProperty = node.get("rdaProperty").asText(); String rdaProperty = node.get("rdaProperty").asText();
String rdaValue = node.get("value").asText(); String rdaValue = node.get("value").asText();
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){ // node.get("value").isNull() //if(rdaValue == null || rdaValue.isEmpty()){
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
continue; continue;
} }
String key = node.get("numbering").asText(); String key = node.get("numbering").asText();
@ -41,10 +44,10 @@ public class DistributionRDAMapper {
rda = new Distribution(); rda = new Distribution();
rdaMap.put(key, rda); rdaMap.put(key, rda);
} }
// Distribution rda = getRelative(rdaMap, node.get("numbering").asText()); /* Distribution rda = getRelative(rdaMap, node.get("numbering").asText());
// if (!rdaMap.containsValue(rda)) { if (!rdaMap.containsValue(rda)) {
// rdaMap.put(node.get("numbering").asText(), rda); rdaMap.put(node.get("numbering").asText(), rda);
// } } */
for (ExportPropertyName exportPropertyName : ExportPropertyName.values()) { for (ExportPropertyName exportPropertyName : ExportPropertyName.values()) {
if (rdaProperty.contains(exportPropertyName.getName())) { if (rdaProperty.contains(exportPropertyName.getName())) {
switch (exportPropertyName) { switch (exportPropertyName) {
@ -52,9 +55,9 @@ public class DistributionRDAMapper {
rda.setAccessUrl(rdaValue); rda.setAccessUrl(rdaValue);
rda.setAdditionalProperty(ImportPropertyName.ACCESS_URL.getName(), node.get("id").asText()); rda.setAdditionalProperty(ImportPropertyName.ACCESS_URL.getName(), node.get("id").asText());
break; break;
case AVAILABLE_UTIL: case AVAILABLE_UNTIL:
rda.setAvailableUntil(rdaValue); rda.setAvailableUntil(rdaValue);
rda.setAdditionalProperty(ImportPropertyName.AVAILABLE_UTIL.getName(), node.get("id").asText()); rda.setAdditionalProperty(ImportPropertyName.AVAILABLE_UNTIL.getName(), node.get("id").asText());
break; break;
case DOWNLOAD_URL: case DOWNLOAD_URL:
rda.setDownloadUrl(URI.create(rdaValue)); rda.setDownloadUrl(URI.create(rdaValue));
@ -76,20 +79,24 @@ public class DistributionRDAMapper {
break; break;
case LICENSE: case LICENSE:
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("license")).collect(Collectors.toList()); List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("license")).collect(Collectors.toList());
rda.setLicense(Collections.singletonList(LicenseRDAMapper.toRDA(licenseNodes))); License license = LicenseRDAMapper.toRDA(licenseNodes);
rda.setLicense(license != null? Collections.singletonList(license): new ArrayList<>());
break; break;
case FORMAT: case FORMAT:
//rda.setFormat(Collections.singletonList(rdaValue));
if(node.get("value").isArray()){ if(node.get("value").isArray()){
Iterator<JsonNode> iter = node.get("value").elements(); Iterator<JsonNode> iter = node.get("value").elements();
List<String> formats = new ArrayList<>(); List<String> formats = new ArrayList<>();
while(iter.hasNext()) { while(iter.hasNext()) {
String format = JavaToJson.objectStringToJson(iter.next().asText()); String format = JavaToJson.objectStringToJson(iter.next().asText());
Map<String,String> result = try {
new ObjectMapper().readValue(format, HashMap.class); Map<String, String> result = new ObjectMapper().readValue(format, HashMap.class);
format = result.get("label"); format = result.get("label");
formats.add(format); formats.add(format);
} }
catch(JsonProcessingException e){
logger.warn(e.getMessage());
}
}
rda.setFormat(formats); rda.setFormat(formats);
} }
else{ else{
@ -110,13 +117,8 @@ public class DistributionRDAMapper {
} }
} }
} }
return rdaMap.values().stream()
List<Distribution> rdaList = rdaMap.values().stream() .filter(distro -> distro.getTitle() != null).collect(Collectors.toList());
.filter(distro -> distro.getTitle() != null)
.collect(Collectors.toList());
return rdaList;
//return new ArrayList<>(rdaMap.values());
} }
public static Map<String, String> toProperties(List<Distribution> rdas) { public static Map<String, String> toProperties(List<Distribution> rdas) {
@ -148,7 +150,7 @@ public class DistributionRDAMapper {
case DOWNLOAD_URL: case DOWNLOAD_URL:
properties.put(entry.getValue().toString(), rda.getDownloadUrl().toString()); properties.put(entry.getValue().toString(), rda.getDownloadUrl().toString());
break; break;
case AVAILABLE_UTIL: case AVAILABLE_UNTIL:
properties.put(entry.getValue().toString(), rda.getAvailableUntil()); properties.put(entry.getValue().toString(), rda.getAvailableUntil());
break; break;
} }
@ -186,7 +188,7 @@ public class DistributionRDAMapper {
case TITLE: case TITLE:
properties.put(distributionNode.get("id").asText(), rda.getTitle()); properties.put(distributionNode.get("id").asText(), rda.getTitle());
break; break;
case AVAILABLE_UTIL: case AVAILABLE_UNTIL:
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil()); properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
break; break;
case DOWNLOAD_URL: case DOWNLOAD_URL:
@ -242,7 +244,7 @@ public class DistributionRDAMapper {
case TITLE: case TITLE:
rda.setTitle(rdaValue); rda.setTitle(rdaValue);
break; break;
case AVAILABLE_UTIL: case AVAILABLE_UNTIL:
rda.setAvailableUntil(rdaValue); rda.setAvailableUntil(rdaValue);
break; break;
case DOWNLOAD_URL: case DOWNLOAD_URL:
@ -310,7 +312,7 @@ public class DistributionRDAMapper {
private enum ExportPropertyName { private enum ExportPropertyName {
ACCESS_URL("access_url"), ACCESS_URL("access_url"),
AVAILABLE_UTIL("available_util"), AVAILABLE_UNTIL("available_until"),
BYTE_SIZE("byte_size"), BYTE_SIZE("byte_size"),
DATA_ACCESS("data_access"), DATA_ACCESS("data_access"),
DESCRIPTION("description"), DESCRIPTION("description"),
@ -333,7 +335,7 @@ public class DistributionRDAMapper {
private enum ImportPropertyName { private enum ImportPropertyName {
ACCESS_URL("accessurlId"), ACCESS_URL("accessurlId"),
AVAILABLE_UTIL("availableUtilId"), AVAILABLE_UNTIL("availableUtilId"),
BYTE_SIZE("byteSizeId"), BYTE_SIZE("byteSizeId"),
DATA_ACCESS("dataAccessId"), DATA_ACCESS("dataAccessId"),
DESCRIPTION("descriptionId"), DESCRIPTION("descriptionId"),

View File

@ -1,6 +1,8 @@
package eu.eudat.models.rda.mapper; package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.utilities.helpers.MyStringUtils; import eu.eudat.logic.utilities.helpers.MyStringUtils;
import eu.eudat.models.rda.Host; import eu.eudat.models.rda.Host;
import eu.eudat.models.rda.PidSystem; import eu.eudat.models.rda.PidSystem;
@ -48,6 +50,13 @@ public class HostRDAMapper {
rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText()); rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText());
break; break;
case GEO_LOCATION: case GEO_LOCATION:
if (rdaValue.startsWith("{")) {
try {
rdaValue = new ObjectMapper().readValue(rdaValue, Map.class).get("id").toString();
} catch (JsonProcessingException e) {
logger.warn(e.getLocalizedMessage() + ". Try to pass value as is");
}
}
rda.setGeoLocation(Host.GeoLocation.fromValue(rdaValue)); rda.setGeoLocation(Host.GeoLocation.fromValue(rdaValue));
rda.setAdditionalProperty(ImportPropertyName.GEO_LOCATION.getName(), node.get("id").asText()); rda.setAdditionalProperty(ImportPropertyName.GEO_LOCATION.getName(), node.get("id").asText());
break; break;
@ -58,14 +67,15 @@ public class HostRDAMapper {
while(iter.hasNext()) { while(iter.hasNext()) {
pList.add(iter.next().asText()); pList.add(iter.next().asText());
} }
List<PidSystem> pidList; // List<PidSystem> pidList;
if(pList.size() == 0){ // if(pList.size() == 0){
pidList = Arrays.stream(rdaValue.replaceAll("[\\[\"\\]]","").split(",")) // pidList = Arrays.stream(rdaValue.replaceAll("[\\[\"\\]]","").split(","))
.map(PidSystem::fromValue).collect(Collectors.toList()); // .map(PidSystem::fromValue).collect(Collectors.toList());
} // }
else{ // else{
pidList = pList.stream().map(PidSystem::fromValue).collect(Collectors.toList()); // pidList = pList.stream().map(PidSystem::fromValue).collect(Collectors.toList());
} // }
List<PidSystem> pidList = pList.stream().map(PidSystem::fromValue).collect(Collectors.toList());
rda.setPidSystem(pidList); rda.setPidSystem(pidList);
rda.setAdditionalProperty(ImportPropertyName.PID_SYSTEM.getName(), node.get("id").asText()); rda.setAdditionalProperty(ImportPropertyName.PID_SYSTEM.getName(), node.get("id").asText());
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.models.rda.mapper; package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.elastic.entities.Tag; import eu.eudat.elastic.entities.Tag;
import eu.eudat.logic.utilities.json.JavaToJson; import eu.eudat.logic.utilities.json.JavaToJson;
@ -14,20 +15,22 @@ public class KeywordRDAMapper {
private static final Logger logger = LoggerFactory.getLogger(KeywordRDAMapper.class); private static final Logger logger = LoggerFactory.getLogger(KeywordRDAMapper.class);
public static List<String> toRDA(String value) { public static List<String> toRDA(String value) {
// ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
// try { value = JavaToJson.objectStringToJson(value);
// value = JavaToJson.objectStringToJson(value); if (!value.isEmpty()) {
// if (!value.isEmpty()) { try {
// List<Tag> tags = Arrays.asList(mapper.readValue(value, Tag[].class)); List<Tag> tags = Arrays.asList(mapper.readValue(value, Tag[].class));
// List<String> keywordNames = tags.stream().map(Tag::getName).collect(Collectors.toList()); List<String> keywordNames = tags.stream().map(Tag::getName).collect(Collectors.toList());
// return keywordNames; return keywordNames;
// } } catch (JsonProcessingException e) {
// } catch (IOException e) { logger.warn(e.getMessage() + ". Attempting to parse it as a String list.");
// logger.error(e.getMessage(), e);
// }
if(!value.isEmpty()) { if(!value.isEmpty()) {
return new ArrayList<>(Arrays.asList(value.replace(" ", "").split(","))); return new ArrayList<>(Arrays.asList(value.replace(" ", "").split(",")));
} }
}
}
return new ArrayList<>(); return new ArrayList<>();
} }
} }

View File

@ -3,6 +3,8 @@ package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import eu.eudat.logic.utilities.json.JsonSearcher; import eu.eudat.logic.utilities.json.JsonSearcher;
import eu.eudat.models.rda.License; import eu.eudat.models.rda.License;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI; import java.net.URI;
import java.util.HashMap; import java.util.HashMap;
@ -10,21 +12,24 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class LicenseRDAMapper { public class LicenseRDAMapper {
private static final Logger logger = LoggerFactory.getLogger(LicenseRDAMapper.class);
public static License toRDA(List<JsonNode> nodes) { public static License toRDA(List<JsonNode> nodes) {
License rda = new License(); License rda = new License();
for (JsonNode node: nodes) { for (JsonNode node: nodes) {
String rdaProperty = node.get("rdaProperty").asText(); String rdaProperty = node.get("rdaProperty").asText();
String value = node.get("value").asText(); String value = node.get("value").asText();
if(value.equals(null)){ if(value == null || value.isEmpty()){
continue; continue;
} }
for (LicenceProperties licenceProperties: LicenceProperties.values()) { for (LicenceProperties licenceProperties: LicenceProperties.values()) {
if (rdaProperty.contains(licenceProperties.getName())) { if (rdaProperty.contains(licenceProperties.getName())) {
switch (licenceProperties) { switch (licenceProperties) {
case LICENSE_REF: case LICENSE_REF:
if(value.contains(":")){ // valid uri try {
rda.setLicenseRef(URI.create(value)); rda.setLicenseRef(URI.create(value));
} catch (IllegalArgumentException e) {
logger.warn(e.getLocalizedMessage() + ". Skipping url parsing");
} }
break; break;
case START_DATE: case START_DATE:
@ -43,14 +48,6 @@ public class LicenseRDAMapper {
}*/ }*/
} }
// if (rda.getLicenseRef() == null) {
// throw new IllegalArgumentException("Licence Reference is missing");
// }
//
// if (rda.getStartDate() == null) {
// throw new IllegalArgumentException("License Start Date is missing");
// }
if(rda.getLicenseRef() == null || rda.getStartDate() == null){ if(rda.getLicenseRef() == null || rda.getStartDate() == null){
return null; return null;
} }

View File

@ -2,7 +2,6 @@ package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import eu.eudat.logic.utilities.helpers.MyStringUtils; import eu.eudat.logic.utilities.helpers.MyStringUtils;
import eu.eudat.models.rda.Distribution;
import eu.eudat.models.rda.SecurityAndPrivacy; import eu.eudat.models.rda.SecurityAndPrivacy;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -22,7 +21,6 @@ public class SecurityAndPrivacyRDAMapper {
if(rdaValue == null || rdaValue.isEmpty()){ if(rdaValue == null || rdaValue.isEmpty()){
continue; continue;
} }
SecurityAndPrivacy rda = getRelative(rdaMap, node.get("numbering").asText()); SecurityAndPrivacy rda = getRelative(rdaMap, node.get("numbering").asText());
if (!rdaMap.containsValue(rda)) { if (!rdaMap.containsValue(rda)) {
rdaMap.put(node.get("numbering").asText(), rda); rdaMap.put(node.get("numbering").asText(), rda);
@ -43,11 +41,9 @@ public class SecurityAndPrivacyRDAMapper {
} }
} }
List<SecurityAndPrivacy> rdaList = rdaMap.values().stream() return rdaMap.values().stream()
.filter(sap -> sap.getTitle() != null) .filter(sap -> sap.getTitle() != null)
.collect(Collectors.toList()); .collect(Collectors.toList());
return rdaList;
//return new ArrayList<>(rdaMap.values());
} }
public static Map<String, String> toProperties(List<SecurityAndPrivacy> rdas) { public static Map<String, String> toProperties(List<SecurityAndPrivacy> rdas) {

View File

@ -2,7 +2,6 @@ package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import eu.eudat.logic.utilities.helpers.MyStringUtils; import eu.eudat.logic.utilities.helpers.MyStringUtils;
import eu.eudat.models.rda.SecurityAndPrivacy;
import eu.eudat.models.rda.TechnicalResource; import eu.eudat.models.rda.TechnicalResource;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -22,7 +21,6 @@ public class TechnicalResourceRDAMapper {
if(rdaValue == null || rdaValue.isEmpty()){ if(rdaValue == null || rdaValue.isEmpty()){
continue; continue;
} }
TechnicalResource rda = getRelative(rdaMap, node.get("numbering").asText()); TechnicalResource rda = getRelative(rdaMap, node.get("numbering").asText());
if (!rdaMap.containsValue(rda)) { if (!rdaMap.containsValue(rda)) {
rdaMap.put(node.get("numbering").asText(), rda); rdaMap.put(node.get("numbering").asText(), rda);
@ -43,11 +41,9 @@ public class TechnicalResourceRDAMapper {
} }
} }
List<TechnicalResource> rdaList = rdaMap.values().stream() return rdaMap.values().stream()
.filter(tr -> tr.getName() != null) .filter(tr -> tr.getName() != null)
.collect(Collectors.toList()); .collect(Collectors.toList());
return rdaList;
//return new ArrayList<>(rdaMap.values());
} }
public static Map<String, String> toProperties(List<TechnicalResource> rdas) { public static Map<String, String> toProperties(List<TechnicalResource> rdas) {

View File

@ -1,6 +1,6 @@
dataset.data_quality_assurance dataset.data_quality_assurance
dataset.distribution.access_url dataset.distribution.access_url
dataset.distribution.available_till dataset.distribution.available_until
dataset.distribution.byte_size dataset.distribution.byte_size
dataset.distribution.data_access dataset.distribution.data_access
dataset.distribution.description dataset.distribution.description

View File

@ -1,9 +1,9 @@
dmp.domain = http://localhost:4200 dmp.domain = http://localhost:4200
####################PERSISTENCE OVERRIDES CONFIGURATIONS########## ####################PERSISTENCE OVERRIDES CONFIGURATIONS##########
database.url= database.url=jdbc:postgresql://dbserver02.local.cite.gr:5432/dmptool
database.username= database.username=dmtadm
database.password= database.password=t00L4DM@18!
spring.datasource.maxIdle=10 spring.datasource.maxIdle=10
spring.datasource.minIdle=5 spring.datasource.minIdle=5
spring.datasource.maxActive=10 spring.datasource.maxActive=10
@ -19,7 +19,7 @@ elasticsearch.index=dmps
http-logger.server-address = http://localhost:31311 http-logger.server-address = http://localhost:31311
####################PDF OVERRIDES CONFIGURATIONS########## ####################PDF OVERRIDES CONFIGURATIONS##########
pdf.converter.url=http://localhost:88/ pdf.converter.url=http://localhost:3000/
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS########## ####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
configuration.externalUrls=externalUrls/ExternalUrls.xml configuration.externalUrls=externalUrls/ExternalUrls.xml
@ -38,7 +38,7 @@ facebook.login.clientSecret=
facebook.login.namespace= facebook.login.namespace=
#############GOOGLE LOGIN CONFIGURATIONS######### #############GOOGLE LOGIN CONFIGURATIONS#########
google.login.clientId= google.login.clientId=524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleusercontent.com
#############LINKEDIN LOGIN CONFIGURATIONS######### #############LINKEDIN LOGIN CONFIGURATIONS#########
linkedin.login.clientId= linkedin.login.clientId=
@ -86,7 +86,7 @@ zenodo.login.redirect_uri=http://localhost:4200/login/external/zenodo
#############CONTACT EMAIL CONFIGURATIONS######### #############CONTACT EMAIL CONFIGURATIONS#########
contact_email.mail= contact_email.mail=
language.path=dmp-frontend/src/assets/i18n/ language.path=C:\\Users\\aldom\\OneDrive\\Desktop\\CITE\\dmp-frontend\\src\\assets\\i18n\\
#############LOGGING######### #############LOGGING#########
logging.config=classpath:logging/logback-${spring.profiles.active}.xml logging.config=classpath:logging/logback-${spring.profiles.active}.xml

View File

@ -98,7 +98,7 @@ database.lock-fail-interval=120000
##########################MISC########################################## ##########################MISC##########################################
#############USER GUIDE######### #############USER GUIDE#########
userguide.path=user-guide/ userguide.path=C:\\Users\\aldom\\OneDrive\\Desktop\\CITE\\user-guide
#############NOTIFICATION######### #############NOTIFICATION#########
notification.rateInterval=30000 notification.rateInterval=30000
@ -112,7 +112,7 @@ notification.modifiedFinalised.subject=[OpenDMP] The {name} has been modified an
logging.config=classpath:logging/logback-${spring.profiles.active}.xml logging.config=classpath:logging/logback-${spring.profiles.active}.xml
#############TEMP######### #############TEMP#########
temp.temp=tmp/ temp.temp=C:\\Users\\aldom\\OneDrive\\Desktop\\CITE-TMP\\
#############ZENODO######### #############ZENODO#########
zenodo.affiliation=ARGOS zenodo.affiliation=ARGOS

View File

@ -1013,7 +1013,7 @@
<label>Zenodo</label> <label>Zenodo</label>
<ordinal>1</ordinal> <ordinal>1</ordinal>
<type>External</type> <type>External</type>
<url>https://sandbox.zenodo.org/api/records/?page={page}&amp;size={pageSize}&amp;q="{like}"</url> <url>https://zenodo.org/api/records/?page={page}&amp;size={pageSize}&amp;q="{like}"</url>
<firstPage>1</firstPage> <firstPage>1</firstPage>
<contenttype>application/json</contenttype> <contenttype>application/json</contenttype>
<data> <data>
@ -1028,7 +1028,7 @@
</urlConfig> </urlConfig>
</prefillingSearch> </prefillingSearch>
<prefillingGet> <prefillingGet>
<url>https://sandbox.zenodo.org/api/records/{id}</url> <url>https://zenodo.org/api/records/{id}</url>
<mappings> <mappings>
<mapping source="metadata.title" target="label" /> <mapping source="metadata.title" target="label" />
<mapping source="metadata.description" target="description" /> <mapping source="metadata.description" target="description" />

View File

@ -45,6 +45,7 @@ import { UserService } from './services/user/user.service';
import { CollectionUtils } from './services/utilities/collection-utils.service'; import { CollectionUtils } from './services/utilities/collection-utils.service';
import { TypeUtils } from './services/utilities/type-utils.service'; import { TypeUtils } from './services/utilities/type-utils.service';
import { SpecialAuthGuard } from './special-auth-guard.service'; import { SpecialAuthGuard } from './special-auth-guard.service';
import {PrefillingService} from "@app/core/services/prefilling.service";
// //
// //
// This is shared module that provides all the services. Its imported only once on the AppModule. // This is shared module that provides all the services. Its imported only once on the AppModule.
@ -118,7 +119,8 @@ export class CoreServiceModule {
deps: [ConfigurationService, HttpClient], deps: [ConfigurationService, HttpClient],
multi: true multi: true
}, },
LanguageInfoService LanguageInfoService,
PrefillingService
], ],
}; };
} }

View File

@ -44,6 +44,7 @@ export interface FieldSet {
export interface Multiplicity { export interface Multiplicity {
min: number; min: number;
max: number; max: number;
placeholder: string;
} }
export interface Field { export interface Field {

View File

@ -3,5 +3,6 @@
export interface Multiplicity { export interface Multiplicity {
min: number; min: number;
max: number; max: number;
placeholder: string;
} }

View File

@ -0,0 +1,5 @@
export interface Prefilling {
pid: string;
name: string;
tag: string;
}

View File

@ -0,0 +1,25 @@
import {Injectable} from "@angular/core";
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {BaseHttpService} from "@app/core/services/http/base-http.service";
import {ConfigurationService} from "@app/core/services/configuration/configuration.service";
import {Observable} from "rxjs";
import {Prefilling} from "@app/core/model/dataset/prefilling";
import {DatasetWizardModel} from "@app/core/model/dataset/dataset-wizard";
@Injectable()
export class PrefillingService {
private readonly actionUrl: string;
private headers = new HttpHeaders();
constructor(private http: BaseHttpService, private httpClient: HttpClient, private configurationService: ConfigurationService) {
this.actionUrl = configurationService.server + 'prefilling/';
}
public getPrefillingList(like: string, configId: string): Observable<Prefilling[]> {
return this.http.get<Prefilling[]>(this.actionUrl + 'list?configId=' + encodeURIComponent(configId) + '&like=' + encodeURIComponent(like), { headers: this.headers });
}
public getPrefillingDataset(pid: string, profileId: string, configId: string): Observable<DatasetWizardModel> {
return this.http.get<DatasetWizardModel>(this.actionUrl + '/generate/' + encodeURIComponent(pid) + '?configId=' + encodeURIComponent(configId) + '&profileId=' + encodeURIComponent(profileId), { headers: this.headers });
}
}

View File

@ -1,22 +1,27 @@
import { FormGroup } from '@angular/forms'; import {FormGroup} from '@angular/forms';
import { Multiplicity } from '../../../../core/model/admin/dataset-profile/dataset-profile'; import {Multiplicity} from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model'; import {BaseFormModel} from '../../../../core/model/base-form-model';
export class MultiplicityEditorModel extends BaseFormModel { export class MultiplicityEditorModel extends BaseFormModel {
public min: number; public min: number;
public max: number; public max: number;
public placeholder: string;
fromModel(item: Multiplicity): MultiplicityEditorModel { fromModel(item: Multiplicity): MultiplicityEditorModel {
this.min = item.min; this.min = item.min;
this.max = item.max; this.max = item.max;
this.placeholder = item.placeholder;
return this; return this;
} }
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup { buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({ return this.formBuilder.group({
min: [{ value: this.min, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.min')) }], min: [{value: this.min, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.min'))}],
max: [{ value: this.max, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.max')) }] max: [{value: this.max, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.max'))}],
placeholder: [{
value: this.placeholder,
disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.placeholder'))
}]
}); });
return formGroup;
} }
} }

View File

@ -111,6 +111,12 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row">
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field" appearance="legacy">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-PLACEHOLDER' | translate}}"
type="text" [formControl]="form.get('multiplicity').get('placeholder')">
</mat-form-field>
</div>
</div> </div>

View File

@ -255,7 +255,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
description: formValue.description, description: formValue.description,
hasCommentField: formValue.hasCommentField, hasCommentField: formValue.hasCommentField,
commentFieldValue: '', commentFieldValue: '',
multiplicity: {max:formValue.multiplicity.max, min : formValue.multiplicity.min}, multiplicity: {max: formValue.multiplicity.max, min: formValue.multiplicity.min, placeholder: formValue.multiplicity.placeholder},
multiplicityItems:null, multiplicityItems:null,
fields: fields.map(editorField=>{ fields: fields.map(editorField=>{
const model = new DatasetDescriptionFieldEditorModel().fromModel(editorField); const model = new DatasetDescriptionFieldEditorModel().fromModel(editorField);
@ -981,11 +981,11 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
} }
canGoUp(index: number): boolean { canGoUp(index: number): boolean {
return index > 0; return index > 0 && !this.viewOnly;
} }
canGoDown(index: number): boolean { canGoDown(index: number): boolean {
return index < (this.fieldsArray.length - 1); return index < (this.fieldsArray.length - 1) && !this.viewOnly;
} }
} }

View File

@ -1,52 +1,59 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import {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 { ExternalSourcesConfigurationService } from '@app/core/services/external-sources/external-sources-configuration.service'; import {ExternalSourcesConfigurationService} 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 { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import {
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; SnackBarNotificationLevel,
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component'; UiNotificationService
import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; } from '@app/core/services/notification/ui-notification-service';
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item'; import {SingleAutoCompleteConfiguration} from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent'; import {DatasetCopyDialogueComponent} from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; import {DatasetWizardEditorModel} from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
import { Link, LinkToScroll, TableOfContents } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents'; import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { BaseComponent } from '@common/base/base.component'; import {IBreadCrumbComponent} from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
import { FormService } from '@common/forms/form-service'; import {DatasetDescriptionFormEditorModel} from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component'; import {
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; Link,
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; LinkToScroll,
import { TranslateService } from '@ngx-translate/core'; TableOfContents
} from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents';
import {FormService} from '@common/forms/form-service';
import {FormValidationErrorsDialogComponent} from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
import {ValidationErrorModel} from '@common/forms/validation/error-model/validation-error-model';
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, interval} 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";
@Component({ @Component({
selector: 'app-dataset-wizard-component', selector: 'app-dataset-wizard-component',
@ -95,14 +102,14 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
tocScrollTop: number; tocScrollTop: number;
links: Link[] = []; links: Link[] = [];
//the table seraches for elements to scroll on page with id (TOCENTRY_ID_PREFIX+fieldsetId<Tocentry>) //the table seraches for elements to scroll on page with id (TOCENTRY_ID_PREFIX+fieldsetId<Tocentry>)
TOCENTRY_ID_PREFIX="TocEntRy"; TOCENTRY_ID_PREFIX = "TocEntRy";
showtocentriesErrors = false; showtocentriesErrors = false;
@ViewChild('table0fContents') table0fContents: TableOfContents; @ViewChild('table0fContents') table0fContents: TableOfContents;
hintErrors: boolean = false; hintErrors: boolean = false;
datasetIsOnceSaved = false; datasetIsOnceSaved = false;
fieldsetIdWithFocus:string; fieldsetIdWithFocus: string;
visRulesService:VisibilityRulesService; visRulesService: VisibilityRulesService;
constructor( constructor(
private datasetWizardService: DatasetWizardService, private datasetWizardService: DatasetWizardService,
@ -131,7 +138,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.route this.route
.data .data
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(v => this.viewOnly = v['public']); .subscribe(v => {
this.viewOnly = v['public'];
});
const dmpRequestItem: RequestItem<DmpCriteria> = new RequestItem(); const dmpRequestItem: RequestItem<DmpCriteria> = new RequestItem();
dmpRequestItem.criteria = new DmpCriteria(); dmpRequestItem.criteria = new DmpCriteria();
@ -197,11 +206,13 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.loadDatasetProfiles(); this.loadDatasetProfiles();
this.registerFormListeners(); this.registerFormListeners();
if(lockStatus){ if (lockStatus) {
this.dialog.open(PopupNotificationDialogComponent,{data:{ this.dialog.open(PopupNotificationDialogComponent, {
title:this.language.instant('DATASET-WIZARD.LOCKED.TITLE'), data: {
message:this.language.instant('DATASET-WIZARD.LOCKED.MESSAGE') title: this.language.instant('DATASET-WIZARD.LOCKED.TITLE'),
}, maxWidth:'30em'}); message: this.language.instant('DATASET-WIZARD.LOCKED.MESSAGE')
}, maxWidth: '30em'
});
} }
// this.availableProfiles = this.datasetWizardModel.dmp.profiles; // this.availableProfiles = this.datasetWizardModel.dmp.profiles;
}) })
@ -232,7 +243,24 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
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();
const dialogRef = this.dialog.open(PrefillDatasetComponent, {
width: '590px',
minHeight: '200px',
restoreFocus: false,
data: {
availableProfiles: this.formGroup.get('dmp').value.profiles,
},
panelClass: 'custom-modalbox'
});
dialogRef.afterClosed().subscribe(result => {
if(result) {
this.datasetWizardModel = this.datasetWizardModel.fromModel(result);
this.datasetWizardModel.dmp = data;
this.formGroup = this.datasetWizardModel.buildForm();
this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
this.formGroup.get('dmp').disable();
}
})
this.loadDatasetProfiles(); this.loadDatasetProfiles();
this.registerFormListeners(); this.registerFormListeners();
// this.availableProfiles = data.profiles; // this.availableProfiles = data.profiles;
@ -334,8 +362,16 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
this.formGroup.get('dmp').setValue(this.datasetWizardModel.dmp); this.formGroup.get('dmp').setValue(this.datasetWizardModel.dmp);
const breadcrumbs = []; const breadcrumbs = [];
breadcrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: '/explore' }); breadcrumbs.push({
breadcrumbs.push({ parentComponentName: null, label: this.datasetWizardModel.label, url: '/datasets/publicEdit/' + this.datasetWizardModel.id }); parentComponentName: null,
label: this.language.instant('NAV-BAR.PUBLIC DATASETS'),
url: '/explore'
});
breadcrumbs.push({
parentComponentName: null,
label: this.datasetWizardModel.label,
url: '/datasets/publicEdit/' + this.datasetWizardModel.id
});
this.breadCrumbs = observableOf(breadcrumbs); this.breadCrumbs = observableOf(breadcrumbs);
} }
}); });
@ -466,6 +502,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// this._listenersSubscription.add(uriSubscription); // this._listenersSubscription.add(uriSubscription);
// this._listenersSubscription.add(tagsSubscription); // this._listenersSubscription.add(tagsSubscription);
} }
// private _unregisterFormListeners(){ // private _unregisterFormListeners(){
// this._listenersSubscription.unsubscribe(); // this._listenersSubscription.unsubscribe();
// this._listenersSubscription = new Subscription(); // this._listenersSubscription = new Subscription();
@ -475,8 +512,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
if (dmp) { if (dmp) {
this.formGroup.get('profile').enable(); this.formGroup.get('profile').enable();
this.loadDatasetProfiles(); this.loadDatasetProfiles();
} } else {
else {
this.availableProfiles = []; this.availableProfiles = [];
this.formGroup.get('profile').reset(); this.formGroup.get('profile').reset();
this.formGroup.get('profile').disable(); this.formGroup.get('profile').disable();
@ -495,7 +531,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;
@ -531,7 +567,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.formGroup.get('status').setValue(DmpStatus.Draft); this.formGroup.get('status').setValue(DmpStatus.Draft);
this.onCallbackError(error); this.onCallbackError(error);
} }
) )
} else { } else {
this.publicMode ? this.router.navigate(['/explore']) : this.router.navigate(['/datasets']); this.publicMode ? this.router.navigate(['/explore']) : this.router.navigate(['/datasets']);
@ -542,8 +577,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
getDatasetDisplay(item: any): string { getDatasetDisplay(item: any): string {
if (!this.publicMode) { if (!this.publicMode) {
return (item['status'] ? this.language.instant('TYPES.DATASET-STATUS.FINALISED').toUpperCase() : this.language.instant('TYPES.DATASET-STATUS.DRAFT').toUpperCase()) + ': ' + item['label']; return (item['status'] ? this.language.instant('TYPES.DATASET-STATUS.FINALISED').toUpperCase() : this.language.instant('TYPES.DATASET-STATUS.DRAFT').toUpperCase()) + ': ' + item['label'];
} else {
return item['label'];
} }
else { return item['label']; }
} }
getDefinition(profileId: string) { getDefinition(profileId: string) {
@ -616,7 +652,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// } // }
submit(saveType?: SaveType) { submit(saveType?: SaveType) {
this.scrollTop = document.getElementById('dataset-editor-form').scrollTop; this.scrollTop = document.getElementById('dataset-editor-form').scrollTop;
this.tocScrollTop = document.getElementById('stepper-options').scrollTop; this.tocScrollTop = document.getElementById('stepper-options').scrollTop;
@ -632,17 +667,22 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
private _getErrorMessage(formControl: AbstractControl, name: string): string[] { private _getErrorMessage(formControl: AbstractControl, name: string): string[] {
const errors: string[] = []; const errors: string[] = [];
Object.keys(formControl.errors).forEach(key => { Object.keys(formControl.errors).forEach(key => {
if (key === 'required') { errors.push(this.language.instant(name + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED'))); } if (key === 'required') {
errors.push(this.language.instant(name + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED')));
}
// if (key === 'required') { errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + this.getPlaceHolder(formControl) + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED')); } // if (key === 'required') { errors.push(this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.THIS-FIELD') + ' "' + this.getPlaceHolder(formControl) + '" ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.HAS-ERROR') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED')); }
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')); } else if (key === 'email') {
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.EMAIL'));
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 })); } } else if (key === 'min') {
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') + ', ' + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.MIN-VALUE', {'min': formControl.getError('min').min}));
} 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}));
} 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);
}
}); });
return errors; return errors;
} }
@ -661,11 +701,10 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
private _buildSemiFormErrorMessages(): string[] {//not including datasetProfileDefinition
private _buildSemiFormErrorMessages(): string[]{//not including datasetProfileDefinition
const errmess: string[] = []; const errmess: string[] = [];
Object.keys(this.formGroup.controls).forEach(controlName=>{ Object.keys(this.formGroup.controls).forEach(controlName => {
if(controlName != 'datasetProfileDefinition' && this.formGroup.get(controlName).invalid){ if (controlName != 'datasetProfileDefinition' && this.formGroup.get(controlName).invalid) {
errmess.push(...this._buildErrorMessagesForAbstractControl(this.formGroup.get(controlName), controlName)); errmess.push(...this._buildErrorMessagesForAbstractControl(this.formGroup.get(controlName), controlName));
} }
}) })
@ -674,16 +713,16 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
// 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;
} }
} }
@ -695,19 +734,19 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
/*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}`));
}); });
} }
@ -718,8 +757,8 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
save(saveType?: SaveType) { save(saveType?: SaveType) {
Object.keys(this.formGroup.controls).forEach(controlName=>{ Object.keys(this.formGroup.controls).forEach(controlName => {
if(controlName == 'datasetProfileDefinition'){ if (controlName == 'datasetProfileDefinition') {
return; return;
} }
this.formService.touchAllFormFields(this.formGroup.get(controlName)); this.formService.touchAllFormFields(this.formGroup.get(controlName));
@ -738,17 +777,17 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
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,
@ -782,7 +821,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
reverse() { reverse() {
this.dialog.open(ConfirmationDialogComponent, { this.dialog.open(ConfirmationDialogComponent, {
data:{ data: {
message: this.language.instant('DATASET-WIZARD.ACTIONS.UNDO-FINALIZATION-QUESTION'), message: this.language.instant('DATASET-WIZARD.ACTIONS.UNDO-FINALIZATION-QUESTION'),
confirmButton: this.language.instant('DATASET-WIZARD.ACTIONS.CONFIRM'), confirmButton: this.language.instant('DATASET-WIZARD.ACTIONS.CONFIRM'),
cancelButton: this.language.instant('DATASET-WIZARD.ACTIONS.REJECT'), cancelButton: this.language.instant('DATASET-WIZARD.ACTIONS.REJECT'),
@ -791,12 +830,14 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
}) })
.afterClosed() .afterClosed()
.pipe( .pipe(
filter(x=> x), filter(x => x),
takeUntil(this._destroyed) takeUntil(this._destroyed)
).subscribe( _ => { ).subscribe(_ => {
this.viewOnly = false; this.viewOnly = false;
this.datasetWizardModel.status = DatasetStatus.Draft; this.datasetWizardModel.status = DatasetStatus.Draft;
setTimeout(x => { this.formGroup = null; }); setTimeout(x => {
this.formGroup = null;
});
setTimeout(x => { setTimeout(x => {
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = this.datasetWizardModel.buildForm();
this.registerFormListeners(); this.registerFormListeners();
@ -804,7 +845,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
}); });
} }
saveFinalize() { saveFinalize() {
@ -813,8 +853,8 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
if (!this.isSemiFormValid(this.formGroup) || (this.table0fContents && this.table0fContents.hasVisibleInvalidFields())) { if (!this.isSemiFormValid(this.formGroup) || (this.table0fContents && this.table0fContents.hasVisibleInvalidFields())) {
// this.showValidationErrorsDialog(); // this.showValidationErrorsDialog();
this.dialog.open(FormValidationErrorsDialogComponent, { this.dialog.open(FormValidationErrorsDialogComponent, {
data:{ data: {
errorMessages:[this.language.instant('DATASET-WIZARD.MESSAGES.MISSING-FIELDS')] errorMessages: [this.language.instant('DATASET-WIZARD.MESSAGES.MISSING-FIELDS')]
} }
}) })
@ -845,11 +885,17 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
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 (data) { if (data) {
if (saveType === this.saveAnd.addNew) { if (saveType === this.saveAnd.addNew) {
this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'new', this.formGroup.get('dmp').value.id]); }) this.router.navigate(['/reload']).then(() => {
this.router.navigate(['/datasets', 'new', this.formGroup.get('dmp').value.id]);
})
} else if (saveType === this.saveAnd.close) { } else if (saveType === this.saveAnd.close) {
this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', this.formGroup.get('dmp').value.id]); }); this.router.navigate(['/reload']).then(() => {
this.router.navigate(['/plans', 'edit', this.formGroup.get('dmp').value.id]);
});
} else if (saveType === SaveType.finalize) { } else if (saveType === SaveType.finalize) {
this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); }); this.router.navigate(['/reload']).then(() => {
this.router.navigate(['/datasets', 'edit', data.id]);
});
} else { } else {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
@ -884,9 +930,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
onCallbackError(error: any) { onCallbackError(error: any) {
const errmes = error && error.message? error.message as string : null; const errmes = error && error.message ? error.message as string : null;
let feedbackMessage = this.language.instant('DATASET-EDITOR.ERRORS.ERROR-OCCURED'); let feedbackMessage = this.language.instant('DATASET-EDITOR.ERRORS.ERROR-OCCURED');
if(errmes){ if (errmes) {
feedbackMessage += errmes; feedbackMessage += errmes;
} }
this.uiNotificationService.snackBarNotification(feedbackMessage, SnackBarNotificationLevel.Warning); this.uiNotificationService.snackBarNotification(feedbackMessage, SnackBarNotificationLevel.Warning);
@ -903,7 +949,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.downloadPDF(this.downloadDocumentId) this.datasetWizardService.downloadPDF(this.downloadDocumentId)
.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);
@ -914,7 +960,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.downloadDOCX(this.downloadDocumentId) this.datasetWizardService.downloadDOCX(this.downloadDocumentId)
.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);
@ -926,7 +972,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.datasetWizardService.downloadXML(this.downloadDocumentId) this.datasetWizardService.downloadXML(this.downloadDocumentId)
.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);
@ -1046,7 +1092,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}});
} }
}); });
} }
@ -1055,8 +1101,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
if (this.datasetWizardModel.isProfileLatestVersion || (this.datasetWizardModel.status === DatasetStatus.Finalized) if (this.datasetWizardModel.isProfileLatestVersion || (this.datasetWizardModel.status === DatasetStatus.Finalized)
|| (this.datasetWizardModel.isProfileLatestVersion == undefined && this.datasetWizardModel.status == undefined)) { || (this.datasetWizardModel.isProfileLatestVersion == undefined && this.datasetWizardModel.status == undefined)) {
return false; return false;
} } else {
else {
return true; return true;
} }
} }
@ -1081,6 +1126,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
linkToScroll: LinkToScroll; linkToScroll: LinkToScroll;
onStepFound(linkToScroll: LinkToScroll) { onStepFound(linkToScroll: LinkToScroll) {
this.linkToScroll = linkToScroll; this.linkToScroll = linkToScroll;
} }
@ -1097,15 +1143,15 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
public changeStep(index: number, dataset?: FormControl) { public changeStep(index: number, dataset?: FormControl) {
if(this.step != index){ //view is changing if (this.step != index) { //view is changing
this.resetScroll(); this.resetScroll();
} }
this.step = index; this.step = index;
} }
public nextStep() { public nextStep() {
if(this.step < this.maxStep){//view is changing if (this.step < this.maxStep) {//view is changing
if(this.step === 0 && this.table0fContents){ if (this.step === 0 && this.table0fContents) {
this.table0fContents.seekToFirstElement(); this.table0fContents.seekToFirstElement();
} }
this.step++; this.step++;
@ -1115,7 +1161,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
} }
public previousStep() { public previousStep() {
if(this.step > 0){ if (this.step > 0) {
this.resetScroll(); this.resetScroll();
this.step--; this.step--;
} }
@ -1136,7 +1182,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// this.hasChanges = false; // this.hasChanges = false;
// this.hintErrors = false; // this.hintErrors = false;
let messageText = ""; let messageText = "";
let confirmButtonText =""; let confirmButtonText = "";
let cancelButtonText = ""; let cancelButtonText = "";
let isDeleteConfirmation = false; let isDeleteConfirmation = false;
@ -1173,14 +1219,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// this.isDiscarded = false; // this.isDiscarded = false;
} }
const dialogRef = this.dialog.open(ConfirmationDialogComponent, { const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false, restoreFocus: false,
data: { data: {
@ -1189,7 +1230,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
cancelButton: cancelButtonText, cancelButton: cancelButtonText,
isDeleteConfirmation: true isDeleteConfirmation: true
}, },
maxWidth:'40em' maxWidth: '40em'
}); });
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) { if (result) {
@ -1198,8 +1239,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
}); });
// this.isDiscarded = false; // this.isDiscarded = false;
} }
@ -1219,13 +1258,15 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
this.links = currentLinks; this.links = currentLinks;
} }
printForm(){ printForm() {
console.log(this.formGroup); console.log(this.formGroup);
} }
printFormValue(){
printFormValue() {
console.log(this.formGroup.value); console.log(this.formGroup.value);
} }
touchForm(){
touchForm() {
this.formGroup.markAllAsTouched(); this.formGroup.markAllAsTouched();
this.showtocentriesErrors = true; this.showtocentriesErrors = true;
} }
@ -1234,7 +1275,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// this.tocentries = this.getTocEntries(this.formGroup.get('datasetProfileDefinition')); //TODO // this.tocentries = this.getTocEntries(this.formGroup.get('datasetProfileDefinition')); //TODO
// get tocentries(){ // get tocentries(){
// const form = this.formGroup.get('datasetProfileDefinition') // const form = this.formGroup.get('datasetProfileDefinition')
// if(!form) return null; // if(!form) return null;
@ -1336,7 +1376,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// }); // });
// result.forEach((entry,i)=>{ // result.forEach((entry,i)=>{
// const sections = entry.form.get('sections') as FormArray; // const sections = entry.form.get('sections') as FormArray;
@ -1356,6 +1395,4 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
// } // }
} }

View File

@ -0,0 +1,50 @@
<div class="template-container">
<div mat-dialog-title class="row d-flex m-0 header">
<span class="template-title align-self-center">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.TITLE' | translate}}</span>
<span class="ml-auto align-self-center" (click)="closeDialog()"><mat-icon
class="close-icon">close</mat-icon></span>
</div>
<div *ngIf="progressIndication" class="progress-bar">
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
</div>
<div mat-dialog-content *ngIf="prefillForm" [formGroup]="prefillForm" class="definition-content">
<div class="row d-flex align-items-center justify-content-center" [class.pb-4]="isPrefilled">
<button mat-raised-button type="button" class="empty-btn"
(click)="closeDialog()">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.EMPTY' | translate}}</button>
<div class="ml-2 mr-2">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.OR' | translate}}</div>
<button mat-raised-button type="button" class="prefill-btn"
(click)="isPrefilled = true">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.PREFILL' | translate}}</button>
</div>
<div *ngIf="isPrefilled" class="row">
<div class="col-12 pl-0 pr-0 pb-2 d-flex flex-row">
<h4 class="col-auto heading">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.PROFILE' | translate}}</h4>
</div>
<mat-form-field class="col-md-12">
<mat-select placeholder="{{'DATASET-CREATE-WIZARD.PREFILL-STEP.PROFILE'| translate}}" [required]="true" [compareWith]="compareWith" formControlName="profile">
<mat-option *ngFor="let profile of data.availableProfiles" [value]="profile">
{{profile.label}}
</mat-option>
</mat-select>
<mat-error *ngIf="prefillForm.get('profile').hasError('backendError')">{{prefillForm.get('profile').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
<div *ngIf="isPrefilled" class="row">
<div class="col-12 pl-0 pr-0 pb-2 d-flex flex-row">
<h4 class="col-auto heading">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.PREFILLED-DATASET' | translate}}</h4>
</div>
<mat-form-field class="col-md-12">
<app-single-auto-complete [required]="true" [formControl]="prefillForm.get('prefill')"
placeholder="{{'DATASET-CREATE-WIZARD.PREFILL-STEP.SEARCH' | translate}}"
[configuration]="prefillAutoCompleteConfiguration">
</app-single-auto-complete>
</mat-form-field>
</div>
</div>
<div *ngIf="isPrefilled">
<div class="col-auto d-flex pb-4 pt-2">
<button mat-raised-button type="button" class="prefill-btn ml-auto" [disabled]="prefillForm.invalid"
(click)="next()">{{'DATASET-CREATE-WIZARD.PREFILL-STEP.NEXT' | translate}}</button>
</div>
</div>
</div>

View File

@ -0,0 +1,57 @@
.template-container {
.header {
display: flex;
width: 100%;
height: 60px;
background-color: #f7dd72;
color: #212121;
font-size: 1.25rem;
}
.template-title {
margin-left: 37px;
white-space: nowrap;
width: 480px;
overflow: hidden;
text-overflow: ellipsis;
}
.close-icon {
cursor: pointer;
margin-right: 20px;
}
.close-icon:hover {
background-color: #fefefe6e !important;
border-radius: 50%;
}
.definition-content {
display: block;
margin: 0;
padding: 25px;
}
.empty-btn, .prefill-btn {
background: #f7dd72 0 0 no-repeat padding-box;
border: 1px solid #f7dd72;
border-radius: 30px;
opacity: 1;
width: 101px;
height: 43px;
color: #212121;
font-weight: 500;
}
.prefill-btn:disabled {
background: #a1a1a1 0 0 no-repeat padding-box;
border: 1px solid #a1a1a1;
opacity: 0.5;
}
.empty-btn {
background: #ffffff 0 0 no-repeat padding-box;
border: 1px solid #a1a1a1;
}
}

View File

@ -0,0 +1,76 @@
import {Component, Inject, OnInit} from "@angular/core";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {takeUntil} from "rxjs/operators";
import {ProgressIndicationService} from "@app/core/services/progress-indication/progress-indication-service";
import {BaseComponent} from "@common/base/base.component";
import {SingleAutoCompleteConfiguration} from "@app/library/auto-complete/single/single-auto-complete-configuration";
import {Observable} from "rxjs";
import {Prefilling} from "@app/core/model/dataset/prefilling";
import {PrefillingService} from "@app/core/services/prefilling.service";
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
@Component({
selector: 'prefill-dataset-component',
templateUrl: 'prefill-dataset.component.html',
styleUrls: ['prefill-dataset.component.scss']
})
export class PrefillDatasetComponent extends BaseComponent implements OnInit {
progressIndication = false;
prefillAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
configId: string = "zenodo";
isPrefilled: boolean = false;
prefillForm: FormGroup;
constructor(public dialogRef: MatDialogRef<PrefillDatasetComponent>,
private prefillingService: PrefillingService,
private progressIndicationService: ProgressIndicationService,
private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) {
super();
}
ngOnInit() {
this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
setTimeout(() => { this.progressIndication = x; });
});
this.prefillForm = this.fb.group({
type: this.fb.control(false),
profile: this.fb.control('', Validators.required),
prefill: this.fb.control(null, Validators.required)
})
if(this.data.availableProfiles && this.data.availableProfiles.length === 1) {
this.prefillForm.get('profile').patchValue(this.data.availableProfiles[0]);
}
this.prefillAutoCompleteConfiguration = {
filterFn: this.searchDatasets.bind(this),
initialItems: (extraData) => this.searchDatasets(''),
displayFn: (item) => (item['name'].length > 60)?(item['name'].substr(0, 60) + "..." ):item['name'],
titleFn: (item) => item['name'],
subtitleFn: (item) => item['pid']
};
}
public compareWith(object1: any, object2: any) {
return object1 && object2 && object1.id === object2.id;
}
searchDatasets(query: string): Observable<Prefilling[]> {
return this.prefillingService.getPrefillingList(query, this.configId);
}
next() {
if(this.isPrefilled) {
this.prefillingService.getPrefillingDataset(this.prefillForm.get('prefill').value.pid, this.prefillForm.get('profile').value.id, this.configId).subscribe(wizard => {
wizard.profile = this.prefillForm.get('profile').value;
this.closeDialog(wizard);
})
} else {
this.closeDialog();
}
}
closeDialog(result = null): void {
this.dialogRef.close(result);
}
}

View File

@ -28,6 +28,7 @@ import { DatasetCopyDialogModule } from './dataset-wizard/dataset-copy-dialogue/
import { DatasetCriteriaDialogComponent } from './listing/criteria/dataset-criteria-dialogue/dataset-criteria-dialog.component'; import { DatasetCriteriaDialogComponent } from './listing/criteria/dataset-criteria-dialogue/dataset-criteria-dialog.component';
import { DatasetOverviewModule } from './overview/dataset-overview.module'; import { DatasetOverviewModule } from './overview/dataset-overview.module';
import {RichTextEditorModule} from "@app/library/rich-text-editor/rich-text-editor.module"; import {RichTextEditorModule} from "@app/library/rich-text-editor/rich-text-editor.module";
import {PrefillDatasetComponent} from "@app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component";
@NgModule({ @NgModule({
imports: [ imports: [
@ -62,6 +63,7 @@ import {RichTextEditorModule} from "@app/library/rich-text-editor/rich-text-edit
DatasetUploadDialogue, DatasetUploadDialogue,
DatasetListingItemComponent, DatasetListingItemComponent,
DatasetCriteriaDialogComponent, DatasetCriteriaDialogComponent,
PrefillDatasetComponent
], ],
entryComponents: [ entryComponents: [
DatasetExternalDataRepositoryDialogEditorComponent, DatasetExternalDataRepositoryDialogEditorComponent,

View File

@ -1,6 +1,6 @@
<div class="main-content"> <div class="main-content">
<div class="container-fluid"> <div class="container-fluid">
<form *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()"> <div *ngIf="formGroup" [formGroup]="formGroup" class="form-container">
<!-- DMP Header --> <!-- DMP Header -->
<div [hidden]="this.step >= stepsBeforeDatasets" class="fixed-editor-header"> <div [hidden]="this.step >= stepsBeforeDatasets" class="fixed-editor-header">
<div class="card editor-header"> <div class="card editor-header">
@ -18,7 +18,7 @@
<div>{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}</div> <div>{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}</div>
</div> </div>
<div *ngIf="!isNew && formGroup.enabled && !lockStatus"> <div *ngIf="!isNew && formGroup.enabled && !lockStatus">
<button *ngIf="!isFinalized" mat-raised-button type="submit" class="save-btn"> <button *ngIf="!isFinalized" mat-raised-button (click)="formSubmit()" class="save-btn">
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}} {{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
</button> </button>
</div> </div>
@ -93,7 +93,7 @@
</div> </div>
</div> </div>
</div> </div>
</form> </div>
</div> </div>
</div> </div>

View File

@ -8,7 +8,7 @@
} }
} }
form { .form-container {
height: calc(100vh - 124px); height: calc(100vh - 124px);
margin-top: 6rem; margin-top: 6rem;
} }

View File

@ -24,7 +24,6 @@
} }
::ng-deep .mat-icon-button { ::ng-deep .mat-icon-button {
height: 30px !important;
font-size: 12px !important; font-size: 12px !important;
} }

View File

@ -19,10 +19,14 @@
</div> </div>
</div> </div>
<div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)" <div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)"
class="col-12 ml-0 mr-0 addOneFieldButton"> class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled" matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"> <span class="pointer d-inline-flex align-items-center">
<button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled">
<mat-icon>add_circle</mat-icon> <mat-icon>add_circle</mat-icon>
</button> </button>
<span class="mt-1" *ngIf="compositeFieldFormGroup.get('multiplicity').value.placeholder">{{compositeFieldFormGroup.get('multiplicity').value.placeholder}}</span>
<span class="mt-1" *ngIf="!compositeFieldFormGroup.get('multiplicity').value.placeholder">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}</span>
</span>
</div> </div>
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup"> <mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup">
<input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}"> <input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}">

View File

@ -31,10 +31,14 @@
</div> </div>
</div> </div>
<div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)" <div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)"
class="col-12 addOneFieldButton"> class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<button mat-icon-button type="button" color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled" matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"> <span class="pointer d-inline-flex align-items-center">
<button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled">
<mat-icon>add_circle</mat-icon> <mat-icon>add_circle</mat-icon>
</button> </button>
<span class="mt-1" *ngIf="compositeFieldFormGroup.get('multiplicity').value.placeholder">{{compositeFieldFormGroup.get('multiplicity').value.placeholder}}</span>
<span class="mt-1" *ngIf="!compositeFieldFormGroup.get('multiplicity').value.placeholder">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}</span>
</span>
</div> </div>
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup"> <mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup">
<input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}"> <input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}">
@ -96,10 +100,14 @@
</div> </div>
</div> </div>
<div *ngIf="(fieldsetEntry.form.get('multiplicity').value.max - 1) > (fieldsetEntry.form.get('multiplicityItems').length)" <div *ngIf="(fieldsetEntry.form.get('multiplicity').value.max - 1) > (fieldsetEntry.form.get('multiplicityItems').length)"
class="col-12 addOneFieldButton"> class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<button mat-icon-button type="button" color="primary" (click)="addMultipleField(i)" [disabled]="fieldsetEntry.form.disabled" matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"> <span class="pointer d-inline-flex align-items-center">
<button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="fieldsetEntry.form.disabled">
<mat-icon>add_circle</mat-icon> <mat-icon>add_circle</mat-icon>
</button> </button>
<span class="mt-1" *ngIf="fieldsetEntry.form.get('multiplicity').value.placeholder">{{fieldsetEntry.form.get('multiplicity').value.placeholder}}</span>
<span class="mt-1" *ngIf="!fieldsetEntry.form.get('multiplicity').value.placeholder">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}</span>
</span>
</div> </div>
<mat-form-field *ngIf="fieldsetEntry.form.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="fieldsetEntry.form"> <mat-form-field *ngIf="fieldsetEntry.form.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="fieldsetEntry.form">
<input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}"> <input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}">

View File

@ -318,17 +318,20 @@ export class DatasetDescriptionFieldEditorModel extends BaseFormModel {
export class DatasetDescriptionMultiplicityEditorModel extends BaseFormModel { export class DatasetDescriptionMultiplicityEditorModel extends BaseFormModel {
public min: number; public min: number;
public max: number; public max: number;
public placeholder: string;
fromModel(item: Multiplicity): DatasetDescriptionMultiplicityEditorModel { fromModel(item: Multiplicity): DatasetDescriptionMultiplicityEditorModel {
this.min = item.min; this.min = item.min;
this.max = item.max; this.max = item.max;
this.placeholder = item.placeholder;
return this; return this;
} }
buildForm(): FormGroup { buildForm(): FormGroup {
const formGroup = this.formBuilder.group({ const formGroup = this.formBuilder.group({
min: [this.min], min: [this.min],
max: [this.max] max: [this.max],
placeholder: [this.placeholder]
}); });
return formGroup; return formGroup;
} }

View File

@ -10,7 +10,7 @@
"loginProviders": { "loginProviders": {
"enabled": [1, 2, 3, 4, 5, 6, 7, 8], "enabled": [1, 2, 3, 4, 5, 6, 7, 8],
"facebookConfiguration": { "clientId": "" }, "facebookConfiguration": { "clientId": "" },
"googleConfiguration": { "clientId": "" }, "googleConfiguration": { "clientId": "524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleusercontent.com" },
"linkedInConfiguration": { "linkedInConfiguration": {
"clientId": "", "clientId": "",
"oauthUrl": "https://www.linkedin.com/oauth/v2/authorization", "oauthUrl": "https://www.linkedin.com/oauth/v2/authorization",

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Additional Information", "ADDITIONAL-INFORMATION": "Additional Information",
"MULTIPLICITY-MIN": "Multiplicity Min", "MULTIPLICITY-MIN": "Multiplicity Min",
"MULTIPLICITY-MAX": "Multiplicity Max", "MULTIPLICITY-MAX": "Multiplicity Max",
"MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection", "COMMENT-HINT": "Provide additional information or justification about your selection",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "DMP", "TITLE": "DMP",
"PLACEHOLDER": "Bestehenden DMP auswählen" "PLACEHOLDER": "Bestehenden DMP auswählen"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Additional Information", "ADDITIONAL-INFORMATION": "Additional Information",
"MULTIPLICITY-MIN": "Multiplicity Min", "MULTIPLICITY-MIN": "Multiplicity Min",
"MULTIPLICITY-MAX": "Multiplicity Max", "MULTIPLICITY-MAX": "Multiplicity Max",
"MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection", "COMMENT-HINT": "Provide additional information or justification about your selection",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "DMP", "TITLE": "DMP",
"PLACEHOLDER": "Pick an existing DMP" "PLACEHOLDER": "Pick an existing DMP"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Información adicional", "ADDITIONAL-INFORMATION": "Información adicional",
"MULTIPLICITY-MIN": "Multiplicidad mínima", "MULTIPLICITY-MIN": "Multiplicidad mínima",
"MULTIPLICITY-MAX": "Multiplicidad máxima", "MULTIPLICITY-MAX": "Multiplicidad máxima",
"MULTIPLICITY-ADD-ONE-FIELD": "Añadir un elemento más", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Orden", "ORDER": "Orden",
"COMMENT-PLACEHOLDER": "Por favir especifique", "COMMENT-PLACEHOLDER": "Por favir especifique",
"COMMENT-HINT": "Proporcione información adicional o justifique su selección", "COMMENT-HINT": "Proporcione información adicional o justifique su selección",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "PGD", "TITLE": "PGD",
"PLACEHOLDER": "Seleccione un PGD existente" "PLACEHOLDER": "Seleccione un PGD existente"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Επιπλέον Πληροφορίες", "ADDITIONAL-INFORMATION": "Επιπλέον Πληροφορίες",
"MULTIPLICITY-MIN": "Ελάχιστη τιμή Min", "MULTIPLICITY-MIN": "Ελάχιστη τιμή Min",
"MULTIPLICITY-MAX": "Μέγιστη τιμή Max", "MULTIPLICITY-MAX": "Μέγιστη τιμή Max",
"MULTIPLICITY-ADD-ONE-FIELD": "Προσθήκη ακόμα ενός πεδίου", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Εντολή", "ORDER": "Εντολή",
"COMMENT-PLACEHOLDER": "Παρακαλώ προσδιορίστε", "COMMENT-PLACEHOLDER": "Παρακαλώ προσδιορίστε",
"COMMENT-HINT": "Προσθέστε επιπλέον πληροφορίες ή αιτιολόγηση σχετικά με την επιλογή σας", "COMMENT-HINT": "Προσθέστε επιπλέον πληροφορίες ή αιτιολόγηση σχετικά με την επιλογή σας",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "Σχέδιο Διαχείρισης Δεδομένων", "TITLE": "Σχέδιο Διαχείρισης Δεδομένων",
"PLACEHOLDER": "Επιλέξτε ένα Σχέδιο Διαχείρισης Δεδομένων από τη συλλογή σας" "PLACEHOLDER": "Επιλέξτε ένα Σχέδιο Διαχείρισης Δεδομένων από τη συλλογή σας"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Informação Adicional", "ADDITIONAL-INFORMATION": "Informação Adicional",
"MULTIPLICITY-MIN": "Multiplicidade Min", "MULTIPLICITY-MIN": "Multiplicidade Min",
"MULTIPLICITY-MAX": "Multiplicidade Máx", "MULTIPLICITY-MAX": "Multiplicidade Máx",
"MULTIPLICITY-ADD-ONE-FIELD": "Adicionar mais um conjunto de campos", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Ordem", "ORDER": "Ordem",
"COMMENT-PLACEHOLDER": "Por favor especifique", "COMMENT-PLACEHOLDER": "Por favor especifique",
"COMMENT-HINT": "Disponibilize informação ou justificação adicional sobre a sua seleção", "COMMENT-HINT": "Disponibilize informação ou justificação adicional sobre a sua seleção",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "PGD", "TITLE": "PGD",
"PLACEHOLDER": "Selecione um PGD existente" "PLACEHOLDER": "Selecione um PGD existente"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Additional Information", "ADDITIONAL-INFORMATION": "Additional Information",
"MULTIPLICITY-MIN": "Multiplicity Min", "MULTIPLICITY-MIN": "Multiplicity Min",
"MULTIPLICITY-MAX": "Multiplicity Max", "MULTIPLICITY-MAX": "Multiplicity Max",
"MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection", "COMMENT-HINT": "Provide additional information or justification about your selection",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "DMP", "TITLE": "DMP",
"PLACEHOLDER": "Vybrať existujúci DMP." "PLACEHOLDER": "Vybrať existujúci DMP."
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Dodatne informacije", "ADDITIONAL-INFORMATION": "Dodatne informacije",
"MULTIPLICITY-MIN": "Višestrukost, minimalno polja", "MULTIPLICITY-MIN": "Višestrukost, minimalno polja",
"MULTIPLICITY-MAX": "Višestrukost, maksimalno polja", "MULTIPLICITY-MAX": "Višestrukost, maksimalno polja",
"MULTIPLICITY-ADD-ONE-FIELD": "Dodajte jedan ili više skupova polja", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Redosled", "ORDER": "Redosled",
"COMMENT-PLACEHOLDER": "Navedite", "COMMENT-PLACEHOLDER": "Navedite",
"COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor", "COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "Plan upravljanja podacima", "TITLE": "Plan upravljanja podacima",
"PLACEHOLDER": "Odaberite postojeći Plan" "PLACEHOLDER": "Odaberite postojeći Plan"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {

View File

@ -367,7 +367,8 @@
"ADDITIONAL-INFORMATION": "Ek Bilgi", "ADDITIONAL-INFORMATION": "Ek Bilgi",
"MULTIPLICITY-MIN": "En az Çokluk", "MULTIPLICITY-MIN": "En az Çokluk",
"MULTIPLICITY-MAX": "En fazla Çokluk", "MULTIPLICITY-MAX": "En fazla Çokluk",
"MULTIPLICITY-ADD-ONE-FIELD": "Bir alan seti daha ekle", "MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add more",
"ORDER": "Düzen", "ORDER": "Düzen",
"COMMENT-PLACEHOLDER": "Lütfen Belirtiniz", "COMMENT-PLACEHOLDER": "Lütfen Belirtiniz",
"COMMENT-HINT": "Seçiminiz hakkında gerekçe veya ek bilgi veriniz", "COMMENT-HINT": "Seçiminiz hakkında gerekçe veya ek bilgi veriniz",
@ -1269,6 +1270,16 @@
"FIRST-STEP": { "FIRST-STEP": {
"TITLE": "VYP", "TITLE": "VYP",
"PLACEHOLDER": "Mevcut olan bir VYP seçin" "PLACEHOLDER": "Mevcut olan bir VYP seçin"
},
"PREFILL-STEP": {
"TITLE": "Initialize your Dataset",
"PREFILL": "Prefill",
"OR": "OR",
"EMPTY": "Empty",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"NEXT": "Next"
} }
}, },
"INVITATION-EDITOR": { "INVITATION-EDITOR": {