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)); } } diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 0f260db2..c5483431 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -57,7 +57,7 @@ export class SearchDataProvidersComponent { @Input() set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) { if(!Array.isArray(customFilter)) { - this.customFilters = [customFilter]; + this.customFilters = customFilter?[customFilter]:null; }else{ this.customFilters = customFilter; } diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts index 6ea539d4..50deb4a2 100644 --- a/searchPages/searchOrganizations.component.ts +++ b/searchPages/searchOrganizations.component.ts @@ -66,7 +66,7 @@ export class SearchOrganizationsComponent { @Input() set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) { if(!Array.isArray(customFilter)) { - this.customFilters = [customFilter]; + this.customFilters = customFilter?[customFilter]:null; }else{ this.customFilters = customFilter; } diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index 0b394601..5e4e36c5 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -50,7 +50,7 @@ export class SearchProjectsComponent { @Input() set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) { if(!Array.isArray(customFilter)) { - this.customFilters = [customFilter]; + this.customFilters = customFilter?[customFilter]:null; }else{ this.customFilters = customFilter; } diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index 7b4e5f28..176ae26c 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -87,7 +87,7 @@ export class SearchResearchResultsComponent { @Input() set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) { if(!Array.isArray(customFilter)) { - this.customFilters = [customFilter]; + this.customFilters = customFilter?[customFilter]:null; }else{ this.customFilters = customFilter; } diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index e52de3b5..51dc82fa 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -228,7 +228,8 @@ -
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 01bb1acf..5f62d7d6 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -73,7 +73,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { @Input() set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) { if(!Array.isArray(customFilter)) { - this.customFilters = [customFilter]; + this.customFilters = customFilter?[customFilter]:null; }else{ this.customFilters = customFilter; } @@ -234,14 +234,14 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { } private getPageContents() { - this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilters[0] && this.customFilters[0].queryFieldName == "communityId") ? this.customFilters[0].valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => { + this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilters && this.customFilters[0] && this.customFilters[0].queryFieldName == "communityId") ? this.customFilters[0].valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => { this.pageContents = contents; })); } private getDivContents() { - this.subscriptions.push(this.helper.getDivHelpContents(this.properties, (this.customFilters[0] && this.customFilters[0].queryFieldName == "communityId") ? this.customFilters[0].valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => { + this.subscriptions.push(this.helper.getDivHelpContents(this.properties, (this.customFilters && this.customFilters[0] && this.customFilters[0].queryFieldName == "communityId") ? this.customFilters[0].valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => { this.divContents = contents; })); } diff --git a/searchPages/searchUtils/portal-search-result.component.ts b/searchPages/searchUtils/portal-search-result.component.ts index cbf85974..7b44fbe7 100644 --- a/searchPages/searchUtils/portal-search-result.component.ts +++ b/searchPages/searchUtils/portal-search-result.component.ts @@ -60,7 +60,7 @@ export class PortalSearchResultComponent implements OnInit{ hasPermission(result: CommunityInfo & StakeholderInfo) { if(this.type === "community") { - return result.status === "all" || (result.status === "manager" && result.isManager); + return result.isPublic() || (result.isRestricted() && result.isManager); } else if(this.type === "stakeholder") { return result.visibility === "PUBLIC" || (result.visibility === "RESTRICTED" && (result.isManager || result.isMember)) || (result.visibility === "PRIVATE" && result.isManager);