diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts index 6e6d7401..49ae33e1 100644 --- a/claims/claim-utils/claimContextSearchForm.component.ts +++ b/claims/claim-utils/claimContextSearchForm.component.ts @@ -224,7 +224,7 @@ getCommunities () { this._contextService.getCategories(this.selectedCommunityId,this.properties.contextsAPI).subscribe( data => { - this.categories =data;// (Array.isArray(data.category))? data.category:[data.category]; + this.categories =data; this.concepts = []; this.addCommunityInConcepts(); this.filteredList = []; @@ -254,11 +254,12 @@ getCommunities () { data => { this.concepts =data; - if(this.selectedCategoryId == "egi::classification"){ + console.log(data); for(var i =0 ; i { - var concepts = data;//(Array.isArray(data))? data:[data]; - if(categoryId == "egi::classification"){ + var concepts = data; this.conceptsClass[categoryId] = []; for(var i =0 ; i { console.log(err); @@ -362,7 +356,7 @@ getCommunities () { this.conceptsCategoryLoading[categoryId] = true; this._contextService.getSubConcepts(conceptId, "",false, this.properties.contextsAPI).subscribe( data => { - var concepts = data[0];//(Array.isArray(data))? data:[data]; + var concepts = data[0]; this.conceptsClass[categoryId].push(concepts) console.log("Data"+concepts); diff --git a/claims/claim-utils/service/contexts.service.ts b/claims/claim-utils/service/contexts.service.ts index d6d4dba7..68cef759 100644 --- a/claims/claim-utils/service/contexts.service.ts +++ b/claims/claim-utils/service/contexts.service.ts @@ -68,38 +68,42 @@ export class ContextsService { .map(res => (parsing)?this.parseSubConcepts(res):res); // .do(res => console.info("Result is "+ res.length )); } - parse (data: any):AutoCompleteValue[] { - var array:AutoCompleteValue[] =[] + parse (data: any):any { + var array =[] if(!Array.isArray(data) && data.id && data.label){ - var value:AutoCompleteValue = new AutoCompleteValue(); + var value ={id:"",label:"",hasSubConcept:""}; value.id = data.id; value.label = data.label; + value.hasSubConcept = data.hasSubConcept; array.push(value); } for(var i = 0; i < data.length; i++){ - var value:AutoCompleteValue = new AutoCompleteValue(); + var value={id:"",label:"",hasSubConcept:""}; value.id = data[i].id; value.label = data[i].label; + value.hasSubConcept = data[i].hasSubConcept; array.push(value); } return array; } - parseSubConcepts (data: any):AutoCompleteValue[] { - var array:AutoCompleteValue[] =[] + parseSubConcepts (data: any):any { + var array = [] if(data.length >0 && data[0].concepts){ var concepts = data[0].concepts; for(var i = 0; i < concepts.length; i++){ - var value:AutoCompleteValue = new AutoCompleteValue(); + var value ={id:"",label:"",hasSubConcept:""}; value.id = concepts[i].id; value.label = concepts[i].label; + value.hasSubConcept = concepts[i].hasSubConcept; if(concepts[i].concepts){ var subconcepts = concepts[i].concepts; for(var x = 0; x < subconcepts.length; x++){ - var value:AutoCompleteValue = new AutoCompleteValue(); + var value ={id:"",label:"",hasSubConcept:""}; value.id = subconcepts[x].id; value.label = subconcepts[x].label; + value.hasSubConcept = subconcepts[x].hasSubConcept; array.push(value); } }