diff --git a/src/main/webapp/app/facet-composer/facet-composer.component.html b/src/main/webapp/app/facet-composer/facet-composer.component.html
index 486b28f..4122692 100644
--- a/src/main/webapp/app/facet-composer/facet-composer.component.html
+++ b/src/main/webapp/app/facet-composer/facet-composer.component.html
@@ -23,7 +23,7 @@
{{typeSpec.facetSpecs[ind].description}}
- + +group {{ind}}
- control {{i}} -
diff --git a/src/main/webapp/app/facet-composer/facet-composer.component.ts b/src/main/webapp/app/facet-composer/facet-composer.component.ts
index 95ce2da..9253d6b 100644
--- a/src/main/webapp/app/facet-composer/facet-composer.component.ts
+++ b/src/main/webapp/app/facet-composer/facet-composer.component.ts
@@ -6,7 +6,7 @@ import { FormArray, FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Va
import { MAT_DIALOG_DATA, MatDialogActions, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { IContextNode } from 'app/services/i-context-node';
import { IResource } from 'app/services/i-resource';
-import { IFacetComposer, IFacetGui } from './i-facet-composer';
+import { IFacetComposer, IFacetProps } from './i-facet-composer';
import { FacetComposerService, ITypeSpecification } from './facet-composer.service';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatButtonModule } from '@angular/material/button';
@@ -32,13 +32,9 @@ export class FacetComposerComponent implements OnInit {
titlePath: string;
myForm: FormGroup ; //form complessiva
-
+
+
typeSpec: ITypeSpecification;
-
-
-
- facetGuis: any;
-
// eslint-disable-next-line @typescript-eslint/member-ordering
constructor(private guiService: FacetComposerService, private fb: FormBuilder,
@@ -48,22 +44,82 @@ export class FacetComposerComponent implements OnInit {
this.titlePath = data.context.path;
this.typeSpec = {} as ITypeSpecification;
+ /*
this.myForm = this.fb.group({
- facets: this.fb.array([]),
- facetGuis:this.fb.array([]),
+ 'facets': this.fb.array([]),
+ 'facetPropsArray':this.fb.array([]),
});
+ */
+
+ this.myForm = this.fb.group({
+ 'facets': this.fb.array([
+ this.fb.group({
+ 'relation':'',
+ 'facetPropsArray':this.fb.array([]),
+ })
+ ]),
+
+ });
+
+ /*
+ segmentRows3: this.fb.array([
+ this.fb.group({
+ segmentId3: '',
+ segmentTime3: '',
+ personRows3: this.fb.array([
+ this.fb.group({
+ personR3: '',
+ personI3: ''
+ })
+ ])
+ })
+ ]),
+ */
}
+
+ /*
+ Cannot find control with path
+ */
+
+
+ get Facets(): FormArray {
+ return this.myForm.get('facets') as FormArray;
+ }
+ get FacetPropsArray(): FormArray {
+ return this.myForm.get('facetPropsArray') as FormArray;
+ }
+
+
+ addFacets() {
+ const fc = {} as IFacetComposer;
+ this.facets.push(this.fb.group(fc));
+ }
+
+ addFacetProps() {
+ const fp = {} as IFacetProps;
+ this.facetPropsArray.push(this.fb.group(fp));
+ }
+
ngOnInit(): void {
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
this.typeSpec = res;
+ this.prepareEnvironment(res);
});
-
- for (let ind = 0; ind < this.typeSpec.facetSpecs.length; ind++) {
+ }
+
+ prepareEnvironment(spec:ITypeSpecification){
+ for (let ind = 0; ind < spec.facetSpecs.length; ind++) {
+ //TODO: metti a posto validazione
+ //this.fb.group()
+ const itemExt = this.fb.control({
+ relation: [spec.facetSpecs[ind].relation,null]
+ });
+
const fGroup: FormGroup = new FormGroup({});
let ctrl: FormControl|undefined;
- for(let j=0; j