diff --git a/dmp-frontend/src/app/entities/model/attribute.ts b/dmp-frontend/src/app/entities/model/attribute.ts
index f5c1190de..0ba075666 100644
--- a/dmp-frontend/src/app/entities/model/attribute.ts
+++ b/dmp-frontend/src/app/entities/model/attribute.ts
@@ -13,5 +13,5 @@ export class Attribute {
validationType: any;
validation : Rule[];
sources: Source[];
-
+ url: string;
}
diff --git a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html
index c4cf4f877..2ddfe815a 100644
--- a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html
+++ b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html
@@ -36,9 +36,14 @@
[required]="field.required" [pattern] = "field.regex" (ngModelChange) = "toggleVisibility($event, field,false)">
-
+
+ {{field.url}}
+
+
+
+
+
+
+
The field "{{field.label}}" is required
The field {{field.label}} must match a regular expression {{field.regex}}
diff --git a/dmp-frontend/src/app/form/fields/field-base.ts b/dmp-frontend/src/app/form/fields/field-base.ts
index 0863ac18c..316321ed1 100644
--- a/dmp-frontend/src/app/form/fields/field-base.ts
+++ b/dmp-frontend/src/app/form/fields/field-base.ts
@@ -14,7 +14,7 @@ export class FieldBase
{
description:string;
attributes: Attribute;
regex:string;
- url: any;
+ url: string;
constructor(options: {
value?: T,
@@ -29,7 +29,7 @@ export class FieldBase{
description?: string,
attributes?: Attribute,
regex?:string,
- url?: any
+ url?: string
} = {}) {
this.value = options.value;
this.key = options.key || '';
@@ -43,6 +43,6 @@ export class FieldBase{
this.description = options.description || '';
this.attributes = options.attributes || new Attribute();
this.regex = options.regex || '';
- this.url = options.url || {"url":null, "fieldpath":null, "data":null};
+ this.url = options.url || "";
}
}
\ No newline at end of file
diff --git a/dmp-frontend/src/app/form/fields/label/label.ts b/dmp-frontend/src/app/form/fields/label/label.ts
new file mode 100644
index 000000000..7c888ed78
--- /dev/null
+++ b/dmp-frontend/src/app/form/fields/label/label.ts
@@ -0,0 +1,11 @@
+import {FieldBase} from '../field-base';
+
+export class LabelField extends FieldBase {
+ controlType = 'label';
+ type: string;
+
+ constructor (options: {} = {}) {
+ super(options);
+ this.type = options['type'] || '';
+ }
+}
\ No newline at end of file
diff --git a/dmp-frontend/src/app/services/dataModelBuilder.service.ts b/dmp-frontend/src/app/services/dataModelBuilder.service.ts
index 69c87be83..c23aed534 100644
--- a/dmp-frontend/src/app/services/dataModelBuilder.service.ts
+++ b/dmp-frontend/src/app/services/dataModelBuilder.service.ts
@@ -5,6 +5,7 @@ import { TextboxField } from '../../app/form/fields/textbox/field-textbox';
import { CheckBoxField } from '../../app/form/fields/checkbox/field-checkbox';
import { RadioBoxField } from '../../app/form/fields/radiobox/field-radiobox';
import { TextAreaField } from '../../app/form/fields/textarea/textarea';
+import { LabelField } from '../../app/form/fields/label/label';
import { DataModel } from '../entities/DataModel';
import { Rule } from '../entities/common/rule';
import { GroupBase } from '../form/dynamic-form-group/group-base';
@@ -29,6 +30,7 @@ export class dataModelBuilder {
this.dataModel = new DataModel();
this.fields = this.buildFields(data.viewstyle.definition.root.fields.field);
this.dataModel.groups = this.getGroups(data.viewstyle.definition.root.fieldGroups.fieldGroup, this.fields, dataValues);
+ this.checkDuplicateInObject('order', this.dataModel.groups[13].groupFields);
this.dataModel.semanticAttr = new Array(new Attribute);
//this.dataModel.semanticAttr = data.dataset.profile.definition.root.fields.field;
this.dataModel.semanticAttr = this.getFieldsAttributes(data.definition.root.fields.field, data.ruleset.definition.root.functions.function, this.fields);
@@ -131,6 +133,23 @@ export class dataModelBuilder {
fieldsVisible.push(newfield);
}
+
+ else if (element.viewStyle._renderstyle == "label") {
+ let newfield: FieldBase;
+ let rule = new Rule();
+ newfield = new LabelField({
+ label: element.title.__cdata,
+ key: element._id,
+ value: element.value,
+ order: element._ordinal,
+ rules: element.visible.rule != undefined ? element.visible.rule : rule,
+ visible: element._defaultVisibility,
+ group: element._group,
+ description: element.description.__cdata
+ });
+
+ fieldsVisible.push(newfield);
+ }
});
fieldsVisible.sort((a, b) => a.order - b.order);
return fieldsVisible;
@@ -177,7 +196,7 @@ export class dataModelBuilder {
newfldGroup.key = fieldGroups._id;
newfldGroup.section = fieldGroups._section;
groups.push(newfldGroup)
- }
+ }
return groups;
}
@@ -200,21 +219,8 @@ export class dataModelBuilder {
newAttribute.sources.push(attr.sources.source);
if (attr.sources.source.length != undefined) {
for (var i = 0; i < attr.sources.source.length; i++) {
- if (attr.sources.source[i].url !== undefined) {
- fields.find(x => x.key == newAttribute.id).url.url = attr.sources.source[i].url._value;
- this.restBase.proxy_get(attr.sources.source[i].url._value).subscribe((data) => {
- console.log(data);
- newAttribute.sources.forEach(src => {
- src.params = new Array();
- data.data.forEach(data => {
- let prm = new Param();
- prm.key = data.id;
- prm.value = data.attributes.name;
- src.params.push(prm);
- });
- });
-
- });
+ if (attr.sources.source[i]._type == "url") {
+ newAttribute.url = attr.sources.source[i].value._value;
break;
} else {
newAttribute.sources.forEach(src => {
@@ -233,21 +239,8 @@ export class dataModelBuilder {
}
}
- if (attr.sources.source.url !== undefined) {
- fields.find(x => x.key == newAttribute.id).url.url = attr.sources.source.url._value;
- this.restBase.proxy_get(attr.sources.source.url._value).subscribe((data) => {
- console.log(data);
- newAttribute.sources.forEach(src => {
- src.params = new Array();
- data.data.forEach(data => {
- let prm = new Param();
- prm.key = data.id;
- prm.value = data.attributes.name;
- src.params.push(prm);
- });
- });
-
- });
+ if (attr.sources.source._type == "url") {
+ newAttribute.url = attr.sources.source.value._value;
} else {
newAttribute.sources.forEach(src => {
@@ -301,7 +294,8 @@ export class dataModelBuilder {
}
attribute.push(newAttribute);
- //if (fields.find(x => x.key == newAttribute.id).url.url == null)
+ if (newAttribute.url !== undefined)
+ fields.find(x => x.key == newAttribute.id).url = newAttribute.url;
fields.find(x => x.key == newAttribute.id).attributes.sources = newAttribute.sources;
fields.find(x => x.key == newAttribute.id).attributes.validation = newAttribute.validation;
});
@@ -341,4 +335,18 @@ export class dataModelBuilder {
});
});
}
+
+ checkDuplicateInObject(propertyName, inputArray) {
+ let DuplicateArray = [];
+ inputArray.forEach(item => {
+ for(var i=0; i