Merge remote-tracking branch 'contributions/w2p-102415_Remote-lookup-entity-on-admin-edit_contribute-7.4' into dspace-7.6

This commit is contained in:
Alexandre Vryghem
2023-07-18 13:40:23 +02:00

View File

@@ -29,6 +29,10 @@ import { RemoteDataBuildService } from '../../../../../core/cache/builders/remot
import { getAllSucceededRemoteDataPayload } from '../../../../../core/shared/operators';
import { followLink } from '../../../../utils/follow-link-config.model';
import { RelationshipType } from '../../../../../core/shared/item-relationships/relationship-type.model';
import { FindListOptions } from '../../../../../core/data/find-list-options.model';
import { RequestParam } from '../../../../../core/cache/models/request-param.model';
import { getFirstSucceededRemoteDataPayload } from '../../../../../core/shared/operators';
import { PaginatedList } from '../../../../../core/data/paginated-list.model';
@Component({
selector: 'ds-dynamic-lookup-relation-modal',
@@ -173,6 +177,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
if (!!this.currentItemIsLeftItem$) {
this.currentItemIsLeftItem$.subscribe((isLeft) => {
this.isLeft = isLeft;
this.label = this.relationshipType.leftwardType;
});
}
@@ -201,6 +206,19 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
).pipe(
getAllSucceededRemoteDataPayload()
);
} else {
const findListOptions = Object.assign({}, new FindListOptions(), {
elementsPerPage: 5,
currentPage: 1,
searchParams: [
new RequestParam('entityType', this.relationshipOptions.relationshipType)
]
});
this.externalSourcesRD$ = this.externalSourceService.searchBy('findByEntityType', findListOptions,
true, true, followLink('entityTypes'))
.pipe(getFirstSucceededRemoteDataPayload(), map((r: PaginatedList<ExternalSource>) => {
return r.page;
}));
}
this.setTotals();