diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html index 9947d775a2..ae36b27c87 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html @@ -30,7 +30,7 @@ } @if (canImpersonate$ | async) { -
+
@if (!isImpersonated) { - @if ((hasMissingOrcidAuthorizations() | async)) { + @if ((hasMissingOrcidAuthorizations$ | async)) {
- - -
-
- @if ((hasOrcidAuthorizations() | async)) { -
-
-
{{ 'person.page.orcid.granted-authorizations'| translate }}
-
-
-
    - @for (auth of (getOrcidAuthorizations() | async); track auth) { -
  • - {{getAuthorizationDescription(auth) | translate}} -
  • - } -
-
-
-
-
- } -
-
-
{{ 'person.page.orcid.missing-authorizations'| translate }}
-
-
- @if ((hasMissingOrcidAuthorizations() | async) !== true) { - - {{'person.page.orcid.no-missing-authorizations-message' | translate}} - - } - @if ((hasMissingOrcidAuthorizations() | async)) { - - {{'person.page.orcid.missing-authorizations-message' | translate}} -
    - @for (auth of (getMissingOrcidAuthorizations() | async); track auth) { -
  • - {{getAuthorizationDescription(auth) | translate }} -
  • - } -
-
- } -
-
-
-
-
- @if ((onlyAdminCanDisconnectProfileFromOrcid() | async) && (ownerCanDisconnectProfileFromOrcid() | async) !== true) { - - {{ 'person.page.orcid.remove-orcid-message' | translate}} - - } - @if ((ownerCanDisconnectProfileFromOrcid() | async)) { -
-
- - @if ((hasMissingOrcidAuthorizations() | async)) { - - } -
-
- } -
-
- - -
-
-
orcid-logo
-
- {{ getOrcidNotLinkedMessage() | async }} -
-
-
-
- -
-
-
-
- diff --git a/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.ts b/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.ts index 2d39ee25a8..f4ed87f2c6 100644 --- a/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.ts +++ b/src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.ts @@ -30,6 +30,7 @@ import { import { Item } from '../../../core/shared/item.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { AlertComponent } from '../../../shared/alert/alert.component'; +import { AlertType } from '../../../shared/alert/alert-type'; import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { createFailedRemoteDataObjectFromError$ } from '../../../shared/remote-data.utils'; @@ -56,43 +57,49 @@ export class OrcidAuthComponent implements OnInit, OnChanges { /** * The list of exposed orcid authorization scopes for the orcid profile */ - profileAuthorizationScopes: BehaviorSubject = new BehaviorSubject([]); + profileAuthorizationScopes$: BehaviorSubject = new BehaviorSubject([]); + + hasOrcidAuthorizations$: Observable; /** * The list of all orcid authorization scopes missing in the orcid profile */ - missingAuthorizationScopes: BehaviorSubject = new BehaviorSubject([]); + missingAuthorizationScopes: BehaviorSubject = new BehaviorSubject([]); + + hasMissingOrcidAuthorizations$: Observable; /** * The list of all orcid authorization scopes available */ - orcidAuthorizationScopes: BehaviorSubject = new BehaviorSubject([]); + orcidAuthorizationScopes: BehaviorSubject = new BehaviorSubject([]); /** * A boolean representing if unlink operation is processing */ - unlinkProcessing: BehaviorSubject = new BehaviorSubject(false); + unlinkProcessing: BehaviorSubject = new BehaviorSubject(false); /** * A boolean representing if orcid profile is linked */ - private isOrcidLinked$: BehaviorSubject = new BehaviorSubject(false); + isOrcidLinked$: BehaviorSubject = new BehaviorSubject(false); /** * A boolean representing if only admin can disconnect orcid profile */ - private onlyAdminCanDisconnectProfileFromOrcid$: BehaviorSubject = new BehaviorSubject(false); + onlyAdminCanDisconnectProfileFromOrcid$: BehaviorSubject = new BehaviorSubject(false); /** * A boolean representing if owner can disconnect orcid profile */ - private ownerCanDisconnectProfileFromOrcid$: BehaviorSubject = new BehaviorSubject(false); + ownerCanDisconnectProfileFromOrcid$: BehaviorSubject = new BehaviorSubject(false); /** * An event emitted when orcid profile is unliked successfully */ @Output() unlink: EventEmitter = new EventEmitter(); + readonly AlertType = AlertType; + constructor( private orcidAuthService: OrcidAuthService, private translateService: TranslateService, @@ -106,6 +113,8 @@ export class OrcidAuthComponent implements OnInit, OnChanges { this.orcidAuthorizationScopes.next(scopes); this.initOrcidAuthSettings(); }); + this.hasOrcidAuthorizations$ = this.hasOrcidAuthorizations(); + this.hasMissingOrcidAuthorizations$ = this.hasMissingOrcidAuthorizations(); } ngOnChanges(changes: SimpleChanges): void { @@ -118,18 +127,11 @@ export class OrcidAuthComponent implements OnInit, OnChanges { * Check if the list of exposed orcid authorization scopes for the orcid profile has values */ hasOrcidAuthorizations(): Observable { - return this.profileAuthorizationScopes.asObservable().pipe( + return this.profileAuthorizationScopes$.pipe( map((scopes: string[]) => scopes.length > 0), ); } - /** - * Return the list of exposed orcid authorization scopes for the orcid profile - */ - getOrcidAuthorizations(): Observable { - return this.profileAuthorizationScopes.asObservable(); - } - /** * Check if the list of exposed orcid authorization scopes for the orcid profile has values */ @@ -139,26 +141,12 @@ export class OrcidAuthComponent implements OnInit, OnChanges { ); } - /** - * Return the list of exposed orcid authorization scopes for the orcid profile - */ - getMissingOrcidAuthorizations(): Observable { - return this.profileAuthorizationScopes.asObservable(); - } - - /** - * Return a boolean representing if orcid profile is linked - */ - isLinkedToOrcid(): Observable { - return this.isOrcidLinked$.asObservable(); - } - - getOrcidNotLinkedMessage(): Observable { + getOrcidNotLinkedMessage(): string { const orcid = this.item.firstMetadataValue('person.identifier.orcid'); if (orcid) { - return this.translateService.get('person.page.orcid.orcid-not-linked-message', { 'orcid': orcid }); + return this.translateService.instant('person.page.orcid.orcid-not-linked-message', { 'orcid': orcid }); } else { - return this.translateService.get('person.page.orcid.no-orcid-message'); + return this.translateService.instant('person.page.orcid.no-orcid-message'); } } @@ -171,13 +159,6 @@ export class OrcidAuthComponent implements OnInit, OnChanges { return 'person.page.orcid.scope.' + scope.substring(1).replace('/', '-'); } - /** - * Return a boolean representing if only admin can disconnect orcid profile - */ - onlyAdminCanDisconnectProfileFromOrcid(): Observable { - return this.onlyAdminCanDisconnectProfileFromOrcid$.asObservable(); - } - /** * Return a boolean representing if owner can disconnect orcid profile */ @@ -243,7 +224,7 @@ export class OrcidAuthComponent implements OnInit, OnChanges { } private setOrcidAuthorizationsFromItem(): void { - this.profileAuthorizationScopes.next(this.orcidAuthService.getOrcidAuthorizationScopesByItem(this.item)); + this.profileAuthorizationScopes$.next(this.orcidAuthService.getOrcidAuthorizationScopesByItem(this.item)); } } diff --git a/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.html b/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.html index 014f995ae0..b86ddb4461 100644 --- a/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.html +++ b/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.html @@ -5,16 +5,16 @@

{{ 'person.orcid.registry.queue' | translate }}

- @if ((processing$ | async) !== true && (getList() | async)?.payload?.totalElements === 0) { + @if ((processing$ | async) !== true && (list$ | async)?.payload?.totalElements === 0) { {{ 'person.page.orcid.sync-queue.empty-message' | translate}} } - @if ((processing$ | async) !== true && (getList() | async)?.payload?.totalElements > 0) { + @if ((processing$ | async) !== true && (list$ | async)?.payload?.totalElements > 0) {
@@ -26,7 +26,7 @@ - @for (entry of (getList() | async)?.payload?.page; track entry) { + @for (entry of (list$ | async)?.payload?.page; track entry) { - @for (entry of (getList() | async)?.payload?.page; track entry) { - - - + @for (entry of list.page; track entry) { + + +
>> = new BehaviorSubject>>({} as any); + list$: BehaviorSubject>> = new BehaviorSubject>>({} as any); /** * The AlertType enumeration - * @type {AlertType} */ - AlertTypeEnum = AlertType; + readonly AlertTypeEnum = AlertType; /** * Array to track all subscriptions and unsubscribe them onDestroy @@ -132,13 +131,6 @@ export class OrcidQueueComponent implements OnInit, OnDestroy, OnChanges { ); } - /** - * Return the list of orcid queue records - */ - getList(): Observable>> { - return this.list$.asObservable(); - } - /** * Return the icon class for the queue object type * diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html index 479f206f90..f7d48dc050 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/navbar/navbar.component.html @@ -1,5 +1,5 @@
{{entry.id}}{{dsoNameService.getName(entry)}}
{{ entry.id }}{{ dsoNameService.getName(entry) }} @@ -15,7 +15,7 @@
+ [ngClass]="{'w-100': (isXs$ | async)}"> @if ((hasSections$ | async) !== true) {