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){ getDatasets(muted?: boolean){
this.spinnerService.show();
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe( this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
response => { response => {
this.tableData = response; this.tableData = response;
@ -167,6 +168,9 @@ export class DatasetsComponent implements OnInit {
}, },
error => { error => {
simple_notifier("danger",null,"Could not update datasets table"); 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" > <div *ngFor="let field of group.compositeFields.groupFields" >
<df-field [field]="field" [form]="form" [dataModel] = "dataModel"></df-field> <df-field [field]="field" [form]="form" [dataModel] = "dataModel"></df-field>
</div> </div>
<div *ngIf = "shouldIShow()">
<a (click)="addFieldSet(form)" style="cursor: default"> <a (click)="addFieldSet(form)" style="cursor: default">
Add another fieldSet + Add another fieldSet +
</a> </a>
</div>

View File

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

View File

@ -165,11 +165,14 @@ export class dataModelBuilder {
let compositeFields = new GroupBase(); let compositeFields = new GroupBase();
newfldGroup.groupFields = new Array(); newfldGroup.groupFields = new Array();
compositeFields.groupFields = new Array(); compositeFields.groupFields = new Array();
fields.forEach(field => { fields.forEach(field => {
if (fieldGroup._id == field.group) { if (fieldGroup._id == field.group) {
if (dataValues != "")//--------------------------SET VALUES--------------------------------------------------------------------------------------- if (dataValues != "")//--------------------------SET VALUES---------------------------------------------------------------------------------------
if (dataValues[fieldGroup._id][field.key] != undefined) // to put values in fields 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; 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 -------------------------------------------------- if(field.order.toString().split(",").length > 1){//--------------Composite Fields Multiplicity --------------------------------------------------
compositeFields.groupFields.push(field); compositeFields.groupFields.push(field);
newfldGroup.compositeFields = compositeFields; newfldGroup.compositeFields = compositeFields;
@ -178,8 +181,34 @@ export class dataModelBuilder {
} else { } else {
//this.dataModel.fields.push(field); //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.title = fieldGroup.title.__cdata;
newfldGroup.key = fieldGroup._id; newfldGroup.key = fieldGroup._id;
newfldGroup.section = fieldGroup._section; newfldGroup.section = fieldGroup._section;