[Trunk | Library]:

1. src/app/openaireLibrary/claims/claim-utils/service/contexts.service.ts & src/app/openaireLibrary/services/searchResearchResults.service.ts: 
	Added in constructor default value null for HttpClient.
2. src/app/openaireLibrary/landingPages/landing-utils/parsingFunctions.class.ts: 
	a. In method "parseIdentifiers()", concat quotes in pid.content to make it string always.
	b. In method "parseResults()" if "data" is null, return empty array.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@61218 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2021-06-15 12:54:40 +00:00
parent b66dd1b2b3
commit 03e5cb0c4a
3 changed files with 12 additions and 10 deletions

View File

@ -11,7 +11,7 @@ export class ContextsService {
private promise: Promise<any>; private promise: Promise<any>;
private sub: Subscription = null; private sub: Subscription = null;
constructor(private http: HttpClient ) { constructor(private http: HttpClient=null ) {
} }
ngOnDestroy() { ngOnDestroy() {

View File

@ -484,8 +484,7 @@ export class ParsingFunctions {
if (!identifiers.has(pid.classid)) { if (!identifiers.has(pid.classid)) {
identifiers.set(pid.classid, new Array<string>()); identifiers.set(pid.classid, new Array<string>());
} }
identifiers.get(pid.classid).push(pid.content+"");
identifiers.get(pid.classid).push(pid.content);
} }
} else { } else {
for (let i = 0; i < pid.length; i++) { for (let i = 0; i < pid.length; i++) {
@ -493,7 +492,7 @@ export class ParsingFunctions {
if (!identifiers.has(pid[i].classid)) { if (!identifiers.has(pid[i].classid)) {
identifiers.set(pid[i].classid, new Array<string>()); identifiers.set(pid[i].classid, new Array<string>());
} }
identifiers.get(pid[i].classid).push(pid[i].content); identifiers.get(pid[i].classid).push(pid[i].content+"");
} }
} }
} }

View File

@ -14,7 +14,7 @@ export class SearchResearchResultsService {
private sizeOfDescription: number = 270; private sizeOfDescription: number = 270;
public parsingFunctions: ParsingFunctions = new ParsingFunctions(); public parsingFunctions: ParsingFunctions = new ParsingFunctions();
constructor(private http: HttpClient) { constructor(private http: HttpClient=null) {
} }
@ -174,6 +174,9 @@ export class SearchResearchResultsService {
parseResults(resultType: string, data: any, properties: EnvProperties): SearchResult[] { parseResults(resultType: string, data: any, properties: EnvProperties): SearchResult[] {
let results: SearchResult[] = []; let results: SearchResult[] = [];
if(data == null) {
return results;
}
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
@ -207,8 +210,8 @@ export class SearchResearchResultsService {
} else { } else {
for (let i = 0; i < resData['pid'].length; i++) { for (let i = 0; i < resData['pid'].length; i++) {
if (resData['pid'][i].classid == 'doi') { if (resData['pid'][i].classid == 'doi') {
if (resData['pid'][i].content != '' && resData['pid'][i].content != null) { if (resData['pid'][i].content != '' && resData['pid'][i].content != null && resData['pid'][i].content) {
result.DOIs.push(resData['pid'][i].content.replace("https://doi.org/", "")); result.DOIs.push((resData['pid'][i].content+"").replace("https://doi.org/", ""));
} }
} }
} }