[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:
parent
b66dd1b2b3
commit
03e5cb0c4a
|
@ -11,7 +11,7 @@ export class ContextsService {
|
|||
private promise: Promise<any>;
|
||||
private sub: Subscription = null;
|
||||
|
||||
constructor(private http: HttpClient ) {
|
||||
constructor(private http: HttpClient=null ) {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
|
@ -484,8 +484,7 @@ export class ParsingFunctions {
|
|||
if (!identifiers.has(pid.classid)) {
|
||||
identifiers.set(pid.classid, new Array<string>());
|
||||
}
|
||||
|
||||
identifiers.get(pid.classid).push(pid.content);
|
||||
identifiers.get(pid.classid).push(pid.content+"");
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < pid.length; i++) {
|
||||
|
@ -493,7 +492,7 @@ export class ParsingFunctions {
|
|||
if (!identifiers.has(pid[i].classid)) {
|
||||
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+"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ import {properties} from "../../../environments/environment";
|
|||
export class SearchResearchResultsService {
|
||||
private sizeOfDescription: number = 270;
|
||||
public parsingFunctions: ParsingFunctions = new ParsingFunctions();
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
|
||||
constructor(private http: HttpClient=null) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,9 +174,12 @@ export class SearchResearchResultsService {
|
|||
|
||||
parseResults(resultType: string, data: any, properties: EnvProperties): SearchResult[] {
|
||||
let results: SearchResult[] = [];
|
||||
|
||||
if(data == null) {
|
||||
return results;
|
||||
}
|
||||
|
||||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||
|
||||
|
@ -207,8 +210,8 @@ export class SearchResearchResultsService {
|
|||
} else {
|
||||
for (let i = 0; i < resData['pid'].length; i++) {
|
||||
if (resData['pid'][i].classid == 'doi') {
|
||||
if (resData['pid'][i].content != '' && resData['pid'][i].content != null) {
|
||||
result.DOIs.push(resData['pid'][i].content.replace("https://doi.org/", ""));
|
||||
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/", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue