[Trunk|Connect]: Fix error logs in connect related pages and components.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@54863 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-02-19 12:17:53 +00:00
parent 5f0d09bc83
commit 0b43bffabd
15 changed files with 208 additions and 59 deletions

View File

@ -68,7 +68,11 @@ export class CommunitiesComponent {
this.communitiesResults = communitiesResults;
this.communitiesToShow = this.communitiesResults.slice();
//console.log(communitiesResults);
});
},
error => {
this.handleError("Error getting communities", error);
}
);
});
}
@ -127,4 +131,8 @@ export class CommunitiesComponent {
}
private handleError(message: string, error) {
console.error("Communities (component): "+message, error);
}
}

View File

@ -118,7 +118,7 @@ export class CommunityComponent {
// emptyCommunity.title = this.masterZenodoCommunityId;
// this.masterZenodoCommunity = emptyCommunity;
//console.log("Master Zenodo community'" + this.community.zenodoCommunity + "' couldn't be loaded");
this.handleError("Error getting Master Zenodo community with id: "+this.community.zenodoCommunityId, error);
}
);
@ -131,7 +131,8 @@ export class CommunityComponent {
},
error => {
console.error("list of zenodo communities couldn't be loaded");
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: "+this.communityId, error);
} //this.handleError('System error retrieving community profile', error)
);
@ -145,34 +146,58 @@ export class CommunityComponent {
this.publicationTotal = publicationTotal;
this.showLoading = true;
this.searchPublications();
});
},
error => {
this.handleError("Error getting number of publications for community with id: "+this.communityId, error);
}
);
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'datasets/count?format=json&fq=communityid='+this.communityId).subscribe(
researchDataTotal => {
this.researchDataTotal = researchDataTotal;
});
},
error => {
this.handleError("Error getting number of research data for community with id: "+this.communityId, error);
}
);
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'software/count?format=json&fq=communityid='+this.communityId).subscribe(
softwareTotal => {
this.softwareTotal = softwareTotal;
});
},
error => {
this.handleError("Error getting number of software for community with id: "+this.communityId, error);
}
);
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'other/count?format=json&fq=communityid='+this.communityId).subscribe(
orpTotal => {
this.orpTotal = orpTotal;
});
},
error => {
this.handleError("Error getting number of other research products for community with id: "+this.communityId, error);
}
);
this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/projects').subscribe(
projectTotal => {
this.projectTotal = projectTotal;
//console.log(projectTotal);
});
},
error => {
this.handleError("Error getting number of projects for community with id: "+this.communityId, error);
}
);
this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/contentproviders').subscribe(
contentProviderTotal => {
this.contentProviderTotal = contentProviderTotal;
//console.log(contentProviderTotal);
});
},
error => {
this.handleError("Error getting number of content providers for community with id: "+this.communityId, error);
}
);
// this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe(
// organizationTotal => {
@ -186,7 +211,10 @@ export class CommunityComponent {
res => {
this.communityInfo = res;
},
error => console.log(error)
error => {
//console.log(error)
this.handleError("Error getting community with id: "+this.communityId, error);
}
);
}
});
@ -202,7 +230,11 @@ export class CommunityComponent {
this.publicationResults = publicationResults;
this.showLoading = false;
//console.log(publicationResults);
});
},
error => {
this.handleError("Error getting publications for community with id: "+this.communityId, error);
}
);
}
}
@ -212,7 +244,11 @@ export class CommunityComponent {
researchDataResults => {
this.researchDataResults = researchDataResults;
this.showLoading = false;
});
},
error => {
this.handleError("Error getting research data for community with id: "+this.communityId, error);
}
);
}
}
@ -222,7 +258,11 @@ export class CommunityComponent {
softwareResults => {
this.softwareResults = softwareResults;
this.showLoading = false;
});
},
error => {
this.handleError("Error getting software for community with id: "+this.communityId, error);
}
);
}
}
@ -232,7 +272,11 @@ export class CommunityComponent {
orpResults => {
this.orpResults = orpResults;
this.showLoading = false;
});
},
error => {
this.handleError("Error getting other research products for community with id: "+this.communityId, error);
}
);
}
}
@ -258,4 +302,8 @@ export class CommunityComponent {
return Session.isPortalAdministrator() || Session.isCommunityCurator() || index != -1;
}
private handleError(message: string, error) {
console.error("Community (component): "+message, error);
}
}

