working on editing GUI

This commit is contained in:
Maria Teresa Paratore 2024-05-13 18:21:37 +02:00
parent e180a94b6b
commit 79389cbbcd
6 changed files with 225 additions and 99 deletions

View File

@ -24,6 +24,7 @@ import org.gcube.informationsystem.service.dto.FacetPropGui;
import org.gcube.informationsystem.service.dto.FacetPropertyDTO;
import org.gcube.informationsystem.service.dto.FacetSpecDTO;
import org.gcube.informationsystem.service.dto.FacetTypeDTO;
import org.gcube.informationsystem.service.dto.ResourceImplFieldsDTO;
import org.gcube.informationsystem.service.dto.ResourceTypeDTO;
import org.gcube.informationsystem.service.dto.ValidationObjDTO;
import org.gcube.informationsystem.tree.Tree;
@ -106,6 +107,8 @@ public class InformationSystemService {
}
public FacetSpecDTO getFacetSpecification(String facetName) throws Exception {
String currentCtx = SecretManagerProvider.instance.get().getContext();
@ -142,6 +145,16 @@ public class InformationSystemService {
}
public String getResource(String type, String uid) throws Exception {
String raw = "";
String currentCtx = SecretManagerProvider.instance.get().getContext();
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(currentCtx);
resourceRegistryClient.setIncludeMeta(false);
UUID coso = UUID.fromString(uid);
raw = resourceRegistryClient.getInstance(type, coso);
return raw;
}
private FacetPropGui toFacetPropGui(FacetPropertyDTO fp, ResourceRegistryClient client) {
FacetPropGui prop = new FacetPropGui();
prop.setPropDescription(fp.getDescription());
@ -387,15 +400,6 @@ public class InformationSystemService {
/*
* Fetches the instance of a certain type for a given UUID
*/
public String getResource(String type, String uid) throws Exception {
String raw = "";
String currentCtx = SecretManagerProvider.instance.get().getContext();
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(currentCtx);
resourceRegistryClient.setIncludeMeta(false);
UUID coso = UUID.fromString(uid);
raw = resourceRegistryClient.getInstance(type, coso);
return raw;
}

View File

@ -18,6 +18,8 @@ import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.config.TokenManager;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
import org.gcube.informationsystem.serialization.ElementMapper;
@ -26,7 +28,12 @@ import org.gcube.informationsystem.service.dto.ContextDTO;
import org.gcube.informationsystem.service.dto.FacetSpecDTO;
import org.gcube.informationsystem.service.dto.FacetTypeDTO;
import org.gcube.informationsystem.service.dto.ResourceBuilderDTO;
import org.gcube.informationsystem.service.dto.ResourceImplFieldsDTO;
import org.gcube.informationsystem.service.dto.ResourceTypeDTO;
import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.utils.UUIDUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -40,7 +47,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriUtils;
import com.jayway.jsonpath.JsonPath;
import lombok.RequiredArgsConstructor;
import net.minidev.json.JSONArray;
import tech.jhipster.web.util.HeaderUtil;
@ -168,6 +178,7 @@ public class InformationSystemResource{
return ResponseEntity.ok().body(sc);
} catch (Exception e) {
//e.printStackTrace();
log.error("****ERROR*************");
log.error(e.getMessage(), e);
return ResponseEntity.noContent()
@ -175,7 +186,63 @@ public class InformationSystemResource{
}
}
/*
* Ritorna il raw json spacchettato in oggetti buoni per la rappresentazione nella GUI
*/
@GetMapping("/facetfields")
public ResponseEntity<String> resourceInstanceMapped(@RequestParam @Nullable String currentContext, @RequestParam String resourceType, @RequestParam String uid) {
log.debug("Request facets fields");
ArrayList<ResourceImplFieldsDTO> facetFields = new ArrayList<ResourceImplFieldsDTO>();
ArrayList<String> facetRelations = new ArrayList<>();
ArrayList<String> facetNames = new ArrayList<>();
ArrayList<JSONArray> extraProps = new ArrayList<JSONArray>();
try {
String currentCtx = SecretManagerProvider.instance.get().getContext();
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(currentCtx);
informationSystemService.setUma(createUmaToken(currentContext));
String rawJson = informationSystemService.getResource(resourceType, uid);
//TODO: qui spacchetta con Jsonpath
//String sc = rawJson;
facetRelations = JsonPath.parse(rawJson).read("$..consistsOf.*.type");
facetNames = JsonPath.parse(rawJson).read("$..consistsOf.*.target.type");
// ArrayList<String> mapKeys = new ArrayList<String>();
for(int i=0; i<facetNames.size(); i++) {
Map<String, Object> targetObj = JsonPath.parse(rawJson).read("$.consistsOf.["+i+"].target");
String fName = facetNames.get(i);
ResourceImplFieldsDTO rif = new ResourceImplFieldsDTO();
rif.setFrname(fName+"_"+facetRelations.get(i));
Map<String, String> facetProps = new HashMap<>();
String jsonFacetDesc = resourceRegistryClient.getType(fName, true);
Type type = TypeMapper.deserializeTypeDefinitions(jsonFacetDesc).get(0); //only one result
FacetType ft = (FacetType) type;
if(ft.getProperties()!=null ) {
for(PropertyDefinition pd:ft.getProperties() ) {
try {
String propName = pd.getName();
String propValue = "";
if(targetObj.get(propName)!=null) {
propValue = targetObj.get(propName).toString();
}
facetProps.put(propName, propValue);
}catch(Exception e) {
e.printStackTrace();
}
}
}
rif.setProperties(facetProps);
facetFields.add(rif);
}
ObjectMapper om = new ObjectMapper();
String json = om.writeValueAsString(facetFields);
return ResponseEntity.ok().body(json);
} catch (Exception e) {
log.error("****ERROR*************");
log.error(e.getLocalizedMessage(), e);
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, e.getLocalizedMessage(), "")).build();
}
}
@GetMapping("/resourcetypejson")
@ -211,6 +278,8 @@ public class InformationSystemResource{
.headers(HeaderUtil.createAlert(applicationName, e.getLocalizedMessage(), "")).build();
}
}
/*
* returns all the instances of resources given a certain type

View File

@ -2,73 +2,116 @@ package org.gcube.informationsystem.web.rest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.service.dto.FacetPropGui;
import org.gcube.informationsystem.service.dto.FacetPropertyDTO;
import org.gcube.informationsystem.service.dto.FacetSpecDTO;
import org.gcube.informationsystem.service.dto.ResourceImplFieldsDTO;
import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
import net.minidev.json.JSONArray;
public class ProveVarie2 {
/*
* {
---"type" : "ConsistsOf",
"target" : {
"authorization":{
"schema" : "myname",
"value" : "mypassword",
"type" : "ValueSchema"
},
"protocol" : "proto",
"endpoint" : "eeeeeee",
"entryName" : "een",
"description" : "dede",
"type" : "AccessPointFacet"
}*/
static ArrayList<String> facetRelations = new ArrayList<>();
static ArrayList<String> facetNames = new ArrayList<>();
static ArrayList<JSONArray> extraProps = new ArrayList<JSONArray>();
static JSONArray props = new JSONArray();
public static void main(String[] args) {
ResourceDescription rd = new ResourceDescription();
rd.setType("EService");
//
ArrayList<FacetDescription> arrFd = new ArrayList<FacetDescription>();
FacetDescription fd1 = new FacetDescription();
fd1.setType("ConsistsOf");
Map<String,Object> targetMap = new HashMap<String,Object>();
targetMap.put("protocol","proto");
targetMap.put("endpoint","https://pippo.topolino.eeeeeee");
targetMap.put("entryName","een");
targetMap.put("description","dede");
targetMap.put("type","AccessPointFacet");
TypeProperty tp = new TypeProperty();
tp.setType("ValueSchema");
tp.setSchema("myschema");
tp.setValue("myvalue");
targetMap.put("authorization", tp);
fd1.setTarget(targetMap);
arrFd.add(fd1);
rd.setConsistsOf(arrFd);
try {
// create object mapper instance
ObjectMapper mapper = new ObjectMapper();
// convert user object to `JsonNode`
JsonNode node = mapper.valueToTree(rd);
System.out.println(node.toPrettyString());
ResourceImplFieldsDTO rd = buildFormFields(realData);
// System.out.println(Json.pretty(rd));
// JsonElement je= JsonParser.parseString(realData);
// System.out.println(je);
}catch(Exception e) {
e.printStackTrace();
}
//rd.setIsRelatedTo(new ArrayList<ExtraPropertyString>());
}
public FacetSpecDTO getFacetSpecification2(String facetName) throws Exception {
String currentCtx = SecretManagerProvider.instance.get().getContext();
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory.create(currentCtx);
String jsonResult = resourceRegistryClient.getType(facetName, true);
Type type = TypeMapper.deserializeTypeDefinitions(jsonResult).get(0); //only one result
FacetSpecDTO fsdto = new FacetSpecDTO();
ArrayList<FacetPropGui> propsGui = new ArrayList<FacetPropGui>();
FacetType ft = (FacetType) type;
if(ft.getProperties()!=null ) {
for(PropertyDefinition pd:ft.getProperties() ) {
try {
FacetPropertyDTO prop = new FacetPropertyDTO();
prop.setName(pd.getName());
}catch(Exception e) {
e.printStackTrace();
}
}
}
fsdto.setGuiProps(propsGui);
return fsdto;
}
static ResourceImplFieldsDTO buildFormFields(String resData) {
ArrayList<ResourceImplFieldsDTO> facetFields = new ArrayList<ResourceImplFieldsDTO>();
facetRelations = JsonPath.parse(realData).read("$..consistsOf.*.type");
facetNames = JsonPath.parse(realData).read("$..consistsOf.*.target.type");
Map<String, Object> targetObj = JsonPath.parse(realData).read("$.consistsOf.[0].target");
String gruppo = targetObj.get("group").toString();
//ArrayList<ResourceImplFieldsDTO> facetFields = new ArrayList<ResourceImplFieldsDTO>();
ResourceImplFieldsDTO rf1 = new ResourceImplFieldsDTO();
rf1.setFrname("cname1");
Map<String, String> props1 = new HashMap<>();
props1.put("campo11", "valore11");
props1.put("campo12", "valore12");
rf1.setProperties(props1);
facetFields.add(rf1);
ResourceImplFieldsDTO rf2 = new ResourceImplFieldsDTO();
rf2.setFrname("cname2");
Map<String, String> props2 = new HashMap<>();
props2.put("campo21", "valore21");
props2.put("campo22", "valore22");
rf2.setProperties(props2);
facetFields.add(rf2);
ObjectMapper om = new ObjectMapper();
try {
String json = om.writeValueAsString(targetObj);
System.out.println(json);
}catch(Exception e) {
e.printStackTrace();
}
return null;
}
static String realData ="{\"type\":\"EService\",\"supertypes\":[\"Service\",\"GCubeResource\",\"Resource\"],\"id\":\"fc212f4e-8741-42fd-ae30-354c46462913\",\"consistsOf\":[{\"type\":\"IsIdentifiedBy\",\"supertypes\":[\"ConsistsOf\"],\"id\":\"4e26d21e-975b-4ea3-8b06-21450661da72\",\"propagationConstraint\":{\"type\":\"PropagationConstraint\",\"add\":\"propagate\",\"delete\":\"cascade\",\"remove\":\"cascade\",\"supertypes\":[\"Property\"]},\"target\":{\"type\":\"SoftwareFacet\",\"supertypes\":[\"Facet\"],\"id\":\"7b5d4e52-1fbf-4e34-949d-49af8dbfb7e5\",\"qualifier\":null,\"name\":\"StorageHub\",\"description\":\"REST web service for Jackrabbit\",\"optional\":false,\"version\":\"1.5.0-SNAPSHOT\",\"group\":\"DataAccess\"}},{\"type\":\"ConsistsOf\",\"id\":\"ab3ff917-dc8b-4015-9251-f23fdf752c9c\",\"propagationConstraint\":{\"type\":\"PropagationConstraint\",\"add\":\"propagate\",\"delete\":\"cascade\",\"remove\":\"cascade\",\"supertypes\":[\"Property\"]},\"target\":{\"type\":\"AccessPointFacet\",\"supertypes\":[\"Facet\"],\"id\":\"cd9392c4-1231-427e-8205-0dfd8f76aa04\",\"authorization\":{\"type\":\"ValueSchema\",\"schema\":null,\"value\":\"gcube-token\",\"supertypes\":[\"GCubeProperty\",\"Property\"]},\"endpoint\":\"https://workspace-repository.dev.d4science.org:443/storagehub/workspace\",\"protocol\":null,\"entryName\":\"org.gcube.data.access.storagehub.StorageHub\",\"description\":null}},{\"type\":\"ConsistsOf\",\"id\":\"ee23ac28-2db8-4b98-b86d-fba3d18eab87\",\"propagationConstraint\":{\"type\":\"PropagationConstraint\",\"add\":\"propagate\",\"delete\":\"cascade\",\"remove\":\"cascade\",\"supertypes\":[\"Property\"]},\"target\":{\"type\":\"AccessPointFacet\",\"supertypes\":[\"Facet\"],\"id\":\"b136870a-9865-4141-b997-c635eb66dfef\",\"authorization\":{\"type\":\"ValueSchema\",\"schema\":null,\"value\":\"gcube-token\",\"supertypes\":[\"GCubeProperty\",\"Property\"]},\"endpoint\":\"https://workspace-repository.dev.d4science.org:443/storagehub/gcube/resource\",\"protocol\":null,\"entryName\":\"StorageHub-remote-management\",\"description\":null}},{\"type\":\"ConsistsOf\",\"id\":\"882bad2f-7ab6-4aa5-884d-87a219ce3caf\",\"propagationConstraint\":{\"type\":\"PropagationConstraint\",\"add\":\"propagate\",\"delete\":\"cascade\",\"remove\":\"cascade\",\"supertypes\":[\"Property\"]},\"target\":{\"type\":\"StateFacet\",\"supertypes\":[\"Facet\"],\"id\":\"9f5e38a2-a202-4f2a-8f22-5aa8700c0cec\",\"date\":\"2024-03-25 14:24:35.934 +0100\",\"value\":\"down\"}},{\"type\":\"ConsistsOf\",\"id\":\"c8c23daf-26b0-4dfd-b0f3-daa408810d3d\",\"propagationConstraint\":{\"type\":\"PropagationConstraint\",\"add\":\"propagate\",\"delete\":\"cascade\",\"remove\":\"cascade\",\"supertypes\":[\"Property\"]},\"target\":{\"type\":\"EventFacet\",\"supertypes\":[\"Facet\"],\"id\":\"401a5260-7888-4de6-ab9d-e06ea084098c\",\"date\":\"2024-03-25 14:22:14.642 +0100\",\"event\":\"ready\"}},{\"type\":\"ConsistsOf\",\"id\":\"933fe059-8ef7-421d-94b9-841c7b504834\",\"propagationConstraint\":{\"type\":\"PropagationConstraint\",\"add\":\"propagate\",\"delete\":\"cascade\",\"remove\":\"cascade\",\"supertypes\":[\"Property\"]},\"target\":{\"type\":\"EventFacet\",\"supertypes\":[\"Facet\"],\"id\":\"5e849b79-172e-492a-981c-72859e1bd693\",\"date\":\"2024-03-25 14:24:35.934 +0100\",\"event\":\"down\"}}]}";
}

View File

@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { ApplicationConfigService } from 'app/core/config/application-config.service';
import { IFacetComposer } from './i-facet-composer';
import { IFacetComposer, IFacetProps } from './i-facet-composer';
@ -13,6 +13,11 @@ export interface ITypeSpecification{
facetSpecs: IFacetComposer[];
}
export interface IFacetFields{
name:string, //nome facet+relazione
facetSpecs: IFacetProps[];
}
@Injectable({
providedIn: 'root'
@ -61,5 +66,15 @@ export class FacetComposerService {
return this.http.post<boolean>(serviceUrl,id,{ headers,params})
}
getGuiFields(ctxPath:string,type:string,uid:string):Observable<IFacetFields[]>{
const serviceUrl = this.applicationConfigService.getEndpointFor('api/is/facetfields');
const headers = new HttpHeaders()
.append(
'Content-Type',
'application/json'
);
let queryParams = new HttpParams();
queryParams = queryParams.append("uid",uid).append("resourceType",type).append("currentContext",ctxPath);
return this.http.get<IFacetFields[]>(serviceUrl,{params:queryParams});
}
}

View File

@ -12,6 +12,7 @@
</mat-panel-description>
</mat-expansion-panel-header>
<p> {{typeSpec.description}} </p>
<p>{{guiFacetFields|json}}</p>
</mat-expansion-panel>
<div [formGroup]="myForm">

View File

@ -10,7 +10,7 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { FacetComposerService, ITypeSpecification } from 'app/facet-composer/facet-composer.service';
import { FacetComposerService, IFacetFields, ITypeSpecification } from 'app/facet-composer/facet-composer.service';
import { IFacetComposer, IFacetProps } from 'app/facet-composer/i-facet-composer';
import { IContextNode } from 'app/services/i-context-node';
import { IResource } from 'app/services/i-resource';
@ -26,7 +26,7 @@ import { MatSelectFilterModule } from 'mat-select-filter';
imports:[CommonModule,MatFormFieldModule,SharedModule,
ReactiveFormsModule,MatButtonModule,
MatDialogModule,MatInputModule,MatExpansionModule,MatSelectFilterModule],
providers: [ResourcesImplService, FacetComposerService]
providers: [FacetComposerService]
})
@ -43,6 +43,8 @@ export class FacetEditorComponent implements OnInit {
// facetData: IFacetComposer[];
typeSpec: ITypeSpecification;
fieldsMap: Map<string, IFacetComposer>;
guiFacetMaps: Map<string, any>;
guiFacetFields: IFacetFields[];
rawjson: string|any;
optionTypes = [
@ -72,42 +74,30 @@ export class FacetEditorComponent implements OnInit {
this.selectedOption = '';
this.typeSpec = {} as ITypeSpecification;
this.fieldsMap = new Map<string,IFacetComposer>();
this.guiFacetFields = {} as IFacetFields[];
this.guiFacetMaps = new Map<string,any>();
this.myForm = this.fb.group({});
}
ngOnInit(): void {
ngOnInit(): void {
/*
this.dataService.getJsonDetails('',this.titleType,this.uid).subscribe(res => {
this.lookoutObject(res);
//TODO: qui va creato rawJson
});
this.dataService.getJsonDetails('',this.titleType,this.uid).subscribe(data => {
this.lookoutObject(data);
*/
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
//getGuiFields(ctxPath:string,type:string,uid:string
this.guiService.getGuiFields(this.titlePath,this.titleType,this.uid).subscribe(res => {
this.guiFacetFields = res;
this.guiFacetMaps = new Map(res.map((obj) => [obj.name,obj.facetSpecs]))
});
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
this.typeSpec = res;
this.fieldsMap = new Map(res.facetSpecs.map((obj) => [obj.name+'_'+obj.relation, obj]));
console.debug("*********** typeSpec *********");
console.debug(this.typeSpec.name);
console.debug("********************");
this.createAndFillForm(this.rawjson,this.typeSpec);
});
}
lookoutObject(obj:any){
for(const key in obj){
//console.debug("*********** lookoutObject *********");
console.debug("key: " + key + ", value: " + obj[key]);
// console.debug("*********** *********");
if(obj[key] instanceof Object){
this.lookoutObject(obj[key]);
}
}
}
createAndFillForm(rawSource:string, fData:ITypeSpecification):void{
//TODO: VA PASSATO RAWSOURCE (O MAPPA) PER RIEMPIRE LA FORM
for(let i=0; i<fData.facetSpecs.length; i++){
@ -117,9 +107,10 @@ export class FacetEditorComponent implements OnInit {
}
createFacetArrayEntry(item: IFacetComposer):void{
this.guiFacetFields;
const nameplus:string = item.name+'_'+item.relation;
const singleFacetArray: FormArray = this.fb.array([]);
singleFacetArray.push(this.createFacetGroup(item,false));
singleFacetArray.push(this.createFacetGroup(item,false,this.fieldsMap.get(nameplus)!));
this.myForm.addControl(nameplus,singleFacetArray);
}
@ -161,11 +152,11 @@ export class FacetEditorComponent implements OnInit {
addFacet(deno:string): void {
const icf: IFacetComposer = <IFacetComposer>this.fieldsMap.get(deno);
const singleFacetArray = this.myForm.controls[deno] as FormArray;
singleFacetArray.push(this.createFacetGroup(icf,true));
singleFacetArray.push(this.createFacetGroup(icf,true,this.guiFacetMaps.get(deno)));
}
createFacetGroup(item: IFacetComposer,isAdded: boolean):FormGroup{
createFacetGroup(item: IFacetComposer,isAdded: boolean,facetFields: IFacetComposer):FormGroup{
const facetFg: FormGroup = this.fb.group({});
const nameFc = this.fb.control(item.name);
facetFg.addControl('facetName', nameFc);
@ -191,17 +182,20 @@ export class FacetEditorComponent implements OnInit {
//1. creo group con le properties
//2. aggiungo formgroup delle properties ai controls per la facet
// facetFg.addControl('properties',this.createPropertyControls(item.guiProps));
return this.addPropertyControls(facetFg,item.guiProps);
return this.addPropertyControls(facetFg,item.guiProps,this.guiFacetMaps.get(nameFc+"_"+relationFc)!);
}
addPropertyControls(facetFg:FormGroup, props: IFacetProps[]):FormGroup{
addPropertyControls(facetFg:FormGroup, props: IFacetProps[], values: IFacetProps[]):FormGroup{
const propsFg = this.fb.group({});
let fc:FormControl;
for(let i=0; i<props.length; i++){
for(let i=0; i<values.length; i++){
const prop=props[i];
const propName = prop.name;
const propValue = prop.value;
if(prop.type==="date"){
fc = this.fb.control(new Date())
fc = this.fb.control(new Date());
}
if(prop.type==="number"){
fc = this.fb.control(0)
@ -223,7 +217,7 @@ export class FacetEditorComponent implements OnInit {
}
}
propsFg.addControl(prop.name,fc); //formGroup.addControl(prop_'controlName', formControl);
// facetFg.addControl("prop_"+prop.name,fc); //formGroup.addControl(prop_'controlName', formControl);
}
facetFg.addControl('props',propsFg);
return facetFg;