[Trunk | Library]:
1. resultLanding.component.html & result-preview.component.html: Show orcid buttons in all environments (production too) | in <orcid-work> added "resultTitle" property. 2. myOrcidLinks.component.ts: Added "getPersonalDetails()" method and link to advanced research outcomes page, filtered by user's name (if personal details from ORCID fails, use name from AAI - getUserInfo). 3. searchMyOrcidResults.module.ts: Removed PagingModule and added NoLoadPaging. 4. searchMyOrcidResults.component.ts: Added method "totalPages()" to calculate pages in paging. 5. searchMyOrcidResults.component.html: a. Added <no-load-paging> (instead of custom paging with <paging-no-load>). b. In <orcid-work> added "resultTitle" property. c. Fix widths of grid inside card for result preview and orcid buttons. 6. orcid-work.component.ts: a. Added "resultTitle" @Input property, to show it in notifications, instead of pids. b. Updated messages for errors and for multiple put-codes. c. Use "danger" notifications instead of "warning" when an error occurs. d. For search and my orcid links pages, in orcid buttons, use <icon> for icons | For landing page, updated icons in orcid buttons. e. Added message "The action will affect your real ORCID iD." in tooltips, when environment == 'beta'. f. Removed property "procedurePaused" and its usage replaced by "currentAction". g. [Bug fix] For search pages, added "uk-align-right", in order orcid button not to take width for the whole line. h. [Bug fix] In method "getOrcidWorks()" check "Session.isLoggedIn()" was missing. 7. orcid.component.ts: If personal details from ORCID fails, use name from AAI - getUserInfo. 8. orcid.module.ts: Added IconsModule and registered icons: add, remove, preview, refresh in IconsService. 9. searchResult.component.ts: Call "orcidService.getPutCodes()" in all environments (production too). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60619 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
be0b3c8753
commit
127c489da4
|
@ -101,8 +101,9 @@
|
|||
</a>
|
||||
</li>
|
||||
<!-- ORCID -->
|
||||
<li *ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore'">
|
||||
<orcid-work [resultId]="id" [resultLandingInfo]="resultLandingInfo" [pids]="pidsArrayString" [pageType]="'landing'">
|
||||
<li *ngIf="properties.adminToolsPortalType == 'explore'">
|
||||
<orcid-work [resultId]="id" [resultTitle]="resultLandingInfo.title" [resultLandingInfo]="resultLandingInfo"
|
||||
[pids]="pidsArrayString" [pageType]="'landing'">
|
||||
</orcid-work>
|
||||
</li>
|
||||
<li *ngIf="properties.b2noteAPIURL">
|
||||
|
|
|
@ -16,6 +16,7 @@ import {SearchResult} from "../../utils/entities/searchResult";
|
|||
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {Meta, Title} from "@angular/platform-browser";
|
||||
import {UserManagementService} from "../../services/user-management.service";
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
|
@ -35,6 +36,11 @@ declare var UIkit: any;
|
|||
<div class="uk-article-title custom-article-title">
|
||||
My ORCID links
|
||||
</div>
|
||||
<div *ngIf="authorNameParam" class="uk-margin-top">
|
||||
<a class="uk-button-text" [queryParams]="authorNameParam" [routerLink]="properties.searchLinkToAdvancedResults" routerLinkActive="router-link-active">
|
||||
Discover research results related to you
|
||||
</a>
|
||||
</div>
|
||||
<div *ngIf="showErrorMessage" class="uk-animation-fade uk-alert uk-alert-warning" role="alert">
|
||||
An Error Occurred
|
||||
</div>
|
||||
|
@ -166,11 +172,14 @@ export class MyOrcidLinksComponent {
|
|||
private tokenUrl: string;
|
||||
private clientId: string = "APP-A5M3KTX6NCN67L91";
|
||||
|
||||
public authorNameParam: any = null;
|
||||
|
||||
public showErrorMessage: boolean = false;
|
||||
|
||||
constructor (private route: ActivatedRoute, private router: Router,
|
||||
private _orcidService: OrcidService,
|
||||
private _searchResearchResultsService: SearchResearchResultsService,
|
||||
private userManagementService: UserManagementService,
|
||||
private _meta: Meta, private _title: Title
|
||||
// ,private http: HttpClient/*ATHENA CODE*/
|
||||
) {
|
||||
|
@ -237,6 +246,7 @@ export class MyOrcidLinksComponent {
|
|||
|
||||
this.typeQuery = "&type=results";
|
||||
this.getLocalWorks();
|
||||
this.getPersonalDetails();
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
|
@ -245,6 +255,34 @@ export class MyOrcidLinksComponent {
|
|||
}
|
||||
}
|
||||
|
||||
private getPersonalDetails() {
|
||||
//get author name
|
||||
this.subscriptions.push(this._orcidService.getPersonalDetails().subscribe(
|
||||
details => {
|
||||
let author: string = "";
|
||||
|
||||
if(details && details['name']) {
|
||||
let name: string = details['name'];
|
||||
if(name['given-names'] && name['given-names']['value']) {
|
||||
author = name['given-names']['value'];
|
||||
}
|
||||
if(name['family-name'] && name['family-name']['value']) {
|
||||
author += (author ? " " : "") + name['family-name']['value'];
|
||||
}
|
||||
this.authorNameParam = this.routerHelper.createQueryParams(['f0', 'fv0'], ['resultauthor', author]);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.error("Error getting personal details", error);
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
if (user) {
|
||||
this.authorNameParam = this.routerHelper.createQueryParams(['f0', 'fv0'], ['resultauthor', user.fullname]);
|
||||
}
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
openGrantWindow() {
|
||||
this.window = window.open(this.tokenUrl, '_blank',
|
||||
'location=yes,height=700,width=540,left=500,top=100,scrollbars=yes,status=yes');
|
||||
|
@ -330,6 +368,18 @@ export class MyOrcidLinksComponent {
|
|||
//this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery)
|
||||
.subscribe(
|
||||
data => {
|
||||
// this is for testing purposes only!
|
||||
// let newRes = JSON.parse(JSON.stringify(data[1][0]));
|
||||
// newRes.identifiers = new Map();
|
||||
// newRes.identifiers.set("doi", [data[1][0].identifiers.get("doi")[1]]);
|
||||
// data[1].push(newRes);
|
||||
// console.log(data[1][data[0]]);
|
||||
//
|
||||
// data[1][0].identifiers.set("doi", [data[1][0].identifiers.get("doi")[0]]);
|
||||
// console.log(data[1][0]);
|
||||
//
|
||||
// data[0] += 1;
|
||||
|
||||
let totalResults = data[0];
|
||||
let results = data[1];
|
||||
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
<!--<div *ngIf="status == errorCodes.NONE" class="uk-text-center uk-margin-large-top uk-width-3-5">-->
|
||||
<!-- <p class="uk-text-large uk-text-muted uk-margin">There are no repositories for your preferences</p>-->
|
||||
|
||||
<!-- <p class="uk-text-large uk-text-muted">We suggest to deposit your research in</p>-->
|
||||
<!-- <!– <a href="{{zenodoInformation.url}}" target="_blank" class="custom-external custom-icon">{{zenodoInformation.name}}</a>–>-->
|
||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" width="173" height="56.685" viewBox="0 0 173 56.685"><defs><style>.a{fill:#191919;}</style></defs><path class="a" d="M171.749,22.311a16.158,16.158,0,0,0-3.364-4.953A15.511,15.511,0,0,0,157.4,12.837a15.213,15.213,0,0,0-6.074,1.206,16.4,16.4,0,0,0-2.63,1.424,16.2,16.2,0,0,0-2.325,1.891,14.893,14.893,0,0,0-1.242,1.383,19.241,19.241,0,0,0-1.173,1.7,19.372,19.372,0,0,0-1.482,3.343c.048-1.943.332-4.842,1.482-6.468V3.272a3.081,3.081,0,0,0-.993-2.323,3.251,3.251,0,0,0-5.556,2.323V15.765a17.084,17.084,0,0,0-4.261-2.156,14.8,14.8,0,0,0-4.781-.773,15.314,15.314,0,0,0-6.028,1.206,15.575,15.575,0,0,0-4.959,3.316,16.056,16.056,0,0,0-3.352,4.953c-.063.142-.118.286-.177.43-.056-.144-.111-.288-.173-.43a16.158,16.158,0,0,0-3.364-4.953,15.519,15.519,0,0,0-4.95-3.316,15.795,15.795,0,0,0-12.105,0,16.068,16.068,0,0,0-4.954,3.316,15.182,15.182,0,0,0-3.359,4.953c-.058.136-.109.272-.162.407-.056-.135-.109-.271-.167-.407a16.056,16.056,0,0,0-3.357-4.953,15.532,15.532,0,0,0-4.956-3.316,15.795,15.795,0,0,0-12.105,0,16.084,16.084,0,0,0-4.948,3.316,15.129,15.129,0,0,0-3.366,4.953c-.051.125-.1.253-.148.378-.051-.125-.1-.253-.155-.378a16.165,16.165,0,0,0-3.366-4.953,15.489,15.489,0,0,0-10.979-4.521,15.185,15.185,0,0,0-6.072,1.206,16.01,16.01,0,0,0-4.622,3.017v-.521A3.335,3.335,0,0,0,27.211,13.2H3.837a3.334,3.334,0,0,0,0,6.669h18.37L.658,48.884A3.333,3.333,0,0,0,0,50.872v2.176a3.337,3.337,0,0,0,3.336,3.336H28.214a3.335,3.335,0,0,0,3.324-3.09,15.693,15.693,0,0,0,3.675,2.184,15.189,15.189,0,0,0,6.031,1.207A14.892,14.892,0,0,0,49.857,54.1a15.447,15.447,0,0,0,4.827-5.188v4.5a3.245,3.245,0,0,0,3.277,3.275,3.194,3.194,0,0,0,2.281-.949,3.077,3.077,0,0,0,.991-2.326V41.733h-.012a.087.087,0,0,1,.012-.015h-8.17a3.175,3.175,0,0,0-1.851.558,3.007,3.007,0,0,0-1.161,1.507l-.535,1.1a8.969,8.969,0,0,1-8.271,5.254,9.141,9.141,0,0,1-3.493-.684,8.463,8.463,0,0,1-2.883-1.939,9.963,9.963,0,0,1-1.94-2.888,8.4,8.4,0,0,1-.729-3.447V38.252H61.234V28.34a8.74,8.74,0,0,1,.688-3.442,8.959,8.959,0,0,1,8.355-5.515,9.117,9.117,0,0,1,3.493.687,8.459,8.459,0,0,1,2.883,1.94,10.032,10.032,0,0,1,1.94,2.889,8.36,8.36,0,0,1,.734,3.442V53.409A3.233,3.233,0,0,0,82.6,56.684a3.211,3.211,0,0,0,2.286-.949,3.107,3.107,0,0,0,.986-2.326v-4.5a15.828,15.828,0,0,0,2.482,3.249,15.454,15.454,0,0,0,4.954,3.314,15.671,15.671,0,0,0,12.061,0,16.035,16.035,0,0,0,5-3.314,15.226,15.226,0,0,0,3.359-4.951c.044-.112.087-.225.129-.338.046.113.087.226.134.338a15.068,15.068,0,0,0,3.359,4.951,16.075,16.075,0,0,0,4.951,3.314,15.79,15.79,0,0,0,12.109,0,15.476,15.476,0,0,0,4.946-3.314,16.166,16.166,0,0,0,3.366-4.951c.06-.142.116-.283.173-.426.058.143.111.284.173.426a16.07,16.07,0,0,0,3.359,4.951,15.454,15.454,0,0,0,4.954,3.314,15.671,15.671,0,0,0,12.061,0,16.008,16.008,0,0,0,5-3.314A15.314,15.314,0,0,0,173,41.178V28.341A14.991,14.991,0,0,0,171.749,22.311ZM8.35,49.716,25.794,26.224a16.054,16.054,0,0,0-.143,2.117V41.178A14.759,14.759,0,0,0,26.9,47.211a16.514,16.514,0,0,0,1.366,2.5H8.35ZM50.285,31.7H32.2V28.34a8.738,8.738,0,0,1,.686-3.442,8.951,8.951,0,0,1,8.36-5.515,9.1,9.1,0,0,1,3.486.687,8.423,8.423,0,0,1,2.885,1.94,10.033,10.033,0,0,1,1.94,2.889,8.318,8.318,0,0,1,.729,3.442V31.7Zm58.093,9.48a8.7,8.7,0,0,1-.688,3.447,8.941,8.941,0,0,1-8.352,5.511,9.141,9.141,0,0,1-3.493-.684,8.417,8.417,0,0,1-2.883-1.939,9.917,9.917,0,0,1-1.94-2.888,8.353,8.353,0,0,1-.729-3.447V28.341A8.74,8.74,0,0,1,90.98,24.9a8.935,8.935,0,0,1,1.937-2.889,9.165,9.165,0,0,1,9.9-1.94,8.433,8.433,0,0,1,2.888,1.94,10.129,10.129,0,0,1,1.94,2.889,8.356,8.356,0,0,1,.729,3.442V41.178Zm29.035,0a8.32,8.32,0,0,1-.729,3.447,9.947,9.947,0,0,1-1.94,2.888,8.358,8.358,0,0,1-2.888,1.939,9.337,9.337,0,0,1-7.018,0,9.046,9.046,0,0,1-4.825-4.826,8.735,8.735,0,0,1-.69-3.447V28.341a8.439,8.439,0,0,1,.732-3.442,10.1,10.1,0,0,1,1.94-2.889,8.522,8.522,0,0,1,2.883-1.94,9.152,9.152,0,0,1,3.493-.687,8.985,8.985,0,0,1,8.357,5.515,8.775,8.775,0,0,1,.686,3.442V41.178Zm29.035,0a8.82,8.82,0,0,1-.686,3.447,9.129,9.129,0,0,1-11.85,4.826,8.424,8.424,0,0,1-2.882-1.939,9.946,9.946,0,0,1-1.942-2.888,8.337,8.337,0,0,1-.732-3.447V28.341a8.742,8.742,0,0,1,.69-3.442,8.935,8.935,0,0,1,1.937-2.889,9.169,9.169,0,0,1,9.905-1.94,8.423,8.423,0,0,1,2.885,1.94,10.088,10.088,0,0,1,1.942,2.889,8.356,8.356,0,0,1,.729,3.442V41.178Z"/></svg>-->
|
||||
<!-- <p>The OpenAIRE Catch-all repository hosted at CERN cloud infrastructure. Whatever your field of research is, you can deposit any type of research product, select the proper license, ask for a DOI and link it to the funding projects for easy reporting.</p>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="uk-margin-top uk-margin">
|
||||
<div class="uk-clearfix ">
|
||||
<paging-no-load [currentPage]="currentPage" [totalResults]="totalResults" [size]="resultsPerPage"
|
||||
(pageChange)="pageChanged($event)" class="uk-float-right"></paging-no-load>
|
||||
</div>
|
||||
<div class="uk-margin-medium-top uk-margin">
|
||||
<no-load-paging *ngIf="totalResults > 0" [type]="'research outcomes'"
|
||||
(pageChange)="pageChanged($event)"
|
||||
[page]="currentPage" [pageSize]="resultsPerPage"
|
||||
[totalResults]="totalResults">
|
||||
</no-load-paging>
|
||||
|
||||
<ul class="uk-list search-results uk-margin-remove-top">
|
||||
<errorMessages *ngIf="status != errorCodes.NONE" [status]="[status]" [type]="'results'"></errorMessages>
|
||||
|
@ -19,15 +11,16 @@
|
|||
<li *ngFor="let result of previewResults" class="uk-animation-fade">
|
||||
<div class="uk-card uk-card-default uk-padding uk-card-hover">
|
||||
<div class="uk-grid uk-grid-divider">
|
||||
<div class="uk-width-3-4 uk-first-column">
|
||||
<div class="uk-width-expand@m uk-width-1-1 uk-first-column">
|
||||
<result-preview [properties]="properties" [showOrcid]="false" [showOrganizations]="true"
|
||||
[showSubjects]="true" [result]="result" [promoteWebsiteURL]="true">
|
||||
</result-preview>
|
||||
</div>
|
||||
|
||||
<div class="uk-width-1-4">
|
||||
<div class="uk-width-auto@m uk-width-1-1">
|
||||
<div class="uk-height-1-1 uk-padding-small uk-flex uk-flex-center uk-flex-column uk-flex-middle">
|
||||
<orcid-work [resultId]="result.relcanId" [type]="result.resultType" [pageType]="'my_search'"
|
||||
<orcid-work [resultId]="result.relcanId" [resultTitle]="result.title"
|
||||
[type]="result.resultType" [pageType]="'my_search'"
|
||||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true"
|
||||
[identifiers]="result.identifiers"
|
||||
[creationDates]="result.orcidCreationDates" [updateDates]="result.orcidUpdateDates">
|
||||
|
|
|
@ -114,4 +114,12 @@ export class searcMyOrcidResultsComponent {
|
|||
public pageChanged($event) {
|
||||
this.pageChange.emit($event);
|
||||
}
|
||||
|
||||
public totalPages(totalResults: number): number {
|
||||
let totalPages:any = totalResults/this.resultsPerPage;
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, this.resultsPerPage) + 1);
|
||||
}
|
||||
return totalPages;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ import {ResultPreviewModule} from "../../utils/result-preview/result-preview.mod
|
|||
import {ErrorMessagesModule} from "../../utils/errorMessages.module";
|
||||
import {searcMyOrcidResultsComponent} from "./searchMyOrcidResults.component";
|
||||
import {OrcidModule} from "../orcid.module";
|
||||
import {PagingModule} from "../../utils/paging.module";
|
||||
import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
RouterModule, ErrorMessagesModule,
|
||||
ResultPreviewModule, OrcidModule, PagingModule
|
||||
ResultPreviewModule, OrcidModule, NoLoadPaging
|
||||
],
|
||||
declarations: [
|
||||
searcMyOrcidResultsComponent
|
||||
|
|
|
@ -8,6 +8,7 @@ import {properties} from "../../../environments/environment";
|
|||
import {Session} from "../login/utils/helper.class";
|
||||
import {LoginErrorCodes} from "../login/utils/guardHelper.class";
|
||||
import {ExternalIDV3_0, WorkV3_0} from "./orcidWork";
|
||||
import {EnvProperties} from "../utils/properties/env-properties";
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
|
@ -32,15 +33,13 @@ declare var UIkit: any;
|
|||
<span *ngIf="!putCodes || putCodes.length == 0"
|
||||
[attr.uk-tooltip]="(!isLoggedIn)
|
||||
? 'Only logged in users can add or delete a work from their ORCID record '
|
||||
: 'Add this work to your ORCID record'">
|
||||
<a (click)="saveWorkPreparation();"
|
||||
: ('Add this work to your ORCID record' +
|
||||
((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : ''))"
|
||||
class="uk-align-right uk-margin-remove-bottom">
|
||||
|
||||
<a (click)="currentAction='add'; saveWorkPreparation();"
|
||||
[class]="'uk-flex uk-flex-middle uk-flex-right uk-margin-right '+ ((showLoading || !isLoggedIn) ? 'uk-disabled ' : '') + (!isLoggedIn ? 'half-opacity' : '')">
|
||||
<!-- [class]="'uk-margin-right uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">-->
|
||||
<svg *ngIf="!showLoading" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"
|
||||
data-svg="plus">
|
||||
<rect x="7" y="1" width="1" height="13"></rect>
|
||||
<rect x="1" y="7" width="13" height="1"></rect>
|
||||
</svg>
|
||||
<icon *ngIf="!showLoading" name="add" ratio="1"></icon>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left uk-flex uk-flex-middle">Add to
|
||||
<span class="orcid-color space uk-flex uk-flex-middle">
|
||||
|
@ -48,31 +47,18 @@ declare var UIkit: any;
|
|||
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}
|
||||
</span>
|
||||
</span>
|
||||
<!-- <span class="uk-margin-small-left">Add to <span class="orcid-color">ORCID</span></span>-->
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span *ngIf="putCodes && putCodes.length > 0"
|
||||
[attr.uk-tooltip]="(!isLoggedIn)
|
||||
? 'Only logged in users can add or delete a work from their ORCID record '
|
||||
: 'Delete this work from your ORCID record'">
|
||||
<a (click)="deleteWorks();"
|
||||
[class]="'uk-flex uk-flex-middle uk-flex-right uk-margin-right '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<!-- <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}-->
|
||||
<!-- <svg *ngIf="!showLoading" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"-->
|
||||
<!-- data-svg="minus">-->
|
||||
<!-- <rect height="1" width="13" y="7" x="1" fill="#FF3D33"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<span *ngIf="!showLoading" class="uk-icon uk-preserve">
|
||||
<!-- <svg width="14" height="14" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="trash">-->
|
||||
<!-- <polyline fill="none" stroke="#666" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline>-->
|
||||
<!-- <polyline fill="none" stroke="#666" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline>-->
|
||||
<!-- <rect x="8" y="7" width="1" height="9" color="#666"></rect>-->
|
||||
<!-- <rect x="11" y="7" width="1" height="9" color="#666"></rect>-->
|
||||
<!-- <rect x="2" y="3" width="16" height="1" color="#666"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<img src="assets/common-assets/common/bin.svg" width="13">
|
||||
</span>
|
||||
: ('Delete this work from your ORCID record' +
|
||||
((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : ''))"
|
||||
class="uk-align-right uk-margin-remove-bottom">
|
||||
<a (click)="currentAction='delete'; deleteWorks();"
|
||||
[class]="'uk-flex uk-flex-middle uk-flex-right uk-margin-right '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<icon *ngIf="!showLoading" name="remove" ratio="0.8"></icon>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left uk-flex uk-flex-middle">Delete from
|
||||
<span class="orcid-color space uk-flex uk-flex-middle">
|
||||
|
@ -89,27 +75,20 @@ declare var UIkit: any;
|
|||
[attr.uk-tooltip]="(!pids || !isLoggedIn)
|
||||
? (!pids?'Only resources with a PID (persistent identifier) like DOI, handle, PMID can be added or deleted from your ORCID record'
|
||||
: 'Only logged in users can add or delete a work from their ORCID record ')
|
||||
: 'Add this work to your ORCID record'"
|
||||
: ('Add this work to your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : ''))"
|
||||
[class]="(!pids || !isLoggedIn) ? 'half-opacity' : ''">
|
||||
<a (click)="saveWorkPreparation();"
|
||||
<a (click)="currentAction='add'; saveWorkPreparation();"
|
||||
[class]="'orcid_icon_opacity uk-link-text uk-text-bold uk-text-uppercase '+ (showLoading ? 'uk-disabled' : '') + (!isLoggedIn || !pids ? 'uk-disabled uk-text-muted' : '')">
|
||||
<!-- uk-icon-button add-orcid-button -->
|
||||
<span *ngIf="!showLoading" class="uk-icon">
|
||||
<!-- <svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" data-svg="plus">-->
|
||||
<!-- <rect x="7.5" y="1" width="1" height="15" fill="#A6CE39"></rect>-->
|
||||
<!-- <rect x="1" y="7.5" width="15" height="1" fill="#A6CE39"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<img src="assets/common-assets/common/orcid_add.svg" width="40" height="40">
|
||||
<img src="assets/common-assets/common/orcid_add.svg" style="width: 42px; height: 42px">
|
||||
</span>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button loading-action-button"><loading
|
||||
[top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left">Add to
|
||||
<span [class]="showLoading ? 'uk-margin-small-left' : 'space'">Add to
|
||||
<span class="orcid-color">
|
||||
<!-- <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}-->
|
||||
ORCID
|
||||
</span>
|
||||
</span>
|
||||
<!-- <span class="uk-margin-small-left">Add to <span class="orcid-color">ORCID</span></span>-->
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
@ -117,35 +96,20 @@ declare var UIkit: any;
|
|||
[attr.uk-tooltip]="(!pids || !isLoggedIn)
|
||||
? (!pids?'Only resources with a PID (persistent identifier) like DOI, handle, PMID can be added or deleted from your ORCID record'
|
||||
: 'Only logged in users can add or delete a work from their ORCID record ')
|
||||
: 'Delete this work from your ORCID record'"
|
||||
: ('Delete this work from your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : ''))"
|
||||
[class]="(!pids || !isLoggedIn) ? 'half-opacity' : ''">
|
||||
<a (click)="deleteWorks();"
|
||||
<a (click)="currentAction='delete'; deleteWorks();"
|
||||
[class]="'orcid_icon_opacity uk-link-text uk-text-bold uk-text-uppercase '+ (showLoading ? 'uk-disabled' : '') + (!isLoggedIn || !pids ? 'uk-disabled uk-text-muted' : '')">
|
||||
<!-- <span *ngIf="!showLoading" class="uk-icon-button delete-orcid-button uk-icon">-->
|
||||
<!-- <svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" data-svg="minus">-->
|
||||
<!-- <rect height="1" width="15" y="7.5" x="1" fill="#FF3D33"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<!-- </span>-->
|
||||
<!-- uk-icon-button delete-orcid-button-->
|
||||
<span *ngIf="!showLoading" class="uk-icon uk-preserve">
|
||||
<!-- <svg width="15" height="15" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="trash">-->
|
||||
<!-- <polyline fill="none" stroke="#FF3D33" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline>-->
|
||||
<!-- <polyline fill="none" stroke="#FF3D33" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline>-->
|
||||
<!-- <rect x="8" y="7" width="1" height="9" color="#FF3D33"></rect>-->
|
||||
<!-- <rect x="11" y="7" width="1" height="9" color="#FF3D33"></rect>-->
|
||||
<!-- <rect x="2" y="3" width="16" height="1" color="#FF3D33"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<img src="assets/common-assets/common/orcid_bin.svg" width="40" height="40">
|
||||
<img src="assets/common-assets/common/orcid_bin.svg" style="width: 42px; height: 42px">
|
||||
</span>
|
||||
<span *ngIf="showLoading" class="uk-icon icon-button loading-action-button"><loading
|
||||
[top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left">Delete from
|
||||
<span [class]="showLoading ? 'uk-margin-small-left' : 'space'">Delete from
|
||||
<span class="orcid-color">
|
||||
<!-- <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}-->
|
||||
ORCID
|
||||
</span>
|
||||
</span>
|
||||
<!-- <span class="uk-margin-small-left">Delete from <span class="orcid-color">ORCID</span></span>-->
|
||||
</a>
|
||||
</span>
|
||||
</ng-container>
|
||||
|
@ -188,82 +152,41 @@ declare var UIkit: any;
|
|||
: 'View this work from your ORCID record'">
|
||||
<a (click)="currentAction='get'; getOrcidWorks()"
|
||||
[class]="'uk-button action uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')">
|
||||
<!-- <svg *ngIf="!showLoading" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"-->
|
||||
<!-- data-svg="plus">-->
|
||||
<!-- <rect x="7" y="1" width="1" height="13" fill="#A6CE39"></rect>-->
|
||||
<!-- <rect x="1" y="7" width="13" height="1" fill="#A6CE39"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<!-- uk-icon="server"-->
|
||||
<span *ngIf="!showLoading || currentAction!='get'">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
||||
<path d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z" fill="#666"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<icon *ngIf="!showLoading || currentAction!='get'" name="preview" ratio="1"></icon>
|
||||
|
||||
<span *ngIf="showLoading && currentAction=='get'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left">View ORCID work</span>
|
||||
<!-- <span class="uk-margin-small-left">Show <span class="orcid-color">ORCID</span> work</span>-->
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span [attr.uk-tooltip]="(!putCodes || putCodes.length == 0)
|
||||
? 'This work is currently deleted.'
|
||||
: 'Update this work to your ORCID record'">
|
||||
: ('Update this work to your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : ''))">
|
||||
<a (click)="currentAction='update'; updateWorkPreparation()"
|
||||
[class]="'uk-button action uk-margin-top uk-flex uk-flex-middle '+ ((showLoading || !putCodes || putCodes.length == 0) ? 'uk-disabled' : '')">
|
||||
<!-- <svg *ngIf="!showLoading" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"-->
|
||||
<!-- data-svg="plus">-->
|
||||
<!-- <rect x="7" y="1" width="1" height="13" fill="#A6CE39"></rect>-->
|
||||
<!-- <rect x="1" y="7" width="13" height="1" fill="#A6CE39"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<span *ngIf="!showLoading || currentAction!='update'" uk-icon="refresh"></span>
|
||||
|
||||
<icon *ngIf="!showLoading || currentAction!='update'" name="refresh" ratio="1"></icon>
|
||||
<span *ngIf="showLoading && currentAction=='update'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left">Update ORCID work</span>
|
||||
<!-- <span class="uk-margin-small-left">Update <span class="orcid-color">ORCID</span> work</span>-->
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span *ngIf="!putCodes || putCodes.length == 0"
|
||||
uk-tooltip="Add this work to your ORCID record">
|
||||
[attr.uk-tooltip]="'Add this work to your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : '')">
|
||||
<a (click)="currentAction='add'; saveWorkPreparation();"
|
||||
[class]="'uk-button action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<svg *ngIf="!showLoading || currentAction!='add'" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"
|
||||
data-svg="plus">
|
||||
<rect x="7" y="1" width="1" height="13"></rect>
|
||||
<rect x="1" y="7" width="13" height="1"></rect>
|
||||
</svg>
|
||||
<icon *ngIf="!showLoading || currentAction!='add'" name="add" ratio="1"></icon>
|
||||
<span *ngIf="showLoading && currentAction=='add'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left">Add to ORCID</span>
|
||||
<!-- <span class="uk-margin-small-left">Add to <span class="orcid-color">ORCID</span></span>-->
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span *ngIf="putCodes && putCodes.length > 0"
|
||||
uk-tooltip="Delete this work from your ORCID record">
|
||||
[attr.uk-tooltip]="'Delete this work from your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : '')">
|
||||
<a (click)="currentAction='delete'; deleteWorks();"
|
||||
[class]="'uk-button action uk-margin-top uk-flex uk-flex-middle '+ (showLoading ? 'uk-disabled' : '')">
|
||||
<!-- <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}-->
|
||||
<!-- <svg *ngIf="!showLoading || currentAction!='delete'" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"-->
|
||||
<!-- data-svg="minus">-->
|
||||
<!-- <rect height="1" width="13" y="7" x="1" fill="#FF3D33"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<span *ngIf="!showLoading || currentAction!='delete'" class="uk-icon uk-preserve">
|
||||
<!-- <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="trash">-->
|
||||
<!-- <polyline fill="none" stroke="#FF3D33" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline>-->
|
||||
<!-- <polyline fill="none" stroke="#FF3D33" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline>-->
|
||||
<!-- <rect x="8" y="7" width="1" height="9" color="#FF3D33"></rect>-->
|
||||
<!-- <rect x="11" y="7" width="1" height="9" color="#FF3D33"></rect>-->
|
||||
<!-- <rect x="2" y="3" width="16" height="1" color="#FF3D33"></rect>-->
|
||||
<!-- </svg>-->
|
||||
<img src="assets/common-assets/common/bin.svg" width="16">
|
||||
</span>
|
||||
|
||||
|
||||
<icon *ngIf="!showLoading || currentAction!='delete'" name="remove" ratio="1"></icon>
|
||||
<span *ngIf="showLoading && currentAction=='delete'" class="uk-icon icon-button"><loading [top_margin]="false"></loading></span>
|
||||
<span class="uk-margin-small-left">Delete from ORCID</span>
|
||||
<!-- <span class="uk-margin-small-left">Delete from <span class="orcid-color">ORCID</span></span>-->
|
||||
</a>
|
||||
</span>
|
||||
</ng-container>
|
||||
|
@ -276,9 +199,6 @@ declare var UIkit: any;
|
|||
</div>
|
||||
</div>
|
||||
</modal-alert>
|
||||
<ng-template #orcidWorkPreview1 let-work="work">
|
||||
{{work | json}}}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #orcidWorkPreview let-work="work">
|
||||
<div class="uk-card uk-card-default uk-padding uk-card-hover">
|
||||
|
@ -372,15 +292,16 @@ declare var UIkit: any;
|
|||
|
||||
<modal-alert #propagationModal [classTitle]="'landing-modal-header uk-padding-small'"
|
||||
[classBody]="'landing-modal uk-padding-remove'">
|
||||
<div class="uk-text-center uk-padding-small">
|
||||
<div class="uk-padding-small">
|
||||
<div>
|
||||
This result in OpenAIRE is the deduplication of multiple harvested results.
|
||||
You have already added {{this.putCodes?.length}} works in your ORCID record related to this result.
|
||||
This research outcome has been <span class="uk-text-bold">deduplicated in OpenAIRE</span>.
|
||||
<br><br>
|
||||
You have already added <span class="uk-text-bold">{{this.putCodes?.length}} works</span> in your ORCID record related to this research outcome.
|
||||
<div *ngIf="currentAction == 'delete'">
|
||||
If you continue with delete action, all these works will be deleted.
|
||||
If you continue with delete action, <span class="uk-text-bold">all these works will be deleted</span>.
|
||||
</div>
|
||||
<div *ngIf="currentAction == 'update'">
|
||||
If you continue with update action, all these works will be deleted and a new merged work will be added instead.
|
||||
If you continue with update action, <span class="uk-text-bold">all these works will be deleted and a new merged work will be added</span> instead.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -402,6 +323,7 @@ declare var UIkit: any;
|
|||
|
||||
export class OrcidWorkComponent {
|
||||
@Input() resultId: string = "";
|
||||
@Input() resultTitle: string = "";
|
||||
@Input() resultLandingInfo: ResultLandingInfo;
|
||||
@Input() pids: string = "";
|
||||
@Input() identifiers: Map<string, string[]>;
|
||||
|
@ -419,10 +341,8 @@ export class OrcidWorkComponent {
|
|||
@ViewChild('messageModal') messageModal;
|
||||
@ViewChild('propagationModal') propagationModal;
|
||||
|
||||
private procedurePaused: string = "save";
|
||||
public requestGrant: boolean = false;
|
||||
public requestGrantMessage: string = "Please grant OpenAIRE to access and update your ORCID works.";
|
||||
private clientId: string = "APP-A5M3KTX6NCN67L91";
|
||||
private tokenUrl: string;
|
||||
public message: string = "";
|
||||
public showLoading: boolean = false;
|
||||
|
@ -435,6 +355,8 @@ export class OrcidWorkComponent {
|
|||
|
||||
public currentAction: string = "";
|
||||
|
||||
public properties: EnvProperties = properties;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private orcidService: OrcidService,
|
||||
|
@ -486,12 +408,6 @@ export class OrcidWorkComponent {
|
|||
// this.requestGrant = false;
|
||||
this.closeGrantModal();
|
||||
|
||||
// var timer = setInterval(function() {
|
||||
// if(this.window.closed) {
|
||||
// clearInterval(timer);
|
||||
// }
|
||||
// }, 1000);
|
||||
|
||||
let self = this;
|
||||
window.onmessage = function (ev) {
|
||||
if (ev.isTrusted && ev.origin !== location.origin && ev.data !== 'success')
|
||||
|
@ -503,28 +419,14 @@ export class OrcidWorkComponent {
|
|||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
if (self.procedurePaused == "save") {
|
||||
if (self.currentAction == "add") {
|
||||
self.saveWorkPreparation();
|
||||
} else if (self.procedurePaused == "delete") {
|
||||
} else if (self.currentAction == "delete") {
|
||||
self.deleteWorks();
|
||||
} else if(self.procedurePaused == "update") {
|
||||
} else if(self.currentAction == "update") {
|
||||
self.updateWorkPreparation();
|
||||
}
|
||||
};
|
||||
|
||||
// window.addEventListener("message", (eventt) => {
|
||||
// // if(event.origin !== location.origin+"/orcid")
|
||||
// // return;
|
||||
// }, false);
|
||||
|
||||
// this.window.onbeforeunload = function () {
|
||||
// UIkit.notification({
|
||||
// message: '<strong>Thank you for connecting your ORCID iD with OpenAIRE!<strong>',
|
||||
// status: 'success',
|
||||
// timeout: 6000,
|
||||
// pos: 'bottom-right'
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,9 +458,7 @@ export class OrcidWorkComponent {
|
|||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError(error,
|
||||
"There was an error adding work with pids: "+this.pids+" to your ORCID record. Please try again later.",
|
||||
"save");
|
||||
this.handleError(error);
|
||||
console.error("Error getting landing info: ", error);
|
||||
}
|
||||
))
|
||||
|
@ -571,7 +471,7 @@ export class OrcidWorkComponent {
|
|||
} else {
|
||||
|
||||
if (this.requestGrant) {
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record", "save");
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record");
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
|
||||
|
@ -594,24 +494,21 @@ export class OrcidWorkComponent {
|
|||
// this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works.";
|
||||
|
||||
if(response == null) {
|
||||
this.handleError(null,
|
||||
"There was an error adding work with pids: "+this.pids+" to your ORCID record. Please try again later.",
|
||||
"save");
|
||||
this.handleError(null);
|
||||
console.error("Error posting landing info: null");
|
||||
} else {
|
||||
//this.work = this.orcidService.parse(this.resultLandingInfo);
|
||||
//this.work['put-code'] = response;
|
||||
// this.works.push(response);
|
||||
this.putCodes.push(""+response['put-code']);
|
||||
this.creationDates.push(response['created-date']['value']);
|
||||
this.updateDates.push(response['last-modified-date']['value']);
|
||||
|
||||
// this.closeGrantModal();
|
||||
this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!";
|
||||
// this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!";
|
||||
this.message = "You have successfully added work \""+this.resultTitle+"\" in your ORCID record!";
|
||||
// this.openMessageModal("Work added successfully");
|
||||
|
||||
// message: 'You have <strong>successfully added</strong> work with pids: <strong>'+this.pids+'</strong> in your ORCID record!',
|
||||
UIkit.notification({
|
||||
message: 'You have <strong>successfully added</strong> work with pids: <strong>'+this.pids+'</strong> in your ORCID record!',
|
||||
message: 'You have <strong>successfully added</strong> work "<strong>'+this.resultTitle+'</strong>" in your ORCID record!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
|
@ -621,9 +518,7 @@ export class OrcidWorkComponent {
|
|||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError(error,
|
||||
"There was an error adding work with pids: "+this.pids+" to your ORCID record. Please try again later.",
|
||||
"save");
|
||||
this.handleError(error);
|
||||
console.error("Error posting landing info", error);
|
||||
}
|
||||
));
|
||||
|
@ -631,12 +526,11 @@ export class OrcidWorkComponent {
|
|||
|
||||
private updateWorkPreparation() {
|
||||
if(!Session.isLoggedIn()){
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
|
||||
if (this.requestGrant) {
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record", "save");
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record");
|
||||
} else if(this.putCodes.length > 1) {
|
||||
this.openPropagationModal("Update ORCID work");
|
||||
} else {
|
||||
|
@ -654,72 +548,65 @@ export class OrcidWorkComponent {
|
|||
private updateWork() {
|
||||
this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.pids, this.putCodes[0]).subscribe(
|
||||
response => {
|
||||
//this.work = this.orcidService.parse(this.resultLandingInfo);
|
||||
//this.work['put-code'] = response;
|
||||
// this.work = response;
|
||||
|
||||
this.updateDates[0] = response['last-modified-date'].value;
|
||||
|
||||
UIkit.notification({
|
||||
message: 'You have <strong>successfully updated</strong> work with pids: <strong>'+this.pids+'</strong> in your ORCID record!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
if(response) {
|
||||
this.updateDates[0] = response['last-modified-date'].value;
|
||||
|
||||
// message: 'You have <strong>successfully updated</strong> work with pids: <strong>' + this.pids + '</strong> in your ORCID record!',
|
||||
UIkit.notification({
|
||||
message: 'You have <strong>successfully updated</strong> work "<strong>' + this.resultTitle + '</strong>" in your ORCID record!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
}
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => {
|
||||
this.handleError(error,
|
||||
"There was an error updating work with pids: "+this.pids+" to your ORCID record. Please try again later.",
|
||||
"update");
|
||||
this.handleError(error);
|
||||
console.error("Error updating landing info", error);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
public confirmedPropagation() {
|
||||
for(let putCode of this.putCodes)
|
||||
{
|
||||
this.deleteWorks();
|
||||
}
|
||||
if(this.currentAction == "update") {
|
||||
this.saveWork();
|
||||
}
|
||||
this.propagationModal.cancel();
|
||||
|
||||
this.deleteWorks(true);
|
||||
//}
|
||||
// if(this.currentAction == "update") {
|
||||
// this.saveWork();
|
||||
// }
|
||||
}
|
||||
|
||||
private getOrcidWorks() {
|
||||
this.showLoading = true;
|
||||
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
|
||||
(response: WorkV3_0[]) => {
|
||||
this.orcidWorks = response;
|
||||
if(!Session.isLoggedIn()){
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
|
||||
(response: WorkV3_0[]) => {
|
||||
this.orcidWorks = response;
|
||||
|
||||
this.openWorkModal();
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => {
|
||||
this.handleError(error,
|
||||
"There was an error getting work with pids: "+this.pids+" from your ORCID record. Please try again later.",
|
||||
"");
|
||||
console.error("Error getting work", error);
|
||||
}
|
||||
));
|
||||
this.openWorkModal();
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => {
|
||||
this.handleError(error);
|
||||
console.error("Error getting work", error);
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private deleteWorks() {
|
||||
private deleteWorks(confirmed: boolean = false) {
|
||||
if(!Session.isLoggedIn()){
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
|
||||
// let put_code;// = this.testingPutCode;
|
||||
// if(this.work && this.work['put-code']) {
|
||||
// put_code = this.work['put-code'];
|
||||
// }
|
||||
if (this.requestGrant) {
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record", "delete");
|
||||
} else if(this.putCodes.length > 1) {
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record");
|
||||
} else if(this.putCodes.length > 1 && !confirmed) {
|
||||
this.openPropagationModal("Delete ORCID work");
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
|
@ -753,27 +640,30 @@ export class OrcidWorkComponent {
|
|||
}
|
||||
|
||||
if (!deletedAll) {
|
||||
this.handleError(null,
|
||||
"There was an error deleting work with pids: "+this.pids+" from your ORCID record. Please try again later.",
|
||||
"delete");
|
||||
this.handleError(null);
|
||||
console.error("Error deleting landing info: null");
|
||||
} else {
|
||||
// this.closeGrantModal();
|
||||
this.message = "You have successfully deleted work with pids: "+this.pids+" from your ORCID record!";
|
||||
// this.openMessageModal("Work deleted successfully");
|
||||
UIkit.notification({
|
||||
message: 'You have <strong>successfully deleted</strong> work with pids: <strong>'+this.pids+'</strong> from your ORCID record!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
this.showLoading = false;
|
||||
if(this.currentAction == "update") {
|
||||
this.saveWork();
|
||||
} else {
|
||||
// this.closeGrantModal();
|
||||
// this.message = "You have successfully deleted work with pids: " + this.pids + " from your ORCID record!";
|
||||
this.message = "You have successfully deleted work \"" + this.resultTitle + "\" from your ORCID record!";
|
||||
// this.openMessageModal("Work deleted successfully");
|
||||
|
||||
// message: 'You have <strong>successfully deleted</strong> work with pids: <strong>' + this.pids + '</strong> from your ORCID record!',
|
||||
UIkit.notification({
|
||||
message: 'You have <strong>successfully deleted</strong> work "<strong>' + this.resultTitle + '</strong>" from your ORCID record!',
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
this.showLoading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError(error,
|
||||
"There was an error deleting work with pids: "+this.pids+" to your ORCID record. Please try again later.",
|
||||
"delete");
|
||||
this.handleError(error);
|
||||
console.error("Error deleting work", error);
|
||||
}
|
||||
));
|
||||
|
@ -781,12 +671,11 @@ export class OrcidWorkComponent {
|
|||
}
|
||||
}
|
||||
|
||||
openGrantModal(title: string, procedurePaused: string) {
|
||||
openGrantModal(title: string) {
|
||||
this.grantModal.cancelButton = false;
|
||||
this.grantModal.okButton = false;
|
||||
this.grantModal.alertTitle = title;
|
||||
this.grantModal.open();
|
||||
this.procedurePaused = procedurePaused;
|
||||
}
|
||||
|
||||
closeGrantModal() {
|
||||
|
@ -826,22 +715,41 @@ export class OrcidWorkComponent {
|
|||
this.propagationModal.cancel();
|
||||
}
|
||||
|
||||
handleError(error, errorMsg: string, procedurePaused: string) {
|
||||
handleError(error) {
|
||||
if(error && error.status == "401") {
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record", procedurePaused);
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record");
|
||||
this.requestGrant = true;
|
||||
this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works. ";
|
||||
// + "If you have already granted OpenAIRE, you just need to login again to ORCID!";
|
||||
} else if(error && error.status == "403") {
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record", procedurePaused);
|
||||
this.openGrantModal("Add, delete or edit work in your ORCID record");
|
||||
this.requestGrant = true;
|
||||
this.requestGrantMessage = "Please login again to ORCID."
|
||||
// this.openGrantModal();
|
||||
} else {
|
||||
this.message = errorMsg;
|
||||
this.message = "";
|
||||
if(error && error.status == "409") {
|
||||
this.message = "There is <span class='uk-text-bold'>already a work in your ORCID record</span> with the same information of the work you are trying to add now. <br><br>";
|
||||
}
|
||||
if(this.currentAction == "get") {
|
||||
// this.message += "There was an <span class='uk-text-bold'>error getting</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 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.";
|
||||
} 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.";
|
||||
} 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.";
|
||||
} else {
|
||||
this.message += "There was an error. Please try again later."
|
||||
}
|
||||
|
||||
UIkit.notification({
|
||||
message: this.message,
|
||||
status: 'warning',
|
||||
status: 'danger',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ import {OrcidService} from "./orcid.service";
|
|||
import {properties} from "../../../environments/environment";
|
||||
import {RouterHelper} from "../utils/routerHelper.class";
|
||||
import {Meta, Title} from "@angular/platform-browser";
|
||||
import {UserManagementService} from "../services/user-management.service";
|
||||
|
||||
@Component({
|
||||
selector: 'orcid',
|
||||
|
@ -35,6 +36,7 @@ export class OrcidComponent {
|
|||
constructor(private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private orcidService: OrcidService,
|
||||
private userManagementService: UserManagementService,
|
||||
private _meta: Meta, private _title: Title) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -138,7 +140,14 @@ export class OrcidComponent {
|
|||
error => {
|
||||
console.error("Error getting personal details", error);
|
||||
if(this.gotToken) {
|
||||
this._router.navigate([properties.searchLinkToAdvancedResults], {});
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
if (user) {
|
||||
let params = this.routerHelper.createQueryParams(['f0', 'fv0'], ['resultauthor', user.fullname]);
|
||||
this._router.navigate([properties.searchLinkToAdvancedResults], {queryParams: params});
|
||||
} else {
|
||||
this._router.navigate([properties.searchLinkToAdvancedResults], {});
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
this.getToken(this.code);
|
||||
}
|
||||
|
|
|
@ -12,10 +12,14 @@ import {AlertModalModule} from "../utils/modal/alertModal.module";
|
|||
import {ResultLandingService} from "../landingPages/result/resultLanding.service";
|
||||
import {LoadingModule} from "../utils/loading/loading.module";
|
||||
import {ResultLandingUtilsModule} from "../landingPages/landing-utils/resultLandingUtils.module";
|
||||
import {IconsModule} from "../utils/icons/icons.module";
|
||||
import {IconsService} from "../utils/icons/icons.service";
|
||||
import {add, preview, refresh, remove} from "../utils/icons/icons";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, RouterModule, AlertModalModule, LoadingModule, ResultLandingUtilsModule
|
||||
CommonModule, RouterModule, AlertModalModule, LoadingModule, ResultLandingUtilsModule,
|
||||
IconsModule
|
||||
],
|
||||
declarations: [
|
||||
OrcidComponent,
|
||||
|
@ -32,4 +36,8 @@ import {ResultLandingUtilsModule} from "../landingPages/landing-utils/resultLand
|
|||
})
|
||||
|
||||
|
||||
export class OrcidModule{}
|
||||
export class OrcidModule{
|
||||
constructor(private iconsService: IconsService) {
|
||||
this.iconsService.registerIcons([add, remove, preview, refresh]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
this.previewResults.push(this.getResultPreview(result));
|
||||
}
|
||||
|
||||
if(this.properties.environment != 'production' && properties.adminToolsPortalType == "explore" && Session.isLoggedIn() && this.results && this.results.length > 0) {
|
||||
if(properties.adminToolsPortalType == "explore" && Session.isLoggedIn() && this.results && this.results.length > 0) {
|
||||
this.orcidService.getPutCodes(this.previewResults.map(
|
||||
previewResult => {
|
||||
if(previewResult.identifiers) {
|
||||
|
|
|
@ -270,8 +270,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<!--&& loggedIn -->
|
||||
<div
|
||||
*ngIf="(result.pop_inf && result.DOI) || (properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && ((showOrcid && result.identifiers && result.identifiers.size > 0) || (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)))"
|
||||
<div *ngIf="(result.pop_inf && result.DOI) ||
|
||||
(properties.adminToolsPortalType == 'explore' &&
|
||||
((showOrcid && result.identifiers && result.identifiers.size > 0) || (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)))"
|
||||
class="result-preview-bottom">
|
||||
<!-- Impact Factors-->
|
||||
<span class="uk-flex uk-flex-top">
|
||||
|
@ -347,17 +348,16 @@
|
|||
</div>
|
||||
</ng-container>
|
||||
<!-- && loggedIn -->
|
||||
<span
|
||||
*ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && showOrcid && result.identifiers && result.identifiers.size > 0"
|
||||
<span *ngIf="properties.adminToolsPortalType == 'explore' && showOrcid && result.identifiers && result.identifiers.size > 0"
|
||||
class="uk-width-1-3 uk-width-expand@s">
|
||||
<!-- class="uk-flex uk-flex-middle uk-flex-right uk-width-expand">-->
|
||||
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0" [resultId]="result.relcanId"
|
||||
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0"
|
||||
[resultId]="result.relcanId" [resultTitle]="result.title"
|
||||
[type]="result.resultType" [pageType]="'search'"
|
||||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
|
||||
</orcid-work>
|
||||
</span>
|
||||
<span
|
||||
*ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)"
|
||||
<span *ngIf="properties.adminToolsPortalType == 'explore' && (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)"
|
||||
class="uk-width-expand uk-text-right">
|
||||
<span *ngIf="result.orcidCreationDates?.length > 0" class="uk-display-inline-block">
|
||||
<span class="uk-text-muted">Added in ORCID:</span>
|
||||
|
|
Loading…
Reference in New Issue