[Trunk|Library]

Fix error logs in Claims Pages and remaining components (approvedByCommunity, userEmailPreferences, navigationBar).


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54848 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-02-18 14:00:43 +00:00
parent 01a945b226
commit 8641787688
12 changed files with 158 additions and 55 deletions

View File

@ -291,7 +291,8 @@ getCommunities () {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting communities", err);
this.loading = false;
this.error = true;
}
@ -320,7 +321,8 @@ getCommunities () {
this.loading = false;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting categories for community with id: "+this.selectedCommunityId, err);
this.loading = false;
}
);
@ -353,7 +355,8 @@ getCommunities () {
this.loading = false;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting concepts for category with id: "+this.selectedCategoryId, err);
this.loading = false;
}
);
@ -383,7 +386,8 @@ getCommunities () {
this.loading = false;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting subconcepts for concept with id: "+conceptId, err);
this.loading = false;
}
);
@ -427,7 +431,8 @@ getCommunities () {
this.conceptsCategoryLoading[categoryId] = false;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting concepts for category with id: "+this.selectedCategoryId, err);
this.conceptsCategoryLoading[categoryId] = false;
}
);
@ -447,7 +452,8 @@ getCommunities () {
this.conceptsCategoryLoading[categoryId] = false;
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting subconcepts for concept with id: "+conceptId, err);
this.conceptsCategoryLoading[categoryId] = false;
}
);
@ -500,4 +506,8 @@ saveStateAndRedirectLogin(){
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url } });
}
private handleError(message: string, error) {
console.error("Claim context search form (component): "+message, error);
}
}

View File

@ -188,7 +188,10 @@ getFunders () {
data => {
this.funders = data[1];
},
err => console.log(err)
err => {
this.handleError("Error getting funders", err);
//console.log(err)
}
);
}
@ -204,4 +207,7 @@ funderChanged(funderId:string, funderName:string){
}
private handleError(message: string, error) {
console.error("Claim project search form (component): "+message, error);
}
}

View File

@ -184,7 +184,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
}
},
err =>{
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting crossref results for term: "+term, err);
this.crossrefStatus = this.errorCodes.ERROR;
}
@ -195,6 +196,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
}
},
err => {
this.handleError("Error getting crossref by DOIs: "+JSON.stringify(this.DOIs), err);
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
data => {
this.crossrefResults = data;
@ -204,7 +207,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
},
err => {
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting crossref results for term: "+term, err);
this.crossrefStatus = this.errorCodes.ERROR;
}
@ -229,7 +233,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
},
err => {
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting crossref results for term: "+term, err);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
@ -255,7 +260,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
},
err => {
this.openairePubsStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting publications by DOIs: "+JSON.stringify(this.DOIs), err);
}
);
}else{
@ -276,7 +282,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
},
err => {
this.openairePubsStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting publications for term: "+term, err);
}
);
}
@ -336,8 +343,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
this.getOrcidAuthors(term);
} else {
this.orcidStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting orcid author for term: "+term, err);
}
}
@ -359,7 +366,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
},
err => {
this.orcidStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting orcid authors for term: "+term+" and ids: "+JSON.stringify(this.authorIds), err);
}
);
}
@ -410,7 +418,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
},
err => {
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting orcid publications for author id: "+this.authors[index].id, err);
this.orcidStatus = this.errorCodes.ERROR;
}
);
@ -447,7 +456,7 @@ private enhanceInfoFromDOI(result){
}
},
err =>{
this.handleError("Error getting crossref by DOIs: "+result['DOI'], err);
}
);
@ -538,7 +547,8 @@ openaireORPPageChange($event) {
},
err => {
this.openaireDataStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting (OpenAIRE) datasets by DOIs: "+JSON.stringify(this.DOIs), err);
}
);
}else{
@ -556,7 +566,8 @@ openaireORPPageChange($event) {
},
err => {
this.openaireDataStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting (OpenAIRE) datasets for term: "+term, err);
}
);
}
@ -581,7 +592,8 @@ openaireORPPageChange($event) {
},
err => {
this.openaireSoftwareStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting (OpenAIRE) software by DOIs: "+JSON.stringify(this.DOIs), err);
}
);
}else{
@ -600,7 +612,8 @@ openaireORPPageChange($event) {
},
err => {
this.openaireSoftwareStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting (OpenAIRE) software for term: "+term, err);
}
);
}
@ -625,7 +638,8 @@ openaireORPPageChange($event) {
},
err => {
this.openaireORPStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting (OpenAIRE) orps by DOIs: "+JSON.stringify(this.DOIs), err);
}
);
}else{
@ -644,7 +658,8 @@ openaireORPPageChange($event) {
},
err => {
this.openaireORPStatus = this.errorCodes.ERROR;
console.log(err.status);
//console.log(err.status);
this.handleError("Error getting (OpenAIRE) orps for term: "+term, err);
}
);
}
@ -696,7 +711,8 @@ openaireORPPageChange($event) {
},
err => {
this.dataciteStatus = this.errorCodes.ERROR;
console.log(err);
//console.log(err);
this.handleError("Error getting datacite results for term: "+term, err);
}
);
@ -712,4 +728,8 @@ openaireORPPageChange($event) {
public clickTab(tab){
this.activeTab = tab;
}
private handleError(message: string, error) {
console.error("Claim Result Search Form (component): "+message, error);
}
}

