# Conflicts:
#	dmp-frontend/src/app/app.module.ts
#	dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts
This commit is contained in:
Diamantis Tziotzios 2018-11-27 16:04:53 +02:00
commit 68dddddf45
70 changed files with 1294 additions and 616 deletions

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ temp/
*.jar *.jar
*.lst *.lst
dmp-frontend/.vscode/ dmp-frontend/.vscode/
*.docx

View File

@ -40,7 +40,9 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
if (criteria.getProjects() != null && !criteria.getProjects().isEmpty()) if (criteria.getProjects() != null && !criteria.getProjects().isEmpty())
query.where(((builder, root) -> root.get("project").in(criteria.getProjects()))); query.where(((builder, root) -> root.get("project").in(criteria.getProjects())));
if (!criteria.getAllVersions()) if (!criteria.getAllVersions())
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"), query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class))); query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"),
nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty()) if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds())); query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue())); query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));

View File

@ -15,11 +15,13 @@ import java.util.stream.Collectors;
@NamedEntityGraphs({ @NamedEntityGraphs({
@NamedEntityGraph( @NamedEntityGraph(
name = "datasetListingModel", name = "datasetListingModel",
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"), attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"),
@NamedAttributeNode(value = "datasetExternalDatasets", subgraph = "datasetExternalDatasets"), @NamedAttributeNode("registries"),
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")}, @NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
subgraphs = { subgraphs = {
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("project"), @NamedAttributeNode("organisations")}), @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("project"), @NamedAttributeNode("organisations")}),
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")}) @NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")}),
@NamedSubgraph(name = "datasetExternalDatasets", attributeNodes = {@NamedAttributeNode("externalDataset")})
}), }),
@NamedEntityGraph( @NamedEntityGraph(

View File

@ -72,7 +72,6 @@ public class DevelDatabaseConfiguration {
properties.setProperty("hibernate.c3p0.maxPoolSize", "70"); properties.setProperty("hibernate.c3p0.maxPoolSize", "70");
properties.setProperty("hibernate.c3p0.timeout", "5000"); properties.setProperty("hibernate.c3p0.timeout", "5000");
properties.setProperty("hibernate.connection.release_mode", "after_transaction"); properties.setProperty("hibernate.connection.release_mode", "after_transaction");
//properties.setProperty("hibernate.connection.provider_class", "org.hibernate.c3p0.internal.C3P0ConnectionProvider");
return properties; return properties;
} }
} }

View File

@ -44,19 +44,15 @@ public class Admin extends BaseController {
@Transactional @Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp/{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp/{id}"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) { public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Edited Dataset Profile");
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext()); eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
datasetprofile.setDefinition(modelDefinition.getDefinition()); datasetprofile.setDefinition(modelDefinition.getDefinition());
this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile); this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
} }
@RequestMapping(method = RequestMethod.GET, value = {"/admin/get/{id}"}, produces = "application/json") @RequestMapping(method = RequestMethod.GET, value = {"/admin/get/{id}"}, produces = "application/json")
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) { public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Open Dataset Profile");
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile); eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel()); datasetprofile.setLabel(profile.getLabel());
@ -65,7 +61,6 @@ public class Admin extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = {"/admin/preview"}, consumes = "application/json",produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/admin/preview"}, consumes = "application/json",produces = "application/json")
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) { public ResponseEntity<ResponseItem<PagedDatasetProfile>> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Previewed Dataset Profile");
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext()); eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = UserManager.generateDatasetProfileModel(modelDefinition); eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = UserManager.generateDatasetProfileModel(modelDefinition);
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile(); PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();

View File

@ -8,6 +8,7 @@ import eu.eudat.data.entities.DMP;
import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest; import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest;
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest; import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
import eu.eudat.logic.managers.DataManagementPlanManager; import eu.eudat.logic.managers.DataManagementPlanManager;
import eu.eudat.logic.managers.DatasetManager;
import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope; import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
import eu.eudat.models.data.dmp.DataManagementPlan; import eu.eudat.models.data.dmp.DataManagementPlan;
@ -19,6 +20,7 @@ import eu.eudat.models.data.security.Principal;
import eu.eudat.types.ApiMessageCode; import eu.eudat.types.ApiMessageCode;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -28,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import javax.activation.MimetypesFileTypeMap; import javax.activation.MimetypesFileTypeMap;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -37,33 +40,36 @@ import java.util.UUID;
@RestController @RestController
@CrossOrigin @CrossOrigin
@RequestMapping(value = {"/api"}) @RequestMapping(value = {"/api/dmps/"})
public class DMPs extends BaseController { public class DMPs extends BaseController {
private DynamicProjectConfiguration dynamicProjectConfiguration; private DynamicProjectConfiguration dynamicProjectConfiguration;
private Environment environment;
@Autowired @Autowired
public DMPs(ApiContext apiContext, DynamicProjectConfiguration dynamicProjectConfiguration) { public DMPs(ApiContext apiContext, DynamicProjectConfiguration dynamicProjectConfiguration, Environment environment) {
super(apiContext); super(apiContext);
this.dynamicProjectConfiguration = dynamicProjectConfiguration; this.dynamicProjectConfiguration = dynamicProjectConfiguration;
this.environment = environment;
} }
@Transactional @Transactional
@RequestMapping(method = RequestMethod.GET, value = {"/dmps/{id}/unlock"}, produces = "application/json") @RequestMapping(method = RequestMethod.GET, value = {"{id}/unlock"}, produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DMP>> unlock(@PathVariable(value = "id") UUID id, Principal principal) throws Exception { ResponseEntity<ResponseItem<DMP>> unlock(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
new DataManagementPlanManager().unlock(this.getApiContext(), id); new DataManagementPlanManager().unlock(this.getApiContext(), id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Unlocked")); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Unlocked"));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/getPaged"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/getPaged"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal) throws Exception { ResponseEntity<ResponseItem<DataTableData<DataManagementPlanListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal) throws Exception {
DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(this.getApiContext(), dataManagementPlanTableRequest, principal); DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(this.getApiContext(), dataManagementPlanTableRequest, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
} }
@RequestMapping(method = RequestMethod.GET, value = {"/dmps/getSingle/{id}"}, produces = "application/json") @RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DataManagementPlan>> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException { ResponseEntity<ResponseItem<DataManagementPlan>> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = new DataManagementPlanManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, principal, this.dynamicProjectConfiguration); eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = new DataManagementPlanManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, principal, this.dynamicProjectConfiguration);
@ -71,28 +77,28 @@ public class DMPs extends BaseController {
} }
@Transactional @Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/createOrUpdate"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/createOrUpdate"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DMP>> createOrUpdate(@RequestBody eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan, Principal principal) throws Exception { ResponseEntity<ResponseItem<DMP>> createOrUpdate(@RequestBody eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan, Principal principal) throws Exception {
DataManagementPlanManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal); DataManagementPlanManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created")); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/new/{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/new/{id}"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DMP>> newVersion(@PathVariable UUID id, @Valid @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { ResponseEntity<ResponseItem<DMP>> newVersion(@PathVariable UUID id, @Valid @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception {
DataManagementPlanManager.newVersion(this.getApiContext(), id, dataManagementPlan, principal); DataManagementPlanManager.newVersion(this.getApiContext(), id, dataManagementPlan, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.NO_MESSAGE));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/clone/{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/clone/{id}"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DMP>> clone(@PathVariable UUID id, @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { ResponseEntity<ResponseItem<DMP>> clone(@PathVariable UUID id, @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception {
DataManagementPlanManager.clone(this.getApiContext(), id, dataManagementPlan, principal); DataManagementPlanManager.clone(this.getApiContext(), id, dataManagementPlan, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.NO_MESSAGE));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/get"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/get"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<List<DataManagementPlan>>> getWithCriteria(@RequestBody DataManagementPlanCriteriaRequest dataManagementPlanCriteria, Principal principal) throws InstantiationException, IllegalAccessException { ResponseEntity<ResponseItem<List<DataManagementPlan>>> getWithCriteria(@RequestBody DataManagementPlanCriteriaRequest dataManagementPlanCriteria, Principal principal) throws InstantiationException, IllegalAccessException {
List<DataManagementPlan> dataTable = new DataManagementPlanManager().getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), dataManagementPlanCriteria, principal); List<DataManagementPlan> dataTable = new DataManagementPlanManager().getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), dataManagementPlanCriteria, principal);
@ -100,21 +106,21 @@ public class DMPs extends BaseController {
} }
@Transactional @Transactional
@RequestMapping(method = RequestMethod.DELETE, value = {"/dmps/delete/{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DMP>> delete(@PathVariable UUID id, Principal principal) { ResponseEntity<ResponseItem<DMP>> delete(@PathVariable UUID id, Principal principal) {
DataManagementPlanManager.delete(this.getApiContext(), id); DataManagementPlanManager.delete(this.getApiContext(), id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Dataset")); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Dataset"));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/dmps/dynamic"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/dynamic"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<List<Tuple<String, String>>>> getWithCriteria(@RequestBody RequestItem<DynamicFieldsCriteria> criteriaRequestItem, Principal principal) throws InstantiationException, IllegalAccessException { ResponseEntity<ResponseItem<List<Tuple<String, String>>>> getWithCriteria(@RequestBody RequestItem<DynamicFieldsCriteria> criteriaRequestItem, Principal principal) throws InstantiationException, IllegalAccessException {
List<Tuple<String, String>> dataTable = new DataManagementPlanManager().getDynamicFields(criteriaRequestItem.getCriteria().getId(), this.dynamicProjectConfiguration, criteriaRequestItem.getCriteria()); List<Tuple<String, String>> dataTable = new DataManagementPlanManager().getDynamicFields(criteriaRequestItem.getCriteria().getId(), this.dynamicProjectConfiguration, criteriaRequestItem.getCriteria());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tuple<String, String>>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tuple<String, String>>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
} }
@RequestMapping(method = RequestMethod.GET, value = {"/dmps/getXml/{id}"}) @RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"})
public @ResponseBody public @ResponseBody
ResponseEntity<byte[]> getXml(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException { ResponseEntity<byte[]> getXml(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException {
FileEnvelope envelope = new DataManagementPlanManager().getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); FileEnvelope envelope = new DataManagementPlanManager().getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
@ -134,5 +140,45 @@ public class DMPs extends BaseController {
HttpStatus.OK); HttpStatus.OK);
} }
@RequestMapping(method = RequestMethod.GET, value = {"/getWord/{id}"})
public @ResponseBody
ResponseEntity<byte[]> getWordDocument(@PathVariable String id) throws IOException, IllegalAccessException, InstantiationException {
File file = new DataManagementPlanManager().getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
InputStream resource = new FileInputStream(file);
System.out.println("Mime Type of " + file.getName() + " is " +
new MimetypesFileTypeMap().getContentType(file));
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(file.length());
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
responseHeaders.set("Content-Disposition", "attachment;filename=" + file.getName());
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
return new ResponseEntity<>(content,
responseHeaders,
HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.GET, value = {"/getPDF/{id}"})
public @ResponseBody
ResponseEntity<byte[]> getPDFDocument(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException, InterruptedException {
File file = new DataManagementPlanManager().getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
File pdffile = new DatasetManager().convertToPDF(file, environment, file.getName());
InputStream resource = new FileInputStream(pdffile);
System.out.println("Mime Type of " + file.getName() + " is " +
new MimetypesFileTypeMap().getContentType(file));
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(pdffile.length());
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
responseHeaders.set("Content-Disposition", "attachment;filename=" + pdffile.getName());
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
return new ResponseEntity<>(content,
responseHeaders,
HttpStatus.OK);
}
} }

View File

@ -68,7 +68,7 @@ public class DatasetProfileController extends BaseController {
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) { public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) {
eu.eudat.data.entities.DatasetProfile profile = new DatasetProfileManager().clone(this.getApiContext(), id); eu.eudat.data.entities.DatasetProfile profile = new DatasetProfileManager().clone(this.getApiContext(), id);
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile); eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel()); datasetprofile.setLabel(profile.getLabel() + " new ");
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
} }

View File

