Commits

Michael Spalti authored 56c8c8c370b
Initial work on browse with thumbs.
No tags

src/app/collection-page/collection-page.component.ts

Modified
21 21
22 22 import { fadeIn, fadeInOut } from '../shared/animations/fade';
23 23 import { hasValue, isNotEmpty } from '../shared/empty.util';
24 24 import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
25 25 import { AuthService } from '../core/auth/auth.service';
26 26 import { PaginationService } from '../core/pagination/pagination.service';
27 27 import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service';
28 28 import { FeatureID } from '../core/data/feature-authorization/feature-id';
29 29 import { getCollectionPageRoute } from './collection-page-routing-paths';
30 30 import { redirectOn4xx } from '../core/shared/authorized.operators';
31 +import { BROWSE_ITEM_LINKS_TO_FOLLOW } from '../core/browse/browse.service';
31 32
32 33 @Component({
33 34 selector: 'ds-collection-page',
34 35 styleUrls: ['./collection-page.component.scss'],
35 36 templateUrl: './collection-page.component.html',
36 37 changeDetection: ChangeDetectionStrategy.OnPush,
37 38 animations: [
38 39 fadeIn,
39 40 fadeInOut
40 41 ]
67 68 private router: Router,
68 69 private authService: AuthService,
69 70 private paginationService: PaginationService,
70 71 private authorizationDataService: AuthorizationDataService,
71 72 ) {
72 73 this.paginationConfig = new PaginationComponentOptions();
73 74 this.paginationConfig.id = 'cp';
74 75 this.paginationConfig.pageSize = 5;
75 76 this.paginationConfig.currentPage = 1;
76 77 this.sortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC);
78 +
77 79 }
78 80
79 81 ngOnInit(): void {
80 82 this.collectionRD$ = this.route.data.pipe(
81 83 map((data) => data.dso as RemoteData<Collection>),
82 84 redirectOn4xx(this.router, this.authService),
83 85 take(1)
84 86 );
85 87 this.logoRD$ = this.collectionRD$.pipe(
86 88 map((rd: RemoteData<Collection>) => rd.payload),
101 103 switchMap(([currentPagination, currentSort]) => this.collectionRD$.pipe(
102 104 getFirstSucceededRemoteData(),
103 105 map((rd) => rd.payload.id),
104 106 switchMap((id: string) => {
105 107 return this.searchService.search(
106 108 new PaginatedSearchOptions({
107 109 scope: id,
108 110 pagination: currentPagination,
109 111 sort: currentSort,
110 112 dsoTypes: [DSpaceObjectType.ITEM]
111 - })).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
113 + }), null, true, true, ...BROWSE_ITEM_LINKS_TO_FOLLOW)
114 + .pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
112 115 }),
113 116 startWith(undefined) // Make sure switching pages shows loading component
114 117 )
115 118 )
116 119 );
117 120
118 121 this.collectionPageRoute$ = this.collectionRD$.pipe(
119 122 getAllSucceededRemoteDataPayload(),
120 123 map((collection) => getCollectionPageRoute(collection.id))
121 124 );

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut