From 038368257ad8984d69136faeb37f153b38a17b49 Mon Sep 17 00:00:00 2001 From: mariateresa Date: Thu, 7 Mar 2024 17:26:01 +0100 Subject: [PATCH] debugging controllers... --- .../facet-composer.component.html | 78 ++++------ .../facet-composer.component.ts | 140 +++++++----------- 2 files changed, 87 insertions(+), 131 deletions(-) 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 4122692..53ac86d 100644 --- a/src/main/webapp/app/facet-composer/facet-composer.component.html +++ b/src/main/webapp/app/facet-composer/facet-composer.component.html @@ -16,55 +16,39 @@
-
- -
- - - - - - - - {{typeSpec.facetSpecs[ind].name}} - - -

{{typeSpec.facetSpecs[ind].description}}

- - - -

group {{ind}}

-
-
- -
-

control {{i}} - - -

-
- + + +
+
+ + + + + + + + {{typeSpec.facetSpecs[ind].name}} + + +

{{typeSpec.facetSpecs[ind].description}}

+ + +
+
+ + + +
-
- - - -
+ + + +
+
+ +
- - - - - - - - -
+ 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 9253d6b..36dbe9f 100644 --- a/src/main/webapp/app/facet-composer/facet-composer.component.ts +++ b/src/main/webapp/app/facet-composer/facet-composer.component.ts @@ -33,7 +33,6 @@ export class FacetComposerComponent implements OnInit { myForm: FormGroup ; //form complessiva - typeSpec: ITypeSpecification; // eslint-disable-next-line @typescript-eslint/member-ordering @@ -43,107 +42,80 @@ export class FacetComposerComponent implements OnInit { this.titleType = data.type.name; this.titlePath = data.context.path; this.typeSpec = {} as ITypeSpecification; - - /* - this.myForm = this.fb.group({ - 'facets': this.fb.array([]), - 'facetPropsArray':this.fb.array([]), - }); - */ - - this.myForm = this.fb.group({ - 'facets': this.fb.array([ + + this.myForm = this.fb.group({ + 'facetBlocks': this.fb.array([ this.fb.group({ 'relation':'', - 'facetPropsArray':this.fb.array([]), + 'facetPropsBlock':this.fb.array([]), + //TODO: PROVA-> 'facetPropsBlock':this.fb.array([this.fb.group({}]), }) ]), }); - - /* - 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; - } - - + + get facetBlocks() { + return this.myForm.get('facetBlocks') as FormArray; + } + - addFacets() { + get facetPropsBlock(): FormArray { + return this.myForm.get('facetPropsBlock') as FormArray; + } + + /* + addFacetBlocks() { const fc = {} as IFacetComposer; - this.facets.push(this.fb.group(fc)); + this.facetBlocks.push(this.fb.group(fc)); } addFacetProps() { const fp = {} as IFacetProps; - this.facetPropsArray.push(this.fb.group(fp)); + this.facetPropsBlock.push(this.fb.control(fp)); } + */ - ngOnInit(): void { - this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => { - this.typeSpec = res; - this.prepareEnvironment(res); - }); - } + ngOnInit(): void { + alert("facetPropsBlock"); + alert(this.facetPropsBlock); + + this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => { + this.typeSpec = res; + this.prepareControls(res); + }); + } - 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