@ -28,10 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.activation.MimetypesFileTypeMap; import javax.activation.MimetypesFileTypeMap;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.io.File; import java.io.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -82,7 +79,7 @@ public class DatasetWizardController extends BaseController {
@RequestMapping(method = RequestMethod.GET, value = {"/getPDF/{id}"}) @RequestMapping(method = RequestMethod.GET, value = {"/getPDF/{id}"})
public @ResponseBody public @ResponseBody
ResponseEntity<byte[]> getWordDocument(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException, InterruptedException { ResponseEntity<byte[]> getPDFDocument(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException, InterruptedException {
File file = new DatasetManager().getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); File file = new DatasetManager().getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
File pdffile = new DatasetManager().convertToPDF(file, environment, file.getName()); File pdffile = new DatasetManager().convertToPDF(file, environment, file.getName());
InputStream resource = new FileInputStream(pdffile); InputStream resource = new FileInputStream(pdffile);

View File

@ -44,13 +44,7 @@ public final class PrincipalArgumentResolver implements HandlerMethodArgumentRes
if (principal == null) throw new UnauthorisedException("Authentication Information Missing"); if (principal == null) throw new UnauthorisedException("Authentication Information Missing");
if (!claimList.contains(Authorities.ANONYMOUS) && !principal.isAuthorized(claimList)) if (!claimList.contains(Authorities.ANONYMOUS) && !principal.isAuthorized(claimList))
throw new UnauthorisedException("You are not Authorized For this Action"); throw new UnauthorisedException("You are not Authorized For this Action");
/*Principal principal1 = new Principal();
principal1.setId(UUID.fromString("46366b8a-a712-4e0c-a499-1a3a0f209325"));
principal1.setToken(UUID.fromString("19031e80-6534-4aa5-b68a-78e97042c968"));
principal1.setName("Ioannis Kalyvas");
principal1.setAvatarUrl("https://lh5.googleusercontent.com/-X65vX1QO_Ew/AAAAAAAAAAI/AAAAAAAAAAA/AAN31DU5lFIOwD_fZiYW96D410pn6v4E-Q/s96-c/photo.jpg");
principal1.setAuthorities(new HashSet<>(Arrays.asList(Authorities.ADMIN, Authorities.USER)));
principal1.setExpiresAt(addADay(new Date()));*/
return principal; return principal;
} }

View File

@ -17,6 +17,8 @@ import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.forms.VisibilityRuleService; import eu.eudat.logic.services.forms.VisibilityRuleService;
import eu.eudat.logic.utilities.builders.XmlBuilder; import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope; import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
import eu.eudat.logic.utilities.documents.word.WordBuilder;
import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder; import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
import eu.eudat.models.HintedModelFactory; import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
@ -30,16 +32,18 @@ import eu.eudat.models.data.listingmodels.DatasetListingModel;
import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.security.Principal;
import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.core.env.Environment;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import java.io.BufferedWriter; import java.io.*;
import java.io.File; import java.math.BigInteger;
import java.io.FileWriter; import java.net.URL;
import java.io.IOException; import java.nio.file.Paths;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -81,6 +85,51 @@ public class DataManagementPlanManager {
return; return;
} }
public File getWordDocument(Environment environment, DMPDao dmpRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
WordBuilder wordBuilder = new WordBuilder();
DatasetWizardModel dataset = new DatasetWizardModel();
String fileUrl = environment.getProperty("configuration.h2020template");
InputStream is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
XWPFDocument document = new XWPFDocument(is);
eu.eudat.data.entities.DMP dmpEntity = dmpRepository.find(UUID.fromString(id));
wordBuilder.addParagraphContent(dmpEntity.getLabel(), document, ParagraphStyle.TITLE, BigInteger.ZERO);
wordBuilder.addParagraphContent(dmpEntity.getDescription(), document, ParagraphStyle.TEXT, BigInteger.ZERO);
wordBuilder.addParagraphContent("Organisations", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
wordBuilder.addParagraphContent(dmpEntity.getOrganisations().stream().map(x -> x.getLabel()).collect(Collectors.joining(","))
, document, ParagraphStyle.TEXT, BigInteger.ZERO);
wordBuilder.addParagraphContent("Researchers", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
wordBuilder.addParagraphContent(dmpEntity.getResearchers().stream().map(x -> x.getLabel()).collect(Collectors.joining(","))
, document, ParagraphStyle.TEXT, BigInteger.ZERO);
wordBuilder.addParagraphContent("Datasets", document, ParagraphStyle.TITLE, BigInteger.ZERO);
dmpEntity.getDataset().stream().forEach(datasetEntity -> {
Map<String, Object> properties = new HashMap<>();
if (datasetEntity.getProperties() != null) {
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
properties = jobject.toMap();
}
wordBuilder.addParagraphContent("Title: " + datasetEntity.getLabel(), document, ParagraphStyle.HEADER1, BigInteger.ZERO);
wordBuilder.addParagraphContent(datasetEntity.getDescription(), document, ParagraphStyle.TEXT, BigInteger.ZERO);
wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER1, BigInteger.ZERO);
PagedDatasetProfile pagedDatasetProfile = new DatasetManager().getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
try {
wordBuilder.build(document, pagedDatasetProfile, visibilityRuleService);
} catch (IOException e) {
e.printStackTrace();
}
});
File exportFile = new File(dmpEntity.getLabel() + ".docx");
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();
return exportFile;
}
public eu.eudat.models.data.dmp.DataManagementPlan getSingle(DMPDao dmpsRepository, String id, Principal principal, DynamicProjectConfiguration dynamicProjectConfiguration) throws InstantiationException, IllegalAccessException { public eu.eudat.models.data.dmp.DataManagementPlan getSingle(DMPDao dmpsRepository, String id, Principal principal, DynamicProjectConfiguration dynamicProjectConfiguration) throws InstantiationException, IllegalAccessException {
DMP dataManagementPlanEntity = dmpsRepository.find(UUID.fromString(id)); DMP dataManagementPlanEntity = dmpsRepository.find(UUID.fromString(id));
if (dataManagementPlanEntity.getCreator().getId() != principal.getId() && dataManagementPlanEntity.getUsers().stream().filter(userInfo -> userInfo.getId() == principal.getId()).collect(Collectors.toList()).size() == 0) if (dataManagementPlanEntity.getCreator().getId() != principal.getId() && dataManagementPlanEntity.getUsers().stream().filter(userInfo -> userInfo.getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
@ -102,7 +151,7 @@ public class DataManagementPlanManager {
datamanagementPlan.getDynamicFields().forEach(item -> { datamanagementPlan.getDynamicFields().forEach(item -> {
Map<String, String> properties = (Map<String, String>) dmpProperties.get(item.getId()); Map<String, String> properties = (Map<String, String>) dmpProperties.get(item.getId());
if (properties != null) if (properties != null)
item.setValue(new Tuple<String, String>(properties.get("id"), properties.get("label"))); item.setValue(new Tuple<>(properties.get("id"), properties.get("label")));
}); });
return datamanagementPlan; return datamanagementPlan;
} }

View File

@ -24,6 +24,7 @@ import eu.eudat.models.data.security.Principal;
import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
@ -32,10 +33,9 @@ import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.io.File; import java.io.*;
import java.io.FileInputStream; import java.net.URL;
import java.io.FileOutputStream; import java.nio.file.Paths;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -91,7 +91,7 @@ public class DatasetManager {
else else
items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()})); items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()}));
} }
QueryableList<eu.eudat.data.entities.Dataset> pagedItems = PaginationManager.applyPaging(items , datasetTableRequest); QueryableList<eu.eudat.data.entities.Dataset> pagedItems = PaginationManager.applyPaging(items, datasetTableRequest);
DataTableData<DatasetListingModel> dataTable = new DataTableData<>(); DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems. CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems.
@ -134,6 +134,9 @@ public class DatasetManager {
public File getWordDocument(Environment environment, DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException { public File getWordDocument(Environment environment, DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
WordBuilder wordBuilder = new WordBuilder(); WordBuilder wordBuilder = new WordBuilder();
DatasetWizardModel dataset = new DatasetWizardModel(); DatasetWizardModel dataset = new DatasetWizardModel();
String fileUrl = environment.getProperty("configuration.h2020template");
InputStream is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
XWPFDocument document = new XWPFDocument(is);
eu.eudat.data.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class)); eu.eudat.data.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
Map<String, Object> properties = new HashMap<>(); Map<String, Object> properties = new HashMap<>();
if (datasetEntity.getProperties() != null) { if (datasetEntity.getProperties() != null) {
@ -143,8 +146,12 @@ public class DatasetManager {
PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset, datasetEntity); PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties); visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules()); visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
File file = wordBuilder.build(environment, pagedDatasetProfile, datasetEntity.getLabel(), visibilityRuleService); wordBuilder.build(document, pagedDatasetProfile, visibilityRuleService);
return file; File exportFile = new File(datasetEntity.getLabel() + ".docx");
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();
return exportFile;
} }
public FileEnvelope getXmlDocument(DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException { public FileEnvelope getXmlDocument(DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
@ -262,7 +269,6 @@ public class DatasetManager {
} }
} }
private static void createRegistriesIfTheyDontExist(RegistryDao registryDao, eu.eudat.data.entities.Dataset dataset) { private static void createRegistriesIfTheyDontExist(RegistryDao registryDao, eu.eudat.data.entities.Dataset dataset) {
if (dataset.getRegistries() != null && !dataset.getRegistries().isEmpty()) { if (dataset.getRegistries() != null && !dataset.getRegistries().isEmpty()) {
for (eu.eudat.data.entities.Registry registry : dataset.getRegistries()) { for (eu.eudat.data.entities.Registry registry : dataset.getRegistries()) {

View File

@ -0,0 +1,141 @@
package eu.eudat.logic.managers;
import eu.eudat.data.dao.entities.DatasetDao;
import eu.eudat.logic.services.forms.VisibilityRuleService;
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
import eu.eudat.logic.utilities.documents.word.WordBuilder;
import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import org.apache.commons.io.IOUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.json.JSONObject;
import org.springframework.core.env.Environment;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.*;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.URL;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* Created by ikalyvas on 10/16/2018.
*/
public class DocumentManager {
public File getWordDocument(Environment environment, DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
WordBuilder wordBuilder = new WordBuilder();
DatasetWizardModel dataset = new DatasetWizardModel();
String fileUrl = environment.getProperty("configuration.h2020template");
InputStream is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
XWPFDocument document = new XWPFDocument(is);
eu.eudat.data.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
Map<String, Object> properties = new HashMap<>();
if (datasetEntity.getProperties() != null) {
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
properties = jobject.toMap();
}
PagedDatasetProfile pagedDatasetProfile = new DatasetManager().getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
wordBuilder.build(document, pagedDatasetProfile, visibilityRuleService);
File exportFile = new File(dataset.getLabel() + ".docx");
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();
return exportFile;
}
public FileEnvelope getXmlDocument(eu.eudat.data.entities.Dataset datasetEntity, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
ExportXmlBuilder xmlBuilder = new ExportXmlBuilder();
DatasetWizardModel dataset = new DatasetWizardModel();
Map<String, Object> properties = new HashMap<>();
if (datasetEntity.getProperties() != null) {
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
properties = jobject.toMap();
}
PagedDatasetProfile pagedDatasetProfile = new DatasetManager().getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
File file = xmlBuilder.build(pagedDatasetProfile, visibilityRuleService);
FileEnvelope fileEnvelope = new FileEnvelope();
fileEnvelope.setFile(file);
fileEnvelope.setFilename(datasetEntity.getLabel());
return fileEnvelope;
}
public File convertToPDF(File file, Environment environment, String label) throws IOException, InterruptedException {
LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("file", new FileSystemResource(file));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
headers.add("Content-disposition", "attachment; filename=" + label + ".docx");
headers.add("Content-type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
HttpEntity<LinkedMultiValueMap<String, Object>> requestEntity = new HttpEntity<LinkedMultiValueMap<String, Object>>(
map, headers);
Map queueResult = new RestTemplate().postForObject(
environment.getProperty("pdf.converter.url") +
"api/v1/", requestEntity, Map.class);
Map mediaResult = new RestTemplate().getForObject(environment.getProperty("pdf.converter.url") +
"/api/v1/" + queueResult.get("id"), Map.class);
System.out.println("Status: " + mediaResult.get("status"));
while (!mediaResult.get("status").equals("finished")) {
Thread.sleep(500);
mediaResult = new RestTemplate().getForObject(environment.getProperty("pdf.converter.url") +
"api/v1/" + queueResult.get("id"), Map.class);
System.out.println("Polling");
}
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter());
HttpHeaders headers2 = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM));
HttpEntity<String> entity = new HttpEntity<String>(headers2);
ResponseEntity<byte[]> response = restTemplate.exchange(environment.getProperty("pdf.converter.url") +
mediaResult.get("result_url"), HttpMethod.GET, entity, byte[].class, "1");
UUID uuid = UUID.randomUUID();
File zip = new File(uuid + ".zip");
if (response.getStatusCode().equals(HttpStatus.OK)) {
FileOutputStream output = new FileOutputStream(zip);
IOUtils.write(response.getBody(), output);
}
return extractFromZip(zip, label + ".pdf");
}
private File extractFromZip(File file, String filename) throws IOException {
byte[] buffer = new byte[1024];
File newFile = new File(filename);
ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
ZipEntry zipEntry = zis.getNextEntry();
while (zipEntry != null) {
String zippedFileName = zipEntry.getName();
if (zippedFileName.equals("pdf")) {
FileOutputStream fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
zipEntry = zis.getNextEntry();
}
}
zis.closeEntry();
zis.close();
return newFile;
}
}

View File

@ -27,6 +27,7 @@ import eu.eudat.logic.services.helpers.FileStorageService;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -91,7 +92,7 @@ public class ProjectManager {
projects.add(project); projects.add(project);
} }
projects.sort(Comparator.comparing(x-> x.getLabel()));
return projects; return projects;
} }

View File

@ -10,6 +10,7 @@ import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.operations.AuthenticationServiceImpl; import eu.eudat.logic.services.operations.AuthenticationServiceImpl;
import eu.eudat.logic.utilities.builders.XmlBuilder; import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.dmp.DataManagementPlan; import eu.eudat.models.data.dmp.DataManagementPlan;
import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.login.Credentials; import eu.eudat.models.data.login.Credentials;
@ -41,7 +42,7 @@ public class UserManager {
} }
public static DataTableData<UserListingModel> getPaged(ApiContext apiContext, UserInfoTableRequestItem userInfoTableRequestItem) throws Exception { public static DataTableData<UserListingModel> getPaged(ApiContext apiContext, UserInfoTableRequestItem userInfoTableRequestItem) throws Exception {
QueryableList<eu.eudat.data.entities.UserInfo> users = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().getWithCriteria(userInfoTableRequestItem.getCriteria()); QueryableList<eu.eudat.data.entities.UserInfo> users = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().getWithCriteria(userInfoTableRequestItem.getCriteria()).withHint(HintedModelFactory.getHint(UserListingModel.class));
QueryableList<eu.eudat.data.entities.UserInfo> pagedUsers = PaginationManager.applyPaging(users, userInfoTableRequestItem); QueryableList<eu.eudat.data.entities.UserInfo> pagedUsers = PaginationManager.applyPaging(users, userInfoTableRequestItem);
List<UserListingModel> modelUsers = pagedUsers.select(item -> new UserListingModel().fromDataModel(item)); List<UserListingModel> modelUsers = pagedUsers.select(item -> new UserListingModel().fromDataModel(item));

View File

@ -1,9 +1,13 @@
package eu.eudat.logic.utilities.documents.word; package eu.eudat.logic.utilities.documents.word;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.services.forms.VisibilityRuleService; import eu.eudat.logic.services.forms.VisibilityRuleService;
import eu.eudat.logic.utilities.documents.types.ParagraphStyle; import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
import eu.eudat.logic.utilities.documents.types.TextStyle; import eu.eudat.logic.utilities.documents.types.TextStyle;
import eu.eudat.logic.utilities.interfaces.ApplierWithValue; import eu.eudat.logic.utilities.interfaces.ApplierWithValue;
import eu.eudat.models.data.components.commons.datafield.CheckBoxData;
import eu.eudat.models.data.components.commons.datafield.ComboBoxData;
import eu.eudat.models.data.user.components.datasetprofile.Field; import eu.eudat.models.data.user.components.datasetprofile.Field;
import eu.eudat.models.data.user.components.datasetprofile.FieldSet; import eu.eudat.models.data.user.components.datasetprofile.FieldSet;
import eu.eudat.models.data.user.components.datasetprofile.Section; import eu.eudat.models.data.user.components.datasetprofile.Section;
@ -14,16 +18,9 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLvl; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLvl;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat;
import org.springframework.core.env.Environment;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -40,6 +37,7 @@ public class WordBuilder {
public WordBuilder() { public WordBuilder() {
this.cTAbstractNum = CTAbstractNum.Factory.newInstance(); this.cTAbstractNum = CTAbstractNum.Factory.newInstance();
this.cTAbstractNum.setAbstractNumId(BigInteger.valueOf(1)); this.cTAbstractNum.setAbstractNumId(BigInteger.valueOf(1));
this.buildOptions();
} }
private void buildOptions() { private void buildOptions() {
@ -52,6 +50,8 @@ public class WordBuilder {
}); });
this.options.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> { this.options.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph(); XWPFParagraph paragraph = mainDocumentPart.createParagraph();
paragraph.setStyle("Title");
paragraph.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run = paragraph.createRun(); XWPFRun run = paragraph.createRun();
run.setText(item); run.setText(item);
run.setBold(true); run.setBold(true);
@ -60,29 +60,29 @@ public class WordBuilder {
}); });
this.options.put(ParagraphStyle.HEADER1, (mainDocumentPart, item) -> { this.options.put(ParagraphStyle.HEADER1, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph(); XWPFParagraph paragraph = mainDocumentPart.createParagraph();
paragraph.setStyle("Heading1");
XWPFRun run = paragraph.createRun(); XWPFRun run = paragraph.createRun();
run.setText(item); run.setText(item);
run.setBold(true); run.setBold(true);
run.setFontSize(12); run.setFontSize(12);
run.setUnderline(UnderlinePatterns.SINGLE);
return paragraph; return paragraph;
}); });
this.options.put(ParagraphStyle.HEADER2, (mainDocumentPart, item) -> { this.options.put(ParagraphStyle.HEADER2, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph(); XWPFParagraph paragraph = mainDocumentPart.createParagraph();
paragraph.setStyle("Heading2");
XWPFRun run = paragraph.createRun(); XWPFRun run = paragraph.createRun();
run.setText(item); run.setText(item);
run.setBold(true); run.setBold(true);
run.setFontSize(12); run.setFontSize(12);
run.setUnderline(UnderlinePatterns.SINGLE);
return paragraph; return paragraph;
}); });
this.options.put(ParagraphStyle.HEADER3, (mainDocumentPart, item) -> { this.options.put(ParagraphStyle.HEADER3, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph(); XWPFParagraph paragraph = mainDocumentPart.createParagraph();
paragraph.setStyle("Heading3");
XWPFRun run = paragraph.createRun(); XWPFRun run = paragraph.createRun();
run.setText(item); run.setText(item);
run.setBold(true); run.setBold(true);
run.setFontSize(11); run.setFontSize(11);
run.setUnderline(UnderlinePatterns.SINGLE);
return paragraph; return paragraph;
}); });
this.options.put(ParagraphStyle.FOOTER, (mainDocumentPart, item) -> { this.options.put(ParagraphStyle.FOOTER, (mainDocumentPart, item) -> {
@ -91,41 +91,37 @@ public class WordBuilder {
run.setText(item); run.setText(item);
return paragraph; return paragraph;
}); });
this.options.put(ParagraphStyle.COMMENT, (mainDocumentPart, item) -> {
XWPFParagraph paragraph = mainDocumentPart.createParagraph();
XWPFRun run = paragraph.createRun();
run.setText(item);
run.setItalic(true);
return paragraph;
});
} }
public File build(Environment environment, PagedDatasetProfile pagedDatasetProfile, String label, VisibilityRuleService visibilityRuleService) throws IOException { public XWPFDocument build(XWPFDocument document, PagedDatasetProfile pagedDatasetProfile, VisibilityRuleService visibilityRuleService) throws IOException {
String fileUrl = environment.getProperty("configuration.h2020template");
InputStream is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
XWPFDocument document = new XWPFDocument(is);
this.buildOptions();
createPages(pagedDatasetProfile.getPages(), document, true, visibilityRuleService); createPages(pagedDatasetProfile.getPages(), document, true, visibilityRuleService);
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum); XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
XWPFNumbering numbering = document.createNumbering(); XWPFNumbering numbering = document.createNumbering();
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum); BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
this.numId = numbering.addNum(abstractNumID); this.numId = numbering.addNum(abstractNumID);
createPages(pagedDatasetProfile.getPages(), document, false, visibilityRuleService); createPages(pagedDatasetProfile.getPages(), document, false, visibilityRuleService);
File exportFile = new File(label + ".docx"); return document;
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();
return exportFile;
} }
public void createPages(List<DatasetProfilePage> datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) { public void createPages(List<DatasetProfilePage> datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) {
//if (createListing) this.addListing(mainDocumentPart, 0, false, true);
datasetProfilePages.forEach(item -> { datasetProfilePages.forEach(item -> {
createSections(item.getSections(), mainDocumentPart, ParagraphStyle.TITLE, 0, createListing, visibilityRuleService); createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER1, 0, createListing, visibilityRuleService);
}); });
} }
public void createSections(List<Section> sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) { public void createSections(List<Section> sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) {
if (createListing) this.addListing(mainDocumentPart, indent, false, true); if (createListing) this.addListing(mainDocumentPart, indent, false, true);
BigInteger listing = numId;
sections.forEach(section -> { sections.forEach(section -> {
if (visibilityRuleService.isElementVisible(section.getId())) { if (visibilityRuleService.isElementVisible(section.getId())) {
if (!createListing) { if (!createListing) {
XWPFParagraph paragraph = addParagraphContent(section.getTitle(), mainDocumentPart, style, listing); XWPFParagraph paragraph = addParagraphContent(section.getNumbering() + " " + section.getTitle(), mainDocumentPart, style, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent)); number.setVal(BigInteger.valueOf(indent));
} }
@ -139,13 +135,17 @@ public class WordBuilder {
if (createListing) this.addListing(mainDocumentPart, indent, true, true); if (createListing) this.addListing(mainDocumentPart, indent, true, true);
compositeFields.forEach(compositeField -> { compositeFields.forEach(compositeField -> {
if (visibilityRuleService.isElementVisible(compositeField.getId())) { if (visibilityRuleService.isElementVisible(compositeField.getId())) {
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) { if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) {
XWPFParagraph paragraph = addParagraphContent(compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER3, numId); XWPFParagraph paragraph = addParagraphContent(compositeField.getNumbering() + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER3, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent)); number.setVal(BigInteger.valueOf(indent));
} }
createFields(compositeField.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService); createFields(compositeField.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
if (compositeField.getHasCommentField() && compositeField.getCommentFieldValue() != null && !compositeField.getCommentFieldValue().isEmpty() && !createListing) {
XWPFParagraph paragraph = addParagraphContent("Comment: " + compositeField.getCommentFieldValue(), mainDocumentPart, ParagraphStyle.COMMENT, numId);
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
}
} }
}); });
} }
@ -155,18 +155,23 @@ public class WordBuilder {
fields.forEach(field -> { fields.forEach(field -> {
if (visibilityRuleService.isElementVisible(field.getId())) { if (visibilityRuleService.isElementVisible(field.getId())) {
if (!createListing) { if (!createListing) {
XWPFParagraph paragraph = addParagraphContent(field.getValue() == null ? "" : field.getValue(), mainDocumentPart, ParagraphStyle.TEXT, numId); try {
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); XWPFParagraph paragraph = addParagraphContent(this.formatter(field), mainDocumentPart, ParagraphStyle.TEXT, numId);
number.setVal(BigInteger.valueOf(indent)); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
number.setVal(BigInteger.valueOf(indent));
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
}); });
} }
public XWPFParagraph addParagraphContent(String text, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) { public XWPFParagraph addParagraphContent(String text, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text); XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text);
if (numId != null) paragraph.setNumID(numId); if (numId != null) {
paragraph.setNumID(numId);
}
return paragraph; return paragraph;
} }
@ -176,8 +181,6 @@ public class WordBuilder {
} }
public void addListing(XWPFDocument document, int indent, Boolean question, Boolean hasIndication) { public void addListing(XWPFDocument document, int indent, Boolean question, Boolean hasIndication) {
//this.cTAbstractNum.setAbstractNumId(BigInteger.valueOf(indent));
CTLvl cTLvl = this.cTAbstractNum.addNewLvl(); CTLvl cTLvl = this.cTAbstractNum.addNewLvl();
String textLevel = ""; String textLevel = "";
@ -186,28 +189,50 @@ public class WordBuilder {
} }
if (question) { if (question) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL); cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
cTLvl.addNewLvlText().setVal("Q " + textLevel);
cTLvl.addNewStart().setVal(BigInteger.valueOf(1));
cTLvl.setIlvl(BigInteger.valueOf(indent)); cTLvl.setIlvl(BigInteger.valueOf(indent));
} else if (!question && hasIndication) { } else if (!question && hasIndication) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL); cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
cTLvl.addNewLvlText().setVal(textLevel);
cTLvl.addNewStart().setVal(BigInteger.valueOf(1));
cTLvl.setIlvl(BigInteger.valueOf(indent)); cTLvl.setIlvl(BigInteger.valueOf(indent));
} }
if (!question && !hasIndication) { if (!question && !hasIndication) {
cTLvl.addNewNumFmt().setVal(STNumberFormat.NONE); cTLvl.addNewNumFmt().setVal(STNumberFormat.NONE);
cTLvl.addNewLvlText().setVal("");
cTLvl.addNewStart().setVal(BigInteger.valueOf(1));
cTLvl.setIlvl(BigInteger.valueOf(indent)); cTLvl.setIlvl(BigInteger.valueOf(indent));
} }
}
/*if (this.numId == null) { public String formatter(Field field) throws IOException {
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum); switch (field.getViewStyle().getRenderStyle()) {
XWPFNumbering numbering = document.createNumbering(); case "combobox": {
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum); String comboboxType = ((ComboBoxData) field.getData()).getType();
this.numId = numbering.addNum(abstractNumID); if (comboboxType.equals("autocomplete")) {
}*/ ObjectMapper mapper = new ObjectMapper();
if (field.getValue() == null) return null;
Map<String, String> map = mapper.readValue(field.getValue(), new TypeReference<Map<String, String>>() {
});
return map.get("label");
} else if (comboboxType.equals("wordlist")) {
ObjectMapper mapper = new ObjectMapper();
if (field.getValue() == null) return null;
Map<String, String> map = mapper.readValue(field.getValue(), new TypeReference<Map<String, String>>() {
});
return map.get("label");
}
}
case "booleanDecision":
if (field.getValue() != null && field.getValue().equals("true")) return "Yes";
else return "No";
case "radiobox":
return field.getValue();
case "checkBox":
CheckBoxData data = (CheckBoxData) field.getData();
if (field.getValue() == null || field.getValue().equals("false")) return null;
return data.getLabel();
case "freetext":
return field.getValue();
case "textarea":
return field.getValue();
}
return null;
} }
} }

View File

@ -88,7 +88,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
@Override @Override
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet item) { public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
if (this.id == null || this.id.isEmpty()) this.id = "fieldSet_" + RandomStringUtils.random(5, true, true); if (this.id == null || this.id.isEmpty()) this.id = "fieldSet_" + RandomStringUtils.random(5, true, true);
List<eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field.class); List<eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field.class);
item.setFields(viewStylefields); item.setFields(viewStylefields);
item.setId(this.id); item.setId(this.id);

View File

@ -18,6 +18,7 @@ import java.util.List;
public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field> { public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field> {
private String id; private String id;
private int ordinal; private int ordinal;
private String numbering;
private ViewStyle viewStyle; private ViewStyle viewStyle;
private DefaultValue defaultValue; private DefaultValue defaultValue;
private Visibility visible; private Visibility visible;
@ -80,6 +81,14 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
this.validations = validations; this.validations = validations;
} }
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element rootElement = doc.createElement("field"); Element rootElement = doc.createElement("field");
@ -103,6 +112,10 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
validations.appendChild(validation); validations.appendChild(validation);
} }
Element numbering = doc.createElement("numbering");
numbering.setTextContent(this.numbering);
rootElement.appendChild(numbering);
rootElement.appendChild(validations); rootElement.appendChild(validations);
rootElement.appendChild(defaultValue); rootElement.appendChild(defaultValue);
rootElement.appendChild(visibility); rootElement.appendChild(visibility);
@ -116,6 +129,7 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
this.id = element.getAttribute("id"); this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal")); this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
this.viewStyle = new ViewStyle(); this.viewStyle = new ViewStyle();
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle"); Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
@ -126,6 +140,9 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
this.visible = new Visibility().fromXml(visibility); this.visible = new Visibility().fromXml(visibility);
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
if (numbering != null) this.numbering = numbering.getTextContent();
Element dataElement = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data"); Element dataElement = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue"); Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");

View File

@ -15,6 +15,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
private String id; private String id;
private int ordinal; private int ordinal;
private List<Field> fields; private List<Field> fields;
private String numbering;
private String title; private String title;
private String description; private String description;
private String extendedDescription; private String extendedDescription;
@ -94,6 +95,14 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
this.commentFieldValue = commentFieldValue; this.commentFieldValue = commentFieldValue;
} }
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element fieldSet = doc.createElement("fieldSet"); Element fieldSet = doc.createElement("fieldSet");
@ -116,11 +125,16 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
commentField.setAttribute("hasCommentField", "" + this.hasCommentField); commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
commentField.setAttribute("commentFieldValue", this.commentFieldValue); commentField.setAttribute("commentFieldValue", this.commentFieldValue);
Element numbering = doc.createElement("numbering");
numbering.setTextContent(this.numbering);
Element fieldsElement = doc.createElement("fields"); Element fieldsElement = doc.createElement("fields");
for (Field field : fields) { for (Field field : fields) {
field.setNumbering(this.numbering + "." + (this.fields.indexOf(field) + 1));
fieldsElement.appendChild(field.toXml(doc)); fieldsElement.appendChild(field.toXml(doc));
} }
fieldSet.appendChild(numbering);
fieldSet.appendChild(commentField); fieldSet.appendChild(commentField);
fieldSet.appendChild(fieldsElement); fieldSet.appendChild(fieldsElement);
fieldSet.appendChild(multiplicity); fieldSet.appendChild(multiplicity);
@ -146,6 +160,9 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
this.commentFieldValue = commentField.getAttribute("commentFieldValue"); this.commentFieldValue = commentField.getAttribute("commentFieldValue");
Element fields = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields"); Element fields = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
if (numbering != null) this.numbering = numbering.getTextContent();
if (fields != null) { if (fields != null) {
NodeList fieldElements = fields.getChildNodes(); NodeList fieldElements = fields.getChildNodes();
for (int temp = 0; temp < fieldElements.getLength(); temp++) { for (int temp = 0; temp < fieldElements.getLength(); temp++) {

View File

@ -1,7 +1,7 @@
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition; package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
import eu.eudat.logic.utilities.builders.XmlBuilder; import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -14,6 +14,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
private String id; private String id;
private int ordinal; private int ordinal;
private boolean defaultVisibility; private boolean defaultVisibility;
private String numbering;
private String page; private String page;
private String title; private String title;
private String description; private String description;
@ -93,6 +94,14 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
this.extendedDescription = extendedDescription; this.extendedDescription = extendedDescription;
} }
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element rootElement = doc.createElement("section"); Element rootElement = doc.createElement("section");
@ -107,12 +116,16 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
Element extendedDescription = doc.createElement("extendedDescription"); Element extendedDescription = doc.createElement("extendedDescription");
extendedDescription.setTextContent(this.extendedDescription); extendedDescription.setTextContent(this.extendedDescription);
Element numbering = doc.createElement("numbering");
numbering.setTextContent(this.numbering);
Element title = doc.createElement("title"); Element title = doc.createElement("title");
title.setTextContent(this.title); title.setTextContent(this.title);
if (sections != null) { if (sections != null) {
Element sections = doc.createElement("sections"); Element sections = doc.createElement("sections");
for (Section section : this.sections) { for (Section section : this.sections) {
section.setNumbering(this.numbering + "." + (this.sections.indexOf(section) + 1));
sections.appendChild(section.toXml(doc)); sections.appendChild(section.toXml(doc));
} }
rootElement.appendChild(sections); rootElement.appendChild(sections);
@ -121,11 +134,13 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
if (this.fieldSets != null) { if (this.fieldSets != null) {
Element formGroups = doc.createElement("fieldSets"); Element formGroups = doc.createElement("fieldSets");
for (FieldSet fieldSet : this.fieldSets) { for (FieldSet fieldSet : this.fieldSets) {
fieldSet.setNumbering(this.numbering + "." + (this.fieldSets.indexOf(fieldSet) + 1));
formGroups.appendChild(fieldSet.toXml(doc)); formGroups.appendChild(fieldSet.toXml(doc));
} }
rootElement.appendChild(formGroups); rootElement.appendChild(formGroups);
} }
rootElement.appendChild(numbering);
rootElement.appendChild(title); rootElement.appendChild(title);
rootElement.appendChild(extendedDescription); rootElement.appendChild(extendedDescription);
rootElement.appendChild(description); rootElement.appendChild(description);
@ -147,6 +162,9 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription"); Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
if (extendedDescription != null) this.extendedDescription = extendedDescription.getTextContent(); if (extendedDescription != null) this.extendedDescription = extendedDescription.getTextContent();
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
if (numbering != null) this.numbering = numbering.getTextContent();
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title"); Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
if (title != null) this.title = title.getTextContent(); if (title != null) this.title = title.getTextContent();

View File

@ -1,7 +1,7 @@
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition; package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
import eu.eudat.logic.utilities.builders.XmlBuilder; import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -36,6 +36,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
Element sections = doc.createElement("sections"); Element sections = doc.createElement("sections");
Element pages = doc.createElement("pages"); Element pages = doc.createElement("pages");
for (Section section : this.sections) { for (Section section : this.sections) {
section.setNumbering("" + (this.sections.indexOf(section) + 1));
sections.appendChild(section.toXml(doc)); sections.appendChild(section.toXml(doc));
} }

View File

@ -20,6 +20,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
private String value; private String value;
private ViewStyle viewStyle; private ViewStyle viewStyle;
private String datatype; private String datatype;
private String numbering;
private int page; private int page;
private DefaultValue defaultValue; private DefaultValue defaultValue;
private Multiplicity multiplicity; private Multiplicity multiplicity;
@ -128,6 +129,13 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
this.validations = eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType.fromIntegers(validations); this.validations = eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType.fromIntegers(validations);
} }
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
public Field cloneForMultiplicity(String key, Map<String, Object> properties) { public Field cloneForMultiplicity(String key, Map<String, Object> properties) {
Field newField = new Field(); Field newField = new Field();
@ -160,6 +168,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
this.id = item.getId(); this.id = item.getId();
this.ordinal = item.getOrdinal(); this.ordinal = item.getOrdinal();
this.viewStyle = item.getViewStyle(); this.viewStyle = item.getViewStyle();
this.numbering = item.getNumbering();
this.data = item.getData(); this.data = item.getData();
this.defaultValue = item.getDefaultValue(); this.defaultValue = item.getDefaultValue();
this.visible = item.getVisible(); this.visible = item.getVisible();

View File

@ -13,6 +13,7 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
private String id; private String id;
private Integer ordinal; private Integer ordinal;
private String title; private String title;
private String numbering;
private String description; private String description;
private String extendedDescription; private String extendedDescription;
private Multiplicity multiplicity; private Multiplicity multiplicity;
@ -83,6 +84,14 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
return multiplicityItems; return multiplicityItems;
} }
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
public void setMultiplicityItems(List<FieldSet> multiplicityItems) { public void setMultiplicityItems(List<FieldSet> multiplicityItems) {
this.multiplicityItems = multiplicityItems; this.multiplicityItems = multiplicityItems;
} }
@ -126,6 +135,7 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
this.ordinal = item.getOrdinal(); this.ordinal = item.getOrdinal();
this.title = item.getTitle(); this.title = item.getTitle();
this.description = item.getDescription(); this.description = item.getDescription();
this.numbering = item.getNumbering();
this.extendedDescription = item.getExtendedDescription(); this.extendedDescription = item.getExtendedDescription();
this.hasCommentField = item.getHasCommentField(); this.hasCommentField = item.getHasCommentField();
this.multiplicity = item.getMultiplicity(); this.multiplicity = item.getMultiplicity();

View File

@ -13,6 +13,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
private List<Section> sections; private List<Section> sections;
private List<FieldSet> compositeFields; private List<FieldSet> compositeFields;
private Boolean defaultVisibility; private Boolean defaultVisibility;
private String numbering;
private String page; private String page;
private Integer ordinal; private Integer ordinal;
private String id; private String id;
@ -85,6 +86,14 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
this.ordinal = ordinal; this.ordinal = ordinal;
} }
public String getNumbering() {
return numbering;
}
public void setNumbering(String numbering) {
this.numbering = numbering;
}
@Override @Override
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) { public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) {
item.setDefaultVisibility(this.defaultVisibility); item.setDefaultVisibility(this.defaultVisibility);
@ -107,6 +116,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class); this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class);
this.id = item.getId(); this.id = item.getId();
this.ordinal = item.getOrdinal(); this.ordinal = item.getOrdinal();
this.numbering = item.getNumbering();
this.page = item.getPage(); this.page = item.getPage();
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class); this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
this.title = item.getTitle(); this.title = item.getTitle();

View File

@ -122,6 +122,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
@Override @Override
public String getHint() { public String getHint() {
return null; return "userInfo";
} }
} }

View File

@ -26,7 +26,7 @@ public abstract class FluentValidator<T> implements Validator {
@Override @Override
public void validate(Object target, Errors errors) { public void validate(Object target, Errors errors) {
List<FluentValidatorResult> validatorResults = new LinkedList<>(); List<FluentValidatorResult> validatorResults = new LinkedList<>();
this.fluentValidatorBuilders.forEach(x-> validatorResults.addAll(x.validate(target))); //this.fluentValidatorBuilders.forEach(x-> validatorResults.addAll(x.validate(target)));
validatorResults.forEach(x-> errors.rejectValue(x.getField(),x.getError())); //validatorResults.forEach(x-> errors.rejectValue(x.getField(),x.getError()));
} }
} }

View File

@ -79,7 +79,10 @@ const appRoutes: Routes = [
}, },
{ {
path: 'users', path: 'users',
loadChildren: './users/users.module#UsersModule' loadChildren: './users/users.module#UsersModule',
data: {
breadcrumb: true
},
}, },
{ {
path: 'welcome', path: 'welcome',

View File

@ -1,60 +1,72 @@
<div class="container" [formGroup]='form'> <div class="container" *ngIf="form" [formGroup]='form'>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput formControlName="label" placeholder="{{'FORM.LABEL' | translate}}" required> <input matInput formControlName="label" placeholder="{{'DYNAMIC-FORM.FIELDS.LABEL' | translate}}" required>
<mat-error *ngIf="form.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-horizontal-stepper [linear]="true" #stepper> <mat-horizontal-stepper [linear]="true" #stepper>
<mat-step> <mat-step>
<div class="panel-group"> <ng-template matStepLabel>{{'DATASET-PROFILE.PAGES-DESCRIPTION' | translate}}</ng-template>
<mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;" #panel> <div>
<mat-expansion-panel-header> <div class="panel-group">
<mat-panel-title *ngIf="form.get('pages').at(i).get('title').value && !panel.expanded">{{i + <mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;" #panel>
1}}.{{form.get('pages').at(i).get('title').value}}</mat-panel-title> <mat-expansion-panel-header>
<div class="btn-group pull-right"> <mat-panel-title *ngIf="form.get('pages').at(i).get('title').value && !panel.expanded">{{i +
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);"> 1}}.{{form.get('pages').at(i).get('title').value}}</mat-panel-title>
<span class="glyphicon glyphicon-erase"></span> <div class="btn-group pull-right">
</button> <button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{'p' + i}}" *ngIf="panel.expanded">
<div>
<app-page-form [form]="form.get('pages').at(i)" [dataModel]="page"></app-page-form>
</div>
</div> </div>
</mat-expansion-panel-header> </mat-expansion-panel>
<div id="{{'p' + i}}" *ngIf="panel.expanded"> </div>
<div> <div style="margin-top:20px; padding-left: 15px;" class="row">
<app-page-form [form]="form.get('pages').at(i)" [dataModel]="page"></app-page-form> <button mat-button (click)="addPage()" style="cursor: pointer">
</div> {{'DYNAMIC-FORM.ACTIONS.ADD-PAGE' | translate}}
</div> </button>
</mat-expansion-panel> </div>
</div>
<div style="margin-top:20px; padding-left: 15px;" class="row">
<button mat-button (click)="addPage()" style="cursor: pointer">
Add Page +
</button>
</div> </div>
</mat-step> </mat-step>
<mat-step> <mat-step>
<ng-template matStepLabel>{{'DATASET-PROFILE.FORM-DESCRIPTION' | translate}}</ng-template>
<div> <div>
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel> <div>
<mat-expansion-panel-header> <mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel>
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value && !panel.expanded">{{i + 1}}. <mat-expansion-panel-header>
{{form.get('sections').get(''+i).get('title').value}}</mat-panel-title> <mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value && !panel.expanded">{{i + 1}}.
<div class="btn-group pull-right"> {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);"> <div class="btn-group pull-right">
<span class="glyphicon glyphicon-erase"></span> <button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
</button> <span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{'s' + i}}" *ngIf="panel.expanded">
<div>
<app-section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></app-section-form>
</div>
</div> </div>
</mat-expansion-panel-header> </mat-expansion-panel>
<div id="{{'s' + i}}" *ngIf="panel.expanded"> </div>
<div> <div style="margin-top:20px; padding-left: 15px;" class="row">
<app-section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></app-section-form> <button mat-button (click)="addSection()" style="cursor: pointer">
</div> {{'DYNAMIC-FORM.ACTIONS.ADD-SECTION' | translate}}
</div> </button>
</mat-expansion-panel> </div>
</div> </div>
<div style="margin-top:20px; padding-left: 15px;" class="row"> </mat-step>
<button mat-button (click)="addSection()" style="cursor: pointer"> <mat-step>
Add Section + <ng-template matStepLabel>{{'DATASET-PROFILE.PREVIEW' | translate}}</ng-template>
</button> <div *ngIf='this.isStepActive(2)'>
<app-dynamic-form *ngIf="dataWizardModel && previewerFormGroup" [form]="this.previewerFormGroup" [dataModel]="dataWizardModel"></app-dynamic-form>
</div> </div>
</mat-step> </mat-step>
</mat-horizontal-stepper> </mat-horizontal-stepper>
<button mat-button (click)="preview()">Preview</button> <button mat-raised-button color="primary" type="button" (click)='onSubmit()' [disabled]="!form.valid">Save</button>
<button mat-raised-button color="primary" type="button" (click)='onSubmit()' [disabled]="form.valid">Save</button>
</div> </div>

View File

@ -2,14 +2,17 @@
import { DatasetProfileService } from '../../services/dataset-profile.service'; import { DatasetProfileService } from '../../services/dataset-profile.service';
import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin'; import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin';
import { Page } from '../../models/datasetProfileAdmin/Page'; import { Page } from '../../models/datasetProfileAdmin/Page';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms'; import { FormGroup, FormControl } from '@angular/forms';
import { FormArray } from '@angular/forms'; import { FormArray } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service'; import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { Section } from '../../models/datasetProfileAdmin/Section'; import { Section } from '../../models/datasetProfileAdmin/Section';
import { MatDialog } from '@angular/material'; import { MatDialog, MatHorizontalStepper, MatStepper } from '@angular/material';
import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-previewer.component'; import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-previewer.component';
import { Observable } from 'rxjs';
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
@Component({ @Component({
selector: 'app-form-component', selector: 'app-form-component',
@ -18,16 +21,20 @@ import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-p
styleUrls: ['./form.component.scss'] styleUrls: ['./form.component.scss']
}) })
export class FormComponent implements OnInit { export class FormComponent implements OnInit, AfterViewInit {
dataModel: DatasetProfileModelAdmin; dataModel: DatasetProfileModelAdmin;
form: FormGroup; form: FormGroup;
previewerFormGroup: FormGroup;
private profileID: string; private profileID: string;
private cloneId: string; private cloneId: string;
dataWizardModel: DatasetWizardModel;
@ViewChild('stepper') stepper: MatHorizontalStepper;
constructor( constructor(
public datasetprofileAdmin: DatasetProfileAdmin, public datasetprofileAdmin: DatasetProfileAdmin,
private datasetProfileService: DatasetProfileService, private datasetProfileService: DatasetProfileService,
private datasetProfileAdminService: DatasetProfileAdmin,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
public dialog: MatDialog, public dialog: MatDialog,
@ -36,19 +43,40 @@ export class FormComponent implements OnInit {
this.cloneId = route.snapshot.params['cloneid']; this.cloneId = route.snapshot.params['cloneid'];
} }
ngAfterViewInit(): void {
console.log(this.stepper);
}
ngOnInit() { ngOnInit() {
this.dataModel = JsonSerializer.fromJSONObject(new DatasetProfileModelAdmin(), DatasetProfileModelAdmin); this.dataModel = JsonSerializer.fromJSONObject(new DatasetProfileModelAdmin(), DatasetProfileModelAdmin);
this.form = this.dataModel.buildForm();
if (this.profileID) { if (this.profileID) {
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => { this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin); this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
this.form = this.dataModel.buildForm(); this.form = this.dataModel.buildForm();
this.form.valueChanges.subscribe(change => {
this.datasetProfileAdminService.preview(this.dataModel).subscribe(dataset => {
const datasetModel = new DatasetWizardModel();
datasetModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(dataset, DatasetProfileDefinitionModel);
this.dataWizardModel = datasetModel;
this.previewerFormGroup = <FormGroup>this.dataWizardModel.buildForm().get('datasetProfileDefinition');
});
});
this.form.updateValueAndValidity();
}); });
} else if (this.cloneId) { } else if (this.cloneId) {
this.datasetprofileAdmin.clone(this.cloneId).subscribe((data) => { this.datasetprofileAdmin.clone(this.cloneId).subscribe((data) => {
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin); this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
this.form = this.dataModel.buildForm(); this.form = this.dataModel.buildForm();
this.form.valueChanges.subscribe(change => {
this.datasetProfileAdminService.preview(this.dataModel).subscribe(dataset => {
const datasetModel = new DatasetWizardModel();
datasetModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(dataset, DatasetProfileDefinitionModel);
this.dataWizardModel = datasetModel;
this.previewerFormGroup = <FormGroup>this.dataWizardModel.buildForm().get('datasetProfileDefinition');
});
});
this.form.updateValueAndValidity();
}); });
} else { } else {
this.addSection(); this.addSection();
@ -97,23 +125,16 @@ export class FormComponent implements OnInit {
if (this.profileID) { if (this.profileID) {
this.updateForm(this.profileID, data).subscribe(() => { this.updateForm(this.profileID, data).subscribe(() => {
this.router.navigate(['/datasetsProfiles']); this.router.navigate(['/dataset-profile']);
}); });
} else { } else {
this.createForm(data).subscribe(() => { this.createForm(data).subscribe(() => {
this.router.navigate(['/datasetsProfiles']); this.router.navigate(['/dataset-profile']);
}); });
} }
} }
preview() { isStepActive(step: number) {
const dialogRef = this.dialog.open(DatasetProfilePreviewerComponent, { return this.stepper && this.stepper.selectedIndex === step;
height: '355px',
width: '700px',
data: {
model: this.dataModel
}
});
} }
} }

View File

@ -12,6 +12,7 @@ import { DataSource } from '@angular/cdk/table';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DataTableRequest } from '../../models/data-table/DataTableRequest'; import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel'; import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
@Component({ @Component({
@ -21,7 +22,6 @@ import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchC
}) })
export class DatasetPublicListingComponent implements OnInit { export class DatasetPublicListingComponent implements OnInit {
@ViewChild(MatPaginator) _paginator: MatPaginator; @ViewChild(MatPaginator) _paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
criteria: FacetSearchCriteriaModel; criteria: FacetSearchCriteriaModel;
@ -44,6 +44,7 @@ export class DatasetPublicListingComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.route.params.subscribe(async (params: Params) => { this.route.params.subscribe(async (params: Params) => {
this.dmpId = params['dmpId']; this.dmpId = params['dmpId'];
this.refresh(); this.refresh();

View File

@ -15,228 +15,243 @@
</button> </button>
</div> </div>
<div *ngIf="this.datasetProfileDefinitionModel || this.datasetWizardModel?.datasetProfileDefinition"> <div *ngIf="this.datasetProfileDefinitionModel || this.datasetWizardModel?.datasetProfileDefinition">
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" <button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly"
(click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button> style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="save();" type="button">{{
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
(click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-FINALISE' | translate }}</button> <button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly"
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="saveFinalize();" type="button">{{
'DATASET-WIZARD.ACTIONS.SAVE-AND-FINALISE' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" <button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="downloadPDF();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-PDF' | translate }}</button> (click)="downloadPDF();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-PDF' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" <button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="downloadXML();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button> (click)="downloadXML();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
<div class="fill-space"></div> <div class="fill-space"></div>
<!-- <button mat-button (click)="redirectToProject()">
<mat-icon>arrow_right_alt</mat-icon>{{'DATASET-WIZARD.ACTIONS.GO-TO-PROJECT' | translate}}</button>
<button mat-button (click)="redirectToDmp()">
<mat-icon>arrow_right_alt</mat-icon>{{'DATASET-WIZARD.ACTIONS.GO-TO-DMP' | translate}}</button> -->
</div> </div>
<mat-horizontal-stepper [linear]="isLinear" #stepper> <mat-horizontal-stepper [linear]="isLinear" #stepper>
<mat-step [stepControl]="formGroup"> <mat-step [stepControl]="formGroup">
<form *ngIf="formGroup" [formGroup]="formGroup"> <div *ngIf="this.isActiveStep(0)">
<app-single-auto-complete [required]="true" [reactiveFormControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}" <form *ngIf="formGroup" [formGroup]="formGroup">
[configuration]="dmpAutoCompleteConfiguration"> <app-single-auto-complete [required]="true" [reactiveFormControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}"
</app-single-auto-complete> [configuration]="dmpAutoCompleteConfiguration">
<ng-template matStepLabel>{{'DATASET-WIZARD.FIRST-STEP.TITLE' | translate}}</ng-template> </app-single-auto-complete>
<mat-form-field formGroupName="profile"> <ng-template matStepLabel>{{'DATASET-WIZARD.FIRST-STEP.TITLE' | translate}}</ng-template>
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" formControlName="id"> <mat-form-field formGroupName="profile">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile.id"> <mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" formControlName="id">
{{profile.label}} <mat-option *ngFor="let profile of availableProfiles" [value]="profile.id">
</mat-option> {{profile.label}}
</mat-select> </mat-option>
<mat-error *ngIf="baseErrorModel?.status">{{baseErrorModel['Criteria.status']}}</mat-error> </mat-select>
</mat-form-field> <mat-error *ngIf="baseErrorModel?.status">{{baseErrorModel['Criteria.status']}}</mat-error>
<app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component> </mat-form-field>
<div class="navigation-buttons-container"> <app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component>
<button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' | <div class="navigation-buttons-container">
translate}} <button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' |
</button> translate}}
</div> </button>
</form> </div>
</form>
</div>
</mat-step> </mat-step>
<mat-step [stepControl]="formGroup"> <mat-step [stepControl]="formGroup">
<form *ngIf="formGroup" [formGroup]="formGroup"> <div *ngIf="this.isActiveStep(1)">
<ng-template matStepLabel>{{'DATASET-WIZARD.SECOND-STEP.TITLE' | translate}}</ng-template> <form *ngIf="formGroup" [formGroup]="formGroup">
<ng-template matStepLabel>{{'DATASET-WIZARD.SECOND-STEP.TITLE' | translate}}</ng-template>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick" *ngIf='!viewOnly'> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}} {{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}
<button mat-raised-button color="primary" (click)="addDataRepository()"> <button mat-raised-button color="primary" (click)="addDataRepository()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
</button> </button>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('dataRepositories') && dataRepositoriesTemplate && externalSourcesConfiguration" <app-external-item-listing *ngIf="formGroup.get('dataRepositories') && dataRepositoriesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}" [options]="externalSourcesConfiguration.dataRepositories" placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}"
[parentTemplate]='dataRepositoriesTemplate' [displayFunction]='dataRepositoryDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [parentTemplate]='dataRepositoriesTemplate' [displayFunction]='dataRepositoryDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[formGroup]="formGroup.get('dataRepositories')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration" [formGroup]="formGroup.get('dataRepositories')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration"
(onItemChange)="dataRepositoriesOnItemChange($event)"> (onItemChange)="dataRepositoriesOnItemChange($event)">
</app-external-item-listing> </app-external-item-listing>
<ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function">
<div class="col-md-2"> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<mat-form-field> <mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info"
[formControl]="suggestion.get('info')"> [formControl]="suggestion.get('info')">
</mat-form-field> </mat-form-field>
</div> </div>
<div class="col-md-2" *ngIf='!viewOnly'> <div class="col-md-2" *ngIf='!viewOnly'>
<button mat-button (click)="callback(i)"> <button mat-button (click)="callback(i)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
</ng-template> </ng-template>
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick" *ngIf='!viewOnly'> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}} {{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}
<button mat-raised-button color="primary" (click)="addExternalDataset()"> <button mat-raised-button color="primary" (click)="addExternalDataset()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
</button> </button>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('externalDatasets') && externalDatasetsTemplate && externalSourcesConfiguration" <app-external-item-listing *ngIf="formGroup.get('externalDatasets') && externalDatasetsTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.externalDatasets" placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}" [options]="externalSourcesConfiguration.externalDatasets" placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}"
[parentTemplate]='externalDatasetsTemplate' [displayFunction]='externalDatasetDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [parentTemplate]='externalDatasetsTemplate' [displayFunction]='externalDatasetDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[formGroup]="formGroup.get('externalDatasets')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration" [formGroup]="formGroup.get('externalDatasets')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration"
(onItemChange)="externalDatasetsOnItemChange($event)"> (onItemChange)="externalDatasetsOnItemChange($event)">
</app-external-item-listing> </app-external-item-listing>
<ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function">
<div class="col-md-2"> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<mat-form-field> <mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info"
[formControl]="suggestion.get('info')"> [formControl]="suggestion.get('info')">
</mat-form-field> </mat-form-field>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<mat-form-field> <mat-form-field>
<mat-select placeholder="{{'DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-DATASET-TYPE' | translate}}" [formControl]="suggestion.get('type')"> <mat-select placeholder="{{'DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-DATASET-TYPE' | translate}}" [formControl]="suggestion.get('type')">
<mat-option [value]="0">{{'TYPES.EXTERNAL-DATASET-TYPE.SOURCE' | translate}}</mat-option> <mat-option [value]="0">{{'TYPES.EXTERNAL-DATASET-TYPE.SOURCE' | translate}}</mat-option>
<mat-option [value]="1">{{'TYPES.EXTERNAL-DATASET-TYPE.OUTPUT' | translate}}</mat-option> <mat-option [value]="1">{{'TYPES.EXTERNAL-DATASET-TYPE.OUTPUT' | translate}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'> <button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
</ng-template> </ng-template>
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick" *ngIf='!viewOnly'> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}} {{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}
<button mat-raised-button color="primary" (click)="addRegistry()"> <button mat-raised-button color="primary" (click)="addRegistry()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
</button> </button>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration" <app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.registries" placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [options]="externalSourcesConfiguration.registries" placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}"
[parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc' [formGroup]="formGroup.get('registries')" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc' [formGroup]="formGroup.get('registries')"
[viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="registriesAutoCompleteConfiguration" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="registriesAutoCompleteConfiguration"
(onItemChange)="registriesOnItemChange($event)"> (onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing> </app-external-item-listing>
<ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function">
<div class="col-md-2"> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div class="col-md-10"> <div class="col-md-10">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'> <button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
</ng-template> </ng-template>
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick" *ngIf='!viewOnly'> <mat-card-title class="thick" *ngIf='!viewOnly'>
{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}} {{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}
<button mat-raised-button color="primary" (click)="addService()"> <button mat-raised-button color="primary" (click)="addService()">
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}} {{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
</button> </button>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration" <app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.services" placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}" [options]="externalSourcesConfiguration.services" placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}"
[parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc' [formGroup]="formGroup.get('services')" [parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc' [formGroup]="formGroup.get('services')"
[viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration"
(onItemChange)="servicesOnItemChange($event)"> (onItemChange)="servicesOnItemChange($event)">
</app-external-item-listing> </app-external-item-listing>
<ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #servicesTemplate let-suggestion let-i="index" let-callback="function">
<div class="col-md-2"> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('label').value}} {{i+1}}) {{suggestion.get('label').value}}
</p> </p>
</div> </div>
<div class="col-md-10"> <div class="col-md-10">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'> <button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
</ng-template> </ng-template>
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title class="thick"> <mat-card-title class="thick">
{{'DATASET-EDITOR.FIELDS.TAGS' | translate}} {{'DATASET-EDITOR.FIELDS.TAGS' | translate}}
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('tags') && tagsTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.tags" <app-external-item-listing *ngIf="formGroup.get('tags') && tagsTemplate && externalSourcesConfiguration"
placeholder="{{'DATASET-EDITOR.FIELDS.TAGS' | translate}}" [parentTemplate]='tagsTemplate' [displayFunction]='tagsDisplayFunc' [options]="externalSourcesConfiguration.tags" placeholder="{{'DATASET-EDITOR.FIELDS.TAGS' | translate}}"
[formGroup]="formGroup.get('tags')" [viewOnly]='viewOnly' [subtitleFunction]='tagsDisplaySubtitleFunc' [parentTemplate]='tagsTemplate' [displayFunction]='tagsDisplayFunc' [formGroup]="formGroup.get('tags')"
[autoCompleteConfiguration]="tagsAutoCompleteConfiguration" (onItemChange)="tagsOnItemChange($event)"> [viewOnly]='viewOnly' [subtitleFunction]='tagsDisplaySubtitleFunc' [autoCompleteConfiguration]="tagsAutoCompleteConfiguration"
</app-external-item-listing> (onItemChange)="tagsOnItemChange($event)">
</app-external-item-listing>
<ng-template #tagsTemplate let-suggestion let-i="index" let-callback="function"> <ng-template #tagsTemplate let-suggestion let-i="index" let-callback="function">
<div class="col-md-2"> <div class="col-md-2">
<p> <p>
{{i+1}}) {{suggestion.get('name').value}} {{i+1}}) {{suggestion.get('name').value}}
</p> </p>
</div> </div>
<div class="col-md-10"> <div class="col-md-10">
<button mat-button (click)="callback(i)" *ngIf='!viewOnly'> <button mat-button (click)="callback(i)" *ngIf='!viewOnly'>
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</div> </div>
</ng-template> </ng-template>
</mat-card> </mat-card>
<div class="navigation-buttons-container"> <div class="navigation-buttons-container">
<button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button> <button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
<button matStepperNext mat-raised-button color="primary" style="float:right;" (click)="getDefinition()">{{'DATASET-WIZARD.ACTIONS.NEXT' <button matStepperNext mat-raised-button color="primary" style="float:right;" (click)="getDefinition()">{{'DATASET-WIZARD.ACTIONS.NEXT'
| translate}}</button> | translate}}</button>
</div> </div>
</form> </form>
</div>
</mat-step> </mat-step>
<mat-step> <mat-step>
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template> <div *ngIf="this.isActiveStep(2)">
<app-dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" <ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
[form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel"></app-dynamic-form> <app-dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition"
<div class="navigation-buttons-container"> [form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel"></app-dynamic-form>
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' <div class="navigation-buttons-container">
| translate}}</button> <button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
| translate}}</button>
</div>
</div>
</mat-step>
<mat-step>
<div *ngIf="this.isActiveStep(3)">
<ng-template matStepLabel>{{'DATASET-WIZARD.FOURTH-STEP.TITLE' | translate}}</ng-template>
<app-dynamic-form-pending-questions-display class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition"
[form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel"></app-dynamic-form-pending-questions-display>
<div class="navigation-buttons-container">
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
| translate}}</button>
</div>
</div> </div>
</mat-step> </mat-step>
</mat-horizontal-stepper> </mat-horizontal-stepper>

View File

@ -6,7 +6,6 @@ import { JsonSerializer } from '../../utilities/JsonSerializer';
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria'; import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { RequestItem } from '../../models/criteria/RequestItem'; import { RequestItem } from '../../models/criteria/RequestItem';
import { DatasetService } from '../../services/dataset/dataset.service'; import { DatasetService } from '../../services/dataset/dataset.service';
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
import { DatasetProfileModel } from '../../models/datasetprofile/DatasetProfileModel'; import { DatasetProfileModel } from '../../models/datasetprofile/DatasetProfileModel';
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel'; import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
import { DatasetWizardModel, DatasetStatus } from '../../models/datasets/DatasetWizardModel'; import { DatasetWizardModel, DatasetStatus } from '../../models/datasets/DatasetWizardModel';
@ -16,9 +15,9 @@ import { DatasetWizardService } from '../../services/dataset-wizard/dataset-wiza
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { ActivatedRoute, Router, Params } from '@angular/router'; import { ActivatedRoute, Router, Params } from '@angular/router';
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef, ChangeDetectionStrategy } from '@angular/core'; import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef, ChangeDetectionStrategy } from '@angular/core';
import { FormGroup, Validators, FormBuilder, FormArray } from '@angular/forms'; import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
import * as FileSaver from 'file-saver'; import * as FileSaver from 'file-saver';
import { MatPaginator, MatSort, MatSnackBar, MatStepper, MatDialog } from '@angular/material'; import { MatSnackBar, MatStepper, MatDialog } from '@angular/material';
import { ExternalDatasetCriteria } from '../../models/criteria/external-dataset/ExternalDatasetCriteria'; import { ExternalDatasetCriteria } from '../../models/criteria/external-dataset/ExternalDatasetCriteria';
import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel'; import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel';
import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria'; import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria';
@ -156,14 +155,55 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
loadDataOnStart: true loadDataOnStart: true
}; };
this.route.params.subscribe((params: Params) => { const params = this.route.snapshot.params;
this.itemId = params['id']; this.itemId = params['id'];
const dmpId = params['dmpId']; const dmpId = params['dmpId'];
if (this.itemId != null) { if (this.itemId != null) {
this.isNew = false; this.isNew = false;
this.datasetWizardService.getSingle(this.itemId).map(data => data as DatasetWizardModel) this.datasetWizardService.getSingle(this.itemId).map(data => data as DatasetWizardModel)
.subscribe(data => { .subscribe(data => {
this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel); this.datasetWizardModel = JsonSerializer.fromJSONObject(data, DatasetWizardModel);
this.breadCrumbs = Observable.of([
{
parentComponentName: null,
label: 'Datasets',
url: '/datasets',
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.project.label,
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
},
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
},
]
}]);
this.formGroup = this.datasetWizardModel.buildForm();
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) { this.formGroup.disable(); }
this.loadDatasetProfiles();
});
} else if (dmpId != null) {
this.isNew = true;
this.dataManagementPlanService.getSingle(dmpId).map(data => data as DataManagementPlanModel)
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardModel();
setTimeout(() => {
this.datasetWizardModel.dmp = data;
this.formGroup = this.datasetWizardModel.buildForm();
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
this.loadDatasetProfiles();
this.breadCrumbs = Observable.of([ this.breadCrumbs = Observable.of([
{ {
parentComponentName: null, parentComponentName: null,
@ -179,65 +219,23 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
parentComponentName: null, parentComponentName: null,
label: this.datasetWizardModel.dmp.label, label: this.datasetWizardModel.dmp.label,
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id, url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
}, }]
]
}]); }]);
this.formGroup = this.datasetWizardModel.buildForm();
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) { this.formGroup.disable(); }
this.loadDatasetProfiles();
}); });
} else if (dmpId != null) {
this.isNew = true;
this.dataManagementPlanService.getSingle(dmpId).map(data => data as DataManagementPlanModel)
.subscribe(data => {
this.datasetWizardModel = new DatasetWizardModel();
setTimeout(() => {
this.datasetWizardModel.dmp = data;
this.formGroup = this.datasetWizardModel.buildForm();
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
this.loadDatasetProfiles();
this.breadCrumbs = Observable.of([
{
parentComponentName: null,
label: 'Datasets',
url: '/datasets',
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.project.label,
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
},
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
}]
}]);
});
});
} else {
this.datasetWizardModel = new DatasetWizardModel();
this.formGroup = this.datasetWizardModel.buildForm();
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) { this.formGroup.disable(); }
this.formGroup.get('dmp').valueChanges.subscribe(x => {
this.loadDatasetProfiles();
}); });
} else {
this.datasetWizardModel = new DatasetWizardModel();
this.formGroup = this.datasetWizardModel.buildForm();
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
} }
}); if (this.viewOnly) { this.formGroup.disable(); }
this.formGroup.get('dmp').valueChanges.subscribe(x => {
this.loadDatasetProfiles();
});
}
} }
ngAfterViewInit() { ngAfterViewInit() {
@ -491,4 +489,8 @@ export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrum
this.viewOnly = true; this.viewOnly = true;
this.formGroup.disable(); this.formGroup.disable();
} }
isActiveStep(index: number) {
return this.stepper.selectedIndex === index;
}
} }

View File

@ -49,7 +49,9 @@ export const DatasetRoutes: Routes = [
{ {
path: 'public', path: 'public',
component: DatasetPublicListingComponent, component: DatasetPublicListingComponent,
//canActivate: [AuthGuard], data: {
breadcrumb: false
}
}, },
{ {
path: 'dmp/:dmpId', path: 'dmp/:dmpId',

View File

@ -1,27 +1,28 @@
<div class="project-editor"> <div class="project-editor">
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup"> <form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
required> required>
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error> <mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.URI' | translate}}" type="text" name="uri" formControlName="uri"> <input matInput placeholder="{{'DATASET-EDITOR.FIELDS.URI' | translate}}" type="text" name="uri" formControlName="uri">
<mat-error *ngIf="formGroup.get('uri').errors?.backendError">{{baseErrorModel.uri}}</mat-error> <mat-error *ngIf="formGroup.get('uri').errors?.backendError">{{baseErrorModel.uri}}</mat-error>
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<textarea matInput class="description-area" placeholder="{{'DATASET-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"></textarea> <textarea matInput class="description-area" placeholder="{{'DATASET-EDITOR.FIELDS.DESCRIPTION' | translate}}"
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error> formControlName="description"></textarea>
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
</mat-form-field> <mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</form> </form>
<!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> --> <!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> -->
</div> </div>

View File

@ -36,9 +36,6 @@ export class DatasetEditorComponent implements AfterViewInit {
// filteredServices: ExternalSourcesItemModel[]; // filteredServices: ExternalSourcesItemModel[];
constructor( constructor(
private datasetService: DatasetService,
private externalSourcesService: ExternalSourcesService,
private route: ActivatedRoute,
public snackBar: MatSnackBar, public snackBar: MatSnackBar,
public router: Router, public router: Router,
public language: TranslateService, public language: TranslateService,

View File

@ -1,5 +1,5 @@
<div class="container-fluid"> <div class="container-fluid">
<h3>{{titlePrefix}} {{'DATASET-LISTING.TITLE' | translate}}</h3> <h3>{{titlePrefix}} {{'DMP-PROFILE-LISTING.TITLE' | translate}}</h3>
<app-dmp-profile-criteria-component></app-dmp-profile-criteria-component> <app-dmp-profile-criteria-component></app-dmp-profile-criteria-component>
@ -11,19 +11,19 @@
<!-- Column Definition: Name --> <!-- Column Definition: Name -->
<ng-container cdkColumnDef="label"> <ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DMP-PROFILE-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell> <mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container> </ng-container>
<!-- Column Definition: status --> <!-- Column Definition: status -->
<ng-container cdkColumnDef="status"> <ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef mat-sort-header="status">{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="status">{{'DMP-PROFILE-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.status}}</mat-cell> <mat-cell *matCellDef="let row">{{row.status}}</mat-cell>
</ng-container> </ng-container>
<!-- Column Definition: Created --> <!-- Column Definition: Created -->
<ng-container cdkColumnDef="created"> <ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DMP-PROFILE-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell> <mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container> </ng-container>
@ -41,4 +41,4 @@
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/dmp-profiles/new'] "> <button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/dmp-profiles/new'] ">
<mat-icon class="mat-24">add</mat-icon> <mat-icon class="mat-24">add</mat-icon>
</button> </button>
</div> </div>

View File

@ -34,6 +34,12 @@
<button mat-menu-item (click)="downloadXml(this.dataManagementPlan.id)"> <button mat-menu-item (click)="downloadXml(this.dataManagementPlan.id)">
<mat-icon>save_alt</mat-icon>{{'DMP-LISTING.ACTIONS.DOWNLOAD-XML' | translate}} <mat-icon>save_alt</mat-icon>{{'DMP-LISTING.ACTIONS.DOWNLOAD-XML' | translate}}
</button> </button>
<button mat-menu-item (click)="downloadDocx(this.dataManagementPlan.id)">
<mat-icon>save_alt</mat-icon>{{'DMP-LISTING.ACTIONS.DOWNLOAD-DOCX' | translate}}
</button>
<button mat-menu-item (click)="downloadPDF(this.dataManagementPlan.id)">
<mat-icon>save_alt</mat-icon>{{'DMP-LISTING.ACTIONS.DOWNLOAD-PDF' | translate}}
</button>
</mat-menu> </mat-menu>
<div> <div>
<button mat-icon-button type="button" [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button type="button" [matMenuTriggerFor]="actionsMenu">
@ -133,8 +139,8 @@
translate}}</button> translate}}</button>
<button *ngIf="this.formGroup.enabled" mat-raised-button color="primary" type="submit">{{'DMP-EDITOR.ACTIONS.SAVE' <button *ngIf="this.formGroup.enabled" mat-raised-button color="primary" type="submit">{{'DMP-EDITOR.ACTIONS.SAVE'
| translate}}</button> | translate}}</button>
<button *ngIf="dataManagementPlan.lockable && this.formGroup.enabled" type="button" mat-raised-button <button *ngIf="dataManagementPlan.lockable && this.formGroup.enabled" type="button" mat-raised-button color="primary"
color="primary" (click)="saveAndFinalize()">{{'DMP-EDITOR.ACTIONS.FINALISE' (click)="saveAndFinalize()">{{'DMP-EDITOR.ACTIONS.FINALISE'
| translate}}</button> | translate}}</button>
<button *ngIf="!isNew && this.formGroup.enabled" mat-raised-button color="primary" type="button" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)">{{'DMP-EDITOR.ACTIONS.DELETE' <button *ngIf="!isNew && this.formGroup.enabled" mat-raised-button color="primary" type="button" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)">{{'DMP-EDITOR.ACTIONS.DELETE'
| translate}}</button> | translate}}</button>

View File

@ -343,6 +343,24 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
}); });
} }
downloadDocx(id: string) {
this.dataManagementPlanService.downloadDocx(id).subscribe(response => {
const blob = new Blob([response.body], { type: 'application/octet-stream' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
});
}
downloadPDF(id: string) {
this.dataManagementPlanService.downloadPDF(id).subscribe(response => {
const blob = new Blob([response.body], { type: 'application/octet-stream' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
});
}
getFilenameFromContentDispositionHeader(header: string): string { getFilenameFromContentDispositionHeader(header: string): string {
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g); const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);

View File

@ -3,4 +3,4 @@
<!-- <input type="checkbox" formControlName="value"> --> <!-- <input type="checkbox" formControlName="value"> -->
</div> </div>
<!-- label="{{field.data.label}}" formControlName="form.get('value').value"--> <!-- label="{{field.data.label}}" formControlName="form.get('value').value"-->

View File

@ -10,8 +10,12 @@ import { Component, Input, ViewEncapsulation, OnInit } from '@angular/core';
], ],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class DynamicFieldCheckBoxComponent { export class DynamicFieldCheckBoxComponent implements OnInit {
@Input() field: Field; @Input() field: Field;
@Input() form: FormGroup; @Input() form: FormGroup;
ngOnInit(): void {
if (this.form.get('value').value === null) { this.form.get('value').patchValue(false); }
}
} }

View File

@ -1,9 +1,9 @@
<div [formGroup]="form"> <div [formGroup]="form">
<mat-form-field> <mat-form-field>
<mat-select formControlName="value" [required]="field.validationRequired"> <mat-select formControlName="value" [required]="field.validationRequired">
<mat-option *ngFor="let opt of field.data.options" [value]="opt.value">{{opt.label}}</mat-option> <mat-option *ngFor="let opt of field.data.options" [value]="assign(opt)">{{opt.label}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="form.get('value').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.get('value').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>

View File

@ -17,4 +17,13 @@ export class DynamicFieldDropdownComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
assign(item: any) {
if (!item) { return null; }
return this.transform(item);
}
transform(item: any) {
if (typeof item === 'string') { return JSON.parse(item); } else { return JSON.stringify(item); }
}
} }

View File

@ -1,67 +1,73 @@
<div *ngIf="form && field" [id]="field.id" [formGroup]="form" [ngSwitch]="field.viewStyle.renderStyle"> <div *ngIf="form && field" [id]="field.id" [formGroup]="form" [ngSwitch]="field.viewStyle.renderStyle">
<!-- <h5 *ngIf="field.title">{{field.title}}</h5> --> <!-- <h5 *ngIf="field.title">{{field.title}}</h5> -->
<div [class.content-left-margin]="field.title"> <div [class.content-left-margin]="field.title">
<h5 *ngIf="field.description">{{field.description}}</h5> <h5 *ngIf="field.description">{{field.description}}</h5>
<h5 *ngIf="field.extendedDescription" class="field-extended-desc"> <h5 *ngIf="field.extendedDescription" class="field-extended-desc">
<i>{{field.extendedDescription}}</i> <i>{{field.extendedDescription}}</i>
</h5> </h5>
<div *ngSwitchCase="'freetext'"> <div *ngSwitchCase="'freetext'">
<mat-form-field> <mat-form-field>
<input matInput formControlName="value" placeholder="{{field.data.label}}" [required]="field.validationRequired"> <input matInput formControlName="value" placeholder="{{field.data.label}}" [required]="field.validationRequired">
<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED'
</mat-form-field> | translate}}</mat-error>
</div> </mat-form-field>
</div>
<div *ngSwitchCase="'combobox'"> <div *ngSwitchCase="'combobox'">
<!--TODO--> <!--TODO-->
<div *ngIf="this.field.data.type === 'autocomplete'"> <div *ngIf="this.field.data.type === 'autocomplete'">
<app-df-autocomplete [form]="form" [field]="field"></app-df-autocomplete> <app-df-autocomplete [form]="form" [field]="field"></app-df-autocomplete>
</div> </div>
<div *ngIf="this.field.data.type === 'wordlist'"> <div *ngIf="this.field.data.type === 'wordlist'">
<app-df-dropdown [form]="form" [field]="field"></app-df-dropdown> <app-df-dropdown [form]="form" [field]="field"></app-df-dropdown>
</div> </div>
</div>
<div *ngSwitchCase="'checkBox'" class="checkbox">
<app-df-checkbox [form]="form" [field]="field"></app-df-checkbox>
</div>
<div *ngSwitchCase="'textarea'">
<mat-form-field>
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10"
[required]="field.validationRequired">
</div>
<div *ngSwitchCase="'checkBox'" class="checkbox">
<app-df-checkbox [form]="form" [field]="field"></app-df-checkbox>
</div>
<div *ngSwitchCase="'textarea'">
<mat-form-field>
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10" [required]="field.validationRequired">
</textarea> </textarea>
<button mat-button *ngIf="!form.get('value').disabled && form.get('value').value" matSuffix mat-icon-button aria-label="Clear" (click)="this.form.patchValue({'value': ''})"> <button mat-button *ngIf="!form.get('value').disabled && form.get('value').value" matSuffix mat-icon-button
<mat-icon>close</mat-icon> aria-label="Clear" (click)="this.form.patchValue({'value': ''})">
</button> <mat-icon>close</mat-icon>
<mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> </button>
</mat-form-field> <mat-error *ngIf="form.get('value')['errors'] && form.get('value')['errors']['required']">{{'GENERAL.VALIDATION.REQUIRED'
| translate}}</mat-error>
</mat-form-field>
</div> </div>
<div *ngSwitchCase="'booleanDecision'"> <div *ngSwitchCase="'booleanDecision'">
<app-df-boolean-decision [form]="form" [field]="field"></app-df-boolean-decision> <app-df-boolean-decision [form]="form" [field]="field"></app-df-boolean-decision>
</div> </div>
<div *ngSwitchCase="'radiobox'"> <div *ngSwitchCase="'radiobox'">
<app-df-radiobox [form]="form" [field]="field"></app-df-radiobox> <app-df-radiobox [form]="form" [field]="field"></app-df-radiobox>
</div> </div>
<div *ngSwitchCase="'label'"> </div> <div *ngSwitchCase="'label'"> </div>
<!--<div [hidden]="isValid"> <!--<div [hidden]="isValid">
<mat-error *ngIf="isValidRequired">The field "{{field.data.label}}" <strong>required</strong></mat-error> <mat-error *ngIf="isValidRequired">The field "{{field.data.label}}" <strong>required</strong></mat-error>
<div class="invalid-feedbackCustom" *ngIf="isValidRequired">The field "{{field.label}}" is required</div> <div class="invalid-feedbackCustom" *ngIf="isValidRequired">The field "{{field.label}}" is required</div>
<div class="invalid-feedbackCustom" *ngIf="isValidPattern">The field {{field.label}} must match a regular expression {{field.regex}}</div> <div class="invalid-feedbackCustom" *ngIf="isValidPattern">The field {{field.label}} must match a regular expression {{field.regex}}</div>
<div class="invalid-feedbackCustom" *ngIf="isValidCustom">The field {{field.label}} custom Validation</div> <div class="invalid-feedbackCustom" *ngIf="isValidCustom">The field {{field.label}} custom Validation</div>
</div>--> </div>-->
</div> </div>
</div> </div>
<!-- <div [formGroup]="form" class="form-group"> <!-- <div [formGroup]="form" class="form-group">

View File

@ -19,10 +19,10 @@ import { Subscription } from 'rxjs';
export class DynamicFormFieldComponent implements OnInit, OnChanges, OnDestroy { export class DynamicFormFieldComponent implements OnInit, OnChanges, OnDestroy {
@Input() field: Field; @Input() field: Field;
form: FormGroup; form: FormGroup;
@Input() pathName: string;
@Input() path: string;
change: Subscription; change: Subscription;
trackByFn = (index, item) => item ? item['id'] : null; trackByFn = (index, item) => item ? item['id'] : null;
constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) { constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) {
} }

View File

