diff --git a/src/app/item-page/orcid-page/orcid-page.component.html b/src/app/item-page/orcid-page/orcid-page.component.html
index 3bb4a0737c..7fb1ae3a71 100644
--- a/src/app/item-page/orcid-page/orcid-page.component.html
+++ b/src/app/item-page/orcid-page/orcid-page.component.html
@@ -10,4 +10,4 @@
-
+
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 d21575e31c..23e59b6f5d 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
@@ -1,60 +1,55 @@
-
-
-
-
-
-
+
+
+
+
{{ 'person.orcid.registry.queue' | translate }}
-
- {{ 'person.page.orcid.sync-queue.empty-message' | translate}}
-
-
0"
- [paginationOptions]="paginationOptions"
- [collectionSize]="(getList() | async)?.payload?.totalElements"
- [retainScrollPosition]="false" [hideGear]="true" (paginationChange)="updateList()">
+
+ {{ 'person.page.orcid.sync-queue.empty-message' | translate}}
+
+ 0"
+ [paginationOptions]="paginationOptions"
+ [collectionSize]="(getList() | async)?.payload?.totalElements"
+ [retainScrollPosition]="false" [hideGear]="true" (paginationChange)="updateList()">
-
-
-
-
- {{'person.page.orcid.sync-queue.table.header.type' | translate}} |
- {{'person.page.orcid.sync-queue.table.header.description' | translate}} |
- {{'person.page.orcid.sync-queue.table.header.action' | translate}} |
-
-
-
-
-
-
- |
-
- {{ entry.description }}
- |
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{'person.page.orcid.sync-queue.table.header.type' | translate}} |
+ {{'person.page.orcid.sync-queue.table.header.description' | translate}} |
+ {{'person.page.orcid.sync-queue.table.header.action' | translate}} |
+
+
+
+
+
+
+ |
+
+ {{ entry.description }}
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+
+
diff --git a/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.spec.ts b/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.spec.ts
index f85feb853d..2c4dcf46c3 100644
--- a/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.spec.ts
+++ b/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.spec.ts
@@ -10,13 +10,12 @@ import { PaginationServiceStub } from '../../../shared/testing/pagination-servic
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
import { OrcidHistoryService } from '../../../core/orcid/orcid-history.service';
-import { ActivatedRoute, Params } from '@angular/router';
-import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
import { OrcidQueue } from '../../../core/orcid/model/orcid-queue.model';
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
import { createPaginatedList } from '../../../shared/testing/utils.test';
import { PaginatedList } from '../../../core/data/paginated-list.model';
import { By } from '@angular/platform-browser';
+import { Item } from '../../../core/shared/item.model';
fdescribe('OrcidQueueComponent test suite', () => {
@@ -27,9 +26,63 @@ fdescribe('OrcidQueueComponent test suite', () => {
const testOwnerId = 'test-owner-id';
- const routeParams: Params = {'id': testOwnerId};
-
- const activatedRouteStub = new ActivatedRouteStub(routeParams);
+ const mockItemLinkedToOrcid: Item = Object.assign(new Item(), {
+ bundles: createSuccessfulRemoteDataObject$(createPaginatedList([])),
+ metadata: {
+ 'dc.title': [{
+ value: 'test person'
+ }],
+ 'dspace.entity.type': [{
+ 'value': 'Person'
+ }],
+ 'dspace.object.owner': [{
+ 'value': 'test person',
+ 'language': null,
+ 'authority': 'deced3e7-68e2-495d-bf98-7c44fc33b8ff',
+ 'confidence': 600,
+ 'place': 0
+ }],
+ 'dspace.orcid.authenticated': [{
+ 'value': '2022-06-10T15:15:12.952872',
+ 'language': null,
+ 'authority': null,
+ 'confidence': -1,
+ 'place': 0
+ }],
+ 'dspace.orcid.scope': [{
+ 'value': '/authenticate',
+ 'language': null,
+ 'authority': null,
+ 'confidence': -1,
+ 'place': 0
+ }, {
+ 'value': '/read-limited',
+ 'language': null,
+ 'authority': null,
+ 'confidence': -1,
+ 'place': 1
+ }, {
+ 'value': '/activities/update',
+ 'language': null,
+ 'authority': null,
+ 'confidence': -1,
+ 'place': 2
+ }, {
+ 'value': '/person/update',
+ 'language': null,
+ 'authority': null,
+ 'confidence': -1,
+ 'place': 3
+ }],
+ 'person.identifier.orcid': [{
+ 'value': 'orcid-id',
+ 'language': null,
+ 'authority': null,
+ 'confidence': -1,
+ 'place': 0
+ }]
+ }
+ });
function orcidQueueElement(id: number) {
return Object.assign(new OrcidQueue(), {
@@ -45,14 +98,8 @@ fdescribe('OrcidQueueComponent test suite', () => {
const orcidQueueElements = [orcidQueueElement(1), orcidQueueElement(2)];
- const orcidQueueServiceMock = {
- searchByOwnerId(id) {
- return createSuccessfulRemoteDataObject$>(createPaginatedList(orcidQueueElements));
- },
- clearFindByOwnerRequests() {
- return null;
- }
- };
+ const orcidQueueServiceSpy = jasmine.createSpyObj('orcidQueueService', ['searchByOwnerId', 'clearFindByOwnerRequests']);
+ orcidQueueServiceSpy.searchByOwnerId.and.returnValue(createSuccessfulRemoteDataObject$>(createPaginatedList(orcidQueueElements)));
beforeEach(waitForAsync(() => {
void TestBed.configureTestingModule({
@@ -67,11 +114,10 @@ fdescribe('OrcidQueueComponent test suite', () => {
],
declarations: [OrcidQueueComponent],
providers: [
- { provide: OrcidQueueService, useValue: orcidQueueServiceMock },
+ { provide: OrcidQueueService, useValue: orcidQueueServiceSpy },
{ provide: OrcidHistoryService, useValue: {} },
{ provide: PaginationService, useValue: new PaginationServiceStub() },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
- { provide: ActivatedRoute, useValue: activatedRouteStub },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
@@ -82,6 +128,7 @@ fdescribe('OrcidQueueComponent test suite', () => {
beforeEach(() => {
fixture = TestBed.createComponent(OrcidQueueComponent);
component = fixture.componentInstance;
+ component.item = mockItemLinkedToOrcid;
debugElement = fixture.debugElement;
fixture.detectChanges();
});
@@ -90,9 +137,9 @@ fdescribe('OrcidQueueComponent test suite', () => {
expect(component).toBeTruthy();
});
- it('should ...', () => {
- const table = debugElement.queryAll(By.css('table'));
- expect(table.length).toBe(1);
+ it('should show the ORCID queue elements', () => {
+ const table = debugElement.queryAll(By.css('[data-test="orcidQueueElementRow"]'));
+ expect(table.length).toBe(2);
});
});
diff --git a/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.ts b/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.ts
index 0dd2f8517c..7faa4f54cb 100644
--- a/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.ts
+++ b/src/app/item-page/orcid-page/orcid-queue/orcid-queue.component.ts
@@ -1,5 +1,4 @@
-import { Component, OnDestroy, OnInit } from '@angular/core';
-import { ActivatedRoute } from '@angular/router';
+import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs';
import { switchMap, tap } from 'rxjs/operators';
@@ -15,6 +14,7 @@ import { hasValue } from '../../../shared/empty.util';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { AlertType } from '../../../shared/alert/aletr-type';
+import { Item } from '../../../core/shared/item.model';
@Component({
selector: 'ds-orcid-queue',
@@ -22,6 +22,12 @@ import { AlertType } from '../../../shared/alert/aletr-type';
styleUrls: ['./orcid-queue.component.scss']
})
export class OrcidQueueComponent implements OnInit, OnDestroy {
+
+ /**
+ * The item for which showing the orcid settings
+ */
+ @Input() item: Item;
+
/**
* Pagination config used to display the list
*/
@@ -54,7 +60,6 @@ export class OrcidQueueComponent implements OnInit, OnDestroy {
constructor(private orcidQueueService: OrcidQueueService,
protected translateService: TranslateService,
private paginationService: PaginationService,
- private route: ActivatedRoute,
private notificationsService: NotificationsService,
private orcidHistoryService: OrcidHistoryService,
) { }
@@ -67,7 +72,7 @@ export class OrcidQueueComponent implements OnInit, OnDestroy {
this.subs.push(
this.paginationService.getCurrentPagination(this.paginationOptions.id, this.paginationOptions).pipe(
tap(() => this.processing$.next(true)),
- switchMap((config: PaginationComponentOptions) => this.orcidQueueService.searchByOwnerId(this.route.snapshot.paramMap.get('id'), config)),
+ switchMap((config: PaginationComponentOptions) => this.orcidQueueService.searchByOwnerId(this.item.id, config)),
getFirstCompletedRemoteData()
).subscribe((result: RemoteData>) => {
this.processing$.next(false);
@@ -236,7 +241,7 @@ export class OrcidQueueComponent implements OnInit, OnDestroy {
}
private getUnauthorizedErrorContent(): Observable {
- return this.orcidQueueService.getOrcidAuthorizeUrl(this.route.snapshot.paramMap.get('id')).pipe(
+ return this.orcidQueueService.getOrcidAuthorizeUrl(this.item.id).pipe(
switchMap((authorizeUrl) => this.translateService.get('person.page.orcid.sync-queue.send.unauthorized-error.content', { orcid : authorizeUrl}))
);
}