[CST-5339] Various improvements

This commit is contained in:
Luca Giamminonni
2022-06-20 15:27:32 +02:00
parent c62f72789d
commit ac677d52d7
6 changed files with 21 additions and 19 deletions

View File

@@ -34,10 +34,10 @@ export class OrcidHistory extends CacheableObject {
entityName: string;
/**
* The identifier of the owner of this Orcid History record.
* The identifier of the profileItem of this Orcid History record.
*/
@autoserialize
ownerId: string;
profileItemId: string;
/**
* The identifier of the entity related to this Orcid History record.

View File

@@ -34,10 +34,10 @@ export class OrcidQueue extends CacheableObject {
description: string;
/**
* The identifier of the owner of this Orcid Queue record.
* The identifier of the profileItem of this Orcid Queue record.
*/
@autoserialize
ownerId: string;
profileItemId: string;
/**
* The identifier of the entity related to this Orcid Queue record.

View File

@@ -73,7 +73,7 @@ export class OrcidQueueService {
}
/**
* @param itemId It represent an Id of owner
* @param itemId It represent an Id of profileItem
* @param paginationOptions The pagination options object
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* no valid cached version. Defaults to true
@@ -81,9 +81,9 @@ export class OrcidQueueService {
* requested after the response becomes stale
* @returns { OrcidQueue }
*/
searchByOwnerId(itemId: string, paginationOptions: PaginationComponentOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true): Observable<RemoteData<PaginatedList<OrcidQueue>>> {
return this.dataService.searchBy('findByOwner', {
searchParams: [new RequestParam('ownerId', itemId)],
searchByProfileItemId(itemId: string, paginationOptions: PaginationComponentOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true): Observable<RemoteData<PaginatedList<OrcidQueue>>> {
return this.dataService.searchBy('findByProfileItem', {
searchParams: [new RequestParam('profileItemId', itemId)],
elementsPerPage: paginationOptions.pageSize,
currentPage: paginationOptions.currentPage
},
@@ -103,8 +103,8 @@ export class OrcidQueueService {
/**
* This method will set linkPath to stale
*/
clearFindByOwnerRequests() {
this.requestService.setStaleByHrefSubstring(this.dataService.linkPath + '/search/findByOwner');
clearFindByProfileItemRequests() {
this.requestService.setStaleByHrefSubstring(this.dataService.linkPath + '/search/findByProfileItem');
}
}

View File

@@ -25,7 +25,7 @@ describe('OrcidQueueComponent test suite', () => {
let orcidQueueService: OrcidQueueService;
let orcidAuthService: jasmine.SpyObj<OrcidAuthService>;
const testOwnerId = 'test-owner-id';
const testProfileItemId = 'test-owner-id';
const mockItemLinkedToOrcid: Item = Object.assign(new Item(), {
bundles: createSuccessfulRemoteDataObject$(createPaginatedList([])),
@@ -88,7 +88,7 @@ describe('OrcidQueueComponent test suite', () => {
function orcidQueueElement(id: number) {
return Object.assign(new OrcidQueue(), {
'id': id,
'ownerId': testOwnerId,
'profileItemId': testProfileItemId,
'entityId': `test-entity-${id}`,
'description': `test description ${id}`,
'recordType': 'Publication',
@@ -99,8 +99,8 @@ describe('OrcidQueueComponent test suite', () => {
const orcidQueueElements = [orcidQueueElement(1), orcidQueueElement(2)];
const orcidQueueServiceSpy = jasmine.createSpyObj('orcidQueueService', ['searchByOwnerId', 'clearFindByOwnerRequests']);
orcidQueueServiceSpy.searchByOwnerId.and.returnValue(createSuccessfulRemoteDataObject$<PaginatedList<OrcidQueue>>(createPaginatedList<OrcidQueue>(orcidQueueElements)));
const orcidQueueServiceSpy = jasmine.createSpyObj('orcidQueueService', ['searchByProfileItemId', 'clearFindByProfileItemRequests']);
orcidQueueServiceSpy.searchByProfileItemId.and.returnValue(createSuccessfulRemoteDataObject$<PaginatedList<OrcidQueue>>(createPaginatedList<OrcidQueue>(orcidQueueElements)));
beforeEach(waitForAsync(() => {
orcidAuthService = jasmine.createSpyObj('OrcidAuthService', {

View File

@@ -89,12 +89,12 @@ export class OrcidQueueComponent implements OnInit, OnDestroy {
debounceTime(100),
distinctUntilChanged(),
tap(() => this.processing$.next(true)),
switchMap((config: PaginationComponentOptions) => this.orcidQueueService.searchByOwnerId(this.item.id, config, false)),
switchMap((config: PaginationComponentOptions) => this.orcidQueueService.searchByProfileItemId(this.item.id, config, false)),
getFirstCompletedRemoteData()
).subscribe((result: RemoteData<PaginatedList<OrcidQueue>>) => {
this.processing$.next(false);
this.list$.next(result);
this.orcidQueueService.clearFindByOwnerRequests();
this.orcidQueueService.clearFindByProfileItemRequests();
})
);
}

View File

@@ -4650,23 +4650,25 @@
"person.page.orcid.sync-queue.send.validation-error.title.required": "The title is required",
"person.page.orcid.sync-queue.send.validation-error.type.required": "The type is required",
"person.page.orcid.sync-queue.send.validation-error.type.required": "The dc.type is required",
"person.page.orcid.sync-queue.send.validation-error.start-date.required": "The start date is required",
"person.page.orcid.sync-queue.send.validation-error.funder.required": "The funder is required",
"person.page.orcid.sync-queue.send.validation-error.country.invalid": "Invalid ISO 3611 country",
"person.page.orcid.sync-queue.send.validation-error.country.invalid": "Invalid 2 digits ISO 3166 country",
"person.page.orcid.sync-queue.send.validation-error.organization.required": "The organization is required",
"person.page.orcid.sync-queue.send.validation-error.organization.name-required": "The organization's name is required",
"person.page.orcid.sync-queue.send.validation-error.publication.date-invalid" : "The publication date must be one year after 1900",
"person.page.orcid.sync-queue.send.validation-error.organization.address-required": "The organization to be sent requires an address",
"person.page.orcid.sync-queue.send.validation-error.organization.city-required": "The address of the organization to be sent requires a city",
"person.page.orcid.sync-queue.send.validation-error.organization.country-required": "The address of the organization to be sent requires a valid ISO 3611 country",
"person.page.orcid.sync-queue.send.validation-error.organization.country-required": "The address of the organization to be sent requires a valid 2 digits ISO 3166 country",
"person.page.orcid.sync-queue.send.validation-error.disambiguated-organization.required": "An identifier to disambiguate organizations is required. Supported ids are GRID, Ringgold, Legal Entity identifiers (LEIs) and Crossref Funder Registry identifiers",