From 72eeff6561a7e65b4f21d75bdb94fe199ba31221 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 15 Jul 2020 11:25:17 +0000 Subject: [PATCH] [Trunk | Library]: 1. parsingFunctions.class.ts: [ticket #3796] When hostedby name is "Unknown repository" or "other resources" show part or url as name. 2. organization.service.ts & searchOrganizations.service.ts: [ticket #5753] Compatibility limitation in landing page removed | Compatibility "openaire-cris_1.1" added in search organizations. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59124 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../landing-utils/parsingFunctions.class.ts | 40 +++++++++---------- services/organization.service.ts | 7 ++-- services/searchOrganizations.service.ts | 1 + 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 2c06cc8d..a1df90ab 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -258,26 +258,26 @@ export class ParsingFunctions { if (instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") { available.downloadName = instance['hostedby'].name; } else { - if (data != null && data.hasOwnProperty("source")) { - let downloadName: string; - if (Array.isArray(data.source)) { - - if (counter == data.source.length) { - counter--; - } - downloadName = data['source'][counter]; - } else { - downloadName = data['source']; - } - if (downloadName) { - counter++; - available.downloadName = downloadName; - } - } - - } - - if(!available.downloadName) { + // if (data != null && data.hasOwnProperty("source")) { + // let downloadName: string; + // if (Array.isArray(data.source)) { + // + // if (counter == data.source.length) { + // counter--; + // } + // downloadName = data['source'][counter]; + // } else { + // downloadName = data['source']; + // } + // if (downloadName) { + // counter++; + // available.downloadName = downloadName; + // } + // } + // + // } + // + // if(!available.downloadName) { available.downloadName = url.substring(0, 30) + '...'; // substring(from, to); } diff --git a/services/organization.service.ts b/services/organization.service.ts index 087f9060..bdb4da27 100644 --- a/services/organization.service.ts +++ b/services/organization.service.ts @@ -17,12 +17,13 @@ export class OrganizationService { organizationInfo: OrganizationInfo; getOrganizationInfo (id: string, properties:EnvProperties):any { - let url = properties.searchAPIURLLAst+'resources?format=json&query=( (oaftype exact organization) and (reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire4.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native)) and ( objIdentifier ='+id+')'; + let url = properties.searchAPIURLLAst+'organizations/'+id+'?format=json'; + //'&query=( (oaftype exact organization) and (reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire4.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native)) and ( objIdentifier ='+id+')'; return this.http.get((properties.useCache)? (properties.cacheUrl +encodeURIComponent(url)): url) //.map(res => res.json()) - .pipe(map(res => res['results'][0])) - //.map(res => res[0]['result']['metadata']['oaf:entity']['oaf:organization']) + //.pipe(map(res => res['results'])) + //.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])) //.map(res => [res, res['rels']['rel']]) .pipe(map(res => this.parseOrganizationInfo(res))); diff --git a/services/searchOrganizations.service.ts b/services/searchOrganizations.service.ts index 0d185468..6f4947de 100644 --- a/services/searchOrganizations.service.ts +++ b/services/searchOrganizations.service.ts @@ -61,6 +61,7 @@ export class SearchOrganizationsService { let url = properties.searchAPIURLLAst+"resources2/?format=json"; var basicQuery = "(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or " + "reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or " + + "reldatasourcecompatibilityid exact openaire-cris_1.1 or " + "reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)"; url += "&query=";