[trunk]: Library:

1. Fix error logs in Landing, Deposit and Search Pages.
2. errorMessages.component: Add method to check status of response and return error code according to 'ErrorCodes' class.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54825 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-02-15 12:50:24 +00:00
parent 52f5134b86
commit 8c25f2bd27
33 changed files with 491 additions and 171 deletions

View File

@ -380,6 +380,7 @@ export class DepositResultComponent {
},
err => {
//console.log(err)
this.handleError("Error getting organization name and url for id: "+this.organizationId, err);
this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE;
if(err.status == '404') {
@ -433,4 +434,8 @@ export class DepositResultComponent {
private updateUrl(url:string){
this._meta.updateTag({content:url},"property='og:url'");
}
private handleError(message: string, error) {
console.error("Deposit Result Page: "+message, error);
}
}

View File

@ -140,8 +140,6 @@ export class DataProviderComponent {
this.datasourceId = data['datasourceId'];
if(this.datasourceId){
this.getDataProviderInfo(this.datasourceId);
}else{
// console.info("Content Provider id not found");
}
if (typeof document !== 'undefined') {
@ -198,8 +196,8 @@ export class DataProviderComponent {
}
},
err => {
console.log(err);
// console.info("error");
//console.log(err);
this.handleError("Error getting content provider for id: "+this.datasourceId, err);
this.errorMessage = 'No dataProvider found';
this.showLoading = false;
}
@ -213,7 +211,8 @@ export class DataProviderComponent {
this.dataProviderInfo.aggregationStatus = data;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content provider aggregation status for id: "+this.datasourceId, err);
}
);
}
@ -497,4 +496,8 @@ export class DataProviderComponent {
this.totalDownloads = $event.totalDownloads;
this.pageViews = $event.pageViews;
}
private handleError(message: string, error) {
console.error("Content Provider Landing Page: "+message, error);
}
}

View File

@ -152,7 +152,8 @@ export class DatasetComponent {
this.showLoading = false;
},
err => {
console.log(err)
//console.log(err)
this.handleError("Error getting research data for id: "+this.datasetId, err);
this.errorMessage = 'No research data found';
this.showLoading = false;
@ -195,4 +196,8 @@ export class DatasetComponent {
public getKeys( map) {
return Array.from(map.keys());
}
private handleError(message: string, error) {
console.error("Research Data Landing Page: "+message, error);
}
}

View File

@ -153,7 +153,8 @@ export class HtmlProjectReportComponent{
}
},
err => {
console.log(err);
this.handleError("Error getting html information for project id: "+this.projectId, err);
//console.log(err);
this.createClipboard();
}
);
@ -202,7 +203,9 @@ export class HtmlProjectReportComponent{
this.showLoading = false;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting html for id: "+this.projectId, err);
this.errorMessage = 'Service not available';
this.showLoading = false;
}
@ -268,4 +271,8 @@ export class HtmlProjectReportComponent{
private updateUrl(url:string){
this._meta.updateTag({content:url},"property='og:url'");
}
private handleError(message: string, error) {
console.error("Html Project Report Page: "+message, error);
}
}

View File

