From 56faf6f6a4744b59775e3b4f510ffe33c957968a Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 13 Feb 2024 17:33:26 +0200 Subject: [PATCH] [develop | DONE | FIXED]: orcid-work.component.ts: [Bug fix] Show tooltip when button is disabled & When in beta environment, do not call query to get put codes, always disable buttons and show tooltip about not available feature on beta. --- orcid/orcid-work.component.ts | 188 +++++++++++++--------------------- 1 file changed, 72 insertions(+), 116 deletions(-) diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 4d653b7f..6153d146 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -22,88 +22,54 @@ declare var UIkit: any; template: ` - - - - Claim - -
+ [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'" + [title]="(noPids || !isLoggedIn) ? ((noPids) ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd"> + + + + + Claim + +
+
- - - - - Remove - -
+ [title]="(noPids || !isLoggedIn) ? ((noPids) ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete"> + + + + + Remove + +
+
- - -
{{requestGrantMessage}}
- - - - - - - - - - - - - - - - - -
@@ -292,18 +258,6 @@ declare var UIkit: any; instead. - - - - - - - - - - - - @@ -369,9 +323,6 @@ export class OrcidWorkComponent { public hasConsent: boolean = false; public currentAction: string = ""; - public hoverAdd: boolean = false; - public hoverDelete: boolean = false; - public properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; @@ -391,24 +342,26 @@ export class OrcidWorkComponent { } ngOnInit() { - this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { - if (user) { - this.isLoggedIn = true; - if (!this.givenPutCode) { - this.getPutCode(); + if(this.properties.environment != 'beta') { + this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { + if (user) { + this.isLoggedIn = true; + if (!this.givenPutCode) { + this.getPutCode(); + } + } else { + this.isLoggedIn = false; } - } else { + }, error => { this.isLoggedIn = false; + })); + if (properties.dashboard == 'irish') { + this.subscriptions.push(this._userProfileService.getUserProfile().subscribe(userProfile => { + this.hasConsent = userProfile.consent; + }, error => { + this.hasConsent = false; + })); } - }, error => { - this.isLoggedIn = false; - })); - if(properties.dashboard == 'irish'){ - this.subscriptions.push(this._userProfileService.getUserProfile().subscribe(userProfile => { - this.hasConsent = userProfile.consent; - }, error =>{ - this.hasConsent = false; - })); } } @@ -894,13 +847,18 @@ export class OrcidWorkComponent { } this.showLoading = false; } - + + get tooltipBETA() { + // return "Login to the production environment to add works to your ORCID record"; + return "Add or delete a work from your ORCID record. This feature is not available on BETA."; + } + get tooltipAdd() { - return "Add this work to your ORCID record" + ((properties.environment == "beta") ? ". The action will affect your real ORCID iD." : ""); + return (properties.environment == "beta") ? this.tooltipBETA : ("Add this work to your ORCID record" + ((properties.environment == "test") ? ". The action will affect your real ORCID iD." : "")); } get tooltipDelete() { - return "Delete this work from your ORCID record" + ((properties.environment == "beta") ? ". The action will affect your real ORCID iD." : ""); + return "Delete this work from your ORCID record" + ((properties.environment == "test") ? ". The action will affect your real ORCID iD." : ""); } get tooltipNoPid() { @@ -908,16 +866,14 @@ export class OrcidWorkComponent { } get tooltipNoLoggedInUser() { - return "Add or delete a work from your ORCID record. Please log in first." + return (properties.environment == "beta") ? this.tooltipBETA : "Add or delete a work from your ORCID record. Please log in first." } - - hoverEvent($event, action: string = "add") { - if (action == "add") { - this.hoverAdd = $event.type == "mouseover"; - this.hoverDelete = false; - } else if (action == "delete") { - this.hoverDelete = $event.type == "mouseover"; - this.hoverAdd = false; - } + + get isDisabled() { + return (this.properties.environment == 'beta' || this.showLoading || !this.isLoggedIn || (!this.pids && (!this.identifiers || this.identifiers.size == 0))); + } + + get noPids() { + return (!this.pids && (!this.identifiers || this.identifiers.size == 0)); } }