View File

@ -56,7 +56,8 @@ export class OpenaireDepositBySubjectResultComponent {
this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
},
error => {
console.error("Community couldn't be loaded");
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: "+communityId, error);
}
);
}
@ -64,4 +65,8 @@ export class OpenaireDepositBySubjectResultComponent {
});
});
}
private handleError(message: string, error) {
console.error("Deposit by subect Result Page: "+message, error);
}
}

View File

@ -58,7 +58,8 @@ export class OpenaireDepositDatasetsComponent {
this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
},
error => {
console.error("Community couldn't be loaded");
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: "+communityId, error);
}
);
}
@ -66,4 +67,8 @@ export class OpenaireDepositDatasetsComponent {
});
});
}
private handleError(message: string, error) {
console.error("Deposit Research Data Page: "+message, error);
}
}

View File

@ -57,7 +57,8 @@ export class OpenaireDepositDatasetsResultComponent {
this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
},
error => {
console.error("Community couldn't be loaded");
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: "+communityId, error);
}
);
}
@ -66,4 +67,7 @@ export class OpenaireDepositDatasetsResultComponent {
});
}
private handleError(message: string, error) {
console.error("Deposit Research Data Result Page: "+message, error);
}
}

View File

@ -88,7 +88,8 @@ export class OpenaireDepositPublicationsComponent {
*/
},
error => {
console.error("Community couldn't be loaded");
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: "+communityId, error);
}
);
}
@ -96,4 +97,8 @@ export class OpenaireDepositPublicationsComponent {
});
});
}
private handleError(message: string, error) {
console.error("Deposit Publications Page: "+message, error);
}
}

View File

@ -55,7 +55,8 @@ export class OpenaireDepositPublicationsResultComponent {
this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
},
error => {
console.error("Community couldn't be loaded");
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: "+communityId, error);
}
);
}
@ -64,4 +65,7 @@ export class OpenaireDepositPublicationsResultComponent {
});
}
private handleError(message: string, error) {
console.error("Deposit Publications Result Page: "+message, error);
}
}

View File

@ -74,8 +74,8 @@ export class ShareInZenodoComponent {
// emptyCommunity.id = this.masterZenodoCommunityId;
// emptyCommunity.title = this.masterZenodoCommunityId;
// this.masterZenodoCommunity = emptyCommunity;
console.error("Master Zenodo community'"+this.masterZenodoCommunityId+"' couldn't be loaded");
//console.error("Master Zenodo community'"+this.masterZenodoCommunityId+"' couldn't be loaded");
this.handleError("Error getting Master Zenodo community with id: "+this.masterZenodoCommunityId, error);
}
);
@ -94,14 +94,16 @@ export class ShareInZenodoComponent {
},
error => {
console.error("list of zenodo communities couldn't be loaded");
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: "+this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} //this.handleError('System error retrieving community profile', error)
);
},
error => {
console.error("Community couldn't be loaded");
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: "+this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
}
);
@ -150,10 +152,14 @@ export class ShareInZenodoComponent {
if(this.zenodocommunitiesloadedCount >= this.CommunityIds.length){
this.zenodoSearchUtils.status = this.errorCodes.DONE;
}
console.error("Zenodo community'"+zenodoid+"' couldn't be loaded");
//console.error("Zenodo community'"+zenodoid+"' couldn't be loaded");
this.handleError("Error getting Zenodo community with id: "+zenodoid+" and openaire id: "+openaireId, error);
}
);
}
private handleError(message: string, error) {
console.error("Share in Zenodo Page: "+message, error);
}
}

View File

