Merge branch 'develop' into recommendations-functionality

This commit is contained in:
argirok 2024-09-10 11:34:09 +03:00
commit 85b6c88021
17 changed files with 156 additions and 59 deletions

View File

@ -187,7 +187,7 @@ export class CustomizationOptions {
if (current.identity && current.identity.mainColor && current.identity.secondaryColor) { if (current.identity && current.identity.mainColor && current.identity.secondaryColor) {
updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
} }
if(!current.identity.customCss){ if(current.identity && !current.identity.customCss){
current.identity.customCss = defaultCO.identity.customCss; current.identity.customCss = defaultCO.identity.customCss;
} }
if (!current.backgrounds) { if (!current.backgrounds) {

View File

@ -44,7 +44,7 @@ export class PluginSearchBar extends PluginBaseInfo{
<entities-selection class="uk-width-1-3" [simpleView]="true" currentEntity="result" [selectedEntity]="selectedEntity" <entities-selection class="uk-width-1-3" [simpleView]="true" currentEntity="result" [selectedEntity]="selectedEntity"
(selectionChange)="entityChanged($event);advanced.focusNext(input, $event)" (disableSelectEmitter)="disableSelectChange($event)" (selectionChange)="entityChanged($event);advanced.focusNext(input, $event)" (disableSelectEmitter)="disableSelectChange($event)"
[onChangeNavigate]="false"></entities-selection> [onChangeNavigate]="false"></entities-selection>
<div input #input class="uk-width-expand" placeholder="Scholary works" [searchable]="true" [hint]="'Search in OpenAIRE'" [(value)]="keyword"></div> <div input #input class="uk-width-expand" placeholder="Scholarly works" [searchable]="true" [hint]="'Search in OpenAIRE'" [(value)]="keyword"></div>
</advanced-search-input> </advanced-search-input>
</div> </div>
</div> </div>

View File

@ -3,3 +3,25 @@
.custom-bottom-border { .custom-bottom-border {
border-bottom: 5px solid fade(@explore-color, @global-opacity); border-bottom: 5px solid fade(@explore-color, @global-opacity);
} }
//.child {
// height: 0;
// //visibility: hidden;
// opacity: 0;
//}
//
//.parent:hover .uk-transition-slide-top {
// transition-delay: 0.5s;
//}
//
//.parent:hover .child {
// height: auto;
// visibility: visible;
// opacity: 1;
// //transition-delay: 0.5s;
// //transition: 0.6s ease-out;
//}
//
//.parent {
// //transition: all 0.6s ease-out;
//}

View File

@ -1,4 +1,14 @@
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild} from '@angular/core'; import {
Component,
EventEmitter,
Inject,
Input,
OnChanges,
OnInit,
Output, PLATFORM_ID,
SimpleChanges,
ViewChild
} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Session, User} from './utils/helper.class'; import {Session, User} from './utils/helper.class';
import {RouterHelper} from '../utils/routerHelper.class'; import {RouterHelper} from '../utils/routerHelper.class';
@ -9,6 +19,7 @@ import {
NotificationConfiguration, NotificationConfiguration,
NotificationsSidebarComponent NotificationsSidebarComponent
} from "../notifications/notifications-sidebar/notifications-sidebar.component"; } from "../notifications/notifications-sidebar/notifications-sidebar.component";
import {isPlatformServer} from "@angular/common";
declare var UIkit; declare var UIkit;
@ -27,7 +38,7 @@ declare var UIkit;
</text> </text>
</svg> </svg>
</a> </a>
<div class="uk-navbar-dropdown uk-dropdown" uk-dropdown="pos: bottom-right"> <div *ngIf="isClient" class="uk-navbar-dropdown uk-dropdown" uk-dropdown="pos: bottom-right">
<ul class="uk-nav uk-navbar-dropdown-nav"> <ul class="uk-nav uk-navbar-dropdown-nav">
<ng-container *ngFor="let item of userMenuItems "> <ng-container *ngFor="let item of userMenuItems ">
<li *ngIf="item.needsAuthorization && isAuthorized || !item.needsAuthorization" <li *ngIf="item.needsAuthorization && isAuthorized || !item.needsAuthorization"
@ -117,6 +128,7 @@ declare var UIkit;
` `
}) })
export class UserMiniComponent implements OnInit, OnChanges { export class UserMiniComponent implements OnInit, OnChanges {
isClient: boolean = false;
@Input() user: User; @Input() user: User;
public loggedIn: boolean = false; public loggedIn: boolean = false;
public isAuthorized: boolean = false; public isAuthorized: boolean = false;
@ -129,7 +141,9 @@ export class UserMiniComponent implements OnInit, OnChanges {
public showNotifications = false; public showNotifications = false;
private subscriptions = []; private subscriptions = [];
constructor(private router: Router, private route: ActivatedRoute, private userManagementService: UserManagementService) { constructor(private router: Router, private route: ActivatedRoute, private userManagementService: UserManagementService,
@Inject(PLATFORM_ID) private platform: any) {
this.isClient = !isPlatformServer(this.platform);
} }
ngOnInit() { ngOnInit() {

View File

@ -206,7 +206,7 @@ export class MyOrcidLinksComponent {
this.subscriptions.push(this._orcidService.getPersonalDetails().subscribe( this.subscriptions.push(this._orcidService.getPersonalDetails().subscribe(
details => { details => {
let author: string = ""; let author: string = "";
console.log(details)
if(details && details['name']) { if(details && details['name']) {
let name: string = details['name']; let name: string = details['name'];
if(name['given-names'] && name['given-names']['value']) { if(name['given-names'] && name['given-names']['value']) {
@ -303,10 +303,14 @@ console.log(details)
let works = this.works.slice(from, to); let works = this.works.slice(from, to);
for(let work of works) { for(let work of works) {
if(work['pids'] && work['pids'].length > 0) {
for (let pid of work['pids']) { for (let pid of work['pids']) {
let identifier: Identifier = Identifier.getIdentifierFromString(pid, false); let identifier: Identifier = Identifier.getIdentifierFromString(pid, false);
this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(pid="' + StringUtils.URIEncode(identifier.id) + '")'); this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(pid="' + StringUtils.URIEncode(identifier.id) + '")');
} }
} else {
this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(objIdentifier="' + StringUtils.URIEncode(work['openaireId']) + '")');
}
} }
this.showLoading = false; this.showLoading = false;
this._getResults(works); this._getResults(works);
@ -344,8 +348,8 @@ console.log(details)
let relatedResults = []; let relatedResults = [];
this.currentResults.push({"work": work, "results" : relatedResults}) this.currentResults.push({"work": work, "results" : relatedResults})
results.forEach(result => { results.forEach(result => {
let identifierValues: string[] = [].concat(...Array.from(result.identifiers.values())); let identifierValues: string[] = result.identifiers ? [].concat(...Array.from(result.identifiers.values())) : [];
if(work['pids'].some(pid => identifierValues.includes(pid))) { if((work['pids'] && work['pids'].some(pid => identifierValues.includes(pid))) || work['openaireId'] === result.relcanId) {
let index: number = resultsFound.get(identifierValues); let index: number = resultsFound.get(identifierValues);
if(!index) { if(!index) {

View File

@ -24,7 +24,7 @@ declare var UIkit: any;
<span *ngIf="!putCodes || putCodes.length == 0" <span *ngIf="!putCodes || putCodes.length == 0"
[ngClass]="isMobile && pageType == 'landing' ? ' uk-width-1-1' : ''" [ngClass]="isMobile && pageType == 'landing' ? ' uk-width-1-1' : ''"
[attr.uk-tooltip]="isMobile? 'cls: uk-invisible' : 'pos: bottom; cls: uk-active uk-text-small uk-padding-small'" [attr.uk-tooltip]="isMobile? 'cls: uk-invisible' : 'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(noPids || !isLoggedIn) ? ((noPids) ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd"> [title]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipAdd">
<span (click)="currentAction='add'; saveWorkPreparation();" <span (click)="currentAction='add'; saveWorkPreparation();"
[class.uk-disabled]="isDisabled" [class.uk-disabled]="isDisabled"
[class.clickable]="!isDisabled"> [class.clickable]="!isDisabled">
@ -32,21 +32,21 @@ declare var UIkit: any;
[ngClass]="isMobile && !(pageType == 'landing') ? 'uk-margin-left' : ''" [ngClass]="isMobile && !(pageType == 'landing') ? 'uk-margin-left' : ''"
[class.uk-text-bolder]="!(isMobile && pageType == 'landing')" [class.uk-text-bolder]="!(isMobile && pageType == 'landing')"
[class.uk-text-muted]="isDisabled"> [class.uk-text-muted]="isDisabled">
<icon *ngIf="!showLoading" [class.text-orcid]="properties.environment != 'beta' && !showLoading && isLoggedIn && (pids || identifiers?.size > 0)" <icon *ngIf="!showLoading" [class.text-orcid]="properties.environment != 'beta' && !showLoading && isLoggedIn"
[class.uk-text-muted]="isDisabled" [class.uk-text-muted]="isDisabled"
name="orcid_add" [ratio]="(isMobile && pageType == 'search') ? 0.7 : 1" visuallyHidden="add"></icon> name="orcid_add" [ratio]="(isMobile && pageType == 'search') ? 0.7 : 1" visuallyHidden="add"></icon>
<span *ngIf="showLoading" class="uk-icon"><loading <span *ngIf="showLoading" class="uk-icon"><loading
[top_margin]="false" [size]="'small'"></loading></span> [top_margin]="false" [size]="'small'"></loading></span>
<span [ngClass]="(isMobile && pageType == 'landing') ? 'uk-margin-small-left' : 'uk-margin-xsmall-left'">Claim</span> <span *ngIf="!compactView" [ngClass]="(isMobile && pageType == 'landing') ? 'uk-margin-small-left' : 'uk-margin-xsmall-left'">Claim</span>
</a> </a>
<div *ngIf="isMobile && pageType == 'landing'" class="uk-margin-xsmall-top uk-padding uk-padding-remove-vertical uk-text-meta uk-text-xsmall" <div *ngIf="isMobile && pageType == 'landing'" class="uk-margin-xsmall-top uk-padding uk-padding-remove-vertical uk-text-meta uk-text-xsmall"
[innerHTML]="(noPids || !isLoggedIn) ? ((noPids) ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd"></div> [innerHTML]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipAdd"></div>
</span> </span>
</span> </span>
<span *ngIf="putCodes && putCodes.length > 0" [ngClass]="isMobile && pageType == 'landing' ? ' uk-width-1-1' : ''" <span *ngIf="putCodes && putCodes.length > 0" [ngClass]="isMobile && pageType == 'landing' ? ' uk-width-1-1' : ''"
[attr.uk-tooltip]="isMobile? 'cls: uk-invisible' : 'pos: bottom; cls: uk-active uk-text-small uk-padding-small'" [attr.uk-tooltip]="isMobile? 'cls: uk-invisible' : 'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(noPids || !isLoggedIn) ? ((noPids) ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete"> [title]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipDelete">
<span (click)="currentAction='delete'; deleteWorks();" <span (click)="currentAction='delete'; deleteWorks();"
[class.uk-disabled]="isDisabled" [class.uk-disabled]="isDisabled"
[class.clickable]="!isDisabled"> [class.clickable]="!isDisabled">
@ -54,15 +54,15 @@ declare var UIkit: any;
[ngClass]="isMobile && !(pageType == 'landing') ? 'uk-margin-left' : ''" [ngClass]="isMobile && !(pageType == 'landing') ? 'uk-margin-left' : ''"
[class.uk-text-bolder]="!(isMobile && pageType == 'landing')" [class.uk-text-bolder]="!(isMobile && pageType == 'landing')"
[class.uk-text-muted]="isDisabled"> [class.uk-text-muted]="isDisabled">
<icon *ngIf="!showLoading" [class.text-orcid]="!showLoading && isLoggedIn && (pids || identifiers?.size > 0)" <icon *ngIf="!showLoading" [class.text-orcid]="!showLoading && isLoggedIn"
[class.uk-text-muted]="isDisabled" [class.uk-text-muted]="isDisabled"
name="orcid_bin" [ratio]="(isMobile && pageType == 'search') ? 0.7 : 1" visuallyHidden="delete"></icon> name="orcid_bin" [ratio]="(isMobile && pageType == 'search') ? 0.7 : 1" visuallyHidden="delete"></icon>
<span *ngIf="showLoading" class="uk-icon"><loading <span *ngIf="showLoading" class="uk-icon"><loading
[top_margin]="false" [size]="'small'"></loading></span> [top_margin]="false" [size]="'small'"></loading></span>
<span [ngClass]="(isMobile && pageType == 'landing') ? 'uk-margin-small-left' : 'uk-margin-xsmall-left'">Remove</span> <span *ngIf="!compactView" [ngClass]="(isMobile && pageType == 'landing') ? 'uk-margin-small-left' : 'uk-margin-xsmall-left'">Remove</span>
</a> </a>
<div *ngIf="isMobile && pageType == 'landing'" class="uk-margin-xsmall-top uk-padding uk-padding-remove-vertical uk-text-meta uk-text-xsmall" <div *ngIf="isMobile && pageType == 'landing'" class="uk-margin-xsmall-top uk-padding uk-padding-remove-vertical uk-text-meta uk-text-xsmall"
[innerHTML]="(noPids || !isLoggedIn) ? ((noPids) ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete"></div> [innerHTML]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipDelete"></div>
</span> </span>
</span> </span>
</ng-container> </ng-container>
@ -192,8 +192,16 @@ declare var UIkit: any;
</p> </p>
</div> </div>
<div *ngIf="work['external-ids'] && work['external-ids']['external-id']" class="uk-margin-small-bottom"> <div *ngIf="(work['external-ids'] && work['external-ids']['external-id']) || openaireId" class="uk-margin-small-bottom">
<showIdentifiers [identifiers]="parseIdentifiers(work['external-ids']['external-id'])"></showIdentifiers> <showIdentifiers [identifiers]="parseIdentifiers(work['external-ids']['external-id'])"></showIdentifiers>
<ng-container *ngIf="openaireId">
<span class="uk-text-meta uk-text-small uk-text-uppercase">Source-work-id: </span>
<span class="uk-margin-small-left">
<a [href]="openaireId.url" target="_blank" class="uk-display-inline-block custom-external">
{{openaireId.value}}
</a>
</span>
</ng-container>
</div> </div>
<div *ngIf="work['contributors'] && work['contributors']['contributor']"> <div *ngIf="work['contributors'] && work['contributors']['contributor']">
@ -300,6 +308,8 @@ export class OrcidWorkComponent {
//for myorcid links page //for myorcid links page
@Input() showOnlyUpdateButton: boolean = false; @Input() showOnlyUpdateButton: boolean = false;
@Input() showUpdateButton: boolean = true; @Input() showUpdateButton: boolean = true;
@Input() compactView: boolean = false; // if true, do not show label for actions
public subscriptions: Subscription[] = []; public subscriptions: Subscription[] = [];
@ViewChild('workModal') workModal; @ViewChild('workModal') workModal;
// @ViewChild('saveWorkModal') saveWorkModal; // @ViewChild('saveWorkModal') saveWorkModal;
@ -317,6 +327,7 @@ export class OrcidWorkComponent {
public works: any[] = []; public works: any[] = [];
public orcidWorks: any[] = []; public orcidWorks: any[] = [];
public openaireId: {value: string, url: string} = null;
public window: any; public window: any;
public isLoggedIn: boolean = false; public isLoggedIn: boolean = false;
@ -395,11 +406,15 @@ export class OrcidWorkComponent {
public parseIdentifiers(identifiers: ExternalIDV3_0[]): Map<string, string[]> { public parseIdentifiers(identifiers: ExternalIDV3_0[]): Map<string, string[]> {
let identifiersMap: Map<string, string[]> = new Map<string, string[]>(); let identifiersMap: Map<string, string[]> = new Map<string, string[]>();
for (let identifier of identifiers) { for (let identifier of identifiers) {
if(identifier['external-id-type'] == "source-work-id") {
this.openaireId = {value: identifier['external-id-value'], url: identifier['external-id-url'].value};
} else {
if (!identifiersMap.has(identifier['external-id-type'])) { if (!identifiersMap.has(identifier['external-id-type'])) {
identifiersMap.set(identifier['external-id-type'], new Array<string>()); identifiersMap.set(identifier['external-id-type'], new Array<string>());
} }
identifiersMap.get(identifier['external-id-type']).push(identifier['external-id-value']); identifiersMap.get(identifier['external-id-type']).push(identifier['external-id-value']);
} }
}
return identifiersMap; return identifiersMap;
} }
@ -442,7 +457,7 @@ export class OrcidWorkComponent {
} }
private getPutCode() { private getPutCode() {
this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe( this.subscriptions.push(this.orcidService.getPutCode(this.resultLandingInfo.relcanId, this.pids).subscribe(
putCodes => { putCodes => {
this.putCodes = putCodes; this.putCodes = putCodes;
this.cdr.markForCheck(); this.cdr.markForCheck();
@ -511,7 +526,7 @@ export class OrcidWorkComponent {
} }
private saveWork() { private saveWork() {
this.subscriptions.push(this.orcidService.saveWork(this.resultLandingInfo, this.pids).subscribe( this.subscriptions.push(this.orcidService.saveWork(this.resultLandingInfo, this.resultLandingInfo.relcanId,this.pids).subscribe(
response => { response => {
if(this.properties.logServiceUrl) { if(this.properties.logServiceUrl) {
this.subscriptions.push(this._logService.logOrcidLink(this.properties, "added", this.resultLandingInfo.title, this.resultLandingInfo.identifiers.get('doi')[0]).subscribe(res => { })); this.subscriptions.push(this._logService.logOrcidLink(this.properties, "added", this.resultLandingInfo.title, this.resultLandingInfo.identifiers.get('doi')[0]).subscribe(res => { }));
@ -564,7 +579,7 @@ export class OrcidWorkComponent {
} }
private updateWorkPreparation() { private updateWorkPreparation() {
if (!Session.isLoggedIn()) { if (!this.isLoggedIn) {
this._router.navigate(['/user-info'], { this._router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID, "errorCode": LoginErrorCodes.NOT_VALID,
@ -590,7 +605,7 @@ export class OrcidWorkComponent {
} }
private updateWork() { private updateWork() {
this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.pids, this.putCodes[0]).subscribe( this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.resultLandingInfo.relcanId, this.pids, this.putCodes[0]).subscribe(
response => { response => {
if (response) { if (response) {
this.updateDates[0] = response['last-modified-date'].value; this.updateDates[0] = response['last-modified-date'].value;
@ -626,7 +641,8 @@ export class OrcidWorkComponent {
} }
public getOrcidWorks() { public getOrcidWorks() {
if (!Session.isLoggedIn()) { this.openaireId = null;
if (!this.isLoggedIn) {
this._router.navigate(['/user-info'], { this._router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID, "errorCode": LoginErrorCodes.NOT_VALID,
@ -668,7 +684,7 @@ export class OrcidWorkComponent {
public deleteWorks(confirmed: boolean = false) { public deleteWorks(confirmed: boolean = false) {
if (!Session.isLoggedIn()) { if (!this.isLoggedIn) {
this._router.navigate(['/user-info'], { this._router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID, "errorCode": LoginErrorCodes.NOT_VALID,
@ -833,7 +849,7 @@ 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."; 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") { } 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.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.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 openaireId: \"<span class='uk-text-bold'>"+this.resultLandingInfo.relcanId+(this.pids?.length > 0 ? "</span>\" and pids: \"<span class='uk-text-bold'>" + this.pids : "") +"</span>\" to your ORCID record. <br> Please try again later.";
} else if (this.currentAction == "update") { } 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.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 \"<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.";
@ -877,7 +893,7 @@ export class OrcidWorkComponent {
} }
get isDisabled() { get isDisabled() {
return (this.properties.environment == 'beta' || this.showLoading || !this.isLoggedIn || (!this.pids && (!this.identifiers || this.identifiers.size == 0))); return (this.properties.environment == 'beta' || this.showLoading || !this.isLoggedIn);
} }
get noPids() { get noPids() {

View File

@ -11,19 +11,21 @@ import {ConnectHelper} from "../connect/connectHelper";
export class OrcidService { export class OrcidService {
constructor(private http: HttpClient) {} constructor(private http: HttpClient) {}
getPutCode(pids: string) { getPutCode(openaireId: string, pids: string) {
let url: string = properties.orcidAPIURL+"local/put-code?pids="+pids; let url: string = properties.orcidAPIURL+"local/put-code?openaireId="+openaireId+(pids ? ("&pids="+pids) : "");
return this.http.get<string[]>(url, CustomOptions.registryOptions()); return this.http.get<string[]>(url, CustomOptions.registryOptions());
} }
getPutCodes(pids: string[][]) { getPutCodes(openaireIds: string[], pids: string[][]) {
let url: string = properties.orcidAPIURL+"local/put-codes"; let url: string = properties.orcidAPIURL+"local/put-codes";
return this.http.post<string[][]>(url, JSON.stringify(pids), CustomOptions.registryOptions()); let map = {"pids": pids, "openaireIds": openaireIds};
return this.http.post<string[][]>(url, JSON.stringify(map), CustomOptions.registryOptions());
} }
getLocalWorksByPids(pids: string[][]) { getLocalWorksByPids(openaireIds: string[], pids: string[][]) {
let url: string = properties.orcidAPIURL+"local/works"; let url: string = properties.orcidAPIURL+"local/works";
return this.http.post<string[][]>(url, JSON.stringify(pids), CustomOptions.registryOptions()); let map = {"pids": pids, "openaireIds": openaireIds};
return this.http.post<string[][]>(url, JSON.stringify(map), CustomOptions.registryOptions());
} }
getToken(code: string) { getToken(code: string) {
@ -47,14 +49,15 @@ export class OrcidService {
return this.http.get(url, CustomOptions.registryOptions()); return this.http.get(url, CustomOptions.registryOptions());
} }
saveWork(resultLandingInfo: ResultLandingInfo, pids: string) { saveWork(resultLandingInfo: ResultLandingInfo, openaireId: string, pids: string) {
let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, null); let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, null);
let portalId: string = ConnectHelper.getCommunityFromDomain(properties.domain); let portalId: string = ConnectHelper.getCommunityFromDomain(properties.domain);
// if dashboard format changes, check in API the metrics service ("calculateMetrics" method) for orcid KPIs // if dashboard format changes, check in API the metrics service ("calculateMetrics" method) for orcid KPIs
let dashboard: string = properties.environment + "_" + properties.dashboard + (portalId? "_" + portalId : ""); let dashboard: string = properties.environment + "_" + properties.dashboard + (portalId? "_" + portalId : "");
let result = { let result = {
"dashboard": dashboard, "dashboard": dashboard,
"pids": pids.split(","), "openaireId": openaireId,
"pids": pids? pids.split(",") : [],
"work": work "work": work
}; };
let url: string = properties.orcidAPIURL+"orcid/work/save"; let url: string = properties.orcidAPIURL+"orcid/work/save";
@ -93,10 +96,11 @@ export class OrcidService {
// return this.http.post(url, JSON.stringify(work), CustomOptions.registryOptions()) // return this.http.post(url, JSON.stringify(work), CustomOptions.registryOptions())
// .pipe(map(res => work)); // .pipe(map(res => work));
// } // }
updateWork(resultLandingInfo: ResultLandingInfo, pids: string, putCode: string) { updateWork(resultLandingInfo: ResultLandingInfo, openaireId: string, pids: string, putCode: string) {
let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, putCode); let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, putCode);
let result = { let result = {
"pids": pids.split(","), "openaireId": openaireId,
"pids": pids ? pids.split(",") : [],
"work": work "work": work
}; };

View File

@ -154,6 +154,15 @@ export class WorkV3_0 {
) )
}) })
})) }))
} else {
work['external-ids'] = { 'external-id': [{
"external-id-type": "source-work-id",
"external-id-value": resultLandingInfo.relcanId,
"external-id-relationship": "self",
"external-id-url": {
"value": "https://explore.openaire.eu/search/"+resultLandingInfo.resultType+"?id="+resultLandingInfo.relcanId
},
}] };
} }
// url (UrlV3_0, optional), // url (UrlV3_0, optional),

View File

@ -409,7 +409,8 @@
[status]=searchUtils.status [status]=searchUtils.status
[type]="entityType" [type]="entityType"
[showLoading]="true" [properties]=properties [showLoading]="true" [properties]=properties
[compactView]="compactView"> [compactView]="compactView"
[isLoggedIn]="isLoggedIn">
</search-result> </search-result>
<deposit-result *ngIf="usedBy == 'deposit'" <deposit-result *ngIf="usedBy == 'deposit'"
[results]="results" [results]="results"

View File

@ -37,6 +37,7 @@ import {IndexInfoService} from "../../utils/indexInfo.service";
import {Background} from "../../utils/background-utils"; import {Background} from "../../utils/background-utils";
import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service"; import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service";
import {Platform} from "@angular/cdk/platform"; import {Platform} from "@angular/cdk/platform";
import {UserManagementService} from "../../services/user-management.service";
export interface SearchForm extends Background {} export interface SearchForm extends Background {}
@ -165,6 +166,8 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
searchTerm: string = null; searchTerm: string = null;
advancedSearchTerms: number = 0; advancedSearchTerms: number = 0;
public isLoggedIn: boolean = false;
@Input() hasCompactView: boolean = false; // if true, show buttons for compact view @Input() hasCompactView: boolean = false; // if true, show buttons for compact view
public compactView: boolean = false; // if true, show less info (e.g. hide description) on each result public compactView: boolean = false; // if true, show less info (e.g. hide description) on each result
@ -180,11 +183,22 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
private helper: HelperService, private helper: HelperService,
private layoutService: LayoutService, private layoutService: LayoutService,
@Inject(PLATFORM_ID) private platform: any, @Inject(PLATFORM_ID) private platform: any,
private cdr: ChangeDetectorRef, private indexInfoService: IndexInfoService) { private cdr: ChangeDetectorRef, private indexInfoService: IndexInfoService,
private userManagementService: UserManagementService) {
this.isServer = isPlatformServer(this.platform); this.isServer = isPlatformServer(this.platform);
} }
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
if (user) {
this.isLoggedIn = true;
} else {
this.isLoggedIn = false;
}
}, error => {
this.isLoggedIn = false;
}));
if(properties.adminToolsPortalType !== "explore") { if(properties.adminToolsPortalType !== "explore") {
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();

View File

@ -26,6 +26,8 @@ export class SearchResultComponent implements OnInit, OnChanges {
@Input() showEnermaps: boolean; @Input() showEnermaps: boolean;
@Input() compactView: boolean = false; // if true, show less info (e.g. hide description) on each result @Input() compactView: boolean = false; // if true, show less info (e.g. hide description) on each result
@Input() isLoggedIn: boolean = false;
public isMobile: boolean = false; public isMobile: boolean = false;
private subscriptions: any[] = []; private subscriptions: any[] = [];
@ -60,25 +62,30 @@ export class SearchResultComponent implements OnInit, OnChanges {
} }
if ((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator" || properties.dashboard == "irish") if ((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator" || properties.dashboard == "irish")
&& Session.isLoggedIn() && this.results && this.results.length > 0 && this.isLoggedIn && this.results && this.results.length > 0
&& (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other") && (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other")
) { ) {
this.subscriptions.push(this.orcidService.getPutCodes(this.previewResults.map( this.subscriptions.push(this.orcidService.getPutCodes(
this.previewResults.map(previewResult => {return previewResult.relcanId}),
this.previewResults.map(
previewResult => { previewResult => {
if (previewResult.identifiers) { if (previewResult.identifiers) {
let pidsArray: string[] = []; let pidsArray: string[] = null;
if(previewResult.identifiers?.size > 0) {
pidsArray = [];
for (let key of Array.from(previewResult.identifiers.keys())) { for (let key of Array.from(previewResult.identifiers.keys())) {
pidsArray = pidsArray.concat(previewResult.identifiers.get(key)); pidsArray = pidsArray.concat(previewResult.identifiers.get(key));
} }
}
return pidsArray;//.join(); return pidsArray;//.join();
} }
})).subscribe( })).subscribe(
putCodes => { putCodes => {
for (let i = 0; i < this.previewResults.length; i++) { for (let i = 0; i < this.previewResults.length; i++) {
if (this.previewResults[i].identifiers) { //if (this.previewResults[i].identifiers) {
this.previewResults[i].orcidPutCodes = putCodes[i]; this.previewResults[i].orcidPutCodes = putCodes[i];
// console.debug(i, this.previewResults[i].orcidPutCodes); // console.debug(i, this.previewResults[i].orcidPutCodes);
} //}
} }
this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver);
}, error => { }, error => {

View File

@ -220,7 +220,7 @@
<a *ngIf="(menu.route.length == 0 && menu.url.length == 0) || ( menu.route.length >0 && menu.routeRequired && !isEnabled([menu.route], showPage) && isAtleastOneEnabled(menu.routeRequired, showPage))"> <a *ngIf="(menu.route.length == 0 && menu.url.length == 0) || ( menu.route.length >0 && menu.routeRequired && !isEnabled([menu.route], showPage) && isAtleastOneEnabled(menu.routeRequired, showPage))">
<span *ngIf="menu.badge" class="badge">{{menu.badge}}</span> <span *ngIf="menu.badge" class="badge">{{menu.badge}}</span>
{{menu.title}}</a> {{menu.title}}</a>
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left uk-height-max-medium uk-overflow-auto"> <div *ngIf="menu.items.length > 0 && isClient" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left uk-height-max-medium uk-overflow-auto">
<!-- Do not delete this div, because it will remove the margin bottom of navbar --> <!-- Do not delete this div, because it will remove the margin bottom of navbar -->
<div> <div>
<ul class="uk-nav uk-navbar-dropdown-nav"> <ul class="uk-nav uk-navbar-dropdown-nav">
@ -272,7 +272,7 @@
<a *ngIf="menu.type == 'noAction'"> <a *ngIf="menu.type == 'noAction'">
{{menu.title}} {{menu.title}}
</a> </a>
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left uk-height-max-medium uk-overflow-auto" <div *ngIf="menu.items.length > 0 && isClient" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left uk-height-max-medium uk-overflow-auto"
style="top: 80px; left: 0px;" id="{{menu._id}}" uk-toggle> style="top: 80px; left: 0px;" id="{{menu._id}}" uk-toggle>
<div> <div>
<ul class="uk-nav uk-navbar-dropdown-nav"> <ul class="uk-nav uk-navbar-dropdown-nav">

View File

@ -1,10 +1,10 @@
import { import {
ChangeDetectorRef, ChangeDetectorRef,
Component, ElementRef, Component, ElementRef, Inject,
Input, Input,
OnChanges, OnChanges,
OnDestroy, OnDestroy,
OnInit, QueryList, OnInit, PLATFORM_ID,
SimpleChanges, ViewChild, SimpleChanges, ViewChild,
ViewChildren ViewChildren
} from '@angular/core'; } from '@angular/core';
@ -21,6 +21,7 @@ import {NotificationConfiguration} from "../notifications/notifications-sidebar/
import {SearchInputComponent} from "./search-input/search-input.component"; import {SearchInputComponent} from "./search-input/search-input.component";
import {Filter} from "../searchPages/searchUtils/searchHelperClasses.class"; import {Filter} from "../searchPages/searchUtils/searchHelperClasses.class";
import {RouterHelper} from "../utils/routerHelper.class"; import {RouterHelper} from "../utils/routerHelper.class";
import {isPlatformServer} from "@angular/common";
declare var UIkit; declare var UIkit;
@ -97,12 +98,16 @@ export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges {
@ViewChild('canvas') canvas: ElementRef; @ViewChild('canvas') canvas: ElementRef;
public routerHelper: RouterHelper = new RouterHelper(); public routerHelper: RouterHelper = new RouterHelper();
public isClient: boolean = false;
constructor(private router: Router, constructor(private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private config: ConfigurationService, private config: ConfigurationService,
private _helpContentService: HelpContentService, private _helpContentService: HelpContentService,
private layoutService: LayoutService, private layoutService: LayoutService,
private cdr: ChangeDetectorRef) {} private cdr: ChangeDetectorRef,
@Inject(PLATFORM_ID) private platform: any) {
this.isClient = !isPlatformServer(this.platform);
}
ngOnInit() { ngOnInit() {
this.subs.push(this.route.queryParams.subscribe(params => { this.subs.push(this.route.queryParams.subscribe(params => {

View File

@ -3,7 +3,7 @@ import {ActivatedRoute} from "@angular/router";
@Component({ @Component({
selector: 'slider-tab', selector: 'slider-tab',
template: `` template: `<ng-content />`
}) })
export class SliderTabComponent { export class SliderTabComponent {
@Input("tabTitle") @Input("tabTitle")

View File

@ -21,6 +21,7 @@ declare var UIkit;
@Component({ @Component({
selector: 'slider-tabs', selector: 'slider-tabs',
template: ` template: `
<ng-content />
<div #sliderElement class="uk-position-relative" [class.uk-slider]="position === 'horizontal'" <div #sliderElement class="uk-position-relative" [class.uk-slider]="position === 'horizontal'"
[ngClass]="customClass"> [ngClass]="customClass">
<div [class.uk-slider-container-tabs]="position === 'horizontal'" [class.uk-border-bottom]="border && position === 'horizontal'" [ngClass]="containerClass"> <div [class.uk-slider-container-tabs]="position === 'horizontal'" [class.uk-border-bottom]="border && position === 'horizontal'" [ngClass]="containerClass">

View File

@ -193,7 +193,7 @@
[url]="properties.domain + properties.baseLink + url + '?' + urlParam + '=' + result.id" [url]="properties.domain + properties.baseLink + url + '?' + urlParam + '=' + result.id"
[showTooltip]="false" [compactView]="compactView"> [showTooltip]="false" [compactView]="compactView">
<span *ngIf="orcid"> <span *ngIf="orcid">
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0" <orcid-work *ngIf="showOrcid"
[resultId]="result.relcanId" [resultTitle]="result.title" [resultId]="result.relcanId" [resultTitle]="result.title"
[type]="result.resultType" [pageType]="'search'" [type]="result.resultType" [pageType]="'search'"
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers" [putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers"
@ -339,7 +339,7 @@
[isMobile]="isMobile" [isMobile]="isMobile"
[showTooltip]="false"> [showTooltip]="false">
<span *ngIf="orcid"> <span *ngIf="orcid">
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0" <orcid-work *ngIf="showOrcid"
[resultId]="result.relcanId" [resultTitle]="result.title" [resultId]="result.relcanId" [resultTitle]="result.title"
[type]="result.resultType" [pageType]="'search'" [type]="result.resultType" [pageType]="'search'"
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers" [putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers"

View File

@ -129,7 +129,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
this.share = true; this.share = true;
this.cite = true; this.cite = true;
this.orcid = (this.properties.adminToolsPortalType == 'explore' || this.properties.adminToolsPortalType == 'community' || this.properties.adminToolsPortalType == 'aggregator' || this.properties.dashboard == 'irish') && this.orcid = (this.properties.adminToolsPortalType == 'explore' || this.properties.adminToolsPortalType == 'community' || this.properties.adminToolsPortalType == 'aggregator' || this.properties.dashboard == 'irish') &&
this.showOrcid && this.result.identifiers && this.result.identifiers.size > 0; this.showOrcid;
} }
projectActions() { projectActions() {