diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index 202fc9f0a..84a57561b 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -30,7 +30,7 @@ export class DatasetsComponent implements OnInit { // Start ALTERNATIVE //whole dmp data model tableData : any[] = new Array(); - + //organisation editor data model editingOrganisation: any = {}; organisationEditorForm : any; @@ -52,19 +52,19 @@ export class DatasetsComponent implements OnInit { @Input() datasets: Dataset[]; @Input() datasetProfileDropDown: DropdownField; @Input() datasetCount = 0; - + @Input() dmpLabelforDatasets: string; @Input() statusDropDown: DropdownField; dataset: any; saveAndDescribe:boolean; - + dataSetValue: boolean = true; - + uriRegex = "/^([a-z0-9+.-]+):(?://(?:((?:[a-z0-9-._~!$&'()*+,;=:]|%[0-9A-F]{2})*)@)?((?:[a-z0-9-._~!$&'()*+,;=]|%[0-9A-F]{2})*)(?::(\d*))?(/(?:[a-z0-9-._~!$&'()*+,;=:@/]|%[0-9A-F]{2})*)?|(/?(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})+(?:[a-z0-9-._~!$&'()*+,;=:@/]|%[0-9A-F]{2})*)?)(?:\?((?:[a-z0-9-._~!$&'()*+,;=:/?@]|%[0-9A-F]{2})*))?(?:#((?:[a-z0-9-._~!$&'()*+,;=:/?@]|%[0-9A-F]{2})*))?$/i"; constructor( - + private serverService: ServerService, private route: ActivatedRoute, private router: Router, @@ -81,9 +81,9 @@ export class DatasetsComponent implements OnInit { } - ngOnInit() { - - + ngOnInit() { + + this.route .queryParams .subscribe(params => { @@ -103,7 +103,7 @@ export class DatasetsComponent implements OnInit { error => { simple_notifier("danger",null,"Could not load User's Dataset Profiles"); } - + ); } @@ -138,8 +138,8 @@ export class DatasetsComponent implements OnInit { simple_notifier("danger",null,"Could not create Dataset"); } ) - $("#newDatasetModal").modal("hide"); - + $("#newDatasetModal").modal("hide"); + } else{ @@ -160,7 +160,7 @@ export class DatasetsComponent implements OnInit { ) $("#newDatasetModal").modal("hide"); } - + } getDatasets(muted?: boolean){ @@ -179,14 +179,14 @@ export class DatasetsComponent implements OnInit { } ); } - + getDatasetForDmpMethod(dmpid) { this.spinnerService.show(); this.serverService.getDatasetForDmp({ "id": dmpid }).subscribe( response => { this.tableData = response; - + }, error => { console.log("could not retrieve dataset for dpm: "+dmpid); @@ -197,7 +197,7 @@ export class DatasetsComponent implements OnInit { ); } - editRow(item, event) { + editRow(item, event) { if (event.toElement.id == "editDataset"){ //this.dataset = item; this.dataset.label = item.label; @@ -214,7 +214,7 @@ export class DatasetsComponent implements OnInit { else if(event.toElement.id == "describeDataset"){ this.describeDataset(item); } - + } newDataset() { @@ -237,7 +237,7 @@ export class DatasetsComponent implements OnInit { markDatasetForDelete(dataset){ this.dataset = dataset; } - + deleteDataset(confirmation){ if(confirmation==true) this.deleteRow(this.dataset); @@ -245,8 +245,8 @@ export class DatasetsComponent implements OnInit { deleteRow(dataset){ - this.serverService.deleteDataset(dataset).subscribe( - response => { + this.serverService.deleteDataset(dataset).subscribe( + response => { simple_notifier("success",null,"Deleted dataset"); this.getDatasets(); }, @@ -258,8 +258,8 @@ export class DatasetsComponent implements OnInit { simple_notifier("danger",null,"Could not delete the dataset"); this.getDatasets(); - } - ); + } + ); } diff --git a/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.html b/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.html new file mode 100644 index 000000000..55876bae5 --- /dev/null +++ b/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.html @@ -0,0 +1,8 @@ +
+

{{compositeField.title}}

+
+ +
+ +
+ \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts b/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts new file mode 100644 index 000000000..71f24d670 --- /dev/null +++ b/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts @@ -0,0 +1,21 @@ +import { CompositeField } from '../../models/CompositeField'; +import { FormGroup } from '@angular/forms'; +import { Section } from '../../entities/model/section'; +import { DataModel } from '../../entities/DataModel'; +import { Component, Input, OnInit } from '@angular/core'; +@Component({ + selector: 'df-composite-field', + templateUrl: './dynamic-form-composite-field.html', + }) + export class DynamicFormCompositeFieldComponent implements OnInit{ + + @Input() compositeField: CompositeField + @Input() form: FormGroup; + @Input() pathName:string; + + constructor(){} + + ngOnInit(){ + + } + } \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html index 21bd4975c..3086b9765 100644 --- a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html +++ b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html @@ -1,27 +1,8 @@ -
-

{{group.title}}

-
- - - - +
+

{{group.title}}

+
+
-
-
- -
-
- - Add another fieldSet + - -
- - - - -
- -
\ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts index efd22c76b..49b624e1b 100644 --- a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts +++ b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts @@ -1,3 +1,4 @@ +import { FieldGroup } from '../../models/FieldGroup'; import { DataModel } from '../../entities/DataModel'; import { GroupBase } from './group-base'; import { Component, Input, OnInit } from '@angular/core'; @@ -16,19 +17,21 @@ import { Rule } from '../../entities/common/rule'; }) export class DynamicFormGroupComponent implements OnInit { @Input() dataModel: DataModel; - @Input() group: GroupBase; + @Input() group: FieldGroup @Input() form: FormGroup; + @Input() pathName:string; + @Input() customStyle: {}; - @Input() classFromJson: string ; + @Input() classFromJson: string; constructor() { } ngOnInit() { - let st = this.group.style == "any" ? "" : this.group.style; - this.classFromJson = this.group.class == "" ? "" : this.group.class; + //let st = this.group.style == "any" ? "" : this.group.style; + //this.classFromJson = this.group.class == "" ? "" : this.group.class; - this.customStyle = {}; + /* this.customStyle = {}; if (st != "") { st.replace(/"/g, '\\"'); @@ -39,44 +42,34 @@ export class DynamicFormGroupComponent implements OnInit { //this.customStyle[entry[0]] = '2px solid #c1baba'; var a = entry[0]; this.customStyle[a] = entry[1]; - } - } + } */ + } -} - - addFieldSet(){ - debugger; + addFieldSet() { + /* debugger; let subgroup: any = {}; - this.group.compositeFields.groupFields.forEach((field, i )=>{ debugger; - this.form.addControl(field.key +"_"+i, new FormControl("") ) + this.group.compositeFields.groupFields.forEach((field, i) => { + debugger; + this.form.addControl(field.key + "_" + i, new FormControl("")) if (field.controlType == "textbox") { let newfield: FieldBase; let rule = new Rule(); newfield = new TextboxField({ - label: field.label+"_"+i, - key: field.key +"_"+i, - value: "", - order: field.order, - rules: field.rules, - visible: field.visible, - group: field.group, - description: field.description + label: field.label + "_" + i, + key: field.key + "_" + i, + value: "", + order: field.order, + rules: field.rules, + visible: field.visible, + group: field.group, + description: field.description }); this.group.compositeFields.groupFields.push(newfield) - } - - }); - } + } - shouldIShow(){ - let show = false; - this.group.compositeFields.groupFields.forEach((field, i )=>{ - if(field.visible) - show = true; - }) - return show; + }); */ } } diff --git a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html new file mode 100644 index 000000000..e280016de --- /dev/null +++ b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html @@ -0,0 +1,13 @@ +
+

{{section.title}}

+
+
+ +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts new file mode 100644 index 000000000..383f93850 --- /dev/null +++ b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts @@ -0,0 +1,20 @@ +import { FormGroup } from '@angular/forms'; +import { Section } from '../../entities/model/section'; +import { DataModel } from '../../entities/DataModel'; +import { Component, Input, OnInit } from '@angular/core'; +@Component({ + selector: 'df-section', + templateUrl: './dynamic-form-section.html', + }) + export class DynamicFormSectionComponent implements OnInit{ + + @Input() section: Section + @Input() form: FormGroup; + @Input() pathName:string; + + constructor(){} + + ngOnInit(){ + + } + } \ No newline at end of file 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 e968a33d6..3f13037ee 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 @@ -26,58 +26,78 @@
--> -
+
- - -
{{field.description}}
- - -
+ +
{{field.extendedDescription}}
- - - -
- - -
- -
- - - - -
- -
- - -
-
-
-
- -
- - -
-
The field "{{field.label}}" is required
-
The field {{field.label}} must match a regular expression {{field.regex}}
-
The field {{field.label}} custom Validation
+
+
- + + + + +
+ + + + +
+ + + + +
+ +
+ +
+ +
+ + + +
+ +
+ + +
+
+
+
+ +
+ + +
+
The field "{{field.label}}" is required
+
The field {{field.label}} must match a regular expression {{field.regex}}
+
The field {{field.label}} custom Validation
+
+ +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -