2019-09-11 11:45:54 +02:00
|
|
|
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
|
|
|
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
2020-05-26 16:42:47 +02:00
|
|
|
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
|
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
|
|
|
import {OpenaireEntities, SearchFields} from '../../utils/properties/searchFields';
|
2019-09-11 11:45:54 +02:00
|
|
|
import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class';
|
2020-05-26 16:42:47 +02:00
|
|
|
import {DOI, StringUtils} from '../../utils/string-utils.class';
|
2020-11-11 15:43:13 +01:00
|
|
|
import {Subject, Subscriber} from 'rxjs';
|
2020-05-26 16:42:47 +02:00
|
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
2019-09-11 11:45:54 +02:00
|
|
|
|
|
|
|
export class FetchResearchResults {
|
|
|
|
private errorCodes: ErrorCodes;
|
|
|
|
private errorMessages: ErrorMessagesComponent;
|
|
|
|
|
|
|
|
public results =[];
|
|
|
|
|
|
|
|
public requestComplete: Subject<void>;
|
|
|
|
|
|
|
|
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
2020-11-11 15:43:13 +01:00
|
|
|
subscriptions = [];
|
2019-09-11 11:45:54 +02:00
|
|
|
public searchFields:SearchFields = new SearchFields();
|
|
|
|
|
|
|
|
public CSV: any = {
|
|
|
|
"columnNames": [
|
|
|
|
"Title", "Authors", "Publication Year", "DOI",
|
|
|
|
"Funder", "Project Name (GA Number)", "Access"
|
|
|
|
],
|
|
|
|
"export":[]
|
|
|
|
};
|
|
|
|
public CSVDownloaded = false;
|
|
|
|
public csvParams: string;
|
|
|
|
|
|
|
|
constructor ( private _searchResearchResultsService: SearchResearchResultsService ) {
|
|
|
|
this.errorCodes = new ErrorCodes();
|
|
|
|
this.errorMessages = new ErrorMessagesComponent();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
this.requestComplete = new Subject<void>();
|
|
|
|
}
|
|
|
|
|
2020-11-11 15:43:13 +01:00
|
|
|
public clearSubscriptions() {
|
|
|
|
this.subscriptions.forEach(subscription => {
|
|
|
|
if (subscription instanceof Subscriber) {
|
|
|
|
subscription.unsubscribe();
|
|
|
|
}
|
|
|
|
});
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
|
2021-03-10 11:41:38 +01:00
|
|
|
public getResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) {
|
2020-05-31 13:28:12 +02:00
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
2021-05-13 17:54:46 +02:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + communityId + (contextId?'&fq=categoryid=' + encodeURIComponent(contextId):''), page, size, "resultdateofacceptance,descending", [], properties).subscribe(
|
2020-05-31 13:28:12 +02:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for community: "+communityId, err);
|
2020-05-31 13:28:12 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2020-05-31 13:28:12 +02:00
|
|
|
}
|
|
|
|
|
2021-03-10 11:41:38 +01:00
|
|
|
public getNumForCommunity(resultType:string, communityId: string, properties:EnvProperties, contextId = null) {
|
2020-05-31 13:28:12 +02:00
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
2021-03-10 11:41:38 +01:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.countTotalResults(resultType, properties, "&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe(
|
2020-05-31 13:28:12 +02:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data;
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting number of "+this.getEntityQueryName(resultType,true)+" for community: "+communityId, err);
|
2020-05-31 13:28:12 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2020-05-31 13:28:12 +02:00
|
|
|
}
|
2021-04-02 11:17:00 +02:00
|
|
|
public getAllResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) {
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults(resultType, "", page, size, "resultdateofacceptance,descending", properties, "&type=results&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe(
|
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
2020-05-31 13:28:12 +02:00
|
|
|
|
2021-04-02 11:17:00 +02:00
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for community: "+communityId, err);
|
2021-04-02 11:17:00 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
}
|
2019-09-11 11:45:54 +02:00
|
|
|
public getResultsByKeyword(resultType:string, keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){
|
|
|
|
var parameters = "";
|
|
|
|
if(keyword.length > 0){
|
|
|
|
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
|
|
|
var doisParams = "";
|
|
|
|
|
|
|
|
for(var i =0 ;i < DOIs.length; i++){
|
|
|
|
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
|
|
|
|
}
|
|
|
|
if(doisParams.length > 0){
|
|
|
|
parameters += "&"+doisParams;
|
|
|
|
}else{
|
|
|
|
parameters = "q=" + StringUtils.URIEncode(keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
var refineParams = null;
|
|
|
|
if(customFilter){
|
|
|
|
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
|
|
|
|
}
|
2022-05-11 12:06:07 +02:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.search(this.getEntityQueryName(resultType,false), parameters,refineParams, page, size, "", [], properties).subscribe(
|
2019-09-11 11:45:54 +02:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
/*console.log(err);
|
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}*/
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for keyword: "+keyword + (doisParams ? "(DOI)" : ""), err);
|
2019-09-11 11:45:54 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public getNumForEntity(resultType: string, entity:string, id:string, properties:EnvProperties){
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
if(id != "" && entity != "") {
|
2022-05-11 12:06:07 +02:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.numOfEntityResults(this.getEntityQueryName(resultType,false), id, entity, properties).subscribe(
|
2019-09-11 11:45:54 +02:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data;
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
/*console.log(err);
|
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}*/
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for "+entity+" with id: "+id, err);
|
2019-09-11 11:45:54 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-10 14:24:19 +01:00
|
|
|
public getDmps(entity:string, id:string, page: number, size: number, properties:EnvProperties) {
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
let parameters = "";
|
|
|
|
if(entity == "project") {
|
|
|
|
parameters = '(relprojectid exact "'+id+'") and (instancetypename exact "Data Management Plan")';
|
|
|
|
} else if(entity == "organization") {
|
|
|
|
parameters = '(relorganizationid exact "'+id+'") and (instancetypename exact "Data Management Plan")';
|
|
|
|
}
|
|
|
|
if(parameters != "") {
|
|
|
|
this.subscriptions.push(this._searchResearchResultsService.searchResultForEntity('publication', parameters, page, size, properties).subscribe(
|
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if (this.searchUtils.totalResults == 0) {
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
/*console.log(err);
|
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}*/
|
|
|
|
this.handleError("Error getting dmps for " + entity + " with id: " + id, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-11 11:45:54 +02:00
|
|
|
public getResultsForEntity(resultType: string, entity:string, id:string, page: number, size: number, properties:EnvProperties){
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
2021-03-10 14:24:19 +01:00
|
|
|
let parameters = "";
|
2019-09-11 11:45:54 +02:00
|
|
|
if(entity == "project") {
|
2020-05-28 12:53:29 +02:00
|
|
|
//parameters = "projects/"+id;
|
|
|
|
parameters = '(relprojectid exact "'+id+'")';
|
2019-09-11 11:45:54 +02:00
|
|
|
} else if(entity == "organization") {
|
2020-05-28 12:53:29 +02:00
|
|
|
//parameters = "organizations/"+id;
|
|
|
|
parameters = '(relorganizationid exact "'+id+'")';
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(parameters != "") {
|
2022-05-11 12:06:07 +02:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.searchResultForEntity(this.getEntityQueryName(resultType,false), parameters, page, size, properties).subscribe(
|
2019-09-11 11:45:54 +02:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
/*console.log(err);
|
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}*/
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for "+entity+" with id: "+id, err);
|
2019-09-11 11:45:54 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public getResultsForDataproviders(resultType: string, id:string, resultsFrom:string, page: number, size: number, properties:EnvProperties){
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
var parameters;
|
2020-03-16 14:09:46 +01:00
|
|
|
// if(resultsFrom == "collectedFrom") {
|
|
|
|
// parameters = this.getEntityName(resultType,true)+"?fq=collectedfromdatasourceid exact "+'"'+id+'"';
|
|
|
|
// } else if(resultsFrom == "hostedBy") {
|
|
|
|
// parameters = this.getEntityName(resultType,true)+"?fq=resulthostingdatasourceid exact "+'"'+id+'"';
|
|
|
|
// }
|
|
|
|
|
2022-05-11 12:06:07 +02:00
|
|
|
parameters = this.getEntityQueryName(resultType,true)+"?fq=collectedfromdatasourceid exact "+'"'+id+'"' + "or resulthostingdatasourceid exact "+'"'+id+'"';
|
2019-09-11 11:45:54 +02:00
|
|
|
|
|
|
|
if(parameters != "") {
|
|
|
|
|
2022-05-11 12:06:07 +02:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.searchForDataproviders(this.getEntityQueryName(resultType,false), parameters, page, size, properties).subscribe(
|
2019-09-11 11:45:54 +02:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
/*console.log(err);
|
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}*/
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for "+OpenaireEntities.DATASOURCE+" ("+resultsFrom+") with id: "+id, err);
|
2019-09-11 11:45:54 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public getAggregatorResults(resultType: string, id:string, page: number, size: number, properties:EnvProperties){
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
2022-05-11 12:06:07 +02:00
|
|
|
// this.getEntityQueryName(resultType,false)
|
2020-11-11 15:43:13 +01:00
|
|
|
this.subscriptions.push(this._searchResearchResultsService.searchAggregators(resultType, id, '&fq=(collectedfromdatasourceid exact "'+id+'" or resulthostingdatasourceid exact "'+id+'")',"&refine=true&fields=resulthostingdatasource&type="+resultType , page, size, properties).subscribe(
|
2019-09-11 11:45:54 +02:00
|
|
|
data => {
|
|
|
|
this.results = data;
|
|
|
|
this.searchUtils.totalResults = this.results.length;
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.requestComplete.complete();
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
/*console.log(err);
|
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}*/
|
2022-05-11 12:06:07 +02:00
|
|
|
this.handleError("Error getting "+this.getEntityQueryName(resultType,true)+" for aggregator with id: "+id, err);
|
2019-09-11 11:45:54 +02:00
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
|
|
|
|
this.requestComplete.complete();
|
|
|
|
}
|
2020-11-11 15:43:13 +01:00
|
|
|
));
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private handleError(message: string, error) {
|
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
|
|
|
console.error("Fetch "+OpenaireEntities.RESULTS+" (class): "+message, error);
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
|
2022-05-11 12:06:07 +02:00
|
|
|
private getEntityQueryName(entityType: string, plural: boolean) {
|
|
|
|
if (entityType == "publication" || entityType == "dataset" || entityType == "organization" || entityType == "datasource" || entityType == "project") {
|
|
|
|
if (plural) {
|
|
|
|
return entityType + "s";
|
|
|
|
}
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
2022-05-11 12:06:07 +02:00
|
|
|
return entityType;
|
2019-09-11 11:45:54 +02:00
|
|
|
}
|
|
|
|
}
|