Added FindAllOptions param to getAuthorizedCollection and getAuthorizedCollectionByCommunity

This commit is contained in:
Giuseppe Digilio
2019-07-26 15:29:00 +02:00
parent 697b8199e4
commit 45ab326355
2 changed files with 7 additions and 8 deletions

View File

@@ -44,13 +44,12 @@ export class CollectionDataService extends ComColDataService<Collection> {
/**
* Get all collections the user is authorized to submit to
*
* @param options The [[FindAllOptions]] object
* @return Observable<RemoteData<PaginatedList<Collection>>>
* collection list
*/
getAuthorizedCollection(): Observable<RemoteData<PaginatedList<Collection>>> {
getAuthorizedCollection(options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findAuthorized';
const options = new FindAllOptions();
options.elementsPerPage = 100;
return this.searchBy(searchHref, options).pipe(
filter((collections: RemoteData<PaginatedList<Collection>>) => !collections.isResponsePending));
@@ -59,13 +58,13 @@ export class CollectionDataService extends ComColDataService<Collection> {
/**
* Get all collections the user is authorized to submit to, by community
*
* @param communityId The community id
* @param options The [[FindAllOptions]] object
* @return Observable<RemoteData<PaginatedList<Collection>>>
* collection list
*/
getAuthorizedCollectionByCommunity(communityId): Observable<RemoteData<PaginatedList<Collection>>> {
getAuthorizedCollectionByCommunity(communityId: string, options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findAuthorizedByCommunity';
const options = new FindAllOptions();
options.elementsPerPage = 100;
options.searchParams = [new SearchParam('uuid', communityId)];
return this.searchBy(searchHref, options).pipe(

View File

@@ -206,7 +206,7 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
);
const findOptions: FindAllOptions = {
elementsPerPage: 100
elementsPerPage: 1000
};
// Retrieve collection list only when is the first change
@@ -219,7 +219,7 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
const listCollection$ = communities$.pipe(
flatMap((communityData: Community) => {
return this.collectionDataService.getAuthorizedCollectionByCommunity(communityData.uuid).pipe(
return this.collectionDataService.getAuthorizedCollectionByCommunity(communityData.uuid, findOptions).pipe(
find((collections: RemoteData<PaginatedList<Collection>>) => !collections.isResponsePending && collections.hasSucceeded),
mergeMap((collections: RemoteData<PaginatedList<Collection>>) => collections.payload.page),
filter((collectionData: Collection) => isNotEmpty(collectionData)),