@ -232,7 +232,8 @@ export class OrganizationComponent {
}
},
err => {
console.log(err)
//console.log(err)
this.handleError("Error getting organization for id: "+this.organizationId, err);
this.errorMessage = 'No organization found';
this.showLoading = false;
@ -339,11 +340,14 @@ export class OrganizationComponent {
}
},
err => {
console.log("Error downloading the file.");
//console.log("Error downloading the file.");
this.handleError("Error downloading file: "+filename+".csv", err);
this.closeLoading();
this.confirmOpenCsvError();
});/*,
() => console.log('Completed file download.'));*/
}/*,
() => console.log('Completed file download.')*/
);
}
private downloadPublicationsFile(funder: string, funderId:string, count:number){
@ -373,7 +377,6 @@ export class OrganizationComponent {
if(!title) {
//url = this.downloadURLAPI+"projects/"+projects[index].id+"?type=publications&format=csv-special";//&size="+data;
url = this.downloadURLAPI+"?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))"
//console.info(url);
} else {
//url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special-notitle";//&size="+data;
url = this.downloadURLAPI+"?format=csv-special-notitle&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))"
@ -439,7 +442,9 @@ export class OrganizationComponent {
}
},
err => {
console.log("Error downloading the file.");
//console.log("Error downloading the file.");
this.handleError("Error downloading file: "+filename, err);
this.closeLoading();
this.confirmOpenCsvError();
}/*,
@ -447,12 +452,17 @@ export class OrganizationComponent {
);
}
},
err => console.log("Error getting number of publications for project."));
err => {
//console.log("Error getting number of publications for project.")
this.handleError("Error getting number of publications for project with id: "+projects[index].id, err);
});
}//);
},
err => {
console.log("Error getting projects project.");
err => {
//console.log("Error getting projects project.");
this.handleError("Error getting projects for organization with id: "+this.organizationId, err);
this.closeLoading();
this.confirmOpenCsvError();
}
@ -553,4 +563,8 @@ export class OrganizationComponent {
encodeURI(input: string): string {
return StringUtils.URIEncode(input);
}
private handleError(message: string, error) {
console.error("Organizaton Landing Page: "+message, error);
}
}

View File

@ -142,7 +142,8 @@ export class OrpComponent {
this.showLoading = false;
},
err => {
console.log(err)
//console.log(err)
this.handleError("Error getting other research product for id: "+this.orpId, err);
this.errorMessage = 'No research product found';
this.showLoading = false;
@ -181,4 +182,8 @@ export class OrpComponent {
public getKeys( map) {
return Array.from(map.keys());
}
private handleError(message: string, error) {
console.error("Other Research Product Landing Page: "+message, error);
}
}

View File

@ -318,7 +318,9 @@ actionsAfterLoadId(){
this.actionsAfterGettingProjectInfo();
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting project for id: "+this.projectId, err);
this.errorMessage = 'No project found';
this.showLoading = false;
}
@ -341,9 +343,11 @@ actionsAfterLoadId(){
this.actionsAfterLoadId();
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting project for grant id: "+grantId+" and funder: "+funder, err);
this.errorMessage = 'No project found';
this.showLoading = false;
this.showLoading = false;
}
);
}
@ -395,7 +399,9 @@ actionsAfterGettingProjectInfo(){
}
},
error => {
console.log("Error downloading the file.");
//console.log("Error downloading the file.");
this.handleError("Error downloading file: "+filename, error);
this.closeLoading();
this.confirmOpenCsvError();
}/*,
@ -484,4 +490,8 @@ actionsAfterGettingProjectInfo(){
this.alertCsvError.okButtonText = "OK";
this.alertCsvError.open();
}
private handleError(message: string, error) {
console.error("Project Landing Page: "+message, error);
}
}

View File

@ -135,7 +135,8 @@ export class PublicationComponent {
this.publicationInfo.openCitations = data[1];
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting open citation for publication with id: "+this.articleId, err);
}
);
}
@ -212,7 +213,8 @@ export class PublicationComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting publication for id: "+this.articleId, err);
this.errorMessage = 'No publication found';
this.showLoading = false;
@ -351,4 +353,7 @@ export class PublicationComponent {
}
*/
private handleError(message: string, error) {
console.error("Publication Landing Page: "+message, error);
}
}

View File

@ -149,7 +149,8 @@ export class SoftwareComponent {
this.showLoading = false;
},
err => {
console.log(err)
//console.log(err)
this.handleError("Error getting software for id: "+this.softwareId, err);
this.errorMessage = 'No software found';
this.showLoading = false;
@ -192,4 +193,8 @@ export class SoftwareComponent {
public getKeys( map) {
return Array.from(map.keys());
}
private handleError(message: string, error) {
console.error("Software Landing Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -33,6 +34,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchDataProvidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
@ -56,6 +58,7 @@ export class AdvancedSearchDataProvidersComponent {
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
//console.info("Con -base url:"+this.searchUtils.baseUrl );
@ -143,20 +146,23 @@ export class AdvancedSearchDataProvidersComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
/*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.searchPage.closeLoading();
this.disableForms = false;
}
@ -173,5 +179,7 @@ export class AdvancedSearchDataProvidersComponent {
}
private handleError(message: string, error) {
console.error("Content Providers advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -33,6 +34,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchDatasetsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
properties:EnvProperties;
@Input() piwikSiteId = null;
@Input() connectCommunityId: string;
@ -58,6 +60,7 @@ export class AdvancedSearchDatasetsComponent {
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -151,20 +154,23 @@ export class AdvancedSearchDatasetsComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting research data", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -185,5 +191,7 @@ export class AdvancedSearchDatasetsComponent {
}
private handleError(message: string, error) {
console.error("Research Data advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -32,6 +33,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchOrganizationsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
properties:EnvProperties;
@Input() piwikSiteId = null;
public results =[];
@ -55,6 +57,7 @@ public resourcesQuery = "(oaftype exact organization)";
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -144,20 +147,23 @@ public resourcesQuery = "(oaftype exact organization)";
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting organizations", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -178,5 +184,7 @@ public resourcesQuery = "(oaftype exact organization)";
}
private handleError(message: string, error) {
console.error("Organizations advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -33,6 +34,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchOrpsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
properties:EnvProperties;
@Input() piwikSiteId = null;
@Input() connectCommunityId: string;
@ -58,6 +60,7 @@ export class AdvancedSearchOrpsComponent {
constructor (private route: ActivatedRoute, private _searchOrpsService: SearchOrpsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -148,15 +151,18 @@ export class AdvancedSearchOrpsComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting other research products", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
/*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.disableForms = false;
}
@ -176,5 +182,7 @@ export class AdvancedSearchOrpsComponent {
}
private handleError(message: string, error) {
console.error("Other Research Products advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchProjectsService} from '../../services/searchProjects.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -31,6 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchProjectsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
@ -56,6 +58,7 @@ export class AdvancedSearchProjectsComponent {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -145,20 +148,23 @@ export class AdvancedSearchProjectsComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting projects", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -180,5 +186,7 @@ export class AdvancedSearchProjectsComponent {
}
private handleError(message: string, error) {
console.error("Projects advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -34,6 +35,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchPublicationsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
@ -63,6 +65,7 @@ export class AdvancedSearchPublicationsComponent {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -155,20 +158,23 @@ export class AdvancedSearchPublicationsComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting publications", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -187,5 +193,7 @@ export class AdvancedSearchPublicationsComponent {
}
private handleError(message: string, error) {
console.error("Publications advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.cl
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -33,6 +34,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchSoftwareComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() connectCommunityId: string;
public results =[];
@ -59,6 +61,7 @@ export class AdvancedSearchSoftwareComponent {
constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -152,20 +155,23 @@ export class AdvancedSearchSoftwareComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting software", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -186,5 +192,7 @@ export class AdvancedSearchSoftwareComponent {
}
private handleError(message: string, error) {
console.error("Software advanced Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -33,6 +34,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchCompatibleDataprovidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public baseUrl:string;
@ -59,6 +61,7 @@ properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -130,20 +133,23 @@ properties:EnvProperties;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting compatible content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -202,4 +208,8 @@ properties:EnvProperties;
}
return filters;
}
private handleError(message: string, error) {
console.error("Compatible Content Providers (Repositories) Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -31,7 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchCompatibleDataprovidersTableComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public columnNames = ["Name", "Type", "Country", "Institution", "Compatibility"];
@ -57,6 +58,7 @@ properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
@ -121,20 +123,23 @@ properties:EnvProperties;
this.enableSearchView = true;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting compatible content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.enableSearchView = true;
}
);
@ -147,20 +152,23 @@ properties:EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting compatible content providers (size=0)", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.enableSearchView = true;
}
);
@ -215,7 +223,7 @@ properties:EnvProperties;
var value_name = [];
var value_original_id = [];
let i, j;
//console.info(data);
for(i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
if(resData.countries) {
@ -247,4 +255,8 @@ properties:EnvProperties;
}
return filters;
}
private handleError(message: string, error) {
console.error("Compatible Content Providers (Repositories) Search Page - Table view: "+message, error);
}
}

View File

@ -4,6 +4,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -32,7 +33,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchEntityRegistriesComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public baseUrl:string;
@ -60,6 +61,7 @@ export class SearchEntityRegistriesComponent {
properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
@ -131,20 +133,23 @@ properties:EnvProperties;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting entity registries", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -193,4 +198,8 @@ properties:EnvProperties;
}
return filters;
}
private handleError(message: string, error) {
console.error("Entity Registries Search Page: "+message, error);
}
}

View File

@ -4,6 +4,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -31,7 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchEntityRegistriesTableComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public columnNames = ["Name", "Type", "Country", "Institution", "Compatibility"];
@ -49,6 +50,7 @@ properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
@ -111,20 +113,23 @@ properties:EnvProperties;
this.enableSearchView = true;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting entity registries", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.enableSearchView = true;
}
);
@ -137,20 +142,23 @@ properties:EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting entity registries (size=0)", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.enableSearchView = true;
}
);
@ -220,7 +228,7 @@ properties:EnvProperties;
var value_name = [];
var value_original_id = [];
let i, j;
//console.info(data);
for(i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
if(resData.countries) {
@ -252,4 +260,8 @@ properties:EnvProperties;
}
return filters;
}
private handleError(message: string, error) {
console.error("Entity Registries Search Page - Table view: "+message, error);
}
}

View File

@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -33,7 +34,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchJournalsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public baseUrl:string;
@ -61,6 +62,7 @@ properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -131,20 +133,23 @@ properties:EnvProperties;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting journals", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -196,4 +201,8 @@ properties:EnvProperties;
}
return filters;
}
private handleError(message: string, error) {
console.error("Journals Search Page: "+message, error);
}
}

View File

@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -32,7 +33,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchJournalsTableComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public columnNames = ["Name", "Type", "Country", "Institution", "Compatibility"];
@ -58,6 +59,7 @@ properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
@ -120,20 +122,23 @@ properties:EnvProperties;
this.enableSearchView = true;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting journals", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.enableSearchView = true;
}
@ -147,20 +152,23 @@ properties:EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting journals (size=0)", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.enableSearchView = true;
}
);
@ -207,4 +215,8 @@ properties:EnvProperties;
}
return filters;
}
private handleError(message: string, error) {
console.error("Journals Search Page - Table view: "+message, error);
}
}

View File

@ -369,7 +369,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting number of Publications", err);
this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
}
);
@ -386,7 +387,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting number of Research Data", err);
this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
}
);
@ -403,15 +405,16 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
}
},
err => {
console.log(err);
this.handleError("Error getting number of Software", err);
/*console.log(err);
if(err.status == '404') {
this.fetchSoftware.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchSoftware.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchSoftware.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchSoftware.searchUtils.status = this.errorCodes.ERROR;
}*/
this.fetchSoftware.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@ -427,7 +430,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting number of Other Research Products", err);
this.fetchOrps.searchUtils.status = this.errorCodes.ERROR;
}
);
@ -444,7 +448,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting number of Projects", err);
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
}
);
@ -465,7 +470,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting number of Organizations", err);
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
}
@ -492,6 +498,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.fetchOrps.searchUtils.status = null;
}
private handleError(message: string, error) {
console.error("General Search Page: "+message, error);
}
}

View File

@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
@ -43,11 +44,12 @@ export class BrowseEntitiesComponent {
public sub: any;
public errorCodes:ErrorCodes = new ErrorCodes();
private errorMessages: ErrorMessagesComponent;
public status = this.errorCodes.LOADING;
public fieldIdsMap=this.searchFields.RESULT_REFINE_FIELDS;
constructor ( private _refineFieldsService: RefineFieldResultsService ) {
this.errorMessages = new ErrorMessagesComponent();
}
public ngOnInit() {
@ -83,20 +85,27 @@ private getStats(){
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting refine fields results (stats) by entity: "+this.entityName, err);
this.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//this.status = this.errorCodes.ERROR;
if(err.status == '404') {
/*if(err.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
}
}*/
}
);
}
}
private handleError(message: string, error) {
console.error("Browse Entities (Search): "+message, error);
}
}

View File

@ -85,8 +85,8 @@ export class SearchDownloadComponent {
this.alertApplyAll.message = "Sorry, but the results are too many! Use the api instead!";
this.alertApplyAll.cancelButtonText = "Ok";
console.error("denial of Download");
console.error("Error downloading file. Results are too many!");
//this.handleError("Error downloading file. Results are too many!", err);
}
downloadfile(url:string,filename:string){
//var newWindow = window.open("", "_parent");
@ -120,7 +120,9 @@ export class SearchDownloadComponent {
}
},
error => {
console.error("Error downloading the file.");
//console.error("Error downloading the file.");
this.handleError("Error downloading file: "+filename, error);
//newWindow.close();
this.closeLoading();
this.confirmOpenCsvError();
@ -158,4 +160,7 @@ export class SearchDownloadComponent {
this.alertCsvError.open();
}
private handleError(message: string, error) {
console.error("Search Download (component): "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -32,6 +33,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchDataprovidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
@ -60,6 +62,7 @@ properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
}
@ -126,7 +129,10 @@ properties: EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content providers for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
@ -134,13 +140,13 @@ properties: EnvProperties;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
/*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;
}
}*/
}
);
}
@ -161,20 +167,23 @@ properties: EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting number of content providers for keyword: "+keyword, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -196,20 +205,23 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content providers in share "+type+" for organization with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -235,20 +247,23 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content providers for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -268,20 +283,23 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content providers for entity registry with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -338,20 +356,23 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -370,4 +391,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
var parameters = $event.value;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
private handleError(message: string, error) {
console.error("Content Providers simple Search Page: "+message, error);
}
}

