diff --git a/landingPages/organization/deletedByInference/deletedByInference.component.ts b/landingPages/organization/deletedByInference/deletedByInference.component.ts index 9502348c..736b2ee2 100644 --- a/landingPages/organization/deletedByInference/deletedByInference.component.ts +++ b/landingPages/organization/deletedByInference/deletedByInference.component.ts @@ -19,28 +19,30 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class"; template: `
- + [totalResults]="resultsPreview.length"> - + [totalResults]="resultsPreview.length">
` }) export class OrganizationsDeletedByInferenceComponent { @Input() prevPath: string = ""; - public results: OrganizationInfo[] = []; + public resultsPreview: ResultPreview[] = []; + @Input() children = []; + @Input() id: string; @Input() ids: string[] = []; @Input() type: string; @@ -67,10 +69,10 @@ export class OrganizationsDeletedByInferenceComponent { this.properties = properties; this.subscriptions.push(this.route.queryParams.subscribe(data => { - this.errorCodes = new ErrorCodes(); - this.status = this.errorCodes.LOADING; + this.errorCodes = new ErrorCodes(); + this.status = this.errorCodes.LOADING; - this.getDeletedByInference(); + this.parseDeletedByInference(); })); } @@ -81,27 +83,38 @@ export class OrganizationsDeletedByInferenceComponent { } }); } - getDeletedByInference() { - this.results = []; - this.status = this.errorCodes.LOADING; - this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe( - data => { - this.results = data; - this.status = this.errorCodes.DONE; - }, - error => { - if(error.status == '404') { - this.status = this.errorCodes.NOT_FOUND; - } else if(error.status == '500') { - this.status = this.errorCodes.ERROR; + public parseDeletedByInference() { + let length = Array.isArray(this.children) ? this.children.length : 1; + for (let i = 0; i < length; i++) { + let result = Array.isArray(this.children) ? this.children[i] : this.children; + let preview = new ResultPreview(); + + if(result.hasOwnProperty("websiteurl")) { + preview.websiteURL = result.websiteurl; + } + if(result.hasOwnProperty("legalshortname")) { + preview.title = result.legalshortname; + } + if(result.hasOwnProperty("legalname")) { + if(preview.title && preview.title != result.legalname) { + preview.title += "("+result.legalname+")"; } else { - this.status = this.errorCodes.NOT_AVAILABLE; + preview.title = result.legalname; } } - )); + + if(result.hasOwnProperty("country")) { + preview.countries = [result['country'].classname]; + } + + preview.resultType = 'organization'; + + this.resultsPreview.push(preview); + } + this.status = this.errorCodes.DONE; } - + public getResultPreview(result: OrganizationInfo): ResultPreview { return ResultPreview.organizationInfoConvert(result); } diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index c58d75c4..a4411222 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -370,7 +370,8 @@ [id]="organizationInfo.objIdentifier" [ids]="organizationInfo.deletedByInferenceIds" [modal]="AlertModalDeletedByInference" - [type]="'organizations'" [prevPath]="prevPath"> + [type]="'organizations'" [prevPath]="prevPath" + [children]="organizationInfo.children"> @@ -484,7 +485,8 @@ + [type]="'organizations'" [prevPath]="prevPath" + [children]="organizationInfo.children"> diff --git a/services/organization.service.ts b/services/organization.service.ts index 44a81633..48daceca 100644 --- a/services/organization.service.ts +++ b/services/organization.service.ts @@ -93,6 +93,7 @@ export class OrganizationService { this.organizationInfo.deletedByInferenceIds.push(result.objidentifier); } } + this.organizationInfo.children = children['organization']; } if(organization['pid']) { diff --git a/utils/entities/organizationInfo.ts b/utils/entities/organizationInfo.ts index 7943db6e..fed1c128 100644 --- a/utils/entities/organizationInfo.ts +++ b/utils/entities/organizationInfo.ts @@ -28,6 +28,7 @@ export class OrganizationInfo { // organizations: {name: string; url: string}[]}[]; deletedByInferenceIds: string[]; + children; identifiers: Map; //key is the classname belongsTo: boolean = true; message: string;