Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot

This commit is contained in:
Nikolaos Laskaris 2017-11-16 11:59:37 +02:00
commit b5ff5bd45f
4 changed files with 39 additions and 1 deletions

View File

@ -159,6 +159,7 @@ export class DatasetsComponent implements OnInit {
}
getDatasets(muted?: boolean){
this.spinnerService.show();
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
response => {
this.tableData = response;
@ -167,6 +168,9 @@ export class DatasetsComponent implements OnInit {
},
error => {
simple_notifier("danger",null,"Could not update datasets table");
},
() =>{
this.spinnerService.hide();
}
);
}

View File

@ -11,9 +11,12 @@
<div *ngFor="let field of group.compositeFields.groupFields" >
<df-field [field]="field" [form]="form" [dataModel] = "dataModel"></df-field>
</div>
<div *ngIf = "shouldIShow()">
<a (click)="addFieldSet(form)" style="cursor: default">
Add another fieldSet +
</a>
</div>

View File

@ -71,10 +71,12 @@ export class DynamicFormGroupComponent implements OnInit {
}
shouldIShow(){
let show = false;
this.group.compositeFields.groupFields.forEach((field, i )=>{
if(field.visible)
return true;
show = true;
})
return show;
}
}

View File

@ -165,11 +165,14 @@ export class dataModelBuilder {
let compositeFields = new GroupBase();
newfldGroup.groupFields = new Array();
compositeFields.groupFields = new Array();
fields.forEach(field => {
if (fieldGroup._id == field.group) {
if (dataValues != "")//--------------------------SET VALUES---------------------------------------------------------------------------------------
if (dataValues[fieldGroup._id][field.key] != undefined) // to put values in fields
field.value = dataValues[fieldGroup._id][field.key].value == undefined ? dataValues[fieldGroup._id][field.key] : dataValues[fieldGroup._id][field.key].value;
if(field.order.toString().split(",").length > 1){//--------------Composite Fields Multiplicity --------------------------------------------------
compositeFields.groupFields.push(field);
newfldGroup.compositeFields = compositeFields;
@ -178,8 +181,34 @@ export class dataModelBuilder {
} else {
//this.dataModel.fields.push(field);
}
//TO DO FIELDSET WITH MULTIPLICITY
// if (dataValues != "")
// if (dataValues[fieldGroup._id][field.key] != undefined){
// let keys = new Array<string>();
// Object.keys(dataValues[fieldGroup._id]).forEach(key=>{if(key.startsWith(field.key+"_"))keys.push(key)})
// if (keys.length)
// if (field.controlType == "textbox") {
// let newfield: FieldBase<any>;
// let rule = new Rule();
// newfield = new TextboxField({
// label: field.label+"_"+ 1,
// key: keys[0],
// value: dataValues[fieldGroup._id][keys[0]].value,
// order: field.order,
// rules: field.rules,
// visible: field.visible,
// group: field.group,
// description: field.description
// });debugger;
// newfldGroup.groupFields.push(newfield);
// }
// }
});
newfldGroup.title = fieldGroup.title.__cdata;
newfldGroup.key = fieldGroup._id;
newfldGroup.section = fieldGroup._section;