From 7a4edd1567eb731b7827180526e66cf074fea14a Mon Sep 17 00:00:00 2001 From: lotte Date: Mon, 13 May 2019 10:39:01 +0200 Subject: [PATCH] 62180: fixed non-uuid paths --- .../collection-page.component.html | 114 +++++++++--------- .../collection-page.component.ts | 34 +++--- 2 files changed, 78 insertions(+), 70 deletions(-) diff --git a/src/app/+collection-page/collection-page.component.html b/src/app/+collection-page/collection-page.component.html index 6265b223d8..91239de17c 100644 --- a/src/app/+collection-page/collection-page.component.html +++ b/src/app/+collection-page/collection-page.component.html @@ -1,58 +1,62 @@
-
-
-
- - - - - - - - - - - - - - - - - - - - -
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+
+ +
+

{{'collection.page.browse.recent.head' | translate}}

+ + +
+ + +
+
+ +
- - -
- -
-

{{'collection.page.browse.recent.head' | translate}}

- - -
- - -
-
diff --git a/src/app/+collection-page/collection-page.component.ts b/src/app/+collection-page/collection-page.component.ts index 164208566d..5fafa52594 100644 --- a/src/app/+collection-page/collection-page.component.ts +++ b/src/app/+collection-page/collection-page.component.ts @@ -16,8 +16,9 @@ import { Item } from '../core/shared/item.model'; import { fadeIn, fadeInOut } from '../shared/animations/fade'; import { hasValue, isNotEmpty } from '../shared/empty.util'; import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; -import { filter, first, flatMap, map } from 'rxjs/operators'; -import { redirectToPageNotFoundOn404 } from '../core/shared/operators'; +import { filter, first, flatMap, map, switchMap } from 'rxjs/operators'; +import { PaginatedSearchOptions } from '../+search-page/paginated-search-options.model'; +import { getSucceededRemoteData, redirectToPageNotFoundOn404 } from '../core/shared/operators'; @Component({ selector: 'ds-collection-page', @@ -36,7 +37,6 @@ export class CollectionPageComponent implements OnInit, OnDestroy { paginationConfig: PaginationComponentOptions; sortConfig: SortOptions; private subs: Subscription[] = []; - private collectionId: string; constructor( private collectionDataService: CollectionDataService, @@ -77,24 +77,28 @@ export class CollectionPageComponent implements OnInit, OnDestroy { this.sortConfig, { direction: sortDirection, field: this.sortConfig.field } ); - this.collectionRD$.subscribe((rd: RemoteData) => { - this.collectionId = rd.payload.id; - this.updatePage({ - pagination: pagination, - sort: sort - }); + this.updatePage({ + pagination: pagination, + sort: sort }); }) ); } updatePage(searchOptions) { - this.itemRD$ = this.itemDataService.findAll({ - scopeID: this.collectionId, - currentPage: searchOptions.pagination.currentPage, - elementsPerPage: searchOptions.pagination.pageSize, - sort: searchOptions.sort - }); + this.itemRD$ = this.collectionRD$.pipe( + getSucceededRemoteData(), + map((rd) => rd.payload.id), + switchMap((id: string) => { + return this.itemDataService.findAll( + new PaginatedSearchOptions({ + scope: id, + currentPage: searchOptions.pagination.currentPage, + elementsPerPage: searchOptions.pagination.pageSize, + sort: searchOptions.sort + })); + }) + ) } ngOnDestroy(): void {