[Library | new-theme]: Bug fixes in orcid (when work was deleted from ORCID ui, problem in "View orcid work" button & on grant (when not granting, but click on logout, success notification was appearing) | Deleted unused code.
1. resultLanding.component.ts & resultLanding.service.ts: Deleted code related to Open Citations (unused and deprecated). 2. myOrcidLinks.component.ts & orcid-work.component.ts: [Bug fix] On method "openGrantWindow()", condition changed to show success notification if (ev.isTrusted && ev.origin == location.origin && ev.data == 'success') - notification was appearing on logout. 3. orcid-work.component.ts: a. In #workModal set large="true". b. [Bug fix] In method "getPutCode()", called in "View orcid work" button, added check and warning notification if response is null - used to open empty modal. c. [Bug fix] In handleError() method, messages fixed -- used to show ...with pids: {{title}}... 4. datasourcesHelper.class.ts: In method "getQueryPrefix()" deleted commented conditional code for the environment.
This commit is contained in:
parent
657ff61207
commit
dea00ca988
|
@ -353,17 +353,6 @@ export class ResultLandingComponent {
|
|||
return array.filter(value => value.toLowerCase() !== type);
|
||||
}
|
||||
|
||||
private getOpenCitations() {
|
||||
this.subscriptions.push(this._resultLandingService.getOpenCitations(this.id, this.properties).subscribe(
|
||||
data => {
|
||||
this.resultLandingInfo.openCitations = data[1];
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting open citation for " + this.type + " with id: " + this.id, err);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private getVocabulariesAndResultLandingInfo() {
|
||||
this.errorMessage = '';
|
||||
this.showLoading = true;
|
||||
|
@ -460,9 +449,6 @@ export class ResultLandingComponent {
|
|||
(this.linkToLandingPage + this.resultLandingInfo.relcanId));
|
||||
this.seoService.createLinkForCanonicalURL(this.canonicalUrl);
|
||||
this.updateUrl(this.canonicalUrl);
|
||||
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
|
||||
// this.getOpenCitations();
|
||||
}
|
||||
this.addNoIndexFilter();
|
||||
if (this.resultLandingInfo.title) {
|
||||
this.updateTitle(this.resultLandingInfo.title);
|
||||
|
@ -628,9 +614,6 @@ export class ResultLandingComponent {
|
|||
this.organizationsPage = $event.value;
|
||||
}
|
||||
|
||||
public updateOpenCitationsPage($event) {
|
||||
this.openCitationsPage = $event.value;
|
||||
}
|
||||
scrollToTabTop(tabId:string){
|
||||
setTimeout(() => {
|
||||
window.scrollTo({
|
||||
|
|
|
@ -470,62 +470,6 @@ export class ResultLandingService {
|
|||
return bioentities;
|
||||
}
|
||||
|
||||
getOpenCitations(id: string, properties:EnvProperties) {
|
||||
//https://services.openaire.eu/opencitations/getCitations?id=doajarticles::2634200c24772ee8f10232d3e184ec65
|
||||
let url = properties.openCitationsAPIURL+id;// "https://services.openaire.eu/opencitations/getCitations?id=" + id;
|
||||
let key = url;
|
||||
|
||||
//return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||
return this.http.get(url)
|
||||
.pipe(map(res => [res['total'], this.parseOpenCitations(res['results'])]));
|
||||
}
|
||||
|
||||
parseOpenCitations(openCitations: any): {"url": string, "title": string, "year": string, "doi": string, "authors": string[]}[] {
|
||||
//title, doi, authors
|
||||
let citations = new Array<{"url": string, "title": string, "year": string, "doi": string, "authors": string[]}>();
|
||||
|
||||
let openCitation;
|
||||
|
||||
let length = Array.isArray(openCitations) ? openCitations.length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
openCitation = Array.isArray(openCitations) ? openCitations[i] : openCitations;
|
||||
|
||||
let citation: {"url": string, "title": string, "year": string, "doi": string, "authors": string[]} = {"url": "", "title": "", "year": "", "doi": "", "authors": []};
|
||||
|
||||
if(openCitation && openCitation.id) {
|
||||
citation.url = openCitation.id;
|
||||
citation.title = openCitation.title;
|
||||
//citation.type = openCitation.type;
|
||||
citation.year = (openCitation.pubDate && (openCitation.pubDate).indexOf('-') !== -1)?openCitation.pubDate.split('-')[0]:openCitation.pubDate;
|
||||
citation.doi = openCitation.doi;
|
||||
|
||||
let authorsLength = Array.isArray(openCitation.authors) ? openCitation.authors.length : 1;
|
||||
for(let i=0; i<authorsLength; i++) {
|
||||
let author = Array.isArray(openCitation.authors) ? openCitation.authors[i] : openCitation.authors;
|
||||
|
||||
if(author) {
|
||||
let lastFirstName: string = "";
|
||||
if(author.lastName) {
|
||||
lastFirstName = author.lastName;
|
||||
}
|
||||
if(author.lastName && author.firstName) {
|
||||
lastFirstName += ", ";
|
||||
}
|
||||
if(author.firstName) {
|
||||
lastFirstName += author.firstName;
|
||||
}
|
||||
|
||||
if(lastFirstName) {
|
||||
citation.authors.push(lastFirstName);
|
||||
}
|
||||
}
|
||||
}
|
||||
citations.push(citation);
|
||||
}
|
||||
}
|
||||
return citations;
|
||||
}
|
||||
|
||||
getEnermapsDetails(id: string) {
|
||||
let url = properties.enermapsURL+"/api/db/metadata?shared_id=eq."+id;
|
||||
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||
|
|
|
@ -237,16 +237,16 @@ export class MyOrcidLinksComponent {
|
|||
|
||||
let self = this;
|
||||
window.onmessage = function (ev) {
|
||||
if (ev.isTrusted && ev.origin !== location.origin && ev.data !== 'success')
|
||||
return;
|
||||
self.requestGrant = false;
|
||||
UIkit.notification({
|
||||
message: 'Thank you for <strong>connecting your ORCID iD</strong> with OpenAIRE!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
self.getLocalWorks();
|
||||
if (ev.isTrusted && ev.origin == location.origin && ev.data == 'success') {
|
||||
self.requestGrant = false;
|
||||
UIkit.notification({
|
||||
message: 'Thank you for <strong>connecting your ORCID iD</strong> with OpenAIRE!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
self.getLocalWorks();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ declare var UIkit: any;
|
|||
</span>
|
||||
</ng-container>
|
||||
|
||||
<modal-alert #workModal>
|
||||
<modal-alert #workModal large="true">
|
||||
<div *ngIf="orcidWorks">
|
||||
<div *ngFor="let work of orcidWorks['bulk']">
|
||||
<ng-container *ngTemplateOutlet="orcidWorkPreview; context:{work: work['work']}"></ng-container>
|
||||
|
@ -410,23 +410,23 @@ export class OrcidWorkComponent {
|
|||
|
||||
let self = this;
|
||||
window.onmessage = function (ev) {
|
||||
if (ev.isTrusted && ev.origin !== location.origin && ev.data !== 'success')
|
||||
return;
|
||||
self.requestGrant = false;
|
||||
UIkit.notification({
|
||||
message: 'Thank you for <strong>connecting your ORCID iD</strong> with OpenAIRE!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
if (self.currentAction == "add") {
|
||||
self.saveWorkPreparation();
|
||||
} else if (self.currentAction == "delete") {
|
||||
self.deleteWorks();
|
||||
} else if(self.currentAction == "update") {
|
||||
self.updateWorkPreparation();
|
||||
if (ev.isTrusted && ev.origin == location.origin && ev.data == 'success') {
|
||||
self.requestGrant = false;
|
||||
UIkit.notification({
|
||||
message: 'Thank you for <strong>connecting your ORCID iD</strong> with OpenAIRE!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
if (self.currentAction == "add") {
|
||||
self.saveWorkPreparation();
|
||||
} else if (self.currentAction == "delete") {
|
||||
self.deleteWorks();
|
||||
} else if (self.currentAction == "update") {
|
||||
self.updateWorkPreparation();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,9 +597,17 @@ export class OrcidWorkComponent {
|
|||
this.showLoading = true;
|
||||
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
|
||||
(response: WorkV3_0[]) => {
|
||||
this.orcidWorks = response;
|
||||
|
||||
this.openWorkModal();
|
||||
if(response) {
|
||||
this.orcidWorks = response;
|
||||
this.openWorkModal();
|
||||
} else {
|
||||
UIkit.notification({
|
||||
message: 'There was an error getting this work. </br> Please make sure you have not deleted it from your ORCID iD.',
|
||||
status: 'warning',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
}
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => {
|
||||
|
@ -755,13 +763,13 @@ export class OrcidWorkComponent {
|
|||
this.message += "There was an <span class='uk-text-bold'>error getting</span> work \"<span class='uk-text-bold'>" + this.resultTitle + "</span>\" from your ORCID record. <br> Please try again later.";
|
||||
} else if(this.currentAction == "add") {
|
||||
// this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> to your ORCID record. <br> Please try again later.";
|
||||
this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" to your ORCID record. <br> Please try again later.";
|
||||
this.message += "There was an <span class='uk-text-bold'>error adding</span> work with pids: \"<span class='uk-text-bold'>"+this.pids+"</span>\" to your ORCID record. <br> Please try again later.";
|
||||
} else if(this.currentAction == "update") {
|
||||
// this.message += "There was an <span class='uk-text-bold'>error updating</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> to your ORCID record. <br> Please try again later.";
|
||||
this.message += "There was an <span class='uk-text-bold'>error updating</span> work with pids: \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" to your ORCID record. <br> Please try again later.";
|
||||
this.message += "There was an <span class='uk-text-bold'>error updating</span> work \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" to your ORCID record. <br> Please try again later.";
|
||||
} else if(this.currentAction == "delete") {
|
||||
// this.message += "There was an <span class='uk-text-bold'>error deleting</span> work with pids: <span class='uk-text-bold'>"+this.pids+"</span> from your ORCID record. <br> Please try again later.";
|
||||
this.message += "There was an <span class='uk-text-bold'>error deleting</span> work with pids: \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" from your ORCID record. <br> Please try again later.";
|
||||
this.message += "There was an <span class='uk-text-bold'>error deleting</span> work \"<span class='uk-text-bold'>"+this.resultTitle+"</span>\" from your ORCID record. <br> Please try again later.";
|
||||
} else {
|
||||
this.message += "There was an error. Please try again later."
|
||||
}
|
||||
|
|
|
@ -47,37 +47,19 @@ export class DatasourcesHelperClass {
|
|||
}
|
||||
}
|
||||
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services"): string {
|
||||
// if(properties.environment == "production") {
|
||||
// if (type == "registries") {
|
||||
// return ' (datasourcetypeuiid = "entityregistry" or datasourcetypeuiid = "entityregistry::products" or datasourcetypeuiid = "entityregistry::repositories" ' +
|
||||
// 'or datasourcetypeuiid = "entityregistry::organizations" or datasourcetypeuiid = "entityregistry::researchers" ) ';
|
||||
//
|
||||
// } else if (type == "journals") {
|
||||
// // return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
|
||||
// return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
|
||||
//
|
||||
// } else if (type == "compatible") {
|
||||
// return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" ';
|
||||
// } else if (type == "deposit") {
|
||||
// return ' oaftype exact datasource ';
|
||||
// } else {
|
||||
// return "";
|
||||
// }
|
||||
// }else{
|
||||
if (type == "registries") {
|
||||
return 'datasourcetypeuiname exact "Registry"';
|
||||
} else if (type == "journals") {
|
||||
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
|
||||
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and datasourcetypeuiname exact "Journal archive" ';
|
||||
if (type == "registries") {
|
||||
return 'datasourcetypeuiname exact "Registry"';
|
||||
} else if (type == "journals") {
|
||||
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
|
||||
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and datasourcetypeuiname exact "Journal archive" ';
|
||||
|
||||
} else if (type == "compatible") {
|
||||
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiname exact "Repository" ';
|
||||
}else if (type == "deposit") {
|
||||
return ' oaftype exact datasource and (datasourcetypeuiname exact "Journal archive" or datasourcetypeuiname exact "Repository")';
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
// }
|
||||
} else if (type == "compatible") {
|
||||
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiname exact "Repository" ';
|
||||
}else if (type == "deposit") {
|
||||
return ' oaftype exact datasource and (datasourcetypeuiname exact "Journal archive" or datasourcetypeuiname exact "Repository")';
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services"): Filter[] {
|
||||
|
|
Loading…
Reference in New Issue