@ -1,19 +1,25 @@
<div *ngIf="form" [id]="compositeField.id" [formGroup]="form"> <div *ngIf="form" [id]="compositeField.id" [formGroup]="form">
<div *ngIf="compositeField.fields.length == 1" class="fieldset-component"> <div *ngIf="compositeField.fields.length == 1" class="fieldset-component">
<h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.title}}</h5> <h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.numbering}}
{{compositeField.title}}
<a *ngIf="this.markForConsiderationService.exists(compositeField)" (click)="markForConsideration()" style="cursor: pointer">
Mark For Consideration
</a>
</h5>
<div class="content-left-margin"> <div class="content-left-margin">
<h5 *ngIf="compositeField.description">{{compositeField.description}}</h5> <h5 *ngIf="compositeField.description">{{compositeField.description}}</h5>
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc"> <h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
<i>{{compositeField.extendedDescription}}</i> <i>{{compositeField.extendedDescription}}</i>
</h5> </h5>
<app-df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [pathName]="pathName+'.fields.'+0"></app-df-field> <app-df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]"></app-df-field>
</div> </div>
</div> </div>
<div *ngIf="compositeField.fields.length > 1" class="fieldset-component"> <div *ngIf="compositeField.fields.length > 1" class="fieldset-component">
<h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.title}}</h5> <h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.numbering}}{{compositeField.title}}</h5>
<div class="content-left-margin"> <div class="content-left-margin">
<h5 *ngIf="compositeField.description">{{compositeField.description}}</h5> <h5 *ngIf="compositeField.description">{{compositeField.description}}</h5>
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc"> <h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
@ -28,13 +34,14 @@
</div> </div>
</div> </div>
<app-df-field [field]="field" [pathName]="pathName+'.fields.'+i"></app-df-field> <app-df-field #{{}} [field]="field"></app-df-field>
<div *ngIf="field"> <div *ngIf="field">
<div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn">
<app-df-field [field]="multipleField" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></app-df-field> <app-df-field [field]="multipleField"></app-df-field>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,6 +3,8 @@ import { CompositeField } from '../../models/CompositeField';
import { FormGroup, FormArray } from '@angular/forms'; import { FormGroup, FormArray } from '@angular/forms';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
import { Field } from '../../models/Field'; import { Field } from '../../models/Field';
import { MarkForConsiderationService } from '../../utilities/mark-for-considerations/mark-for-consideration.service';
import { FormFocusService } from '../../utilities/form-focus-service/form-focus.service';
@Component({ @Component({
selector: 'app-df-composite-field', selector: 'app-df-composite-field',
templateUrl: './dynamic-form-composite-field.html', templateUrl: './dynamic-form-composite-field.html',
@ -15,11 +17,13 @@ export class DynamicFormCompositeFieldComponent implements OnInit {
@Input() compositeField: CompositeField; @Input() compositeField: CompositeField;
form: FormGroup; form: FormGroup;
@Input() pathName: string;
@Input() path: string;
trackByFn = (index, item) => item ? item['id'] : null; trackByFn = (index, item) => item ? item['id'] : null;
constructor(private visibilityRulesService: VisibilityRulesService) { constructor(
private visibilityRulesService: VisibilityRulesService,
private markForConsiderationService: MarkForConsiderationService,
private formFocusService: FormFocusService
) {
} }
ngOnInit() { ngOnInit() {
@ -28,10 +32,13 @@ export class DynamicFormCompositeFieldComponent implements OnInit {
} }
} }
addMultipleField(fieldIndex: number) { addMultipleField(fieldIndex: number) {
const field: Field = this.compositeField.fields[fieldIndex].cloneForMultiplicity(fieldIndex, ''); const field: Field = this.compositeField.fields[fieldIndex].cloneForMultiplicity(fieldIndex, '');
this.compositeField.fields[fieldIndex].multiplicityItems.push(field); this.compositeField.fields[fieldIndex].multiplicityItems.push(field);
(<FormArray>(this.form.get('fields').get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm()); (<FormArray>(this.form.get('fields').get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm());
} }
markForConsideration() {
this.markForConsiderationService.markForConsideration(this.compositeField);
}
} }

View File

@ -1,20 +1,20 @@
<div *ngIf="form" class="group-component" [id]="group.id" [formGroup]="form"> <div *ngIf="form" class="group-component" [id]="group.id" [formGroup]="form">
<div class="content-left-margin"> <div class="content-left-margin">
<div *ngFor="let compositeField of group.compositeFields; let i = index; trackBy: trackByFn"> <div *ngFor="let compositeField of group.compositeFields; let i = index; trackBy: trackByFn">
<div> <div>
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)"> <div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
<a (click)="addMultipleField(i)" style="cursor: pointer"> <a (click)="addMultipleField(i)" style="cursor: pointer">
Add one more fieldset + Add one more fieldset +
</a> </a>
</div> </div>
</div> </div>
<app-df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></app-df-composite-field> <app-df-composite-field [compositeField]="compositeField"></app-df-composite-field>
<div *ngIf="compositeField"> <div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<app-df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></app-df-composite-field> <app-df-composite-field [compositeField]="multipleCompositeField"></app-df-composite-field>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,7 +3,7 @@
<mat-expansion-panel expanded=true> <mat-expansion-panel expanded=true>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
{{path}} {{section.title}} {{section.numbering}} {{section.title}}
</mat-panel-title> </mat-panel-title>
<mat-panel-description> <mat-panel-description>
<h3 *ngIf="section.description">{{section.description}}</h3> <h3 *ngIf="section.description">{{section.description}}</h3>
@ -18,16 +18,19 @@
Add one more fieldset + Add one more fieldset +
</a> </a>
</div> </div>
<app-df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></app-df-composite-field> <app-df-composite-field [compositeField]="compositeField"></app-df-composite-field>
<div *ngIf="compositeField"> <div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<app-df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></app-df-composite-field> <app-df-composite-field [compositeField]="multipleCompositeField"></app-df-composite-field>
</div> </div>
<div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)"> <div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)">
<mat-form-field> <mat-form-field>
<input matInput formControlName="commentFieldValue" placeholder="comment"> <input matInput formControlName="commentFieldValue" placeholder="comment">
</mat-form-field> </mat-form-field>
</div> </div>
<button mat-icon-button type="button" (click)="next(compositeField)">
<mat-icon>expand_more</mat-icon>
</button>
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@ import { FormGroup, Form, FormArray } from '@angular/forms';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, AfterViewInit } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, AfterViewInit } from '@angular/core';
import { CompositeField } from '../../models/CompositeField'; import { CompositeField } from '../../models/CompositeField';
import { Section } from '../../models/Section'; import { Section } from '../../models/Section';
import { FormFocusService } from '../../utilities/form-focus-service/form-focus.service';
@Component({ @Component({
@ -20,7 +21,10 @@ export class DynamicFormSectionComponent implements OnInit, AfterViewInit {
@Input() pathName: string; @Input() pathName: string;
@Input() path: string; @Input() path: string;
trackByFn = (index, item) => item ? item['id'] : null; trackByFn = (index, item) => item ? item['id'] : null;
constructor(public visibilityRulesService: VisibilityRulesService) { } constructor(
public visibilityRulesService: VisibilityRulesService,
private formFocusService: FormFocusService
) { }
ngOnInit() { ngOnInit() {
if (this.section) { if (this.section) {
@ -47,4 +51,8 @@ export class DynamicFormSectionComponent implements OnInit, AfterViewInit {
} }
return false; return false;
} }
next(compositeField: CompositeField) {
this.formFocusService.focusNext(compositeField);
}
} }

View File

@ -32,6 +32,9 @@ import { NgModule } from '@angular/core';
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service'; import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { DatasetProfileService } from '../services/dataset-profile.service'; import { DatasetProfileService } from '../services/dataset-profile.service';
import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service'; import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service';
import { DynamicFormPendingQuestionsDisplayComponent } from './helpers/dynamic-form-pending-questions/dynamic-form-pending-questions-display.component';
import { MarkForConsiderationService } from '../utilities/mark-for-considerations/mark-for-consideration.service';
import { FormFocusService } from '../utilities/form-focus-service/form-focus.service';
@NgModule({ @NgModule({
@ -57,6 +60,7 @@ import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.
DynamicFormCompositeFieldComponent, DynamicFormCompositeFieldComponent,
DynamicFieldBooleanDecisionComponent, DynamicFieldBooleanDecisionComponent,
DynamicFieldRadioBoxComponent, DynamicFieldRadioBoxComponent,
DynamicFormPendingQuestionsDisplayComponent,
TableOfContentsComponent, TableOfContentsComponent,
TableOfContentsFieldSetComponent, TableOfContentsFieldSetComponent,
TableOfContentsGroupComponent, TableOfContentsGroupComponent,
@ -76,6 +80,7 @@ import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.
DynamicFormCompositeFieldComponent, DynamicFormCompositeFieldComponent,
DynamicFieldBooleanDecisionComponent, DynamicFieldBooleanDecisionComponent,
DynamicFieldRadioBoxComponent, DynamicFieldRadioBoxComponent,
DynamicFormPendingQuestionsDisplayComponent,
TableOfContentsComponent, TableOfContentsComponent,
TableOfContentsFieldSetComponent, TableOfContentsFieldSetComponent,
TableOfContentsGroupComponent, TableOfContentsGroupComponent,
@ -92,7 +97,9 @@ import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.
PaginationService, PaginationService,
DatasetProfileService, DatasetProfileService,
DatasetProfileAdmin, DatasetProfileAdmin,
DatasetWizardService DatasetWizardService,
MarkForConsiderationService,
FormFocusService
] ]
}) })

View File

@ -6,15 +6,17 @@ import { BaseHttpService } from '../../utilities/cite-http-service-module/base-h
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service'; import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel'; import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel'; import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
import { Component, Input, OnInit, AfterViewChecked, ViewChild, forwardRef, ViewEncapsulation, AfterViewInit, ChangeDetectionStrategy } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation, AfterViewInit, ViewChild } from '@angular/core';
import { FormGroup, Validators, ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { FormGroup } from '@angular/forms';
import { NgForm } from '@angular/forms'; import { Router, ActivatedRoute } from '@angular/router';
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import 'rxjs/add/operator/switchMap'; import 'rxjs/add/operator/switchMap';
import '../../utilities/enhancers/flatJoinOn';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { MatSidenavModule } from '@angular/material/sidenav'; import { MarkForConsiderationService } from '../../utilities/mark-for-considerations/mark-for-consideration.service';
import { FormFocusService } from '../../utilities/form-focus-service/form-focus.service';
declare function simple_notifier(type: string, title: string, message: string): any; import { CompositeField } from '../../models/CompositeField';
import { Pair } from '../../models/helpers/Pair';
import { MatStepper } from '@angular/material';
@Component({ @Component({
selector: 'app-dynamic-form', selector: 'app-dynamic-form',
@ -23,6 +25,7 @@ declare function simple_notifier(type: string, title: string, message: string):
'./dynamic-form.component.scss' './dynamic-form.component.scss'
], ],
providers: [ providers: [
FormFocusService
], ],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
@ -35,8 +38,8 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
datasetProfileDefinitionModel: DatasetProfileDefinitionModel; datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
private progressbar = false; private progressbar = false;
private currentPageIndex = 0; private currentPageIndex = 0;
@ViewChild('stepper') stepper: MatStepper;
private fragment: string;
@Input() dataModel: DatasetWizardModel = new DatasetWizardModel(); @Input() dataModel: DatasetWizardModel = new DatasetWizardModel();
@Input() path: string; @Input() path: string;
@Input() form: FormGroup; @Input() form: FormGroup;
@ -48,11 +51,9 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
constructor( constructor(
private router: Router, private router: Router,
private _location: Location,
private route: ActivatedRoute, private route: ActivatedRoute,
private visibilityRulesService: VisibilityRulesService, private visibilityRulesService: VisibilityRulesService,
private http: BaseHttpService, private formFocusService: FormFocusService
private datasetWizardService: DatasetWizardService,
) { ) {
//this.datasetId = route.snapshot.params['id']; //this.datasetId = route.snapshot.params['id'];
} }
@ -69,14 +70,26 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
this.visibilityRulesService.buildVisibilityRules(rules); this.visibilityRulesService.buildVisibilityRules(rules);
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition; this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition;
this.visibilityRulesService.setModel(this.datasetProfileDefinitionModel); this.visibilityRulesService.setModel(this.datasetProfileDefinitionModel);
this.createPagination(); this.createPagination();
this.progressbar = true; this.progressbar = true;
const sections: Pair<Section[], number>[] = this.datasetProfileDefinitionModel.pages.map(page => new Pair<Section[], number>(page.sections, page.ordinal)).filter(x => x);
const compositeFields: Pair<CompositeField[], number>[] = sections.map(section => new Pair<CompositeField[], number>(section.left.flatMap(sec => sec.compositeFields), section.right)).filter(x => x);
const nestedSections: Pair<Section[], number>[] = sections.map(section => new Pair<Section[], number>(section.left.flatMap(x => x.sections), section.right)).filter(x => x);
const nestedCompositeFields: Pair<CompositeField[], number>[] = nestedSections.map(section => new Pair<CompositeField[], number>(section.left.flatMap(x => x.compositeFields), section.right)).filter(x => x);
const compositeFieldsUnion: Pair<CompositeField[], number>[] = compositeFields.concat(nestedCompositeFields);
//const fields = compositeFieldsUnion.flatJoinOn(x => x.right);
this.formFocusService.setFields(compositeFieldsUnion);
this.route.fragment.subscribe((fragment: string) => { this.route.fragment.subscribe((fragment: string) => {
const self = this; const self = this;
setTimeout(function () { self.scrollTo(fragment); }); setTimeout(function () { self.scrollTo(fragment); });
}); });
}
ngAfterViewInit() {
this.visibilityRulesService.triggerVisibilityEvaluation();
this.route.queryParams.subscribe((params) => { this.route.queryParams.subscribe((params) => {
if (params && 'page' in params) { if (params && 'page' in params) {
this.changeCurrentPage(params['page']); this.changeCurrentPage(params['page']);
@ -84,35 +97,17 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
}); });
} }
ngAfterViewInit() {
this.visibilityRulesService.triggerVisibilityEvaluation();
}
toggleSidebar() { toggleSidebar() {
this.visibleSidebar = !this.visibleSidebar; this.visibleSidebar = !this.visibleSidebar;
} }
// getPages(model: DatasetProfileDefinitionModel): Array<number> {
// let pageSet = new Set<number>();
// model.sections.forEach(section => {
// pageSet.add(section.page);
// });
// return Array.from(pageSet).sort((a, b) => a - b);
// }
shouldDisplaySection(section: Section): Boolean { shouldDisplaySection(section: Section): Boolean {
return (section.page) === this.currentPageIndex; return (section.page) === this.currentPageIndex;
} }
createPagination() { createPagination() {
/*this.pages.forEach(item => {
this.stepperItems.push({
label: '',
})
});*/
} }
changePageIndex(index: any) { changePageIndex(index: any) {
@ -125,16 +120,14 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
if (!element) { return; } if (!element) { return; }
element.scrollIntoView(); element.scrollIntoView();
this.visibleSidebar = true; this.visibleSidebar = true;
const scrollElement = document.querySelector('.scrollableContent');
//scrollElement.scrollTop = topElement.offsetTop;
} }
changeCurrentPage(pageString: string) { changeCurrentPage(pageString: string) {
if (!pageString) { return; } //if (!pageString) { return; }
const page = parseInt(pageString); const page = parseInt(pageString);
if (isNaN(page)) { return; } /*if (isNaN(page)) { return; }
const pageIndex = this.pages.indexOf(page); const pageIndex = this.pages.indexOf(page);
if (pageIndex === -1) { return; } if (pageIndex === -1) { return; }*/
this.currentPageIndex = page; this.stepper.selectedIndex = page;
} }
} }

View File

@ -0,0 +1,4 @@
<div *ngFor="let field of this.markForConsideration.getFields()">
<app-df-composite-field [compositeField]="field">
</app-df-composite-field>
</div>

View File

@ -0,0 +1,52 @@
import { Component, ViewEncapsulation, OnInit, Input } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { VisibilityRulesService } from '../../../utilities/visibility-rules/visibility-rules.service';
import { JsonSerializer } from '../../../utilities/JsonSerializer';
import { Rule } from '../../../models/Rule';
import { DatasetWizardModel } from '../../../models/datasets/DatasetWizardModel';
import { DatasetProfileDefinitionModel } from '../../../models/DatasetProfileDefinitionModel';
import { Section } from '../../../models/Section';
import { CompositeField } from '../../../models/CompositeField';
import '../../../utilities/enhancers/flatMap';
import { Field } from '../../../models/Field';
import { MarkForConsiderationService } from '../../../utilities/mark-for-considerations/mark-for-consideration.service';
@Component({
selector: 'app-dynamic-form-pending-questions-display',
templateUrl: './dynamic-form-pending-questions-display.component.html',
styleUrls: [
'./dynamic-form-pending-questions-display.component.scss'
],
providers: [
],
encapsulation: ViewEncapsulation.None,
})
export class DynamicFormPendingQuestionsDisplayComponent implements OnInit {
constructor(
private visibilityRulesService: VisibilityRulesService,
private markForConsideration: MarkForConsiderationService) {
}
datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
@Input()
form: FormGroup;
@Input() dataModel: DatasetWizardModel = new DatasetWizardModel();
fields: CompositeField[];
ngOnInit(): void {
const rules: Rule[] = JsonSerializer.fromJSONArray(this.dataModel.datasetProfileDefinition.rules, Rule);
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition;
const sections: Section[] = this.datasetProfileDefinitionModel.pages.flatMap(page => page.sections).filter(x => x);
const compositeFields: CompositeField[] = sections.flatMap(section => section.compositeFields).filter(x => x);
const nestedSections: Section[] = sections.flatMap(section => section.sections).filter(x => x);
const nestedCompositeFiels: CompositeField[] = nestedSections.flatMap(section => section.compositeFields).filter(x => x);
const compositeFieldsUnion = compositeFields.concat(nestedCompositeFiels);
//const fields: Field[] = compositeFields.flatMap(composite => composite.fields).concat(nestedCompositeFiels.flatMap(composite => composite.fields));
const fields = compositeFieldsUnion.filter(compositeField => this.visibilityRulesService.checkElementVisibility(compositeField.id))
.filter(compositeField => compositeField.fields.filter(x => x && x.validationRequired && this.visibilityRulesService.getFormGroup(x.id).value == null).length > 0);
fields.forEach(x => this.markForConsideration.markForConsideration(x));
}
}

View File

@ -54,12 +54,13 @@ export class ProgressBarComponent implements OnInit {
if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); } else if (control instanceof FormArray) { if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); } else if (control instanceof FormArray) {
const formArray = (<FormArray>control); const formArray = (<FormArray>control);
for (let i = 0; i < formArray.length; i++) { for (let i = 0; i < formArray.length; i++) {
//if (<FormGroup>formArray.get("" + i).value && this.visibilityRulesService.isElementVisible(null, formArray.get("" + i).value.id)) if (<FormGroup>formArray.get('' + i).value && this.visibilityRulesService.checkElementVisibility(formArray.get('' + i).value.id)) {
//value += this.getFormControlDepthLength(<FormGroup>formArray.get("" + i)) value += this.getFormControlDepthLength(<FormGroup>formArray.get('' + i));
}
} }
} else if (key === 'value' && this.visibilityRulesService.checkElementVisibility(form.controls['id'].value)) {
value++;
} }
//else if (key === "value" && this.visibilityRulesService.isElementVisible(null, form.controls["id"].value))
//value++;
}); });
return value; return value;
} }