View File

@ -146,6 +146,7 @@ private seoService: SEOService) {
},
err => {
this.handleErrors(err);
this.handleError("Error getting claims for project with id: "+this.fetchId, err);
}
);
}else if(this.fetchBy =="User"){
@ -155,6 +156,7 @@ private seoService: SEOService) {
},
err => {
this.handleErrors(err);
this.handleError("Error getting claims for user with id: "+this.fetchId, err);
}
);
}else if(this.fetchBy =="Result"){
@ -164,6 +166,7 @@ private seoService: SEOService) {
},
err => {
this.handleErrors(err);
this.handleError("Error getting claims for result with id: "+this.fetchId, err);
}
);
}else if(this.fetchBy =="Context"){
@ -173,6 +176,7 @@ private seoService: SEOService) {
},
err => {
this.handleErrors(err);
this.handleError("Error getting claims for context with id: "+this.fetchId, err);
}
);
}else{
@ -182,6 +186,7 @@ private seoService: SEOService) {
},
err => {
this.handleErrors(err);
this.handleError("Error getting claims", err);
}
);
}
@ -219,12 +224,17 @@ handleErrors(err){
this.showForbiddenMessage = true;
}
}catch (e) {
console.log("Couldn't parse answer as json")
//console.log("Couldn't parse answer as json")
this.handleError("Error parsing answer as json", e);
this.showErrorMessage = true;
}
}
private handleError(message: string, error) {
console.error("Dispaly Claims (component): "+message, error);
}
goTo(page:number = 1){
this.page = page;
@ -495,6 +505,9 @@ handleErrors(err){
}
},
error => {
this.handleError("Error deleting claim with id: "+id, error);
});
}
}
@ -535,7 +548,8 @@ handleErrors(err){
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>';
}
}, err => {
console.log(err);
//console.log(err);
this.handleError("Error deleting claims with ids: "+ids, err);
this.showErrorMessage = true;
this.loading.close();

View File

@ -9,6 +9,7 @@ import { Subject } from 'rxjs/Subject';
import{EnvProperties} from '../../utils/properties/env-properties';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
@ -51,6 +52,7 @@ export class ClaimsByTokenComponent {
public contact_person: string[] = ["Konstantina", "Argiro", "Katerina"];
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public pending_status: number;
public curated_status: number;
@ -90,6 +92,7 @@ export class ClaimsByTokenComponent {
private claimsByTokenService: ClaimsByTokenService,
private _meta: Meta, private _title: Title) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.pending_status = this.errorCodes.LOADING;
this.curated_status = this.errorCodes.LOADING;
}
@ -319,7 +322,11 @@ refreshTable(page:number, whichTable: string) {
this.curated_status = this.errorCodes.DONE;
},
err => {
if(err.status == '404') {
this.handleError("Error getting claims for openaire id: "+this.openaireId, err);
this.pending_status = this.errorMessages.getErrorCode(err.status);
this.curated_status = this.pending_status;
/*if(err.status == '404') {
this.pending_status = this.errorCodes.NOT_FOUND;
this.curated_status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
@ -328,7 +335,7 @@ refreshTable(page:number, whichTable: string) {
} else {
this.pending_status = this.errorCodes.NOT_AVAILABLE;
this.curated_status = this.errorCodes.NOT_AVAILABLE;
}
}*/
this.showTables = true;
if(!this.triggered) {
@ -344,7 +351,7 @@ refreshTable(page:number, whichTable: string) {
}
this.accessStatus = "invalid";
console.log(err);
//console.log(err);
}
);
} else {
@ -471,7 +478,8 @@ refreshTable(page:number, whichTable: string) {
this.validateJWTandToken();
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error updating claim curation: "+JSON.stringify(claimCurationInfo), err);
this.curated_status = this.errorCodes.NOT_SAVED;
}
);
@ -495,7 +503,8 @@ refreshTable(page:number, whichTable: string) {
},
err => {
//this.closeLoading();
console.log(err);
//console.log(err);
this.handleError("Error updating claims: right: "+JSON.stringify(this.selectedRight_PendingMode)+" and wrong: "+JSON.stringify(this.selectedWrong_PendingMode), err);
this.pending_status = this.errorCodes.NOT_SAVED;
}
);
@ -562,4 +571,7 @@ refreshTable(page:number, whichTable: string) {
}
private handleError(message: string, error) {
console.error("Claims Project Manager Page: "+message, error);
}
}

