debugging Resources editor
This commit is contained in:
parent
adfb060279
commit
e180a94b6b
|
@ -226,8 +226,10 @@ public class InformationSystemService {
|
|||
String jsonResult = resourceRegistryClient.getType(typeName, true);
|
||||
ResourceTypeDTO dto = null;
|
||||
try {
|
||||
List<Type> types = TypeMapper.deserializeTypeDefinitions(jsonResult);
|
||||
for(Type type : types) {
|
||||
//List<Type> types = TypeMapper.deserializeTypeDefinitions(jsonResult);
|
||||
//for(Type type : types) {
|
||||
//prendo solo il primo (non voglio la gerarchia annidata)
|
||||
Type type = TypeMapper.deserializeTypeDefinitions(jsonResult).get(0);
|
||||
ResourceType resType = (ResourceType) type;
|
||||
String name = resType.getName();
|
||||
String id = resType.getID().toString();
|
||||
|
@ -246,7 +248,7 @@ public class InformationSystemService {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
//}
|
||||
}catch(Exception e) {
|
||||
log.error("**********");
|
||||
log.error(e.getMessage(),e);
|
||||
|
@ -432,28 +434,17 @@ public class InformationSystemService {
|
|||
props = JsonPath.parse(formData).read("$..props");
|
||||
ResourceDescription rd = new ResourceDescription();
|
||||
rd = buildSendingJson(resourceType,facetNames,facetRelations,extraProps,props);
|
||||
// create object mapper instance
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// convert object to `JsonNode`
|
||||
JsonNode node = mapper.valueToTree(rd);
|
||||
// System.out.println(node.toPrettyString());
|
||||
|
||||
|
||||
log.debug("******** JSON STRING TO BE SENT:");
|
||||
log.debug(sendingJson);
|
||||
log.debug("********");
|
||||
/*
|
||||
try {
|
||||
// create object mapper instance
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// convert object to `JsonNode`
|
||||
JsonNode node = mapper.valueToTree(rd);
|
||||
System.out.println(node.toPrettyString());
|
||||
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
try {
|
||||
// create object mapper instance
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// convert object to `JsonNode`
|
||||
JsonNode node = mapper.valueToTree(rd);
|
||||
log.debug(node.toPrettyString());
|
||||
sendingJson = node.toString();
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
|
||||
}catch(Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ADDITIONAL PROPERTIES -->
|
||||
<div formArrayName ="extraProps" style="border: 2px solid rgb(176, 206, 230); padding: 10px; margin: 5px;">
|
||||
<span [style.width.px]="350" [style.font-weight]="900">Custom Properties</span>
|
||||
|
|
|
@ -80,17 +80,20 @@ export class FacetComposerComponent implements OnInit {
|
|||
*/
|
||||
|
||||
optionTypes = [
|
||||
{ value: 'String'} //per ora solo tipo String
|
||||
/*
|
||||
{ value: 'Boolean'},
|
||||
{ value: 'Integer'},
|
||||
{ value: 'Short'},
|
||||
{ value: 'Long'},
|
||||
{ value: 'Float'},
|
||||
{ value: 'Double'},
|
||||
{ value: 'Password'},//Password implica salvare criptato
|
||||
{ value: 'Password'},
|
||||
{ value: 'Date'},
|
||||
{ value: 'String'},
|
||||
{ value: 'Binary'},
|
||||
{ value: 'Byte'}
|
||||
*/
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
</mat-expansion-panel-header>
|
||||
<p> {{typeSpec.description}} </p>
|
||||
</mat-expansion-panel>
|
||||
<div [formGroup]="myForm">
|
||||
|
||||
<div [formGroup]="myForm">
|
||||
|
||||
<div formArrayName="{{facetTemplate.key}}" *ngFor="let facetTemplate of fieldsMap|keyvalue;" >
|
||||
<div [formGroupName] ="ind" *ngFor="let fct of (getSingleFacetArray(facetTemplate.key)).controls; let ind=index;" style="border: 3px solid rgb(72, 157, 202); padding: 10px; margin: 5px;">
|
||||
<mat-form-field appearance="outline" >
|
||||
|
@ -43,14 +45,28 @@
|
|||
<!-- PROPERTIES -->
|
||||
<div formGroupName ="props" >
|
||||
<div *ngFor="let prop of facetTemplate.value.guiProps">
|
||||
<mat-form-field>
|
||||
<mat-label>{{prop.label}}</mat-label>
|
||||
<input matInput formControlName="{{prop.name}}" id="{{prop.name}}"
|
||||
type="{{prop.type}}"/>
|
||||
<div *ngIf="prop.type==='typeprop'; else singlefield" style="border: 1px solid rgb(202, 202, 202); padding: 10px; margin: 5px;">
|
||||
<p style="color: darkgrey;">{{prop.label}}</p>
|
||||
<mat-form-field>
|
||||
<mat-label>username</mat-label>
|
||||
<input matInput formControlName="schema" id="username"
|
||||
type="text"/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>password</mat-label>
|
||||
<input matInput formControlName="value" id="password"
|
||||
type="password"/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<ng-template #singlefield>
|
||||
<mat-form-field>
|
||||
<mat-label>{{prop.label}}</mat-label>
|
||||
<input matInput formControlName="{{prop.name}}" id="{{prop.name}}"
|
||||
type="{{prop.type}}"/>
|
||||
</mat-form-field>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ADDITIONAL PROPERTIES -->
|
||||
<div formArrayName ="extraProps" style="border: 2px solid rgb(176, 206, 230); padding: 10px; margin: 5px;">
|
||||
<span [style.width.px]="350" [style.font-weight]="900">Custom Properties</span>
|
||||
|
|
|
@ -26,7 +26,7 @@ import { MatSelectFilterModule } from 'mat-select-filter';
|
|||
imports:[CommonModule,MatFormFieldModule,SharedModule,
|
||||
ReactiveFormsModule,MatButtonModule,
|
||||
MatDialogModule,MatInputModule,MatExpansionModule,MatSelectFilterModule],
|
||||
providers: [ResourcesImplService]
|
||||
providers: [ResourcesImplService, FacetComposerService]
|
||||
|
||||
})
|
||||
|
||||
|
@ -46,6 +46,8 @@ export class FacetEditorComponent implements OnInit {
|
|||
rawjson: string|any;
|
||||
|
||||
optionTypes = [
|
||||
{ value: 'String'}, //per ora solo tipo String
|
||||
/*
|
||||
{ value: 'Boolean'},
|
||||
{ value: 'Integer'},
|
||||
{ value: 'Short'},
|
||||
|
@ -54,13 +56,13 @@ export class FacetEditorComponent implements OnInit {
|
|||
{ value: 'Double'},
|
||||
{ value: 'Password'},//Password implica salvare criptato
|
||||
{ value: 'Date'},
|
||||
{ value: 'String'},
|
||||
|
||||
{ value: 'Binary'},
|
||||
{ value: 'Byte'}
|
||||
*/
|
||||
]
|
||||
|
||||
|
||||
//TODO: PASSARE UID COME STRINGA
|
||||
constructor(private dataService: ResourcesImplService, private guiService: FacetComposerService, private fb: FormBuilder,
|
||||
private dialogRef:MatDialogRef<FacetEditorComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) data: {type: IResource ,context:IContextNode, uid:string}){
|
||||
|
@ -75,24 +77,30 @@ export class FacetEditorComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
/*
|
||||
this.dataService.getJsonDetails('',this.titleType,this.uid).subscribe(res => {
|
||||
this.lookoutObject(res);
|
||||
//TODO: qui va creato rawJson
|
||||
});
|
||||
|
||||
*/
|
||||
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);
|
||||
});
|
||||
|
||||
this.createAndFillForm(this.rawjson,this.typeSpec);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
lookoutObject(obj:any){
|
||||
for(const key in obj){
|
||||
console.debug("*********** lookoutObject *********");
|
||||
//console.debug("*********** lookoutObject *********");
|
||||
console.debug("key: " + key + ", value: " + obj[key]);
|
||||
console.debug("*********** *********");
|
||||
// console.debug("*********** *********");
|
||||
if(obj[key] instanceof Object){
|
||||
this.lookoutObject(obj[key]);
|
||||
}
|
||||
|
@ -101,6 +109,7 @@ export class FacetEditorComponent implements OnInit {
|
|||
|
||||
|
||||
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++){
|
||||
const facetSpec = fData.facetSpecs[i];
|
||||
this.createFacetArrayEntry(facetSpec);
|
||||
|
|
Loading…
Reference in New Issue