table of contents + pagination
This commit is contained in:
parent
95c5dd4a60
commit
80115ed3cf
|
@ -89,12 +89,16 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
Element description = doc.createElement("description");
|
Element description = doc.createElement("description");
|
||||||
description.setTextContent(this.description);
|
description.setTextContent(this.description);
|
||||||
|
|
||||||
|
Element title = doc.createElement("title");
|
||||||
|
title.setTextContent(this.title);
|
||||||
|
|
||||||
Element viewStyle = doc.createElement("viewStyle");
|
Element viewStyle = doc.createElement("viewStyle");
|
||||||
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
||||||
viewStyle.setAttribute("cssClass", this.viewStyle.getCssClass());
|
viewStyle.setAttribute("cssClass", this.viewStyle.getCssClass());
|
||||||
|
|
||||||
Element visibility = this.visible.toXml(doc);
|
Element visibility = this.visible.toXml(doc);
|
||||||
|
|
||||||
|
rootElement.appendChild(title);
|
||||||
rootElement.appendChild(visibility);
|
rootElement.appendChild(visibility);
|
||||||
rootElement.appendChild(extendedDescription);
|
rootElement.appendChild(extendedDescription);
|
||||||
rootElement.appendChild(viewStyle);
|
rootElement.appendChild(viewStyle);
|
||||||
|
@ -114,6 +118,9 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
Element description = (Element)element.getElementsByTagName("description").item(0);
|
Element description = (Element)element.getElementsByTagName("description").item(0);
|
||||||
this.description = description.getTextContent();
|
this.description = description.getTextContent();
|
||||||
|
|
||||||
|
Element title = (Element)element.getElementsByTagName("title").item(0);
|
||||||
|
this.title = title.getTextContent();
|
||||||
|
|
||||||
this.viewStyle = new ViewStyle();
|
this.viewStyle = new ViewStyle();
|
||||||
Element viewStyle = (Element)element.getElementsByTagName("viewStyle").item(0);
|
Element viewStyle = (Element)element.getElementsByTagName("viewStyle").item(0);
|
||||||
this.viewStyle.setRenderStyle(viewStyle.getAttribute("renderstyle"));
|
this.viewStyle.setRenderStyle(viewStyle.getAttribute("renderstyle"));
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import utilities.XmlSerializable;
|
import utilities.XmlSerializable;
|
||||||
|
import utilities.builders.XmlBuilder;
|
||||||
|
|
||||||
public class FieldGroup implements DatabaseViewStyleDefinition,XmlSerializable<FieldGroup>{
|
public class FieldGroup implements DatabaseViewStyleDefinition,XmlSerializable<FieldGroup>{
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -97,6 +98,9 @@ public class FieldGroup implements DatabaseViewStyleDefinition,XmlSerializable<F
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldGroup fromXml(Element element) {
|
public FieldGroup fromXml(Element element) {
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
|
@ -104,12 +108,15 @@ public class FieldGroup implements DatabaseViewStyleDefinition,XmlSerializable<F
|
||||||
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
||||||
this.page = Integer.parseInt(element.getAttribute("page"));
|
this.page = Integer.parseInt(element.getAttribute("page"));
|
||||||
|
|
||||||
Element title = (Element)element.getElementsByTagName("title").item(0);
|
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"title");
|
||||||
this.title = title.getTextContent();
|
this.title = title.getTextContent();
|
||||||
|
|
||||||
Element extendedDescription = (Element)element.getElementsByTagName("extendedDescription").item(0);
|
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"extendedDescription");
|
||||||
this.extendedDescription = extendedDescription.getTextContent();
|
this.extendedDescription = extendedDescription.getTextContent();
|
||||||
|
|
||||||
|
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"description");
|
||||||
|
this.description = description .getTextContent();
|
||||||
|
|
||||||
this.fieldSets = new LinkedList();
|
this.fieldSets = new LinkedList();
|
||||||
Element fieldSets = (Element)element.getElementsByTagName("fieldsets").item(0);
|
Element fieldSets = (Element)element.getElementsByTagName("fieldsets").item(0);
|
||||||
if(fieldSets!=null){
|
if(fieldSets!=null){
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import utilities.XmlSerializable;
|
import utilities.XmlSerializable;
|
||||||
|
import utilities.builders.XmlBuilder;
|
||||||
|
|
||||||
public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Section>{
|
public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Section>{
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -91,6 +92,9 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
Element extendedDescription = doc.createElement("extendedDescription");
|
Element extendedDescription = doc.createElement("extendedDescription");
|
||||||
extendedDescription.setTextContent(this.extendedDescription);
|
extendedDescription.setTextContent(this.extendedDescription);
|
||||||
|
|
||||||
|
Element title = doc.createElement("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){
|
||||||
|
@ -106,6 +110,8 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
}
|
}
|
||||||
rootElement.appendChild(formGroups);
|
rootElement.appendChild(formGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootElement.appendChild(title);
|
||||||
rootElement.appendChild(extendedDescription);
|
rootElement.appendChild(extendedDescription);
|
||||||
rootElement.appendChild(description);
|
rootElement.appendChild(description);
|
||||||
|
|
||||||
|
@ -119,11 +125,14 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
||||||
this.page = Integer.parseInt(element.getAttribute("page"));
|
this.page = Integer.parseInt(element.getAttribute("page"));
|
||||||
|
|
||||||
Element description = (Element)element.getElementsByTagName("description").item(0);
|
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"description");
|
||||||
if(description!=null) this.description = description.getTextContent();
|
if(description!=null) this.description = description.getTextContent();
|
||||||
|
|
||||||
Element extendedDescription = (Element)element.getElementsByTagName("extendedDescription").item(0);
|
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"extendedDescription");
|
||||||
if(extendedDescription != null) this.extendedDescription = description.getTextContent();
|
if(extendedDescription != null) this.extendedDescription = extendedDescription.getTextContent();
|
||||||
|
|
||||||
|
Element title =XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"title");
|
||||||
|
if(title!=null) this.title = title.getTextContent();
|
||||||
|
|
||||||
this.sections = new LinkedList<Section>();
|
this.sections = new LinkedList<Section>();
|
||||||
Element sections = (Element)element.getElementsByTagName("sections").item(0);
|
Element sections = (Element)element.getElementsByTagName("sections").item(0);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class AdminManager {
|
||||||
entities.DatasetProfile datasetProfile = new entities.DatasetProfile();
|
entities.DatasetProfile datasetProfile = new entities.DatasetProfile();
|
||||||
datasetProfile.setDefinition(xml);
|
datasetProfile.setDefinition(xml);
|
||||||
datasetProfile.setStatus((short)1);
|
datasetProfile.setStatus((short)1);
|
||||||
datasetProfile.setLabel("dasd");
|
datasetProfile.setLabel(profile.getLabel());
|
||||||
datasetProfile.setCreated(new Date());
|
datasetProfile.setCreated(new Date());
|
||||||
return datasetProfile;
|
return datasetProfile;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class AdminManager {
|
||||||
|
|
||||||
DatasetProfileViewstyle datasetProfileViewstyle = new DatasetProfileViewstyle();
|
DatasetProfileViewstyle datasetProfileViewstyle = new DatasetProfileViewstyle();
|
||||||
datasetProfileViewstyle.setDefinition(xml);
|
datasetProfileViewstyle.setDefinition(xml);
|
||||||
datasetProfileViewstyle.setLabel("skdjal");
|
datasetProfileViewstyle.setLabel(profile.getLabel());
|
||||||
return datasetProfileViewstyle;
|
return datasetProfileViewstyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import models.admin.components.datasetprofile.*;
|
import models.admin.components.datasetprofile.*;
|
||||||
|
|
||||||
public class DatasetProfile {
|
public class DatasetProfile {
|
||||||
|
private String label;
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
public List<Section> getSections() {
|
||||||
|
@ -16,9 +17,16 @@ public class DatasetProfile {
|
||||||
|
|
||||||
public void setSections(List<Section> sections) {
|
public void setSections(List<Section> sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
public void buildProfile(entities.xmlmodels.modeldefinition.FieldGroup fieldGroup,entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
public void buildProfile(entities.xmlmodels.modeldefinition.FieldGroup fieldGroup,entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||||
updateProfile(fieldGroup,viewStyle);
|
updateProfile(fieldGroup,viewStyle);
|
||||||
|
|
|
@ -102,11 +102,22 @@ public class ComboBoxData extends FieldData<ComboBoxData>{
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ComboBoxData fromData(Object data) {
|
public ComboBoxData fromData(Object data) {
|
||||||
|
this.options = new LinkedList();
|
||||||
|
|
||||||
if(data!=null){
|
if(data!=null){
|
||||||
this.type = (String)((Map<String,Object>)data).get("type");
|
this.type = (String)((Map<String,Object>)data).get("type");
|
||||||
this.url = (String)((Map<String,Object>)data).get("url");
|
this.url = (String)((Map<String,Object>)data).get("url");
|
||||||
this.options = (List<Option>)((Map<String,Object>)data).get("options");
|
List<Map<String,String>> options = ((Map<String,List<Map<String,String>>>)data).get("options");
|
||||||
|
if(options!=null){
|
||||||
|
for(Map<String,String> map : options){
|
||||||
|
Option newOption = new Option();
|
||||||
|
newOption.setLabel(map.get("label"));
|
||||||
|
newOption.setValue(map.get("value"));
|
||||||
|
this.options.add(newOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package models.properties;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||||
|
|
||||||
|
import models.components.commons.DefaultValue;
|
||||||
|
import models.components.commons.Multiplicity;
|
||||||
|
import models.components.commons.ViewStyle;
|
||||||
|
import models.components.commons.Visibility;
|
||||||
|
import utilities.ModelDefinition;
|
||||||
|
import utilities.ViewStyleDefinition;
|
||||||
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
|
public class Field implements PropertiesGenerator{
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toMap(Map<String,String> fieldValues){
|
||||||
|
fieldValues.put(this.id, this.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package models.properties;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||||
|
|
||||||
|
import models.components.commons.Multiplicity;
|
||||||
|
import utilities.ModelDefinition;
|
||||||
|
import utilities.ViewStyleDefinition;
|
||||||
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
|
public class FieldSet implements PropertiesGenerator{
|
||||||
|
private List<Field> fields;
|
||||||
|
|
||||||
|
public List<Field> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<Field> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toMap(Map<String, String> fieldValues) {
|
||||||
|
this.fields.forEach(item->item.toMap(fieldValues));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package models.properties;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||||
|
|
||||||
|
import entities.xmlmodels.viewstyledefinition.FieldGroup;
|
||||||
|
import utilities.ModelDefinition;
|
||||||
|
import utilities.ViewStyleDefinition;
|
||||||
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
|
public class Group implements PropertiesGenerator{
|
||||||
|
private List<FieldSet> compositeFields;
|
||||||
|
|
||||||
|
|
||||||
|
public List<FieldSet> getCompositeFields() {
|
||||||
|
return compositeFields;
|
||||||
|
}
|
||||||
|
public void setCompositeFields(List<FieldSet> compositeFields) {
|
||||||
|
this.compositeFields = compositeFields;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void toMap(Map<String, String> fieldValues) {
|
||||||
|
this.compositeFields.forEach(item->item.toMap(fieldValues));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package models.properties;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface PropertiesGenerator {
|
||||||
|
void toMap(Map<String,String> fieldValues);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package models.properties;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class PropertiesModel implements PropertiesGenerator{
|
||||||
|
private List<Section> sections;
|
||||||
|
|
||||||
|
public List<Section> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSections(List<Section> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toMap(Map<String, String> fieldValues) {
|
||||||
|
this.sections.forEach(item->item.toMap(fieldValues));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package models.properties;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import utilities.ModelDefinition;
|
||||||
|
import utilities.ViewStyleDefinition;
|
||||||
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
|
public class Section implements PropertiesGenerator{
|
||||||
|
|
||||||
|
private List<Section> sections;
|
||||||
|
private List<Group> fieldGroups;
|
||||||
|
|
||||||
|
public List<Section> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
public void setSections(List<Section> sections) {
|
||||||
|
this.sections = sections;
|
||||||
|
}
|
||||||
|
public List<Group> getFieldGroups() {
|
||||||
|
return fieldGroups;
|
||||||
|
}
|
||||||
|
public void setFieldGroups(List<Group> fieldGroups) {
|
||||||
|
this.fieldGroups = fieldGroups;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void toMap(Map<String, String> fieldValues) {
|
||||||
|
this.sections.forEach(item->item.toMap(fieldValues));
|
||||||
|
this.fieldGroups.forEach(item->item.toMap(fieldValues));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package models.user.components.datasetprofile;
|
package models.user.components.datasetprofile;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
|
@ -9,11 +11,12 @@ import models.components.commons.DefaultValue;
|
||||||
import models.components.commons.Multiplicity;
|
import models.components.commons.Multiplicity;
|
||||||
import models.components.commons.ViewStyle;
|
import models.components.commons.ViewStyle;
|
||||||
import models.components.commons.Visibility;
|
import models.components.commons.Visibility;
|
||||||
|
import models.user.composite.PropertiesModelBuilder;
|
||||||
import utilities.ModelDefinition;
|
import utilities.ModelDefinition;
|
||||||
import utilities.ViewStyleDefinition;
|
import utilities.ViewStyleDefinition;
|
||||||
import utilities.builders.ModelBuilder;
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Field implements ModelDefinition<entities.xmlmodels.modeldefinition.Field>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Field>{
|
public class Field implements PropertiesModelBuilder, ModelDefinition<entities.xmlmodels.modeldefinition.Field>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Field>{
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private String title;
|
private String title;
|
||||||
|
@ -150,6 +153,11 @@ public class Field implements ModelDefinition<entities.xmlmodels.modeldefinition
|
||||||
this.title = item.getTitle();
|
this.title = item.getTitle();
|
||||||
this.viewStyle = item.getViewStyle();
|
this.viewStyle = item.getViewStyle();
|
||||||
this.data = item.getData();
|
this.data = item.getData();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
|
this.value = (String)properties.get(this.id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,15 +2,17 @@ package models.user.components.datasetprofile;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||||
|
|
||||||
import models.components.commons.Multiplicity;
|
import models.components.commons.Multiplicity;
|
||||||
|
import models.user.composite.PropertiesModelBuilder;
|
||||||
import utilities.ModelDefinition;
|
import utilities.ModelDefinition;
|
||||||
import utilities.ViewStyleDefinition;
|
import utilities.ViewStyleDefinition;
|
||||||
import utilities.builders.ModelBuilder;
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class FieldSet implements ModelDefinition<entities.xmlmodels.modeldefinition.FieldSet>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.FieldSet>{
|
public class FieldSet implements PropertiesModelBuilder, ModelDefinition<entities.xmlmodels.modeldefinition.FieldSet>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.FieldSet>{
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private Multiplicity multiplicity;
|
private Multiplicity multiplicity;
|
||||||
|
@ -80,6 +82,12 @@ public class FieldSet implements ModelDefinition<entities.xmlmodels.modeldefinit
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
|
this.fields.forEach(item->item.fromJsonObject(properties));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
package models.user.components.datasetprofile;
|
package models.user.components.datasetprofile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||||
|
|
||||||
import entities.xmlmodels.viewstyledefinition.FieldGroup;
|
import entities.xmlmodels.viewstyledefinition.FieldGroup;
|
||||||
|
import models.user.composite.PropertiesModelBuilder;
|
||||||
import utilities.ModelDefinition;
|
import utilities.ModelDefinition;
|
||||||
import utilities.ViewStyleDefinition;
|
import utilities.ViewStyleDefinition;
|
||||||
import utilities.builders.ModelBuilder;
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Group implements ModelDefinition<entities.xmlmodels.modeldefinition.FieldGroup>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.FieldGroup>{
|
public class Group implements PropertiesModelBuilder, ModelDefinition<entities.xmlmodels.modeldefinition.FieldGroup>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.FieldGroup>{
|
||||||
private String id;
|
private String id;
|
||||||
private String title;
|
private String title;
|
||||||
private String section;
|
private String section;
|
||||||
|
@ -115,4 +117,9 @@ public class Group implements ModelDefinition<entities.xmlmodels.modeldefinition
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
|
this.compositeFields.forEach(item->item.fromJsonObject(properties));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package models.user.components.datasetprofile;
|
package models.user.components.datasetprofile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import models.user.composite.PropertiesModelBuilder;
|
||||||
import utilities.ModelDefinition;
|
import utilities.ModelDefinition;
|
||||||
import utilities.ViewStyleDefinition;
|
import utilities.ViewStyleDefinition;
|
||||||
import utilities.builders.ModelBuilder;
|
import utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Section implements ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Section>{
|
public class Section implements ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Section>,PropertiesModelBuilder{
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<Group> fieldGroups;
|
private List<Group> fieldGroups;
|
||||||
private Boolean defaultVisibility;
|
private Boolean defaultVisibility;
|
||||||
|
@ -87,6 +89,11 @@ public class Section implements ViewStyleDefinition<entities.xmlmodels.viewstyle
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
|
this.sections.forEach(item->item.fromJsonObject(properties));
|
||||||
|
this.fieldGroups.forEach(item->item.fromJsonObject(properties));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,12 @@ import utilities.builders.ModelBuilder;
|
||||||
import utilities.helpers.ModelBuilderCollector;
|
import utilities.helpers.ModelBuilderCollector;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import models.user.components.datasetprofile.*;
|
import models.user.components.datasetprofile.*;
|
||||||
import models.user.components.commons.Rule;
|
import models.user.components.commons.Rule;
|
||||||
|
|
||||||
public class DatasetProfile {
|
public class DatasetProfile implements PropertiesModelBuilder{
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<Rule> rules;
|
private List<Rule> rules;
|
||||||
public List<Section> getSections() {
|
public List<Section> getSections() {
|
||||||
|
@ -38,5 +39,11 @@ public class DatasetProfile {
|
||||||
this.rules = ModelBuilderCollector.collectRules(viewStyle.getSections());
|
this.rules = ModelBuilderCollector.collectRules(viewStyle.getSections());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
|
this.sections.forEach(item->item.fromJsonObject(properties));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package models.user.composite;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface PropertiesModelBuilder {
|
||||||
|
void fromJsonObject(Map<String,Object> properties);
|
||||||
|
}
|
|
@ -4,11 +4,10 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -62,6 +61,34 @@ public class Admin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp/{id}" },consumes = "application/json", produces="application/json")
|
||||||
|
public ResponseEntity<Object> updateDmp(@PathVariable String id,@RequestBody DatasetProfile profile){
|
||||||
|
try{
|
||||||
|
entities.DatasetProfile modelDefinition = AdminManager.generateModelDefinition(profile);
|
||||||
|
entities.DatasetProfileViewstyle viewStyleDefinition = AdminManager.generateViewStyleDefinition(profile);
|
||||||
|
|
||||||
|
|
||||||
|
entities.DatasetProfile datasetprofile = datasetProfileDao.read(UUID.fromString(id));
|
||||||
|
|
||||||
|
entities.DatasetProfileViewstyle oldviewStyle = datasetProfileViewstyleDao.read((datasetprofile.getViewstyle().getId()));
|
||||||
|
oldviewStyle.setDefinition(viewStyleDefinition.getDefinition());
|
||||||
|
datasetProfileViewstyleDao.update(oldviewStyle);
|
||||||
|
|
||||||
|
|
||||||
|
if(!datasetprofile.getDataset().isEmpty())throw new Exception ("Cannot edit a Profile that has Datasets assigned");
|
||||||
|
|
||||||
|
datasetprofile.setViewstyle(oldviewStyle);
|
||||||
|
datasetprofile.setDefinition(modelDefinition.getDefinition());
|
||||||
|
datasetProfileDao.update(datasetprofile);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
|
||||||
|
}catch(Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"reason\":\""+ex.getMessage()+"\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = { "/admin/get/{id}" }, produces="application/json")
|
@RequestMapping(method = RequestMethod.GET, value = { "/admin/get/{id}" }, produces="application/json")
|
||||||
public ResponseEntity<Object> get(@PathVariable String id){
|
public ResponseEntity<Object> get(@PathVariable String id){
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -1,23 +1,31 @@
|
||||||
package rest.entities;
|
package rest.entities;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import dao.entities.DatasetDao;
|
||||||
import dao.entities.DatasetProfileDao;
|
import dao.entities.DatasetProfileDao;
|
||||||
import dao.entities.DatasetProfileRulesetDao;
|
import dao.entities.DatasetProfileRulesetDao;
|
||||||
import dao.entities.DatasetProfileViewstyleDao;
|
import dao.entities.DatasetProfileViewstyleDao;
|
||||||
import helpers.SerializerProvider;
|
import helpers.SerializerProvider;
|
||||||
import managers.AdminManager;
|
import managers.AdminManager;
|
||||||
import managers.UserManager;
|
import managers.UserManager;
|
||||||
|
import models.properties.PropertiesModel;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
|
@ -26,17 +34,40 @@ public class DatasetProfileController {
|
||||||
@Autowired private DatasetProfileDao datasetProfileDao;
|
@Autowired private DatasetProfileDao datasetProfileDao;
|
||||||
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
|
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
|
||||||
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
|
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
|
||||||
|
@Autowired private DatasetDao datasetDao;
|
||||||
@RequestMapping(method = RequestMethod.GET, value = { "/datasetprofile/get/{id}" }, produces="application/json")
|
|
||||||
public ResponseEntity<Object> get(@PathVariable String id){
|
|
||||||
try {
|
|
||||||
entities.DatasetProfile profile = datasetProfileDao.read(UUID.fromString(id));
|
|
||||||
models.user.composite.DatasetProfile datasetprofile = UserManager.generateDatasetProfileModel(profile);
|
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = { "/datasetprofile/get/{id}" }, produces="application/json")
|
||||||
|
public ResponseEntity<Object> getSingle(@PathVariable String id){
|
||||||
|
try {
|
||||||
|
entities.Dataset dataset = datasetDao.read(UUID.fromString(id));
|
||||||
|
models.user.composite.DatasetProfile datasetprofile = UserManager.generateDatasetProfileModel(dataset.getProfile());
|
||||||
|
if(dataset.getProperties()!=null){
|
||||||
|
JSONObject jobject = new JSONObject(dataset.getProperties());
|
||||||
|
Map<String,Object> properties = (Map<String, Object>)jobject.toMap();
|
||||||
|
datasetprofile.fromJsonObject(properties);
|
||||||
|
}
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
|
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = { "/datasetprofile/save/{id}" }, consumes="application/json",produces="application/json")
|
||||||
|
public ResponseEntity<Object> postDataset(@PathVariable String id,@RequestBody PropertiesModel properties){
|
||||||
|
try {
|
||||||
|
entities.Dataset dataset = datasetDao.read(UUID.fromString(id));
|
||||||
|
Map<String,String> values = new HashMap();
|
||||||
|
properties.toMap(values);
|
||||||
|
JSONObject jobject = new JSONObject(values);
|
||||||
|
dataset.setProperties(jobject.toString());
|
||||||
|
datasetDao.update(dataset);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(properties);
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,14 @@ import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import entities.xmlmodels.viewstyledefinition.FieldSet;
|
||||||
|
|
||||||
|
|
||||||
public class XmlBuilder {
|
public class XmlBuilder {
|
||||||
|
|
||||||
|
@ -66,4 +71,14 @@ public class XmlBuilder {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Element getNodeFromListByTagName(NodeList list, String tagName) {
|
||||||
|
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||||
|
Node element = list.item(temp);
|
||||||
|
if (element.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
if(element.getNodeName().equals(tagName))return (Element) element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{"sections":[{"sections":[],"fieldGroups":[{"id":"dataSummaryGroup","title":"Data Summary","value":null,"description":null,"extendedDescription":null,"defaultVisibility":true,"page":null,"ordinal":"1","compositeFields":[{"id":"dataSummaryFS","ordinal":1,"fields":[{"id":"dataSummary","title":null,"description":null,"extendedDescription":null,"defaultVisibility":null,"page":null,"ordinal":1,"multiplicity":{"min":1,"max":1},"defaultValue":{"type":null,"value":null},"viewStyle":{"cssClass":null,"renderStyle":"textarea"},"visible":{"style":null,"rules":[]}}],"multiplicity":{"min":1,"max":1}}]}],"defaultVisibility":true,"page":null,"id":"datasummary","title":"Data Summary","description":null,"ordinal":"1"},{"sections":[{"sections":[],"fieldGroups":[{"id":"FindDataMetadataGroup","title":null,"value":null,"description":null,"extendedDescription":null,"defaultVisibility":true,"page":null,"ordinal":"2","compositeFields":[{"id":"useMetadataQ211FS","ordinal":1,"fields":[{"id":"useMetadataQ211","title":"Q2.1.1 Will you use metadata to describe the data?","description":"User can select from a list of metadata standards. If they cannot find the standard in the list provided then they should choose \"not listed\". Selecting this will result in a field in which the user can insert the URL to the description of the metadata scheme used. A \"comments\" box should exist to allow users to add comments. They may select more than one metadata standard. They may specify more than one URL when selecting \"not listed\". They are also presented with a field in which to specify the location of the metadata service. Users can select the \"no metadata\" button to specify no metadata will be used to describe the data.","extendedDescription":null,"defaultVisibility":true,"page":null,"ordinal":1,"multiplicity":{"min":1,"max":1},"defaultValue":{"type":null,"value":null},"viewStyle":{"cssClass":null,"renderStyle":"booleanDesicion"},"visible":{"style":null,"rules":[]}}],"multiplicity":{"min":1,"max":1}}]}],"defaultVisibility":true,"page":null,"id":"dataMetadata","title":"2.1 Making data findable, including provisions for metadata","description":null,"ordinal":"3"}],"fieldGroups":[],"defaultVisibility":null,"page":null,"id":"fairData","title":"2 Fair Data","description":null,"ordinal":null}],"label":"Horizon 2020 template"}
|
|
@ -49,7 +49,7 @@ const appRoutes: Routes = [
|
||||||
RouterModule.forRoot(
|
RouterModule.forRoot(
|
||||||
appRoutes
|
appRoutes
|
||||||
,{
|
,{
|
||||||
useHash: true
|
useHash: false
|
||||||
//,enableTracing: true <-- debugging purposes only
|
//,enableTracing: true <-- debugging purposes only
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
import {
|
||||||
|
TableOfContentsFieldComponent,
|
||||||
|
} from './form/tableOfContents/table-of-content-field/table-of-content-field.component';
|
||||||
|
import { ProgressBarComponent } from './form/pprogress-bar/progress-bar.component';
|
||||||
|
import {
|
||||||
|
TableOfContentsSectionComponent,
|
||||||
|
} from './form/tableOfContents/table-of-content-section/table-of-content-section.component';
|
||||||
|
import {
|
||||||
|
TableOfContentsGroupComponent,
|
||||||
|
} from './form/tableOfContents/table-of-content-group/table-of-content-group.component';
|
||||||
|
import {
|
||||||
|
TableOfContentsFieldSetComponent,
|
||||||
|
} from './form/tableOfContents/table-of-content-fieldset/table-of-content-fieldset.component';
|
||||||
|
import { TableOfContentsComponent } from './form/tableOfContents/table-of-contents.component';
|
||||||
import {
|
import {
|
||||||
DynamicFieldRadioBoxComponent,
|
DynamicFieldRadioBoxComponent,
|
||||||
} from './form/dynamic-fields/dynamic-field-radiobox/dynamic-field-radiobox.component';
|
} from './form/dynamic-fields/dynamic-field-radiobox/dynamic-field-radiobox.component';
|
||||||
|
@ -19,7 +33,7 @@ import { RouterModule, Routes, Router } from '@angular/router';
|
||||||
//import {DataTableModule } from 'angular-4-data-table-bootstrap-4';
|
//import {DataTableModule } from 'angular-4-data-table-bootstrap-4';
|
||||||
import { DataTableModule } from "angular2-datatable";
|
import { DataTableModule } from "angular2-datatable";
|
||||||
|
|
||||||
//import { OrganisationTableFilterPipe } from './pipes/organisation-table-filter.pipe';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { RestBase } from './services/rest-base';
|
import { RestBase } from './services/rest-base';
|
||||||
|
@ -34,7 +48,6 @@ import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AuthGuard } from './guards/auth.guard';
|
import { AuthGuard } from './guards/auth.guard';
|
||||||
import { PageNotFoundComponent } from './not-found.component';
|
import { PageNotFoundComponent } from './not-found.component';
|
||||||
import { HomepageComponent } from './homepage/homepage.component';
|
import { HomepageComponent } from './homepage/homepage.component';
|
||||||
import { TocComponent } from './form/tableOfContents/toc.component';
|
|
||||||
import { ConfirmationComponent } from './widgets/confirmation/confirmation.component';
|
import { ConfirmationComponent } from './widgets/confirmation/confirmation.component';
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +66,7 @@ import { NguiAutoCompleteModule } from '@ngui/auto-complete';
|
||||||
|
|
||||||
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
|
|
||||||
import { BreadcrumbModule, MenuItem } from 'primeng/primeng';
|
import { BreadcrumbModule,PanelModule, MenuItem } from 'primeng/primeng';
|
||||||
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
@ -81,8 +94,7 @@ import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
|
||||||
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
|
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
|
||||||
import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component';
|
import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component';
|
||||||
|
|
||||||
|
import {ProgressBarModule} from 'primeng/primeng';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -93,7 +105,10 @@ import { ProjectDetailedComponent } from './viewers/project-detailed/project-det
|
||||||
DynamicFormCompositeFieldComponent,
|
DynamicFormCompositeFieldComponent,
|
||||||
DynamicFieldBooleanDecisionComponent,
|
DynamicFieldBooleanDecisionComponent,
|
||||||
DynamicFieldRadioBoxComponent,
|
DynamicFieldRadioBoxComponent,
|
||||||
TocComponent,
|
TableOfContentsComponent,
|
||||||
|
TableOfContentsFieldSetComponent,
|
||||||
|
TableOfContentsGroupComponent,
|
||||||
|
TableOfContentsSectionComponent,
|
||||||
GooggleSignInComponent,
|
GooggleSignInComponent,
|
||||||
MainSignInComponent,
|
MainSignInComponent,
|
||||||
PageNotFoundComponent,
|
PageNotFoundComponent,
|
||||||
|
@ -113,6 +128,8 @@ import { ProjectDetailedComponent } from './viewers/project-detailed/project-det
|
||||||
DatasetTableFilterPipe,
|
DatasetTableFilterPipe,
|
||||||
DatasetStatusFilterPipe,
|
DatasetStatusFilterPipe,
|
||||||
StatusToString,
|
StatusToString,
|
||||||
|
TableOfContentsFieldComponent,
|
||||||
|
ProgressBarComponent,
|
||||||
DynamicFieldCheckBoxComponent,
|
DynamicFieldCheckBoxComponent,
|
||||||
BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent
|
BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent
|
||||||
],
|
],
|
||||||
|
@ -131,6 +148,9 @@ import { ProjectDetailedComponent } from './viewers/project-detailed/project-det
|
||||||
Ng4LoadingSpinnerModule,
|
Ng4LoadingSpinnerModule,
|
||||||
NguiAutoCompleteModule,
|
NguiAutoCompleteModule,
|
||||||
BreadcrumbModule,
|
BreadcrumbModule,
|
||||||
|
ProgressBarModule,
|
||||||
|
PanelModule,
|
||||||
|
BrowserAnimationsModule,
|
||||||
SidebarModule.forRoot()
|
SidebarModule.forRoot()
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<label>{{field.description}}</label>
|
<label>{{field.description}}</label>
|
||||||
<div>{{field.extendedDescription}}</div>
|
<div>{{field.extendedDescription}}</div>
|
||||||
<select class="form-control" formControlName="value">
|
<select class="form-control" formControlName="value">
|
||||||
<option *ngFor="let opt of field.data.values" [value]="opt.value">{{opt.label}}</option>
|
<option *ngFor="let opt of field.data.options" [value]="opt.value">{{opt.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
|
@ -2,6 +2,6 @@
|
||||||
<label>{{field.description}}</label>
|
<label>{{field.description}}</label>
|
||||||
<div>{{field.extendedDescription}}</div>
|
<div>{{field.extendedDescription}}</div>
|
||||||
<div *ngFor="let option of this.field.data.options">
|
<div *ngFor="let option of this.field.data.options">
|
||||||
<input type="radio" formControlName="value" value="option.value">{{option.label}}<br>
|
<input type="radio" formControlName="value" [value]="option.value">{{option.label}}<br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -26,22 +26,21 @@
|
||||||
|
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div *ngIf="this.visibilityRulesService.isElementVisible(pathName,field.id)" [formGroup]="form" class="form-group" [ngSwitch]="field.viewStyle.renderStyle">
|
<div [id]="field.id" *ngIf="visibilityRulesService.isElementVisible(pathName,field.id)" [formGroup]="form" [ngSwitch]="field.viewStyle.renderStyle">
|
||||||
<div [ngClass]="{true:'show', false:'hide'}[field.visible]">
|
|
||||||
|
|
||||||
|
|
||||||
<label>{{field.title}}</label>
|
<label>{{path+' '+field.title}}</label>
|
||||||
|
|
||||||
<div *ngSwitchCase="'freetext'">
|
|
||||||
<label>{{field.description}}</label>
|
|
||||||
<div>{{field.extendedDescription}}</div>
|
|
||||||
<input class="form-control" formControlName="value">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--input or change event
|
<div *ngSwitchCase="'freetext'">
|
||||||
|
<label>{{field.description}}</label>
|
||||||
|
<div>{{field.extendedDescription}}</div>
|
||||||
|
<input class="form-control" formControlName="value">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--input or change event
|
||||||
on change event the listener is triggered on blur -->
|
on change event the listener is triggered on blur -->
|
||||||
|
|
||||||
<!-- <div *ngSwitchCase="'dropdown'">
|
<!-- <div *ngSwitchCase="'dropdown'">
|
||||||
|
|
||||||
<autocomplete-remote *ngIf="field.url" formControlName="value" [url]="field.url" ></autocomplete-remote>
|
<autocomplete-remote *ngIf="field.url" formControlName="value" [url]="field.url" ></autocomplete-remote>
|
||||||
|
|
||||||
|
@ -50,51 +49,49 @@
|
||||||
</select>
|
</select>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div *ngSwitchCase="'combobox'">
|
<div *ngSwitchCase="'combobox'">
|
||||||
<!--TODO-->
|
<!--TODO-->
|
||||||
<div *ngIf="this.field.data.type === 'autocomplete'">
|
<div *ngIf="this.field.data.type === 'autocomplete'">
|
||||||
<df-autocomplete [form]="form" [field]="field"></df-autocomplete>
|
<df-autocomplete [form]="form" [field]="field"></df-autocomplete>
|
||||||
</div>
|
|
||||||
<div *ngIf="this.field.data.type === 'wordlist'">
|
|
||||||
<df-dropdown [form]="form" [field]="field"></df-dropdown>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="this.field.data.type === 'wordlist'">
|
||||||
|
<df-dropdown [form]="form" [field]="field"></df-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- <div *ngSwitchCase="'checkbox'" class="checkbox">
|
<!-- <div *ngSwitchCase="'checkbox'" class="checkbox">
|
||||||
<label class="checkBoxLabelCustom">
|
<label class="checkBoxLabelCustom">
|
||||||
<input *ngSwitchCase="'checkbox'" class="form-check" formControlName="value" [type]="field.type"
|
<input *ngSwitchCase="'checkbox'" class="form-check" formControlName="value" [type]="field.type"
|
||||||
(change)="toggleVisibility($event, field, true)" [required]="field.required" [checked]="form.get(field.key).value">{{field.label}}
|
(change)="toggleVisibility($event, field, true)" [required]="field.required" [checked]="form.get(field.key).value">{{field.label}}
|
||||||
</label>
|
</label>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div *ngSwitchCase="'checkBox'" class="checkbox">
|
<div *ngSwitchCase="'checkBox'" class="checkbox">
|
||||||
<df-checkbox [form]="form" [field]="field"></df-checkbox>
|
<df-checkbox [form]="form" [field]="field"></df-checkbox>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngSwitchCase="'textarea'">
|
|
||||||
<textarea class="form-control" formControlName="value"> </textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngSwitchCase="'booleanDecision'">
|
|
||||||
<df-booleanDecision [form]="form" [field]="field"></df-booleanDecision>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngSwitchCase="'radiobox'">
|
|
||||||
<df-radiobox [form]="form" [field]="field"></df-radiobox>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngSwitchCase="'label'"> </div>
|
<div *ngSwitchCase="'textarea'">
|
||||||
|
<textarea class="form-control" formControlName="value"> </textarea>
|
||||||
|
|
||||||
<div [hidden]="isValid">
|
|
||||||
<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="isValidCustom">The field {{field.label}} custom Validation</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngSwitchCase="'booleanDecision'">
|
||||||
|
<df-booleanDecision [form]="form" [field]="field"></df-booleanDecision>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngSwitchCase="'radiobox'">
|
||||||
|
<df-radiobox [form]="form" [field]="field"></df-radiobox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngSwitchCase="'label'"> </div>
|
||||||
|
|
||||||
|
|
||||||
|
<div [hidden]="isValid">
|
||||||
|
<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="isValidCustom">The field {{field.label}} custom Validation</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,8 @@ export class DynamicFormFieldComponent {
|
||||||
@Input() field: Field;
|
@Input() field: Field;
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() pathName:string;
|
@Input() pathName:string;
|
||||||
|
@Input() path:string;
|
||||||
|
|
||||||
private fragment: string;
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,private visibilityRulesService:VisibilityRulesService) { }
|
constructor(private route: ActivatedRoute,private visibilityRulesService:VisibilityRulesService) { }
|
||||||
|
|
||||||
ngOnChanges(changeRecord) {
|
ngOnChanges(changeRecord) {
|
||||||
|
@ -41,8 +40,4 @@ export class DynamicFormFieldComponent {
|
||||||
return this.form.get("value").hasError("forbiddenName");
|
return this.form.get("value").hasError("forbiddenName");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit() {
|
|
||||||
this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); //navigate to certain section of the page
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
<div [formGroup]="form">
|
<div [id]="compositeField.id" [formGroup]="form">
|
||||||
<h4>{{compositeField.title}}</h4>
|
<h4>{{compositeField.title}}</h4>
|
||||||
|
<h4>{{compositeField.description}}</h4>
|
||||||
|
<h4>{{compositeField.extendedDescription}}</h4>
|
||||||
<div *ngFor="let field of compositeField.fields; let i = index;">
|
<div *ngFor="let field of compositeField.fields; let i = index;">
|
||||||
<df-field [field]="field" [form]="form.get('fields').get(''+i)" [pathName]="pathName+'.fields.'+i"></df-field>
|
<df-field [field]="field" [form]="form.get('fields').get(''+i)" [path]="path" [pathName]="pathName+'.fields.'+i"></df-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||||
@Input() compositeField: CompositeField
|
@Input() compositeField: CompositeField
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() pathName:string;
|
@Input() pathName:string;
|
||||||
|
@Input() path:string;
|
||||||
|
|
||||||
constructor(){}
|
constructor(){}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<div [formGroup]="form" >
|
<div [id]="group.id" [formGroup]="form" >
|
||||||
<h4 >{{group.title}}</h4>
|
<h4 >{{path+' '+group.title}}</h4>
|
||||||
|
<h4 >{{group.description}}</h4>
|
||||||
|
<h4 >{{group.extendedDescription}}</h4>
|
||||||
<div *ngFor="let compositeField of group.compositeFields; let i = index;">
|
<div *ngFor="let compositeField of group.compositeFields; let i = index;">
|
||||||
<df-composite-field [compositeField]="compositeField" [form]="form.get('compositeFields').get(''+i)" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
|
<df-composite-field [compositeField]="compositeField" [form]="form.get('compositeFields').get(''+i)" [path]="path+'.'+(i+1)" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,8 +16,8 @@ export class DynamicFormGroupComponent implements OnInit {
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() pathName:string;
|
@Input() pathName:string;
|
||||||
|
|
||||||
@Input() customStyle: {};
|
@Input() path:string;
|
||||||
@Input() classFromJson: string;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
<div [formGroup]="form">
|
<p-panel [header]="path+' '+section.title" [toggleable]="true">
|
||||||
<h3>{{section.title}}</h3>
|
|
||||||
<div *ngIf="section.fieldGroups">
|
<div [id]="section.id" [formGroup]="form">
|
||||||
<div *ngFor="let group of section.fieldGroups; let j = index;">
|
<h4>{{section.description}}</h4>
|
||||||
<df-group [group]="group" [form]="form.get('fieldGroups').get(''+j)" [pathName]="pathName+'.fieldGroups.'+j"></df-group>
|
<h4>{{section.extendedDescription}}</h4>
|
||||||
|
<div *ngIf="section.fieldGroups">
|
||||||
|
<div *ngFor="let group of section.fieldGroups; let j = index;">
|
||||||
|
<df-group [group]="group" [form]="form.get('fieldGroups').get(''+j)" [path]="path+'.'+(j+1)" [pathName]="pathName+'.fieldGroups.'+j"></df-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="section.sections">
|
||||||
|
<div *ngFor="let itemsection of section.sections; let j = index;">
|
||||||
|
<df-section [section]="itemsection" [form]="form.get('sections').get(''+j)" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></df-section>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="section.sections">
|
</p-panel>
|
||||||
<div *ngFor="let itemsection of section.sections; let j = index;">
|
|
||||||
<df-section [section]="itemsection" [form]="form.get('sections').get(''+j)" [pathName]="pathName+'.sections.'+j"></df-section>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -10,7 +10,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||||
@Input() section: Section
|
@Input() section: Section
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() pathName:string;
|
@Input() pathName:string;
|
||||||
|
@Input() path:string;
|
||||||
constructor(){}
|
constructor(){}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
|
|
|
@ -1,53 +1,42 @@
|
||||||
<div class="parent-div">
|
<div class="ui-g">
|
||||||
|
|
||||||
<div class=" child-div-left" [ngClass]="{true:'col-md-8 col-sm-9', false:'col-md-12 col-sm-12'}[expandedToc]">
|
<div class="ui-g-8" >
|
||||||
|
|
||||||
<div class="col-md-12 form-body-container" id="form-container">
|
<div class="col-md-12 form-body-container" id="form-container">
|
||||||
|
|
||||||
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||||
|
|
||||||
<div *ngFor = "let section of dataModel.sections; let i = index;">
|
<div *ngFor="let section of dataModel.sections; let i = index;">
|
||||||
<df-section [section]="section" [form]="form.get('sections').get(''+i)" [pathName]="'sections.'+i"></df-section>
|
<df-section [section]="section" [form]="form.get('sections').get(''+i)" [path]="i+1" [pathName]="'sections.'+i"></df-section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div *ngFor="let group of dataModel.groups">
|
|
||||||
<df-group [group]="group" [dataModel]="dataModel" [form]="getSubForm(group.key)"></df-group>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-12 form-footer-container">
|
||||||
|
<div>
|
||||||
|
<progress-bar *ngIf="progressbar" [formGroup]=form></progress-bar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- <div class="col-md-12 form-footer-seperator" >
|
<!-- <div class="col-md-12 form-footer-seperator" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-12 form-footer-container" >
|
|
||||||
|
|
||||||
<div >
|
|
||||||
<div class="progress">
|
|
||||||
<div class="progress-bar progress-bar-info progress-bar-striped" role="progressbar" aria-valuenow= "" aria-valuemin="0" aria-valuemax="100" [ngStyle]="{'width': dirtyValues + '%'}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" (click)="SaveForm();">Save</button>
|
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" (click)="SaveForm();">Save</button>
|
||||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" data-toggle="modal" data-target="#confirmModal">Finalize</button>
|
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" data-toggle="modal" data-target="#confirmModal">Finalize</button>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
<!--
|
<!--
|
||||||
<div *ngIf="payLoad" class="form-row">
|
<div *ngIf="payLoad" class="form-row">
|
||||||
<strong>Saved the following values</strong><br>{{payLoad}}
|
<strong>Saved the following values</strong><br>{{payLoad}}
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<p>Form value: {{ form.value | json }}</p>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <div class="text-center">
|
<!-- <div class="text-center">
|
||||||
<ul *ngIf="pagination.pages && pagination.pages.length" class="pagination">
|
<ul *ngIf="pagination.pages && pagination.pages.length" class="pagination">
|
||||||
<li [ngClass]="{disabled:pagination.currentPage === 1}">
|
<li [ngClass]="{disabled:pagination.currentPage === 1}">
|
||||||
|
@ -68,32 +57,35 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- <div *ngIf="!expandedToc" class="collapsed-div-caret" (click)="toggleTOC()">
|
<!-- <div *ngIf="!expandedToc" class="collapsed-div-caret" (click)="toggleTOC()">
|
||||||
--> <!--
|
-->
|
||||||
|
<!--
|
||||||
<i class="fa toc-toggler" [ngClass]="{true:'fa-arrow-right', false:'fa-arrow-left'}[expandedToc]" aria-hidden="true" ><div>Show ToC</div></i>
|
<i class="fa toc-toggler" [ngClass]="{true:'fa-arrow-right', false:'fa-arrow-left'}[expandedToc]" aria-hidden="true" ><div>Show ToC</div></i>
|
||||||
-->
|
-->
|
||||||
<!-- <i class="fa toc-toggler" aria-hidden="true" ><div>Show ToC</div></i>
|
<!-- <i class="fa toc-toggler" aria-hidden="true" ><div>Show ToC</div></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="expandedToc" class="col-md-12" style="width:200px; text-align: center;">
|
<div *ngIf="expandedToc" class="col-md-12" style="width:200px; text-align: center;">
|
||||||
<h4 style="display: inline-block; text-align: center; width:150px;">Table of Contents</h4>
|
<h4 style="display: inline-block; text-align: center; width:150px;">Table of Contents</h4>
|
||||||
<div class="child-div-caret" style="display: inline-block; width:50px;" (click)="toggleTOC()"> -->
|
<div class="child-div-caret" style="display: inline-block; width:50px;" (click)="toggleTOC()"> -->
|
||||||
<!--
|
<!--
|
||||||
<i class="fa toc-toggler" [ngClass]="{true:'fa-arrow-right', false:'fa-arrow-left'}[expandedToc]" aria-hidden="true" ><div>Shrink</div></i>
|
<i class="fa toc-toggler" [ngClass]="{true:'fa-arrow-right', false:'fa-arrow-left'}[expandedToc]" aria-hidden="true" ><div>Shrink</div></i>
|
||||||
-->
|
-->
|
||||||
<!-- <i class="fa toc-toggler" aria-hidden="true"><div>(hide)</div></i>
|
<!-- <i class="fa toc-toggler" aria-hidden="true"><div>(hide)</div></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<table-of-content [model]="dataModel"></table-of-content>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12 form-footer-container">
|
||||||
|
<button type="button" class="btn btn-primary" (click)="submit();">Save and Finalize</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="child-div-right" [ngClass]="{true:'col-md-4 col-sm-3', false:'shrink-width' }[expandedToc]" id="toc-container">
|
|
||||||
<toc [dataModel]="dataModel" (setPage)="setPage($event)"></toc>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,5 +108,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
|
@ -17,36 +17,36 @@ import { PaginationService } from '../../app/services/pagination.service';
|
||||||
import { TokenService, TokenProvider } from '../services/login/token.service';
|
import { TokenService, TokenProvider } from '../services/login/token.service';
|
||||||
import { ModalComponent } from '../modal/modal.component';
|
import { ModalComponent } from '../modal/modal.component';
|
||||||
|
|
||||||
import {Location} from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
|
|
||||||
import { AngularDraggableModule } from 'angular2-draggable';
|
import { AngularDraggableModule } from 'angular2-draggable';
|
||||||
|
|
||||||
import {MenuItem} from 'primeng/primeng';
|
import { MenuItem } from 'primeng/primeng';
|
||||||
|
|
||||||
import {PDFService} from '../services/transformers/pdf.service';
|
import { PDFService } from '../services/transformers/pdf.service';
|
||||||
|
|
||||||
import './../../assets/xml2json.min.js';
|
import './../../assets/xml2json.min.js';
|
||||||
declare var X2JS: any;
|
declare var X2JS: any;
|
||||||
|
|
||||||
var flatten = require('flat');
|
var flatten = require('flat');
|
||||||
declare var $ :any;
|
declare var $: any;
|
||||||
|
|
||||||
|
|
||||||
import * as scroll from '../../assets/jquery.scrollTo.min.js';
|
import * as scroll from '../../assets/jquery.scrollTo.min.js';
|
||||||
|
|
||||||
|
|
||||||
import '../../assets/custom.js';
|
import '../../assets/custom.js';
|
||||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
declare function simple_notifier(type: string, title: string, message: string): any;
|
||||||
|
|
||||||
|
|
||||||
//import '../../assets/perfect-scrollbar/perfect-scrollbar.js';
|
//import '../../assets/perfect-scrollbar/perfect-scrollbar.js';
|
||||||
declare var PerfectScrollbar : any;
|
declare var PerfectScrollbar: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dynamic-form',
|
selector: 'dynamic-form',
|
||||||
templateUrl: './dynamic-form.component.html',
|
templateUrl: './dynamic-form.component.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-form.component.css',
|
'./dynamic-form.component.css',
|
||||||
'../../assets/perfect-scrollbar/perfect-scrollbar.css'
|
'../../assets/perfect-scrollbar/perfect-scrollbar.css'
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
|
@ -56,27 +56,17 @@ declare var PerfectScrollbar : any;
|
||||||
export class DynamicFormComponent implements OnInit {
|
export class DynamicFormComponent implements OnInit {
|
||||||
|
|
||||||
@Input() dataModel: DatasetModel = new DatasetModel();
|
@Input() dataModel: DatasetModel = new DatasetModel();
|
||||||
|
@Input() path:string;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
payLoad = '';
|
|
||||||
@Input() dirtyValues: number = 0;
|
|
||||||
// pagination object
|
|
||||||
@Input() pagination: any = {};
|
|
||||||
finalizeStatus:boolean = false;
|
|
||||||
id: string;
|
id: string;
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
pathName:string;
|
pathName: string;
|
||||||
//datasetProperties:string;
|
|
||||||
|
|
||||||
private fragment: string;
|
private progressbar:boolean = false;
|
||||||
xml2jsonOBJ: any;
|
|
||||||
|
|
||||||
expandedToc : boolean = true;
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private qcs: FieldControlService, private serverService: ServerService, private router: Router, private pdfService : PDFService,
|
constructor(private qcs: FieldControlService, private serverService: ServerService, private router: Router, private pdfService: PDFService,
|
||||||
private _location: Location, private route: ActivatedRoute, private pagerService: PaginationService, private tokenService: TokenService,private visibilityRulesService:VisibilityRulesService) {
|
private _location: Location, private route: ActivatedRoute, private pagerService: PaginationService, private tokenService: TokenService, private visibilityRulesService: VisibilityRulesService) {
|
||||||
this.form = this.qcs.toFormGroup(new Array(), new Array());
|
|
||||||
this.xml2jsonOBJ = new X2JS();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSubForm(subformName) {
|
getSubForm(subformName) {
|
||||||
|
@ -85,13 +75,41 @@ export class DynamicFormComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataModel = new JsonSerializer<DatasetModel>().fromJSONObject(TestModel,DatasetModel);
|
//this.dataModel = new JsonSerializer<DatasetModel>().fromJSONObject(new DatasetModel(), DatasetModel);
|
||||||
this.form = this.dataModel.buildForm();
|
//this.form = this.dataModel.buildForm();
|
||||||
this.visibilityRulesService.formGroup = this.form;
|
let sub = this.route.queryParams.subscribe(params => {
|
||||||
let rules:Rule[] = new JsonSerializer<Rule>().fromJSONArray(TestModel.rules,Rule);
|
|
||||||
this.visibilityRulesService.buildVisibilityRules(rules)
|
let dmpid = params.id;
|
||||||
|
this.datasetId = params.datasetId;
|
||||||
|
this.serverService.getDmp(this.datasetId).subscribe(
|
||||||
|
response => {
|
||||||
|
this.dataModel = new JsonSerializer<DatasetModel>().fromJSONObject(response, DatasetModel);
|
||||||
|
this.form = this.dataModel.buildForm();
|
||||||
|
this.visibilityRulesService.formGroup = this.form;
|
||||||
|
let rules:Rule[] = new JsonSerializer<Rule>().fromJSONArray(response.rules,Rule);
|
||||||
|
this.visibilityRulesService.buildVisibilityRules(rules)
|
||||||
|
this.progressbar = true;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log("Could not load dmp");
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/* else{
|
||||||
|
|
||||||
|
this.addSection();
|
||||||
|
}
|
||||||
|
this.dataModel = new JsonSerializer<DatasetModel>().fromJSONObject(TestModel,DatasetModel);
|
||||||
|
this.form = this.dataModel.buildForm();
|
||||||
|
this.visibilityRulesService.formGroup = this.form;
|
||||||
|
let rules:Rule[] = new JsonSerializer<Rule>().fromJSONArray(TestModel.rules,Rule);
|
||||||
|
this.visibilityRulesService.buildVisibilityRules(rules) */
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
submit(){
|
||||||
|
this.serverService.updateDataset(this.datasetId,this.form.value).subscribe()
|
||||||
|
}
|
||||||
/* scrollToElemID(elemID) {
|
/* scrollToElemID(elemID) {
|
||||||
scroll("#" + elemID);
|
scroll("#" + elemID);
|
||||||
}
|
}
|
||||||
|
@ -116,39 +134,7 @@ export class DynamicFormComponent implements OnInit {
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
submitForm(final){
|
|
||||||
debugger;
|
|
||||||
this.serverService.getDatasetByID(this.datasetId).subscribe(
|
|
||||||
(data) => {
|
|
||||||
if (final) data.status = 2;
|
|
||||||
|
|
||||||
//data.properties = "<root><formValues><![CDATA["+JSON.stringify(this.form.value)+"]]></formValues><dataModel><![CDATA["+JSON.stringify(this.dataModel)+"]]></dataModel></root>";
|
|
||||||
data.properties = JSON.stringify(this.form.value);
|
|
||||||
|
|
||||||
data.profile = {"id": data.profile.id};
|
|
||||||
|
|
||||||
this.serverService.setDataset(data).subscribe(
|
|
||||||
(data) => {
|
|
||||||
|
|
||||||
console.log("Updated dataset");
|
|
||||||
|
|
||||||
if (final){
|
|
||||||
this._location.back();
|
|
||||||
simple_notifier("success",null,"Finalized form progress");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
simple_notifier("success",null,"Saved form progress");
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
simple_notifier("danger",null,"Could not save form progress");
|
|
||||||
});
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
simple_notifier("danger",null,"Could not save form progress");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveForm() {
|
SaveForm() {
|
||||||
let final = false;
|
let final = false;
|
||||||
|
@ -198,8 +184,8 @@ export class DynamicFormComponent implements OnInit {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
createPDF(elementID : string, pdffilename : string){
|
createPDF(elementID : string, pdffilename : string){
|
||||||
this.pdfService.toPDF(elementID, pdffilename);
|
this.pdfService.toPDF(elementID, pdffilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<p-progressBar [value]="value"></p-progressBar>
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { FormGroup, FormControl, FormArray } from '@angular/forms'
|
||||||
|
@Component({
|
||||||
|
selector: 'progress-bar',
|
||||||
|
templateUrl: './progress-bar.component.html',
|
||||||
|
})
|
||||||
|
export class ProgressBarComponent implements OnInit {
|
||||||
|
@Input() formGroup: FormGroup
|
||||||
|
|
||||||
|
private value: number;
|
||||||
|
ngOnInit() {
|
||||||
|
this.formGroup
|
||||||
|
.valueChanges
|
||||||
|
.subscribe(control => {
|
||||||
|
this.value = (this.getDirtyValues(this.formGroup) / this.getFormControlDepthLength(this.formGroup)) * 100
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getDirtyValues(form: FormGroup): number {
|
||||||
|
let value = 0;
|
||||||
|
Object.keys(form.controls).forEach(key => {
|
||||||
|
let control = form.controls[key]
|
||||||
|
if (control instanceof FormGroup) value += this.getDirtyValues(control);
|
||||||
|
else if (control instanceof FormArray) {
|
||||||
|
let formArray = (<FormArray>control);
|
||||||
|
for (let i = 0; i < formArray.length; i++) {
|
||||||
|
value += this.getDirtyValues(<FormGroup>formArray.get("" + i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (control.valid) value++;
|
||||||
|
});
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
getFormControlDepthLength(form: FormGroup): number {
|
||||||
|
let value = 0;
|
||||||
|
Object.keys(form.controls).forEach(key => {
|
||||||
|
let control = form.controls[key]
|
||||||
|
if (control instanceof FormGroup) value += this.getFormControlDepthLength(control);
|
||||||
|
else if (control instanceof FormArray) {
|
||||||
|
let formArray = (<FormArray>control);
|
||||||
|
for (let i = 0; i < formArray.length; i++) {
|
||||||
|
value += this.getFormControlDepthLength(<FormGroup>formArray.get("" + i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (control instanceof FormControl) value++;
|
||||||
|
});
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { ActivatedRouteSnapshot,Router,ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
export class BaseTableOfContent{
|
||||||
|
constructor(public router: Router,public route:ActivatedRoute){}
|
||||||
|
|
||||||
|
scrollToId(elementId) {
|
||||||
|
this.router.navigate([this.route.snapshot.url], { fragment: elementId });
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<a (click)="scrollToId(model.id)">{{path+' '+model.title}}</a>
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { BaseTableOfContent } from '../base-table-of-content.component';
|
||||||
|
import { CompositeField } from '../../../models/CompositeField';
|
||||||
|
import { Field } from '../../../models/Field';
|
||||||
|
import { Section } from '../../../models/Section';
|
||||||
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import {Router, ActivatedRoute} from '@angular/router'
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'table-of-contents-field',
|
||||||
|
templateUrl: '/table-of-content-field.component.html',
|
||||||
|
providers: []
|
||||||
|
})
|
||||||
|
export class TableOfContentsFieldComponent extends BaseTableOfContent{
|
||||||
|
@Input() model:Field;
|
||||||
|
@Input() index:number;
|
||||||
|
@Input() public path:string;
|
||||||
|
|
||||||
|
constructor(public router: Router, public route: ActivatedRoute) {
|
||||||
|
super(router, route)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<!-- All contents in the first page -->
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let field of model.fields let i = index">
|
||||||
|
<table-of-contents-field [model]="field" [index]="i" [path]="path"> </table-of-contents-field>
|
||||||
|
</li>
|
||||||
|
</ul>
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { BaseTableOfContent } from '../base-table-of-content.component';
|
||||||
|
import { CompositeField } from '../../../models/CompositeField';
|
||||||
|
import { FieldGroup } from '../../../models/FieldGroup';
|
||||||
|
import { Section } from '../../../models/Section';
|
||||||
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router'
|
||||||
|
|
||||||
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'table-of-contents-fieldset',
|
||||||
|
templateUrl: '/table-of-content-fieldset.component.html',
|
||||||
|
providers: []
|
||||||
|
})
|
||||||
|
export class TableOfContentsFieldSetComponent extends BaseTableOfContent {
|
||||||
|
|
||||||
|
@Input() model: CompositeField;
|
||||||
|
@Input() index: number;
|
||||||
|
@Input() public path: string;
|
||||||
|
|
||||||
|
constructor(public router: Router, public route: ActivatedRoute) {
|
||||||
|
super(router, route)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<a (click)="scrollToId(model.id)">{{path+' '+model.title}}</a>
|
||||||
|
|
||||||
|
<div *ngFor="let fieldsetModel of model.compositeFields let i = index">
|
||||||
|
<table-of-contents-fieldset [model]="fieldsetModel" [index]="i" [path]="path+'.'+(i+1)"> </table-of-contents-fieldset>
|
||||||
|
</div>
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { BaseTableOfContent } from '../base-table-of-content.component';
|
||||||
|
import { FieldGroup } from '../../../models/FieldGroup';
|
||||||
|
import { Section } from '../../../models/Section';
|
||||||
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import {Router, ActivatedRoute} from '@angular/router'
|
||||||
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'table-of-contents-group',
|
||||||
|
templateUrl: '/table-of-content-group.component.html',
|
||||||
|
providers: []
|
||||||
|
})
|
||||||
|
export class TableOfContentsGroupComponent extends BaseTableOfContent {
|
||||||
|
|
||||||
|
@Input() model: FieldGroup;
|
||||||
|
@Input() index: number;
|
||||||
|
@Input() public path: string;
|
||||||
|
|
||||||
|
/* @Output()
|
||||||
|
setPage:EventEmitter<number> = new EventEmitter<number>();
|
||||||
|
|
||||||
|
*/
|
||||||
|
constructor(public router: Router, public route: ActivatedRoute) {
|
||||||
|
super(router, route)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!-- All contents in the first page -->
|
||||||
|
<a (click)="scrollToId(model.id)">{{path+' '+model.title}}</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let groupModel of model.fieldGroups let i = index">
|
||||||
|
<table-of-contents-group [model]="groupModel" [index]="i" [path]="path+'.'+(i+1)"> </table-of-contents-group>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- All contents in the first page -->
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let sectionModel of model.sections let i = index">
|
||||||
|
<table-of-contents-section [model]="sectionModel" [index]="i" [path]="path+'.'+(i+1)"> </table-of-contents-section>
|
||||||
|
</li>
|
||||||
|
</ul>
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { BaseTableOfContent } from '../base-table-of-content.component';
|
||||||
|
import { Section } from '../../../models/Section';
|
||||||
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import { ActivatedRouteSnapshot,Router,ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'table-of-contents-section',
|
||||||
|
templateUrl: '/table-of-content-section.component.html',
|
||||||
|
providers: []
|
||||||
|
})
|
||||||
|
export class TableOfContentsSectionComponent extends BaseTableOfContent implements OnInit {
|
||||||
|
|
||||||
|
@Input() model: Section;
|
||||||
|
@Input() index: number;
|
||||||
|
@Input() public path: string;
|
||||||
|
|
||||||
|
constructor(public router: Router,public route:ActivatedRoute){
|
||||||
|
super(router,route)
|
||||||
|
}
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<!-- All contents in the first page -->
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let section of model.sections let i = index">
|
||||||
|
<!-- && field.label for sections without field label as data summery -->
|
||||||
|
<table-of-contents-section [model]="section" [index]="i+1" [path]="i+1"> </table-of-contents-section>
|
||||||
|
</li>
|
||||||
|
</ul>
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { Model } from '../../entities/model/model';
|
||||||
|
import { DatasetModel } from '../../models/DatasetModel';
|
||||||
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
|
||||||
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
||||||
|
|
||||||
|
import * as scroll from '../../../assets/jquery.scrollTo.min.js';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'table-of-content',
|
||||||
|
templateUrl: '/table-of-contents.component.html',
|
||||||
|
styleUrls: ['./toc.component.css'],
|
||||||
|
providers: []
|
||||||
|
})
|
||||||
|
export class TableOfContentsComponent implements OnInit{
|
||||||
|
|
||||||
|
@Input() model:DatasetModel;
|
||||||
|
public path:string="";
|
||||||
|
/* @Output()
|
||||||
|
setPage:EventEmitter<number> = new EventEmitter<number>();
|
||||||
|
|
||||||
|
*/ ngOnInit(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
<body data-spy="scroll" data-target="#toc">
|
|
||||||
<nav id="toc" data-toggle="toc">
|
|
||||||
<ul class="nav flex-column">
|
|
||||||
<li class="nav-item">
|
|
||||||
<div *ngFor="let group of dataModel.groups"> <!-- All contents in the first page -->
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a class="cursor-hand" (click)='scrollToElemID(group.key, group.page)'>{{group.title}}</a>
|
|
||||||
<ul *ngFor="let field of group.groupFields">
|
|
||||||
<li *ngIf="field.visible == 'true' && field.label"> <!-- && field.label for sections without field label as data summery -->
|
|
||||||
<a class="cursor-hand" (click)='scrollToElemID(field.key, group.page)'>{{field.label}} </a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</body>
|
|
|
@ -1,31 +0,0 @@
|
||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
|
||||||
|
|
||||||
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
|
||||||
|
|
||||||
import * as scroll from '../../../assets/jquery.scrollTo.min.js';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'toc',
|
|
||||||
templateUrl: '/toc.component.html',
|
|
||||||
styleUrls: ['./toc.component.css'],
|
|
||||||
providers: []
|
|
||||||
})
|
|
||||||
export class TocComponent implements OnInit{
|
|
||||||
|
|
||||||
private headers = new Array();
|
|
||||||
|
|
||||||
@Output()
|
|
||||||
setPage:EventEmitter<number> = new EventEmitter<number>();
|
|
||||||
|
|
||||||
ngOnInit(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollToElemID(elemID, _page){
|
|
||||||
console.log("going to id:"+elemID)
|
|
||||||
var page = parseInt(_page)
|
|
||||||
this.setPage.emit(page);
|
|
||||||
scroll("#"+elemID, {}, {offset: top});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -29,15 +29,15 @@ export class Field extends BaseModel implements Serializable<Field>,FormGenerato
|
||||||
|
|
||||||
buildForm():FormGroup{
|
buildForm():FormGroup{
|
||||||
let formGroup = this.formBuilder.group({
|
let formGroup = this.formBuilder.group({
|
||||||
id: [this.id],
|
id: [this.id],
|
||||||
title: [this.title],
|
/* title: [this.title], */
|
||||||
value: [this.value],
|
value: [this.value]/* ,
|
||||||
description: [this.description],
|
description: [this.description],
|
||||||
extendedDescription:[this.extendedDescription],
|
extendedDescription:[this.extendedDescription],
|
||||||
viewStyle: [this.viewStyle],
|
viewStyle: [this.viewStyle],
|
||||||
defaultVisibility:[this.defaultVisibility],
|
defaultVisibility:[this.defaultVisibility],
|
||||||
page:[this.page],
|
page:[this.page],
|
||||||
data:[this.data]
|
data:[this.data] */
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,13 @@ export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, F
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup: FormGroup = this.formBuilder.group({
|
let formGroup: FormGroup = this.formBuilder.group({
|
||||||
id: [this.id],
|
/* id: [this.id],
|
||||||
title: [this.title],
|
title: [this.title],
|
||||||
value: [this.value],
|
value: [this.value],
|
||||||
description: [this.description],
|
description: [this.description],
|
||||||
extendedDescription: [this.extendedDescription],
|
extendedDescription: [this.extendedDescription],
|
||||||
defaultVisibility: [this.defaultVisibility],
|
defaultVisibility: [this.defaultVisibility],
|
||||||
page: [this.page]
|
page: [this.page] */
|
||||||
});
|
});
|
||||||
let compositeFieldsFormArray = new Array<FormGroup>();
|
let compositeFieldsFormArray = new Array<FormGroup>();
|
||||||
if (this.compositeFields) {
|
if (this.compositeFields) {
|
||||||
|
|
|
@ -42,11 +42,11 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
|
||||||
}
|
}
|
||||||
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
||||||
formGroup.addControl('fieldGroups', this.formBuilder.array(fieldGroupsFormArray));
|
formGroup.addControl('fieldGroups', this.formBuilder.array(fieldGroupsFormArray));
|
||||||
formGroup.addControl('defaultVisibility', new FormControl(this.defaultVisibility))
|
/* formGroup.addControl('defaultVisibility', new FormControl(this.defaultVisibility))
|
||||||
formGroup.addControl('page', new FormControl(this.page))
|
formGroup.addControl('page', new FormControl(this.page))
|
||||||
formGroup.addControl('id', new FormControl(this.id))
|
formGroup.addControl('id', new FormControl(this.id))
|
||||||
formGroup.addControl('title', new FormControl(this.title))
|
formGroup.addControl('title', new FormControl(this.title))
|
||||||
formGroup.addControl('description', new FormControl(this.description))
|
formGroup.addControl('description', new FormControl(this.description)) */
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@ export class RestBase {
|
||||||
|
|
||||||
|
|
||||||
protocol: string = "http";
|
protocol: string = "http";
|
||||||
hostname: string ="dionysus.di.uoa.gr"
|
hostname: string ="localhost"
|
||||||
port: number = 8080;
|
port: number = 8080;
|
||||||
webappname: string = "dmp-backend";
|
webappname: string = "dmp-backend";
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,8 @@ export class ServerService {
|
||||||
return this.restBase.get("dmp/listDMPLabelID");
|
return this.restBase.get("dmp/listDMPLabelID");
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDmp(dmpid : string, eager? : boolean){
|
public getDmp(dmpid : string){
|
||||||
if(eager && eager==true)
|
return this.restBase.get("datasetprofile/get/"+dmpid);
|
||||||
return this.restBase.get("dmps/"+dmpid, {"eager": true});
|
|
||||||
else
|
|
||||||
return this.restBase.get("dmps/"+dmpid, {"eager": false});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDmpHistory(dmpid: string){
|
public getDmpHistory(dmpid: string){
|
||||||
|
@ -160,6 +157,9 @@ export class ServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public updateDataset(id:string,properties:any){
|
||||||
|
return this.restBase.post("datasetprofile/save/"+id,properties);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
logOut() {
|
logOut() {
|
||||||
this.tokenService.logout();
|
this.tokenService.logout();
|
||||||
|
|
|
@ -30,7 +30,7 @@ export class DmpDetailedComponent implements OnInit {
|
||||||
let sub = this.route.queryParams.subscribe(params => {
|
let sub = this.route.queryParams.subscribe(params => {
|
||||||
|
|
||||||
let dmpid = params.dmpid;
|
let dmpid = params.dmpid;
|
||||||
this.serverService.getDmp(dmpid, true).subscribe(
|
this.serverService.getDmp(dmpid).subscribe(
|
||||||
response => {
|
response => {
|
||||||
|
|
||||||
this.dmp = response;
|
this.dmp = response;
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class VisibilityRulesService {
|
||||||
let sourceVisibilityRules = visibilityRule.sourceVisibilityRules;
|
let sourceVisibilityRules = visibilityRule.sourceVisibilityRules;
|
||||||
for (let i = 0; i < sourceVisibilityRules.length; i++) {
|
for (let i = 0; i < sourceVisibilityRules.length; i++) {
|
||||||
let sourceVisibilityRule = sourceVisibilityRules[i];
|
let sourceVisibilityRule = sourceVisibilityRules[i];
|
||||||
if (!this.formGroup.get( this.fieldsPathMemory[sourceVisibilityRule.sourceControlId] + '.value'))continue;
|
if (!this.formGroup.get( this.fieldsPathMemory[sourceVisibilityRule.sourceControlId] + '.value'))return false; //TODO
|
||||||
if(sourceVisibilityRule.sourceControlValue != ''+this.formGroup.get( this.fieldsPathMemory[sourceVisibilityRule.sourceControlId] + '.value').value) return false;
|
if(sourceVisibilityRule.sourceControlValue != ''+this.formGroup.get( this.fieldsPathMemory[sourceVisibilityRule.sourceControlId] + '.value').value) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue