diff --git a/dmp-admin/src/app/app.module.ts b/dmp-admin/src/app/app.module.ts index 63e1fd898..fd7dd5a74 100644 --- a/dmp-admin/src/app/app.module.ts +++ b/dmp-admin/src/app/app.module.ts @@ -70,6 +70,7 @@ import { CompositeFieldFormComponent } from './compositefield-form/compositefiel import { ComboboxComponent } from './combobox/combobox-component'; import { AutocompleteComponent } from './autocomplete/autocomplete-component'; import { WordlistComponent } from './wordlist/wordlist-component'; +import { RadioBoxComponent } from './radiobox/radiobox-component'; @@ -97,6 +98,7 @@ import { WordlistComponent } from './wordlist/wordlist-component'; ComboboxComponent, AutocompleteComponent, WordlistComponent, + RadioBoxComponent, DatasetsViewerComponent, ProfileEditorComponent, PropertiesEditorComponent, diff --git a/dmp-admin/src/app/autocomplete/autocomplete-component.ts b/dmp-admin/src/app/autocomplete/autocomplete-component.ts index c6f61cc63..2f4c09d74 100644 --- a/dmp-admin/src/app/autocomplete/autocomplete-component.ts +++ b/dmp-admin/src/app/autocomplete/autocomplete-component.ts @@ -15,6 +15,7 @@ export class AutocompleteComponent implements OnInit{ private data:AutocompleteData = new AutocompleteData(); ngOnInit(){ + this.data.type= "autocomplete"; let autocomplete: AutocompleteData = new AutocompleteData(); this.dataModel.data = new JsonSerializer().fromJSONObject(this.data,AutocompleteData); //(this.form.get("data")).push(autocomplete.buildForm()); diff --git a/dmp-admin/src/app/compositefield-form/compositefield-form.component.html b/dmp-admin/src/app/compositefield-form/compositefield-form.component.html index 1d60b34a7..401c19599 100644 --- a/dmp-admin/src/app/compositefield-form/compositefield-form.component.html +++ b/dmp-admin/src/app/compositefield-form/compositefield-form.component.html @@ -18,11 +18,11 @@
- +
- +
diff --git a/dmp-admin/src/app/compositefield-form/compositefield-form.component.ts b/dmp-admin/src/app/compositefield-form/compositefield-form.component.ts index 921074b13..782190da3 100644 --- a/dmp-admin/src/app/compositefield-form/compositefield-form.component.ts +++ b/dmp-admin/src/app/compositefield-form/compositefield-form.component.ts @@ -26,7 +26,7 @@ addNewField(){ (this.form.get("fields")).push(field.buildForm()); } DeleteField(index){ - this.dataModel.fields.splice(index); + this.dataModel.fields.splice(index, 1); (this.form.get("fields")).removeAt(index); } } \ No newline at end of file diff --git a/dmp-admin/src/app/field-form/field-form.component.html b/dmp-admin/src/app/field-form/field-form.component.html index 78d65f5bd..fefbca431 100644 --- a/dmp-admin/src/app/field-form/field-form.component.html +++ b/dmp-admin/src/app/field-form/field-form.component.html @@ -19,6 +19,7 @@ + @@ -28,6 +29,9 @@
+
+ +
@@ -77,7 +81,7 @@
- + \ No newline at end of file diff --git a/dmp-admin/src/app/field-form/field-form.component.ts b/dmp-admin/src/app/field-form/field-form.component.ts index ef5eedcd3..de0733025 100644 --- a/dmp-admin/src/app/field-form/field-form.component.ts +++ b/dmp-admin/src/app/field-form/field-form.component.ts @@ -30,7 +30,7 @@ addNewRule(){ } DeleteRule(index){ - this.dataModel.visible.rules.splice(index); + this.dataModel.visible.rules.splice(index, 1); (this.form.get("visible").get("rules")).removeAt(index); } diff --git a/dmp-admin/src/app/form/form.component.html b/dmp-admin/src/app/form/form.component.html index 7cf31fc75..9de3ea02a 100644 --- a/dmp-admin/src/app/form/form.component.html +++ b/dmp-admin/src/app/form/form.component.html @@ -1,6 +1,12 @@
+
+
+ + +
+

Section