View File

@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchResult} from '../../utils/entities/searchResult';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -38,6 +39,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class SearchDatasetsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters: Filter[] =[];
@ -66,6 +68,7 @@ properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
@ -143,20 +146,23 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting research data for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -185,20 +191,23 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting research data for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -264,20 +273,23 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting research data", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -299,4 +311,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy);
}
private handleError(message: string, error) {
console.error("Research Data simple Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -32,6 +33,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchOrganizationsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
@ -55,6 +57,7 @@ properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
@ -156,20 +159,23 @@ properties: EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting organizations", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -186,4 +192,8 @@ properties: EnvProperties;
//console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
private handleError(message: string, error) {
console.error("Organizations simple Search Page: "+message, error);
}
}

View File

@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchResult} from '../../utils/entities/searchResult';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -37,6 +38,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class SearchOrpsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters: Filter[] =[];
@ -63,6 +65,7 @@ properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchOrpsService: SearchOrpsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
@ -140,15 +143,18 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting other research products for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
/*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;
}
}*/
}
);
}
@ -176,15 +182,18 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting other research products for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
/*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;
}
}*/
}
);
}
@ -248,15 +257,18 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting other research products", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
/*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.disableForms = false;
}
@ -276,4 +288,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
var parameters = $event.value;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy);
}
private handleError(message: string, error) {
console.error("Other Research Products simple Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -31,6 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchProjectsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters: Filter[] =[];
@ -55,6 +57,7 @@ properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
@ -159,20 +162,23 @@ properties: EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting projects", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -196,20 +202,23 @@ properties: EnvProperties;
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting projects for content provider with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -223,4 +232,7 @@ properties: EnvProperties;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
private handleError(message: string, error) {
console.error("Projects simple Search Page: "+message, error);
}
}

View File

@ -7,6 +7,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
@ -41,6 +42,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class SearchPublicationsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
@ -74,6 +76,7 @@ export class SearchPublicationsComponent {
properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
@ -151,20 +154,23 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting publications for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -193,20 +199,23 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting publications for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -275,20 +284,23 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting publications", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -330,5 +342,7 @@ public getAggregatorResults(id:string, page: number, size: number){
}
private handleError(message: string, error) {
console.error("Publications simple Search Page: "+message, error);
}
}

View File

@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -37,6 +38,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class SearchSoftwareComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() openaireLink: string ;
@Input() connectCommunityId: string;
@Input() advancedSearchParameters ;
@ -65,6 +67,7 @@ properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
@ -143,20 +146,23 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting software for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -185,20 +191,23 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting software for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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;
}
}*/
}
);
}
@ -264,20 +273,23 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting software", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//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') {
/*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.searchPage.closeLoading();
this.disableForms = false;
@ -299,4 +311,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy);
}
private handleError(message: string, error) {
console.error("Software simple Search Page: "+message, error);
}
}

View File

@ -42,10 +42,11 @@ import {ErrorCodes} from './properties/errorCodes';
public errorCodes:ErrorCodes;
constructor () {}
constructor () {
this.errorCodes = new ErrorCodes();
}
ngOnInit() {
this.errorCodes = new ErrorCodes();
if(!this.status) {
this.status = [this.errorCodes.LOADING];
}
@ -58,4 +59,14 @@ import {ErrorCodes} from './properties/errorCodes';
return (status == code);
}
}
public getErrorCode(status: string) {
if(status == '404') {
return this.errorCodes.NOT_FOUND;
} else if(status == '500') {
return this.errorCodes.ERROR;
} else {
return this.errorCodes.NOT_AVAILABLE;
}
}
}