diff --git a/dmp-admin/src/app/app.module.ts b/dmp-admin/src/app/app.module.ts index 797f41c11..63e1fd898 100644 --- a/dmp-admin/src/app/app.module.ts +++ b/dmp-admin/src/app/app.module.ts @@ -67,6 +67,9 @@ import { GroupFieldFormComponent } from './groupfield-form/groupfield-form.compo import { RuleFormComponent } from './rule-component/rule.component'; import { SectionFormComponent } from './section-form/section-form.component'; import { CompositeFieldFormComponent } from './compositefield-form/compositefield-form.component'; +import { ComboboxComponent } from './combobox/combobox-component'; +import { AutocompleteComponent } from './autocomplete/autocomplete-component'; +import { WordlistComponent } from './wordlist/wordlist-component'; @@ -91,6 +94,9 @@ import { CompositeFieldFormComponent } from './compositefield-form/compositefiel RuleFormComponent, SectionFormComponent, CompositeFieldFormComponent, + ComboboxComponent, + AutocompleteComponent, + WordlistComponent, DatasetsViewerComponent, ProfileEditorComponent, PropertiesEditorComponent, diff --git a/dmp-admin/src/app/autocomplete/autocomplete-component.html b/dmp-admin/src/app/autocomplete/autocomplete-component.html new file mode 100644 index 000000000..f210ba7f7 --- /dev/null +++ b/dmp-admin/src/app/autocomplete/autocomplete-component.html @@ -0,0 +1,9 @@ +
+
+
+ + +
+
+ +
\ No newline at end of file diff --git a/dmp-admin/src/app/autocomplete/autocomplete-component.ts b/dmp-admin/src/app/autocomplete/autocomplete-component.ts new file mode 100644 index 000000000..c6f61cc63 --- /dev/null +++ b/dmp-admin/src/app/autocomplete/autocomplete-component.ts @@ -0,0 +1,24 @@ +import { FormGroup } from '@angular/forms'; +import { Field } from '../models/Field'; +import { Component, Input, OnInit } from '@angular/core'; +import { AutocompleteData } from '../models/DataField/AutocompleteData'; +import { FormArray } from '@angular/forms/src/model'; +import { JsonSerializer } from '../utilities/JsonSerializer'; + +@Component({ + selector: 'autocomplete-component', + templateUrl: './autocomplete-component.html' +}) +export class AutocompleteComponent implements OnInit{ + @Input() dataModel: Field; + @Input() form: FormGroup; + private data:AutocompleteData = new AutocompleteData(); + + ngOnInit(){ + let autocomplete: AutocompleteData = new AutocompleteData(); + this.dataModel.data = new JsonSerializer().fromJSONObject(this.data,AutocompleteData); + //(this.form.get("data")).push(autocomplete.buildForm()); + if (this.form.get("data")) this.form.removeControl("data"); + this.form.addControl("data", this.data.buildForm()); + } +} \ No newline at end of file diff --git a/dmp-admin/src/app/combobox/combobox-component.html b/dmp-admin/src/app/combobox/combobox-component.html new file mode 100644 index 000000000..ef4d77e0c --- /dev/null +++ b/dmp-admin/src/app/combobox/combobox-component.html @@ -0,0 +1,16 @@ +
+ + +
+
+ +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/dmp-admin/src/app/combobox/combobox-component.ts b/dmp-admin/src/app/combobox/combobox-component.ts new file mode 100644 index 000000000..abd17c00c --- /dev/null +++ b/dmp-admin/src/app/combobox/combobox-component.ts @@ -0,0 +1,18 @@ +import { FormGroup } from '@angular/forms'; +import { Field } from '../models/Field'; +import { Component, Input, OnInit } from '@angular/core'; + +@Component({ + selector: 'combobox-component', + templateUrl: './combobox-component.html' +}) +export class ComboboxComponent implements OnInit{ + @Input() dataModel: Field; + @Input() form: FormGroup; + + options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}]; + + ngOnInit(){ + + } +} \ 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 85b1c0c24..78d65f5bd 100644 --- a/dmp-admin/src/app/field-form/field-form.component.html +++ b/dmp-admin/src/app/field-form/field-form.component.html @@ -26,8 +26,7 @@
- - +
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 ac6353a43..ef5eedcd3 100644 --- a/dmp-admin/src/app/field-form/field-form.component.ts +++ b/dmp-admin/src/app/field-form/field-form.component.ts @@ -4,6 +4,7 @@ import { Field } from '../models/Field'; import { Rule } from '../models/Rule'; import { Multiplicity } from '../models/Multiplicity'; import { FormArray } from '@angular/forms/src/model'; +import {ComboboxComponent} from '../combobox/combobox-component'; @Component({ selector: 'field-form', diff --git a/dmp-admin/src/app/models/Field.ts b/dmp-admin/src/app/models/Field.ts index c3b6fcab2..9cd9767ed 100644 --- a/dmp-admin/src/app/models/Field.ts +++ b/dmp-admin/src/app/models/Field.ts @@ -67,7 +67,8 @@ export class Field extends BaseModel implements Serializable,FormGenerato formGroup.addControl("defaultValue", this.defaultValue.buildForm()); formGroup.addControl("viewStyle", this.viewStyle.buildForm()); formGroup.addControl("visible", this.visible.buildForm()); - if(this.data)formGroup.addControl("data", this.data.buildForm()); + //formGroup.addControl("data",this.data? this.data.buildForm():this.formBuilder.group({})); + if(this.data)formGroup.addControl("data",this.data.buildForm()); return formGroup; } diff --git a/dmp-admin/src/app/services/rest-base.ts b/dmp-admin/src/app/services/rest-base.ts index bc80e0cae..c2082b173 100644 --- a/dmp-admin/src/app/services/rest-base.ts +++ b/dmp-admin/src/app/services/rest-base.ts @@ -18,7 +18,7 @@ export class RestBase { /* */ protocol: string = "http"; - hostname: string = "localhost"; + hostname: string = "192.168.32.103"; port: number = 8080; webappname: string = "dmp-backend"; restpath: string = "rest"; diff --git a/dmp-admin/src/app/wordlist/wordlist-component.html b/dmp-admin/src/app/wordlist/wordlist-component.html new file mode 100644 index 000000000..23f83f04c --- /dev/null +++ b/dmp-admin/src/app/wordlist/wordlist-component.html @@ -0,0 +1,24 @@ +
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+ + +
\ No newline at end of file diff --git a/dmp-admin/src/app/wordlist/wordlist-component.ts b/dmp-admin/src/app/wordlist/wordlist-component.ts new file mode 100644 index 000000000..a6c07efc5 --- /dev/null +++ b/dmp-admin/src/app/wordlist/wordlist-component.ts @@ -0,0 +1,32 @@ +import { FormGroup } from '@angular/forms'; +import { Field } from '../models/Field'; +import { Component, Input, OnInit } from '@angular/core'; +import { WordListData } from '../models/DataField/WordListData'; +import { FormArray } from '@angular/forms/src/model'; +import { ListingItem } from '../models/Commons/ListingItem'; +import { JsonSerializer } from '../utilities/JsonSerializer'; + +@Component({ + selector: 'wordlist-component', + templateUrl: './wordlist-component.html' +}) +export class WordlistComponent implements OnInit{ + @Input() dataModel: Field; + @Input() form: FormGroup; + private data: WordListData = new WordListData(); + 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 wordListOptions:ListingItem = new ListingItem(); + (this.form.get("data").get("options")).push(wordListOptions.buildForm()); + this.data.options = []; + this.data.options.push(wordListOptions); + this.dataModel.data = new JsonSerializer().fromJSONObject(this.data,WordListData); + } +} \ No newline at end of file