View File

@ -144,7 +144,8 @@ export class DirectLinkingComponent {
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
//console.log("An error occured")
this.handleError("Error getting project by id: "+id, err);
});
}
getPublicationById(id:string, isInlineResult:boolean){
@ -171,7 +172,8 @@ export class DirectLinkingComponent {
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
//console.log("An error occured")
this.handleError("Error getting publication by id: "+id, err);
});
}
getDatasetById(id:string, isInlineResult:boolean){
@ -198,7 +200,8 @@ export class DirectLinkingComponent {
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
//console.log("An error occured")
this.handleError("Error getting research data by id: "+id, err);
});
}
getSoftwareById(id:string, isInlineResult:boolean){
@ -225,7 +228,8 @@ export class DirectLinkingComponent {
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
//console.log("An error occured")
this.handleError("Error getting software by id: "+id, err);
});
}
getOrpById(id:string, isInlineResult:boolean){
@ -252,7 +256,12 @@ getOrpById(id:string, isInlineResult:boolean){
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
//console.log("An error occured")
this.handleError("Error getting other research product by id: "+id, err);
});
}
private handleError(message: string, error) {
console.error("Direct Linking Page: "+message, error);
}
}

View File

@ -164,7 +164,8 @@ export class BulkClaimComponent {
this.enableUpload = true;
console.log(error);
this.loading.close();
this.errorMessage = "An error occured while uploading...";
//this.errorMessage = "An error occured while uploading...";
this.handleError("Error uploading file", error);
});
}
private removeDoubleQuotes(value){
@ -228,7 +229,8 @@ export class BulkClaimComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting crossref by DOIs: "+id, err);
this.notFoundIds.push(id);
this.notFoundIdsRow.push(row);
this.endOfFetching();
@ -252,7 +254,8 @@ export class BulkClaimComponent {
this.endOfFetching();
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting datacite result by DOI: "+id, err);
this.notFoundIds.push(id);
this.notFoundIdsRow.push(row);
this.endOfFetching();
@ -275,4 +278,8 @@ export class BulkClaimComponent {
}
}
private handleError(message: string, error) {
console.error("Bulk Claim (component): "+message, error);
}
}

View File