@ -40,8 +40,8 @@ export class HtmlPageComponent {
}
},
err => {
console.log(err);
//console.log(err);
this.handleError("Error getting html content with route: "+location.pathname+" for community with id: "+this.communityId, err);
}
);
}
@ -55,5 +55,7 @@ export class HtmlPageComponent {
}
}
private handleError(message: string, error) {
console.error("Html Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../../openaireLibrary/searchPages/searchUtils/sear
import {SearchResult} from '../../openaireLibrary/utils/entities/searchResult';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../openaireLibrary/utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../openaireLibrary/utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../../openaireLibrary/searchPages/searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
@ -33,7 +34,7 @@ import {PiwikHelper} from '../../utils/piwikHelper';
})
export class OpenaireSearchDataprovidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public columnNames = ['Name', 'Official Name'];
public results =[];
public filters =[];
@ -54,6 +55,7 @@ export class OpenaireSearchDataprovidersComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
@ -117,6 +119,7 @@ export class OpenaireSearchDataprovidersComponent {
this.enableSearchView = true;
},
err => {
/*
console.log(err);
//TODO check erros (service not available, bad request)
@ -127,6 +130,9 @@ export class OpenaireSearchDataprovidersComponent {
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
*/
this.handleError("Error getting content providers for community with id: "+this.communityId, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.enableSearchView = true;
}
@ -181,4 +187,8 @@ export class OpenaireSearchDataprovidersComponent {
return filters;
}
*/
private handleError(message: string, error) {
console.error("Content Providers simple Search Page: "+message, error);
}
}

View File

@ -5,6 +5,7 @@ import { Filter, Value} from '../../openaireLibrary/searchPages/searchUtils/sear
import {SearchResult} from '../../openaireLibrary/utils/entities/searchResult';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../openaireLibrary/utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../openaireLibrary/utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../../openaireLibrary/searchPages/searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
@ -33,7 +34,7 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireSearchProjectsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public columnNames = ['Project', 'GrantId', 'Funder'];
public results =[];
public filters =[];
@ -54,6 +55,7 @@ export class OpenaireSearchProjectsComponent {
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchCommunityProjectsService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
@ -118,6 +120,7 @@ export class OpenaireSearchProjectsComponent {
this.enableSearchView = true;
},
err => {
/*
console.log(err);
//TODO check erros (service not available, bad request)
@ -128,6 +131,9 @@ export class OpenaireSearchProjectsComponent {
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
*/
this.handleError("Error getting projects for community with id: "+this.communityId, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.enableSearchView = true;
}
@ -179,4 +185,8 @@ export class OpenaireSearchProjectsComponent {
}
return filters;
}
private handleError(message: string, error) {
console.error("Projects simple Search Page: "+message, error);
}
}

View File

@ -134,7 +134,8 @@ export class StatisticsComponent {
this.getDisplayOptions();
},
error => {
console.log(error);
//console.log(error);
this.handleError("Error getting community statistics for community with id: "+this.communityId, error);
this.status = this.errorCodes.ERROR;
});
}
@ -150,7 +151,8 @@ export class StatisticsComponent {
},
error => {
console.log(error);
//console.log(error);
this.handleError("Error getting community statistics choices by administrators for community with id: "+this.communityId, error);
this.status = this.errorCodes.ERROR;
}
);
@ -170,7 +172,10 @@ export class StatisticsComponent {
}
console.log(this.entitiesList);*/
},
error => console.log(error),
error => {
//console.log(error)
this.handleError("Error getting community with id: "+this.communityId, error);
},
() => this.initializeDisplayedCharts()
);
}
@ -272,6 +277,9 @@ export class StatisticsComponent {
// console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`);
}
private handleError(message: string, error) {
console.error("Statistics (Monitor) Page: "+message, error);
}
}

View File

@ -44,7 +44,11 @@ export class ManageComponent {
this._communityService.iscommunityManager(this.properties, this.properties.communityAPI+ this.communityId, email).subscribe (
res => {
this.isManager = res;
});
},
error => {
this.handleError("Error getting response if email: "+email+" is community manager for community with id: "+this.communityId, error);
}
);
}
}
});
@ -53,4 +57,7 @@ export class ManageComponent {
}
private handleError(message: string, error) {
console.error("Manage (component): "+message, error);
}
}

View File

@ -14,6 +14,7 @@ import {EnvProperties} from '../../../openaire
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
@Component({
@ -54,6 +55,7 @@ export class InviteComponent implements OnInit {
public communityIdParam = {};
public status: number = 1;
public errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
constructor (
private element: ElementRef,
@ -65,6 +67,7 @@ export class InviteComponent implements OnInit {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.status = this.errorCodes.LOADING;
}
@ -95,7 +98,11 @@ export class InviteComponent implements OnInit {
this.status = this.errorCodes.DONE;
},
error => this.handleError(error)
error => {
//this.handleError(error)
this.handleError("Error getting community with id: "+this.communityId, error);
this.status = this.errorMessages.getErrorCode(error.status);
}
);
} else {
this.status = this.errorCodes.DONE;
@ -150,7 +157,8 @@ export class InviteComponent implements OnInit {
this.recipients = "";
},
error => {
console.log(error);
//console.log(error);
this.handleError("Error inviting emails: "+JSON.stringify(this.recipients)+" to community with id: "+this.communityId+" by: "+this.fullname, error);
this.status = this.errorCodes.DONE;
this.inviteErrorMessage = "There was an error sending emails. Please try again.";
}
@ -210,7 +218,7 @@ export class InviteComponent implements OnInit {
public composeEmail() {
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
}
/*
public handleError(error) {
if(error.status == '401') {
this.status = this.errorCodes.FORBIDDEN;
@ -225,6 +233,7 @@ export class InviteComponent implements OnInit {
}
console.log('Server responded: ' + error);
}
*/
allowEdit(){
var email = Session.getUserEmail();
var index =-1;
@ -236,4 +245,8 @@ export class InviteComponent implements OnInit {
}
private handleError(message: string, error) {
console.error("Invite Page (or component): "+message, error);
}
}

View File

@ -68,13 +68,18 @@ export class SubscribeComponent {
this._subscribeService.isSubscribedToCommunity(this.communityId, email,this.properties.adminToolsAPIURL).subscribe (
res => {
this.subscribed = res;
},
error => {
this.handleError("Error getting response if email: "+email+" is subscribed to community with id: "+this.communityId, error);
});
}
}else{
this._subscribeService.getCommunitySubscribers(this.communityId, this.properties.adminToolsAPIURL).subscribe (
res => {
this.subscribers = (res && res.subscribers && res.subscribers.length )?res.subscribers.length:0;
},
error => {
this.handleError("Error getting community subscribers for community with id: "+this.communityId, error);
});
}
@ -84,7 +89,10 @@ export class SubscribeComponent {
community => {
this.community = community;
},
error => console.log('System error retrieving community profile', error)
error => {
//console.log('System error retrieving community profile', error)
this.handleError("Error getting community with id: "+this.communityId, error);
}
);
});
@ -117,8 +125,8 @@ export class SubscribeComponent {
//console.log("The email has been sent successfully!")
},
error => {
console.log(error)
//console.log(error)
this.handleError("Error notifying managers about new subscribers for community with id: "+this.communityId, error);
}
);
}
@ -132,7 +140,8 @@ export class SubscribeComponent {
timeout : 3000,
pos : 'top-center'
});
console.log(error)
//console.log(error)
this.handleError("Error subscribing email: "+email+" to community with id: "+this.communityId, error);
});
}
}
@ -169,7 +178,8 @@ export class SubscribeComponent {
timeout : 3000,
pos : 'top-center'
});
console.log(error)
//console.log(error)
this.handleError("Error unsubscribing email: "+email+" from community with id: "+this.communityId, error);
});
}
}
@ -187,4 +197,8 @@ export class SubscribeComponent {
confirmClose(data){
this.unsubscribe();
}
private handleError(message: string, error) {
console.error("Subscribe (component): "+message, error);
}
}