+
+ + +
Add another section + diff --git a/dmp-admin/src/app/form/form.component.ts b/dmp-admin/src/app/form/form.component.ts index 418ad101b..8b388d545 100644 --- a/dmp-admin/src/app/form/form.component.ts +++ b/dmp-admin/src/app/form/form.component.ts @@ -55,7 +55,7 @@ export class FormComponent { } DeleteSection(index) { - this.dataModel.sections.splice(index); + this.dataModel.sections.splice(index,1); (this.form.get("sections")).removeAt(index) } diff --git a/dmp-admin/src/app/groupfield-form/groupfield-form.component.ts b/dmp-admin/src/app/groupfield-form/groupfield-form.component.ts index cf687ba56..cf599e739 100644 --- a/dmp-admin/src/app/groupfield-form/groupfield-form.component.ts +++ b/dmp-admin/src/app/groupfield-form/groupfield-form.component.ts @@ -36,7 +36,7 @@ export class GroupFieldFormComponent { } DeleteFieldSet(index){ - this.dataModel.compositeFields.splice(index); + this.dataModel.compositeFields.splice(index, 1); (this.form.get("compositeFields")).removeAt(index); } diff --git a/dmp-admin/src/app/models/DatasetProfileModel.ts b/dmp-admin/src/app/models/DatasetProfileModel.ts index 9d86174c1..a0392fc84 100644 --- a/dmp-admin/src/app/models/DatasetProfileModel.ts +++ b/dmp-admin/src/app/models/DatasetProfileModel.ts @@ -1,5 +1,5 @@ import { BaseModel } from './BaseModel'; -import { FormBuilder, FormGroup } from '@angular/forms'; +import { FormBuilder, FormGroup, FormControl } from '@angular/forms'; import { FormGenerator } from './interfaces/FormGenerator'; import { JsonSerializer } from '../utilities/JsonSerializer'; import { Section } from './Section'; @@ -7,9 +7,11 @@ import { Serializable } from './interfaces/Serializable'; export class DatasetProfileModel extends BaseModel implements Serializable,FormGenerator{ public sections:Array
= new Array
(); - + public label: string; + fromJSONObject(item:any):DatasetProfileModel{ this.sections = new JsonSerializer
().fromJSONArray(item.sections,Section); + this.label = item.label; return this; } @@ -21,6 +23,7 @@ export class DatasetProfileModel extends BaseModel implements Serializable +
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/dmp-admin/src/app/radiobox/radiobox-component.ts b/dmp-admin/src/app/radiobox/radiobox-component.ts new file mode 100644 index 000000000..ca41461fb --- /dev/null +++ b/dmp-admin/src/app/radiobox/radiobox-component.ts @@ -0,0 +1,32 @@ +import { FormGroup } from '@angular/forms'; +import { Field } from '../models/Field'; +import { Component, Input, OnInit } from '@angular/core'; +import { RadioBoxData } from '../models/DataField/RadioBoxData'; +import { FormArray } from '@angular/forms/src/model'; +import { ListingItem } from '../models/Commons/ListingItem'; +import { JsonSerializer } from '../utilities/JsonSerializer'; + +@Component({ + selector: 'radiobox-component', + templateUrl: './radiobox-component.html' +}) +export class RadioBoxComponent implements OnInit{ + @Input() dataModel: Field; + @Input() form: FormGroup; + private data: RadioBoxData = new RadioBoxData(); + private options = new Array(); + + ngOnInit(){ + if (this.form.get("data")) this.form.removeControl("data"); + this.form.addControl("data", this.data.buildForm()); + this.addNewRow(); + } + + addNewRow(){ + let radioListOptions:ListingItem = new ListingItem(); + (this.form.get("data").get("options")).push(radioListOptions.buildForm()); + this.data.options = []; + this.data.options.push(radioListOptions); + this.dataModel.data = new JsonSerializer().fromJSONObject(this.data,RadioBoxData); + } +} \ No newline at end of file diff --git a/dmp-admin/src/app/rule-component/rule.component.html b/dmp-admin/src/app/rule-component/rule.component.html index db0d76feb..cd6928e4b 100644 --- a/dmp-admin/src/app/rule-component/rule.component.html +++ b/dmp-admin/src/app/rule-component/rule.component.html @@ -9,7 +9,7 @@
- +
diff --git a/dmp-admin/src/app/rule-component/rule.component.ts b/dmp-admin/src/app/rule-component/rule.component.ts index baff11560..b6c746321 100644 --- a/dmp-admin/src/app/rule-component/rule.component.ts +++ b/dmp-admin/src/app/rule-component/rule.component.ts @@ -12,4 +12,8 @@ export class RuleFormComponent { @Input() form: FormGroup; @Input() dataModel: FormGroup; +TargetValidation(){ + debugger; +} + } \ No newline at end of file diff --git a/dmp-admin/src/app/section-form/section-form.component.html b/dmp-admin/src/app/section-form/section-form.component.html index 20aa82d87..93cd6a372 100644 --- a/dmp-admin/src/app/section-form/section-form.component.html +++ b/dmp-admin/src/app/section-form/section-form.component.html @@ -27,6 +27,11 @@
+

Section + +

@@ -48,10 +53,10 @@ + + Add section + + +
diff --git a/dmp-admin/src/app/section-form/section-form.component.ts b/dmp-admin/src/app/section-form/section-form.component.ts index cef984dc6..0ff8420cc 100644 --- a/dmp-admin/src/app/section-form/section-form.component.ts +++ b/dmp-admin/src/app/section-form/section-form.component.ts @@ -30,7 +30,7 @@ export class SectionFormComponent { } DeleteFieldGroup(index){ - this.dataModel.fieldGroups.splice(index); + this.dataModel.fieldGroups.splice(index, 1); (this.form.get("fieldGroups")).removeAt(index) } @@ -39,5 +39,10 @@ export class SectionFormComponent { this.dataModel.sections.push(section); (this.form.get("sections")).push(section.buildForm()); } + + DeleteSectionInSection(index){ + this.dataModel.sections.splice(index); + (this.form.get("sections")).removeAt(index); + } } \ No newline at end of file diff --git a/dmp-admin/src/app/wordlist/wordlist-component.html b/dmp-admin/src/app/wordlist/wordlist-component.html index 23f83f04c..64b6b89e7 100644 --- a/dmp-admin/src/app/wordlist/wordlist-component.html +++ b/dmp-admin/src/app/wordlist/wordlist-component.html @@ -4,11 +4,11 @@
- +
- +
diff --git a/dmp-admin/src/app/wordlist/wordlist-component.ts b/dmp-admin/src/app/wordlist/wordlist-component.ts index a6c07efc5..203c8cd6a 100644 --- a/dmp-admin/src/app/wordlist/wordlist-component.ts +++ b/dmp-admin/src/app/wordlist/wordlist-component.ts @@ -17,6 +17,7 @@ export class WordlistComponent implements OnInit{ private options = new Array(); ngOnInit(){ + this.data.type = "wordlist"; if (this.form.get("data")) this.form.removeControl("data"); this.form.addControl("data", this.data.buildForm()); this.addNewRow();