@ -162,6 +162,8 @@ private insertActions(){
this.errorInRecords = err.errorInClaims;
}
this.isertBulkClaims(claims);
this.handleError("Error inserting direct records: "+JSON.stringify(directclaims), err);
}
);
}else{
@ -197,6 +199,8 @@ private isertBulkClaims(claims){
localStorage.setItem(this.localStoragePrefix + "inlineEntity", JSON.stringify(this.inlineEntity));
}
this.afterclaimsInsertion();
this.handleError("Error inserting bulk claims: "+JSON.stringify(claims), err);
}
);
}
@ -404,4 +408,8 @@ createDirectClaim(result, projects, contexts){
confirmClose(data){
this.insertActions();
}
private handleError(message: string, error) {
console.error("Insert Claim (component): "+message, error);
}
}

View File

@ -42,6 +42,9 @@ export class ApprovedByCommunityComponent {
contentproviders => {
this.communityContentProviders = contentproviders;
this.approved = this.checkApproval();
},
error => {
this.handleError("Error getting content providers for community with id: "+this.communityId, error);
}
);
}
@ -57,4 +60,8 @@ export class ApprovedByCommunityComponent {
return id == self.contentProviderId;
});
}
private handleError(message: string, error) {
console.error("Approved by Community (component): "+message, error);
}
}

View File

@ -9,6 +9,7 @@ import {EnvProperties} from '../../utils/properties/env-properties';
import {MailPrefsService} from './mailPrefs.service';
import {ConnectHelper} from '../connectHelper';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
declare var UIkit: any;
@ -37,11 +38,13 @@ export class MailPrefsComponent {
public fetchId:string;
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() showSaveResetButtons: boolean = true;
constructor (private _mailPrefsService: MailPrefsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.status = this.errorCodes.LOADING;
}
@ -90,6 +93,7 @@ export class MailPrefsComponent {
},
err => {
this.handleErrors(err);
this.handleError("Error getting user email preferences for community with id: "+this.communityId, err);
}
);
} else {
@ -112,6 +116,7 @@ export class MailPrefsComponent {
err => {
//console.info(err);
this.handleErrors(err);
this.handleError("Error getting user email preferences for openaire", err);
}
);
}
@ -175,7 +180,8 @@ export class MailPrefsComponent {
this.savedMessage = "Notification settings for claims saved!";
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error saving user email preferences: "JSON.stringify(this.notifications[index]), err);
this.status = this.errorCodes.NOT_SAVED;
}
);
@ -235,17 +241,11 @@ export class MailPrefsComponent {
} else {
code = err.status;
}
if(code == "403") {
this.status = this.errorCodes.FORBIDDEN;
this.status = this.errorMessages.getErrorCode(code);
}
else if(code == "204") {
this.status = this.errorCodes.NONE;
} else if(code == "404") {
this.status = this.errorCodes.NOT_FOUND;
} else if(code == "500") {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
private handleError(message: string, error) {
console.error("User mail notification preferences Page (for claims): "+message, error);
}
@ -253,5 +253,4 @@ export class MailPrefsComponent {
//console.log("Couldn't parse answer as json")
//this.showErrorMessage = true;
//}
}
}

View File

@ -72,6 +72,9 @@ if( this.APIUrl && this.communityId ){
}
},
error => {
this.handleError("Error getting community information (e.g. pages,entities) for community with id: "+this.communityId, error);
});
}
@ -106,4 +109,8 @@ if( this.APIUrl && this.communityId ){
}
return (count > 0)?true:false;
}
private handleError(message: string, error) {
console.error("NavigationBar (component): "+message, error);
}
}

View File

@ -61,7 +61,11 @@ import {ErrorCodes} from './properties/errorCodes';
}
public getErrorCode(status: string) {
if(status == '404') {
if(status == "403") {
return this.errorCodes.FORBIDDEN;
} else if(status == "204") {
return this.errorCodes.NONE;
} else if(status == '404') {
return this.errorCodes.NOT_FOUND;
} else if(status == '500') {
return this.errorCodes.ERROR;