View File

@ -8,6 +8,7 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
public fields: Array<Field> = new Array<Field>(); public fields: Array<Field> = new Array<Field>();
public ordinal: number; public ordinal: number;
public id: string; public id: string;
public numbering: string;
public multiplicity: Multiplicity; public multiplicity: Multiplicity;
public multiplicityItems: Array<CompositeField> = new Array<CompositeField>(); public multiplicityItems: Array<CompositeField> = new Array<CompositeField>();
public title: string; public title: string;
@ -22,6 +23,7 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
this.ordinal = item.ordinal; this.ordinal = item.ordinal;
this.id = item.id; this.id = item.id;
this.title = item.title; this.title = item.title;
this.numbering = item.numbering;
this.description = item.description; this.description = item.description;
this.extendedDescription = item.extendedDescription; this.extendedDescription = item.extendedDescription;
this.hasCommentField = item.hasCommentField; this.hasCommentField = item.hasCommentField;

View File

@ -15,6 +15,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
public value: any; public value: any;
public defaultValue: DefaultValue; public defaultValue: DefaultValue;
public description: string; public description: string;
public numbering: string;
public extendedDescription: string; public extendedDescription: string;
public viewStyle: ViewStyle; public viewStyle: ViewStyle;
public defaultVisibility: boolean; public defaultVisibility: boolean;
@ -29,6 +30,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
this.id = item.id; this.id = item.id;
this.title = item.title; this.title = item.title;
//this.value = item.value; //this.value = item.value;
this.numbering = item.numbering;
this.description = item.description; this.description = item.description;
this.extendedDescription = item.extendedDescription; this.extendedDescription = item.extendedDescription;
this.viewStyle = item.viewStyle; this.viewStyle = item.viewStyle;

View File

@ -11,6 +11,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
//public fieldGroups: Array<FieldGroup>; //public fieldGroups: Array<FieldGroup>;
public defaultVisibility: boolean; public defaultVisibility: boolean;
public page: number; public page: number;
public numbering: string;
public ordinal: number; public ordinal: number;
public id: string; public id: string;
public title: string; public title: string;
@ -22,6 +23,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
//this.fieldGroups = new JsonSerializer<FieldGroup>().fromJSONArray(item.fieldGroups, FieldGroup); //this.fieldGroups = new JsonSerializer<FieldGroup>().fromJSONArray(item.fieldGroups, FieldGroup);
this.page = item.page; this.page = item.page;
this.defaultVisibility = item.defaultVisibility; this.defaultVisibility = item.defaultVisibility;
this.numbering = item.numbering;
this.id = item.id; this.id = item.id;
this.title = item.title; this.title = item.title;
this.ordinal = item.ordinal; this.ordinal = item.ordinal;

View File

@ -0,0 +1,9 @@
export class Pair<L, R> {
public readonly left: L;
public readonly right: R;
constructor(left: L, right: R) {
this.left = left;
this.right = right;
}
}

View File

@ -29,7 +29,7 @@ export class BreadCrumbResolverService {
} }
public resolve(activatedRoute: ActivatedRoute): Observable<BreadcrumbItem[]> { public resolve(activatedRoute: ActivatedRoute): Observable<BreadcrumbItem[]> {
this.breadCrumbs = Observable.of([]); this.breadCrumbs = null;
const routeComponents = this.getComponentsFromRoute(activatedRoute, []); const routeComponents = this.getComponentsFromRoute(activatedRoute, []);
this.activeComponents.filter(x => routeComponents.indexOf(x.constructor.name) !== -1).forEach(x => { this.activeComponents.filter(x => routeComponents.indexOf(x.constructor.name) !== -1).forEach(x => {
if (x.hasOwnProperty('breadCrumbs')) { if (x.hasOwnProperty('breadCrumbs')) {

View File

@ -1,17 +1,17 @@
import 'rxjs/add/operator/map';
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { HostConfiguration } from './../../app.constants';
import 'rxjs/add/operator/map';
import { environment } from '../../../environments/environment';
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
import { RequestItem } from '../../models/criteria/RequestItem';
import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel';
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { DataTableData } from '../../models/data-table/DataTableData';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel';
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service'; import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
import { Observable } from 'rxjs';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DataTableData } from '../../models/data-table/DataTableData';
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel';
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { RequestItem } from '../../models/criteria/RequestItem';
import { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
@Injectable() @Injectable()
@ -22,7 +22,7 @@ export class DataManagementPlanService {
constructor(private http: BaseHttpService, private httpClient: HttpClient) { constructor(private http: BaseHttpService, private httpClient: HttpClient) {
this.actionUrl = environment.Server + 'dmps/'; this.actionUrl = HostConfiguration.Server + 'dmps/';
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
this.headers = this.headers.set('Content-Type', 'application/json'); this.headers = this.headers.set('Content-Type', 'application/json');
@ -75,4 +75,12 @@ export class DataManagementPlanService {
public downloadXML(id: string): Observable<HttpResponse<Blob>> { public downloadXML(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' }); return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' });
} }
public downloadDocx(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'getWord/' + id, { responseType: 'blob', observe: 'response' });
}
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response' });
}
} }

View File

@ -7,7 +7,6 @@
</a> </a>
</li> </li>
<mat-icon fxFlex="nogrow">chevron_right</mat-icon> <mat-icon fxFlex="nogrow">chevron_right</mat-icon>
</div> </div>
</div> </div>
</ol> </ol>

View File

@ -30,7 +30,8 @@ export class BreadcrumbComponent implements OnInit {
} }
buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> { buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> {
return this.breadCrumbService.resolve(route).map(x => { x.unshift({ label: 'Dashboard', url: '/welcome' }); return x; }); if (this.breadCrumbService.resolve(route)) { return this.breadCrumbService.resolve(route).map(x => { x.unshift({ label: 'Dashboard', url: '/welcome' }); return x; }); }
return Observable.of([]);
} }
navigate(url, params) { navigate(url, params) {

View File

@ -0,0 +1,9 @@
interface Array<T> {
flatJoinOn<E, J>(by: (item: T) => J): Array<E>;
}
Array.prototype.flatJoinOn = function (f: Function) {
return this.groupBy(f).reduce((ys: any, x: any) => {
return ys.concat(f.call(this, x));
}, []);
};

View File

@ -0,0 +1,9 @@
interface Array<T> {
flatMap<E>(callback: (t: T) => Array<E>): Array<E>;
}
Array.prototype.flatMap = function (f: Function) {
return this.reduce((ys: any, x: any) => {
return ys.concat(f.call(this, x));
}, []);
};

View File

@ -0,0 +1,11 @@
interface Array<T> {
groupBy<E, J>(by: (item: T) => J): Array<Array<E>>;
}
Array.prototype.groupBy = function (f: Function) {
return this.reduce((ys: any, x: any) => {
ys[f.call(this, x)] = ys[f.call(this, x)] || [];
ys[f.call(this, x)].push(x);
return ys;
}, []);
};

View File

@ -0,0 +1,36 @@
import { Injectable } from '@angular/core';
import { CompositeField } from '../../models/CompositeField';
import { Router, ActivatedRoute } from '@angular/router';
import { Pair } from '../../models/helpers/Pair';
import '../../utilities/enhancers/groupBy';
import { VisibilityRulesService } from '../visibility-rules/visibility-rules.service';
@Injectable()
export class FormFocusService {
private compositeFields: Pair<CompositeField[], number>[] = [];
constructor(
public router: Router,
public route: ActivatedRoute,
public visibilityService: VisibilityRulesService
) {
}
setFields(compositeFields: Pair<CompositeField[], number>[]) {
this.compositeFields = compositeFields;
}
focusNext(field: CompositeField) {
const flattenedCompositeFields = this.compositeFields.groupBy(x => x.right)
.map(x => x.reduce((first: Pair<CompositeField[], number>, second: Pair<CompositeField[], number>) =>
(new Pair<CompositeField[], number>(first.left.concat(second.left), first.right))));
const page = flattenedCompositeFields.filter(x => x['left'].map(y => y.id).indexOf(field.id) !== -1)[0];
let pageIndex = page['right'];
const currentFields = page['left'].filter(x => this.visibilityService.checkElementVisibility(x.id)).map(x => x.id);
const fieldIndex = currentFields.indexOf(field.id);
if (fieldIndex === currentFields.length - 1) { pageIndex = pageIndex + 1; }
this.router.navigate(['datasets/' + this.route.snapshot.url[0] + '/' + this.route.snapshot.url[1]], { fragment: page['left'].filter(x => this.visibilityService.checkElementVisibility(x.id))[fieldIndex].id, queryParams: { page: pageIndex } });
}
}

View File

@ -0,0 +1,22 @@
import { Injectable } from '@angular/core';
import { CompositeField } from '../../models/CompositeField';
@Injectable()
export class MarkForConsiderationService {
private compositeFields: CompositeField[] = [];
markForConsideration(field: CompositeField) {
if (this.exists(field)) {
this.compositeFields.push(field);
}
}
getFields() {
return this.compositeFields;
}
exists(field: CompositeField) {
return this.compositeFields.map(x => x.id).indexOf(field.id) === -1;
}
}

View File

@ -39,7 +39,7 @@ export class VisibilityRulesService {
} }
public checkElementVisibility(id: string): boolean { public checkElementVisibility(id: string): boolean {
if (!this.elementVisibilityMap.has(id) || this.elementVisibilityMap.get(id)) { return true; } else { return false; } return !this.elementVisibilityMap.has(id) || this.elementVisibilityMap.get(id);
} }
public buildVisibilityRules(item: Array<Rule>) { public buildVisibilityRules(item: Array<Rule>) {
@ -55,7 +55,7 @@ export class VisibilityRulesService {
private evaluateVisibility(visibilityRule: VisibilityRule) { private evaluateVisibility(visibilityRule: VisibilityRule) {
for (let i = 0; i < visibilityRule.sourceVisibilityRules.length; i++) { for (let i = 0; i < visibilityRule.sourceVisibilityRules.length; i++) {
const pathKey = this.fieldsPathMemory[visibilityRule.sourceVisibilityRules[i].sourceControlId]; const pathKey = this.fieldsPathMemory[visibilityRule.sourceVisibilityRules[i].sourceControlId];
if (this.formGroup.get(pathKey + '.value') && ((this.formGroup.get(pathKey + '.value').value == null || this.formGroup.get(pathKey + '.value').value == null) || '' + this.formGroup.get(pathKey + '.value').value !== '' + visibilityRule.sourceVisibilityRules[i].sourceControlValue)) { if (this.formGroup.get(pathKey + '.value') && (this.parseValue(this.formGroup.get(pathKey + '.value').value) !== this.parseValue(visibilityRule.sourceVisibilityRules[i].sourceControlValue))) {
if (this.formGroup.get(pathKey).parent.get('id')) { if (this.formGroup.get(pathKey).parent.get('id')) {
if (!this.checkElementVisibility(this.formGroup.get(pathKey).parent.get('id').value)) { if (!this.checkElementVisibility(this.formGroup.get(pathKey).parent.get('id').value)) {
const targetPathKey = this.fieldsPathMemory[visibilityRule.targetControlId]; const targetPathKey = this.fieldsPathMemory[visibilityRule.targetControlId];
@ -88,20 +88,11 @@ export class VisibilityRulesService {
} }
} }
// deleteFromModel(path: string, obj: any) { parseValue(value: any) {
// if (!path) return if (typeof value === 'string') {
// const _obj = JSON.parse(JSON.stringify(obj)); if (value === 'true') { return true; } else if (value === 'false') { return false; } else { return this.translate(value); }
// const keys = path.split('.'); } else { return value; }
}
// keys.reduce((acc, key, index) => {
// if (index === keys.length - 1) {
// delete acc[key];
// return true;
// }
// return acc[key];
// }, _obj);
// return _obj;
// }
updateValue(obj, value, path) { updateValue(obj, value, path) {
let i; let i;
@ -146,4 +137,12 @@ export class VisibilityRulesService {
} }
} }
} }
private translate(item: any) {
try {
return JSON.parse(item).value;
} catch (error) {
return item;
}
}
} }

View File

@ -72,7 +72,9 @@
"NEW-VERSION": "New Version", "NEW-VERSION": "New Version",
"VIEW-VERSION": "All DMP Versions", "VIEW-VERSION": "All DMP Versions",
"CLONE": "Clone", "CLONE": "Clone",
"DOWNLOAD-XML": "Download XML" "DOWNLOAD-XML": "Download XML",
"DOWNLOAD-DOCX": "Download Document",
"DOWNLOAD-PDF": "Download PDF"
} }
}, },
"DATASET-WIZARD": { "DATASET-WIZARD": {
@ -132,6 +134,30 @@
"DATASET-PUBLIC-LISTING": { "DATASET-PUBLIC-LISTING": {
"TITLE": "Published dataset descriptions" "TITLE": "Published dataset descriptions"
}, },
"DATASET-PROFILE-LISTING": {
"TITLE": "Dataset Profiles",
"COLUMNS": {
"NAME": "Name",
"REFERNCE": "Reference",
"PROJECT": "Project",
"URI": "Uri",
"STATUS": "Status",
"DESCRIPTION": "Description",
"CREATED": "Created",
"ACTIONS": "Actions",
"DMP": "Dmp",
"PROFILE": "Profile",
"DATAREPOSITORIES": "Data Repositories",
"REGISTRIES": "Registries",
"SERVICES": "Services"
},
"ACTIONS": {
"EDIT": "Edit",
"MAKE-IT-PUBLIC": "Make it public",
"VIEW": "View",
"CLONE": "Clone"
}
},
"DMP-PROFILE-EDITOR": { "DMP-PROFILE-EDITOR": {
"TITLE": { "TITLE": {
"NEW": "New DMP Profile", "NEW": "New DMP Profile",
@ -195,6 +221,24 @@
"FINALISE": "Finalise" "FINALISE": "Finalise"
} }
}, },
"DMP-PROFILE-LISTING": {
"TITLE": "DMP Profiles",
"COLUMNS": {
"NAME": "Name",
"STATUS": "Status",
"CREATED": "Created"
}
},
"DYNAMIC-FORM": {
"FIELDS": {
"LABEL": "Label"
},
"ACTIONS": {
"PREVIEW": "Preview",
"ADD-PAGE": "Add Page +",
"ADD-SECTION": "Add Section +"
}
},
"CRITERIA": { "CRITERIA": {
"FILTERS": "Filters", "FILTERS": "Filters",
"PROJECTS": { "PROJECTS": {
@ -207,8 +251,10 @@
"FINISHED": "Finished" "FINISHED": "Finished"
} }
}, },
"DATASET-PROFILE": {
"LIKE": "Search"
},
"DATA-SETS": { "DATA-SETS": {
"LIKE": "Search",
"PERIOD-FROM": "Start", "PERIOD-FROM": "Start",
"PERIOD-TO": "End", "PERIOD-TO": "End",
"STATUS": "Status", "STATUS": "Status",
@ -316,6 +362,11 @@
"SAVE": "Save" "SAVE": "Save"
} }
}, },
"DATASET-PROFILE": {
"PREVIEW": "Preview",
"FORM-DESCRIPTION": "Form Description",
"PAGES-DESCRIPTION": "Pages Description"
},
"RECENT-ACTIVITY": { "RECENT-ACTIVITY": {
"MY-TITLE-PROJECT": "My Recent Project Activity", "MY-TITLE-PROJECT": "My Recent Project Activity",
"MY-TITLE-DMP": "My Recent DMP Activity", "MY-TITLE-DMP": "My Recent DMP Activity",