landing pages: keep the loaded url as canonical if there is a timeout error - show the correct message
This commit is contained in:
parent
ca430fd89f
commit
f911dec31e
|
@ -145,6 +145,7 @@ export class DataProviderComponent {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
||||||
this.updateTitle("Content provider");
|
this.updateTitle("Content provider");
|
||||||
this.updateDescription("");
|
this.updateDescription("");
|
||||||
|
@ -259,10 +260,13 @@ export class DataProviderComponent {
|
||||||
"page_type": "dataprovider"
|
"page_type": "dataprovider"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}else if(err.name == "TimeoutError"){
|
||||||
|
this.errorMessage = 'An error occurred please try again later';
|
||||||
|
}else {
|
||||||
|
this.errorMessage = 'No dataProvider found';
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToDataProviders);
|
||||||
}
|
}
|
||||||
this.errorMessage = 'No dataProvider found';
|
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToDataProviders);
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,20 +32,20 @@ import {properties} from "../../../../environments/environment";
|
||||||
export class OrganizationComponent {
|
export class OrganizationComponent {
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
@Input() communityId = null;
|
@Input() communityId = null;
|
||||||
|
|
||||||
public organizationInfo: OrganizationInfo;
|
public organizationInfo: OrganizationInfo;
|
||||||
public organizationId: string;
|
public organizationId: string;
|
||||||
|
|
||||||
// Message variables
|
// Message variables
|
||||||
public warningMessage = "";
|
public warningMessage = "";
|
||||||
public errorMessage = "";
|
public errorMessage = "";
|
||||||
public showLoading: boolean = true;
|
public showLoading: boolean = true;
|
||||||
|
|
||||||
// CSV variables
|
// CSV variables
|
||||||
public downloadURLAPI: string;
|
public downloadURLAPI: string;
|
||||||
public csvProjectParamsHead: string;
|
public csvProjectParamsHead: string;
|
||||||
public csvParamsTail: string;
|
public csvParamsTail: string;
|
||||||
|
|
||||||
// Variables for publications, research data, projects, dataproviders tabs
|
// Variables for publications, research data, projects, dataproviders tabs
|
||||||
public fetchProjects: FetchProjects;
|
public fetchProjects: FetchProjects;
|
||||||
public fetchPublications: FetchResearchResults;
|
public fetchPublications: FetchResearchResults;
|
||||||
|
@ -67,18 +67,18 @@ export class OrganizationComponent {
|
||||||
|
|
||||||
@ViewChild('downloadReportModal') downloadReportModal;
|
@ViewChild('downloadReportModal') downloadReportModal;
|
||||||
@ViewChild('downloadFunderReportModal') downloadFunderReportModal;
|
@ViewChild('downloadFunderReportModal') downloadFunderReportModal;
|
||||||
|
|
||||||
@ViewChild(ModalLoading) loading: ModalLoading;
|
@ViewChild(ModalLoading) loading: ModalLoading;
|
||||||
// Alert box when CSV: Project Publications for a funder is requested
|
// Alert box when CSV: Project Publications for a funder is requested
|
||||||
@ViewChild('AlertModalApplyAll') alertApplyAll;
|
@ViewChild('AlertModalApplyAll') alertApplyAll;
|
||||||
// Alert box when something is wrong with CSV requests
|
// Alert box when something is wrong with CSV requests
|
||||||
@ViewChild('AlertModalCsvError') alertCsvError;
|
@ViewChild('AlertModalCsvError') alertCsvError;
|
||||||
|
|
||||||
public routerHelper: RouterHelper = new RouterHelper();
|
public routerHelper: RouterHelper = new RouterHelper();
|
||||||
public errorCodes: ErrorCodes = new ErrorCodes();
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
||||||
public pageContents = null;
|
public pageContents = null;
|
||||||
public divContents = null;
|
public divContents = null;
|
||||||
|
|
||||||
// Helper variables to specify funder in downloadPublicationsFile function
|
// Helper variables to specify funder in downloadPublicationsFile function
|
||||||
public contentTypes: [string, string][] = [
|
public contentTypes: [string, string][] = [
|
||||||
['results', 'all research outcomes'],
|
['results', 'all research outcomes'],
|
||||||
|
@ -97,11 +97,11 @@ export class OrganizationComponent {
|
||||||
public indexUpdateDate: Date;
|
public indexUpdateDate: Date;
|
||||||
public showFeedback: boolean = false;
|
public showFeedback: boolean = false;
|
||||||
public feedbackFields: string [] = ['Name', 'Country', 'Other'];
|
public feedbackFields: string [] = ['Name', 'Country', 'Other'];
|
||||||
|
|
||||||
@ViewChild('AlertModalDeletedByInference') alertModalDeletedByInference;
|
@ViewChild('AlertModalDeletedByInference') alertModalDeletedByInference;
|
||||||
@ViewChild('projectsModal') projectsModal;
|
@ViewChild('projectsModal') projectsModal;
|
||||||
public deleteByInferenceOpened: boolean = false;
|
public deleteByInferenceOpened: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
constructor(private element: ElementRef,
|
constructor(private element: ElementRef,
|
||||||
private _organizationService: OrganizationService,
|
private _organizationService: OrganizationService,
|
||||||
|
@ -125,7 +125,7 @@ export class OrganizationComponent {
|
||||||
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
||||||
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
@ -139,14 +139,15 @@ export class OrganizationComponent {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
|
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||||
this.organizationInfo = null;
|
this.organizationInfo = null;
|
||||||
this.updateTitle("Organization");
|
this.updateTitle("Organization");
|
||||||
this.updateDescription("");
|
this.updateDescription("");
|
||||||
|
|
||||||
this.organizationId = params['organizationId'];
|
this.organizationId = params['organizationId'];
|
||||||
|
|
||||||
if (this.organizationId && StringUtils.isOpenAIREID(this.organizationId)) {
|
if (this.organizationId && StringUtils.isOpenAIREID(this.organizationId)) {
|
||||||
this.getOrganizationInfo();
|
this.getOrganizationInfo();
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,13 +161,13 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
|
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.downloadURLAPI = this.properties.csvAPIURL;
|
this.downloadURLAPI = this.properties.csvAPIURL;
|
||||||
//this.csvAffiliatedPublications = this.downloadURLAPI + "?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \"" + this.organizationId + "\"))";
|
//this.csvAffiliatedPublications = this.downloadURLAPI + "?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \"" + this.organizationId + "\"))";
|
||||||
this.csvProjectParamsHead = 'format=csv&type=projects&fq=((funder exact "';
|
this.csvProjectParamsHead = 'format=csv&type=projects&fq=((funder exact "';
|
||||||
//this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact ';
|
//this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact ';
|
||||||
}
|
}
|
||||||
|
|
||||||
private getPageContents() {
|
private getPageContents() {
|
||||||
if(this.communityId) {
|
if(this.communityId) {
|
||||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||||
|
@ -174,7 +175,7 @@ export class OrganizationComponent {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getDivContents() {
|
private getDivContents() {
|
||||||
if(this.communityId) {
|
if(this.communityId) {
|
||||||
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||||
|
@ -209,11 +210,11 @@ export class OrganizationComponent {
|
||||||
this.fetchSoftware.getNumForEntity('software', 'organization', this.organizationId, this.properties);
|
this.fetchSoftware.getNumForEntity('software', 'organization', this.organizationId, this.properties);
|
||||||
this.fetchOrps.getNumForEntity('other', 'organization', this.organizationId, this.properties);
|
this.fetchOrps.getNumForEntity('other', 'organization', this.organizationId, this.properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTotalDataproviders() {
|
private getTotalDataproviders() {
|
||||||
this.fetchDataproviders.getNumForEntity('organization', this.organizationId, this.properties);
|
this.fetchDataproviders.getNumForEntity('organization', this.organizationId, this.properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private searchContentProviders() {
|
// private searchContentProviders() {
|
||||||
// this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, this.searchNumber, this.properties);
|
// this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, this.searchNumber, this.properties);
|
||||||
// }
|
// }
|
||||||
|
@ -227,7 +228,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
this.reloadDataproviders = false;
|
this.reloadDataproviders = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private searchPublications() {
|
// private searchPublications() {
|
||||||
// this.fetchPublications.getResultsForEntity("publication", "organization", this.organizationId, 1, size, this.properties);
|
// this.fetchPublications.getResultsForEntity("publication", "organization", this.organizationId, 1, size, this.properties);
|
||||||
// }
|
// }
|
||||||
|
@ -241,7 +242,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
this.reloadPublications = false;
|
this.reloadPublications = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private searchDatasets() {
|
// private searchDatasets() {
|
||||||
// this.fetchDatasets.getResultsForEntity("dataset", "organization", this.organizationId, 1, this.searchNumber, this.properties);
|
// this.fetchDatasets.getResultsForEntity("dataset", "organization", this.organizationId, 1, this.searchNumber, this.properties);
|
||||||
// }
|
// }
|
||||||
|
@ -283,13 +284,13 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
this.reloadOrps = false;
|
this.reloadOrps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getOrganizationInfo() {
|
private getOrganizationInfo() {
|
||||||
|
|
||||||
this.warningMessage = '';
|
this.warningMessage = '';
|
||||||
this.errorMessage = ""
|
this.errorMessage = ""
|
||||||
this.showLoading = true;
|
this.showLoading = true;
|
||||||
|
|
||||||
this.organizationInfo = null;
|
this.organizationInfo = null;
|
||||||
|
|
||||||
this.subscriptions.push(this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe(
|
this.subscriptions.push(this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe(
|
||||||
|
@ -337,14 +338,17 @@ export class OrganizationComponent {
|
||||||
"page_type": "organization"
|
"page_type": "organization"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}else if(err.name == "TimeoutError"){
|
||||||
|
this.errorMessage = 'An error occurred please try again later';
|
||||||
|
}else {
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganizations);
|
||||||
|
this.errorMessage = 'No organization found';
|
||||||
}
|
}
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain+ this.properties.baseLink + this.properties.searchLinkToOrganizations);
|
|
||||||
this.errorMessage = 'No organization found';
|
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public downloadFile(url: string, filename: string) {
|
public downloadFile(url: string, filename: string) {
|
||||||
this.openLoading();
|
this.openLoading();
|
||||||
this.setMessageLoading("Downloading CSV file");
|
this.setMessageLoading("Downloading CSV file");
|
||||||
|
@ -352,7 +356,7 @@ export class OrganizationComponent {
|
||||||
this.subscriptions.push(this._reportsService.downloadCSVFile(url).subscribe(
|
this.subscriptions.push(this._reportsService.downloadCSVFile(url).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
|
|
||||||
var url = window.URL.createObjectURL(data);
|
var url = window.URL.createObjectURL(data);
|
||||||
var a = window.document.createElement('a');
|
var a = window.document.createElement('a');
|
||||||
window.document.body.appendChild(a);
|
window.document.body.appendChild(a);
|
||||||
|
@ -362,7 +366,7 @@ export class OrganizationComponent {
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
a.remove(); // remove the element
|
a.remove(); // remove the element
|
||||||
|
|
||||||
//window.open(window.URL.createObjectURL(data));
|
//window.open(window.URL.createObjectURL(data));
|
||||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||||
this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename, this.piwikSiteId).subscribe());
|
this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename, this.piwikSiteId).subscribe());
|
||||||
|
@ -371,26 +375,26 @@ export class OrganizationComponent {
|
||||||
err => {
|
err => {
|
||||||
//console.log("Error downloading the file.");
|
//console.log("Error downloading the file.");
|
||||||
this.handleError("Error downloading file: " + filename + ".csv", err);
|
this.handleError("Error downloading file: " + filename + ".csv", err);
|
||||||
|
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
this.confirmOpenCsvError();
|
this.confirmOpenCsvError();
|
||||||
}/*,
|
}/*,
|
||||||
() => console.log('Completed file download.')*/
|
() => console.log('Completed file download.')*/
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private downloadFileByFunder() {
|
private downloadFileByFunder() {
|
||||||
|
|
||||||
this.openLoading();
|
this.openLoading();
|
||||||
this.setMessageLoading("Downloading CSV file");
|
this.setMessageLoading("Downloading CSV file");
|
||||||
|
|
||||||
let response: string[] = [];
|
let response: string[] = [];
|
||||||
let totalResponse: string = "";
|
let totalResponse: string = "";
|
||||||
let projects = [];
|
let projects = [];
|
||||||
let counter: number = this.funderCount;
|
let counter: number = this.funderCount;
|
||||||
let title: boolean = false;
|
let title: boolean = false;
|
||||||
let title_index: number = 0;
|
let title_index: number = 0;
|
||||||
|
|
||||||
let filename: string = 'funder-project-' + this.funderContentType + '-report';
|
let filename: string = 'funder-project-' + this.funderContentType + '-report';
|
||||||
|
|
||||||
this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe(
|
this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe(
|
||||||
|
@ -404,7 +408,7 @@ export class OrganizationComponent {
|
||||||
counter--;
|
counter--;
|
||||||
response[index] = "";
|
response[index] = "";
|
||||||
//console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]);
|
//console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]);
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
//for(let i=count-1; i>=0; i--) {
|
//for(let i=count-1; i>=0; i--) {
|
||||||
for (let i = 0; i < projects.length; i++) {
|
for (let i = 0; i < projects.length; i++) {
|
||||||
|
@ -417,7 +421,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
|
|
||||||
var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'}));
|
var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'}));
|
||||||
var a = window.document.createElement('a');
|
var a = window.document.createElement('a');
|
||||||
window.document.body.appendChild(a);
|
window.document.body.appendChild(a);
|
||||||
|
@ -447,7 +451,7 @@ export class OrganizationComponent {
|
||||||
counter--;
|
counter--;
|
||||||
response[index] = data;
|
response[index] = data;
|
||||||
//console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]);
|
//console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]);
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
//for(let i=count-1; i>=0; i--) {
|
//for(let i=count-1; i>=0; i--) {
|
||||||
for (let i = 0; i < projects.length; i++) {
|
for (let i = 0; i < projects.length; i++) {
|
||||||
|
@ -460,7 +464,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
|
|
||||||
var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'}));
|
var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'}));
|
||||||
var a = window.document.createElement('a');
|
var a = window.document.createElement('a');
|
||||||
window.document.body.appendChild(a);
|
window.document.body.appendChild(a);
|
||||||
|
@ -477,7 +481,7 @@ export class OrganizationComponent {
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
this.handleError("Error downloading file: " + filename, err);
|
this.handleError("Error downloading file: " + filename, err);
|
||||||
|
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
this.confirmOpenCsvError();
|
this.confirmOpenCsvError();
|
||||||
this.innerReportSubscriptions.forEach(subscription => subscription.unsubscribe());
|
this.innerReportSubscriptions.forEach(subscription => subscription.unsubscribe());
|
||||||
|
@ -496,18 +500,18 @@ export class OrganizationComponent {
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
this.handleError("Error getting projects for organization with id: " + this.organizationId, err);
|
this.handleError("Error getting projects for organization with id: " + this.organizationId, err);
|
||||||
|
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
this.confirmOpenCsvError();
|
this.confirmOpenCsvError();
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateDescription(description: string) {
|
private updateDescription(description: string) {
|
||||||
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
|
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
|
||||||
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
|
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle(title: string) {
|
private updateTitle(title: string) {
|
||||||
var _prefix = "";
|
var _prefix = "";
|
||||||
// if(!this.communityId) {
|
// if(!this.communityId) {
|
||||||
|
@ -517,11 +521,11 @@ export class OrganizationComponent {
|
||||||
this._title.setTitle(title);
|
this._title.setTitle(title);
|
||||||
this._meta.updateTag({content: title}, "property='og:title'");
|
this._meta.updateTag({content: title}, "property='og:title'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateUrl(url: string) {
|
private updateUrl(url: string) {
|
||||||
this._meta.updateTag({content: url}, "property='og:url'");
|
this._meta.updateTag({content: url}, "property='og:url'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private openLoading() {
|
private openLoading() {
|
||||||
this.closeDownloadReportModal();
|
this.closeDownloadReportModal();
|
||||||
this.closeDownloadFunderReportModal();
|
this.closeDownloadFunderReportModal();
|
||||||
|
@ -530,19 +534,19 @@ export class OrganizationComponent {
|
||||||
this.loading.open();
|
this.loading.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private closeLoading() {
|
private closeLoading() {
|
||||||
if (this.loading) {
|
if (this.loading) {
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private setMessageLoading(message: string) {
|
private setMessageLoading(message: string) {
|
||||||
if (this.loading) {
|
if (this.loading) {
|
||||||
this.loading.message = message;
|
this.loading.message = message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public confirmOpenApplyAll(contentType: string) {
|
public confirmOpenApplyAll(contentType: string) {
|
||||||
this.alertApplyAll.cancelButton = true;
|
this.alertApplyAll.cancelButton = true;
|
||||||
this.alertApplyAll.okButton = true;
|
this.alertApplyAll.okButton = true;
|
||||||
|
@ -555,11 +559,11 @@ export class OrganizationComponent {
|
||||||
this.funderCount = this.funder.number;
|
this.funderCount = this.funder.number;
|
||||||
this.funderContentType = contentType;
|
this.funderContentType = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public confirmCloseApplyAll() {
|
public confirmCloseApplyAll() {
|
||||||
this.downloadFileByFunder();
|
this.downloadFileByFunder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public confirmOpenCsvError() {
|
public confirmOpenCsvError() {
|
||||||
this.alertCsvError.cancelButton = false;
|
this.alertCsvError.cancelButton = false;
|
||||||
this.alertCsvError.okButton = true;
|
this.alertCsvError.okButton = true;
|
||||||
|
@ -568,15 +572,15 @@ export class OrganizationComponent {
|
||||||
this.alertCsvError.okButtonText = "OK";
|
this.alertCsvError.okButtonText = "OK";
|
||||||
this.alertCsvError.open();
|
this.alertCsvError.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
encodeURI(input: string): string {
|
encodeURI(input: string): string {
|
||||||
return StringUtils.URIEncode(input);
|
return StringUtils.URIEncode(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(message: string, error) {
|
private handleError(message: string, error) {
|
||||||
console.error("Organizaton Landing Page: " + message, error);
|
console.error("Organizaton Landing Page: " + message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
openDeletedByInference() {
|
openDeletedByInference() {
|
||||||
this.deleteByInferenceOpened = true;
|
this.deleteByInferenceOpened = true;
|
||||||
this.alertModalDeletedByInference.cancelButton = false;
|
this.alertModalDeletedByInference.cancelButton = false;
|
||||||
|
@ -584,26 +588,26 @@ export class OrganizationComponent {
|
||||||
this.alertModalDeletedByInference.alertTitle = "Other versions of";
|
this.alertModalDeletedByInference.alertTitle = "Other versions of";
|
||||||
this.alertModalDeletedByInference.open();
|
this.alertModalDeletedByInference.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTypeParam(type: string): string {
|
public getTypeParam(type: string): string {
|
||||||
if (type == 'results') {
|
if (type == 'results') {
|
||||||
type = 'publications&type=datasets&type=software&type=other';
|
type = 'publications&type=datasets&type=software&type=other';
|
||||||
}
|
}
|
||||||
return 'type=' + type;
|
return 'type=' + type;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCSVAffiliated(contentType: string): string {
|
getCSVAffiliated(contentType: string): string {
|
||||||
return this.downloadURLAPI + '?format=csv&' + this.getTypeParam(contentType) + '&fq=(relorganizationid exact "' + this.organizationId + '")';
|
return this.downloadURLAPI + '?format=csv&' + this.getTypeParam(contentType) + '&fq=(relorganizationid exact "' + this.organizationId + '")';
|
||||||
}
|
}
|
||||||
|
|
||||||
getFunderProjects(): string {
|
getFunderProjects(): string {
|
||||||
return this.downloadURLAPI + '?' + this.csvProjectParamsHead + encodeURI(this.funder.id) + this.csvParamsTail;
|
return this.downloadURLAPI + '?' + this.csvProjectParamsHead + encodeURI(this.funder.id) + this.csvParamsTail;
|
||||||
}
|
}
|
||||||
|
|
||||||
open(value: any) {
|
open(value: any) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
openDownloadReportModal() {
|
openDownloadReportModal() {
|
||||||
this.downloadReportModal.cancelButton = false;
|
this.downloadReportModal.cancelButton = false;
|
||||||
this.downloadReportModal.okButton = false;
|
this.downloadReportModal.okButton = false;
|
||||||
|
@ -614,7 +618,7 @@ export class OrganizationComponent {
|
||||||
closeDownloadReportModal() {
|
closeDownloadReportModal() {
|
||||||
this.downloadReportModal.cancel();
|
this.downloadReportModal.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
openDownloadFunderReportModal() {
|
openDownloadFunderReportModal() {
|
||||||
this.funder = this.fetchProjects.funders[0];
|
this.funder = this.fetchProjects.funders[0];
|
||||||
this.downloadFunderReportModal.cancelButton = false;
|
this.downloadFunderReportModal.cancelButton = false;
|
||||||
|
@ -634,7 +638,7 @@ export class OrganizationComponent {
|
||||||
return this.routerHelper.createQueryParams(['f0', 'fv0'], ['relorganizationid', this.organizationId]);
|
return this.routerHelper.createQueryParams(['f0', 'fv0'], ['relorganizationid', this.organizationId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSelectActiveTab(activeTabId) {
|
public onSelectActiveTab(activeTabId) {
|
||||||
if (this.activeTab != activeTabId) { // tab really changed
|
if (this.activeTab != activeTabId) { // tab really changed
|
||||||
if (activeTabId == 'projects') {
|
if (activeTabId == 'projects') {
|
||||||
|
@ -657,7 +661,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get total(): number {
|
public get total(): number {
|
||||||
let total = this.fetchPublications.searchUtils.totalResults;
|
let total = this.fetchPublications.searchUtils.totalResults;
|
||||||
total += this.fetchDatasets.searchUtils.totalResults;
|
total += this.fetchDatasets.searchUtils.totalResults;
|
||||||
|
@ -665,7 +669,7 @@ export class OrganizationComponent {
|
||||||
total += this.fetchOrps.searchUtils.totalResults;
|
total += this.fetchOrps.searchUtils.totalResults;
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public get numberOfTabs(): number {
|
// public get numberOfTabs(): number {
|
||||||
// if (this.tabsAreInitialized) {
|
// if (this.tabsAreInitialized) {
|
||||||
// return this._numberOfTabs;
|
// return this._numberOfTabs;
|
||||||
|
@ -724,7 +728,7 @@ export class OrganizationComponent {
|
||||||
// this.tabsAreInitialized = true;
|
// this.tabsAreInitialized = true;
|
||||||
// return this._numberOfTabs;
|
// return this._numberOfTabs;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
||||||
if (entityType == "publication") {
|
if (entityType == "publication") {
|
||||||
return "publication" + (plural ? "s" : "");
|
return "publication" + (plural ? "s" : "");
|
||||||
|
@ -740,7 +744,7 @@ export class OrganizationComponent {
|
||||||
return entityType + (plural ? "s" : "");
|
return entityType + (plural ? "s" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public scroll() {
|
public scroll() {
|
||||||
HelperFunctions.scroll();
|
HelperFunctions.scroll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ export class ProjectComponent {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
|
|
||||||
|
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||||
|
@ -351,9 +352,12 @@ export class ProjectComponent {
|
||||||
this.handleError("Error getting project for id: " + this.projectId, err);
|
this.handleError("Error getting project for id: " + this.projectId, err);
|
||||||
if(err.status == 404) {
|
if(err.status == 404) {
|
||||||
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
||||||
|
}else if(err.name == "TimeoutError"){
|
||||||
|
this.errorMessage = 'An error occurred please try again later';
|
||||||
|
}else {
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
|
||||||
|
this.errorMessage = 'No project found';
|
||||||
}
|
}
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
|
|
||||||
this.errorMessage = 'No project found';
|
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
@ -380,9 +384,12 @@ export class ProjectComponent {
|
||||||
this.handleError("Error getting project for grant id: " + grantId + " and funder: " + funder, err);
|
this.handleError("Error getting project for grant id: " + grantId + " and funder: " + funder, err);
|
||||||
if(err.status == 404) {
|
if(err.status == 404) {
|
||||||
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
||||||
|
}else if(err.name == "TimeoutError"){
|
||||||
|
this.errorMessage = 'An error occurred please try again later';
|
||||||
|
}else {
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
|
||||||
|
this.errorMessage = 'No project found';
|
||||||
}
|
}
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
|
|
||||||
this.errorMessage = 'No project found';
|
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
|
@ -143,6 +143,7 @@ export class ResultLandingComponent {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
||||||
if (data['articleId']) {
|
if (data['articleId']) {
|
||||||
this.id = data['articleId'];
|
this.id = data['articleId'];
|
||||||
|
@ -422,17 +423,19 @@ export class ResultLandingComponent {
|
||||||
this.handleError("Error getting " + this.type + " for " + (this.id ? ("id: " + this.id) : ("pid: " + this.identifier.id + " ("+this.identifier.class+")")), err);
|
this.handleError("Error getting " + this.type + " for " + (this.id ? ("id: " + this.id) : ("pid: " + this.identifier.id + " ("+this.identifier.class+")")), err);
|
||||||
if (err.status == 404) {
|
if (err.status == 404) {
|
||||||
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
|
||||||
}
|
}else if(err.name == "TimeoutError"){
|
||||||
|
this.errorMessage = 'An error occurred please try again later';
|
||||||
if (this.type == "publication" || this.type == "software") {
|
}else{
|
||||||
this.errorMessage = 'No ' + this.type + ' found';
|
if (this.type == "publication" || this.type == "software") {
|
||||||
} else if (this.type == "dataset") {
|
this.errorMessage = 'No ' + this.type + ' found';
|
||||||
this.errorMessage += "No research data found";
|
} else if (this.type == "dataset") {
|
||||||
} else if (this.type == "orp") {
|
this.errorMessage += "No research data found";
|
||||||
this.errorMessage += "No research product found";
|
} else if (this.type == "orp") {
|
||||||
|
this.errorMessage += "No research product found";
|
||||||
|
}
|
||||||
|
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToSearchPage);
|
||||||
}
|
}
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToSearchPage);
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue