From d775467fcb62c5216a99d894a25925a709fa8e3f Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Thu, 7 Dec 2017 11:28:44 +0100 Subject: [PATCH] cleaned up remotedata for a better separation of concerns, moved statuscode and errormsg in to RemoteDataError object, moved pageInfo to PaginatedList object in the payload --- .../collection-page.component.ts | 3 +- ...ty-page-sub-collection-list.component.html | 2 +- ...nity-page-sub-collection-list.component.ts | 5 +- .../top-level-community-list.component.ts | 3 +- .../+search-page/search-page.component.html | 4 +- src/app/+search-page/search-page.component.ts | 3 +- .../search-service/search.service.ts | 66 +++++------------ .../builders/remote-data-build.service.ts | 70 ++++++++++--------- src/app/core/data/data.service.ts | 5 +- src/app/core/data/paginated-list.ts | 42 +++++++++++ src/app/core/data/remote-data-error.ts | 7 ++ src/app/core/data/remote-data.ts | 7 +- src/app/core/data/request.models.ts | 20 ++++-- src/app/core/data/request.service.ts | 28 +++++--- .../core/metadata/metadata.service.spec.ts | 6 +- .../object-list/object-list.component.html | 6 +- src/app/object-list/object-list.component.ts | 13 ++-- 17 files changed, 162 insertions(+), 128 deletions(-) create mode 100644 src/app/core/data/paginated-list.ts create mode 100644 src/app/core/data/remote-data-error.ts diff --git a/src/app/+collection-page/collection-page.component.ts b/src/app/+collection-page/collection-page.component.ts index 853bd0d154..de7e9a72d4 100644 --- a/src/app/+collection-page/collection-page.component.ts +++ b/src/app/+collection-page/collection-page.component.ts @@ -6,6 +6,7 @@ import { Subscription } from 'rxjs/Subscription'; import { SortOptions } from '../core/cache/models/sort-options.model'; import { CollectionDataService } from '../core/data/collection-data.service'; import { ItemDataService } from '../core/data/item-data.service'; +import { PaginatedList } from '../core/data/paginated-list'; import { RemoteData } from '../core/data/remote-data'; import { MetadataService } from '../core/metadata/metadata.service'; @@ -30,7 +31,7 @@ import { PaginationComponentOptions } from '../shared/pagination/pagination-comp }) export class CollectionPageComponent implements OnInit, OnDestroy { collectionRDObs: Observable>; - itemRDObs: Observable>; + itemRDObs: Observable>>; logoRDObs: Observable>; paginationConfig: PaginationComponentOptions; sortConfig: SortOptions; diff --git a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.html b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.html index b04e93ff71..8e2d04c5cd 100644 --- a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.html +++ b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.html @@ -2,7 +2,7 @@

{{'community.sub-collection-list.head' | translate}}

    -
  • +
  • {{collection.name}}
    {{collection.shortDescription}} diff --git a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.ts b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.ts index 8edc275437..cb371617c9 100644 --- a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.ts +++ b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.ts @@ -1,11 +1,12 @@ import { Component, OnInit } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; import { CollectionDataService } from '../../core/data/collection-data.service'; +import { PaginatedList } from '../../core/data/paginated-list'; import { RemoteData } from '../../core/data/remote-data'; import { Collection } from '../../core/shared/collection.model'; import { fadeIn } from '../../shared/animations/fade'; -import { Observable } from 'rxjs/Observable'; @Component({ selector: 'ds-community-page-sub-collection-list', @@ -14,7 +15,7 @@ import { Observable } from 'rxjs/Observable'; animations:[fadeIn] }) export class CommunityPageSubCollectionListComponent implements OnInit { - subCollectionsRDObs: Observable>; + subCollectionsRDObs: Observable>>; constructor(private cds: CollectionDataService) { diff --git a/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts b/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts index b364985fc1..1b71220382 100644 --- a/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts +++ b/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { SortOptions } from '../../core/cache/models/sort-options.model'; import { CommunityDataService } from '../../core/data/community-data.service'; +import { PaginatedList } from '../../core/data/paginated-list'; import { RemoteData } from '../../core/data/remote-data'; import { Community } from '../../core/shared/community.model'; @@ -17,7 +18,7 @@ import { PaginationComponentOptions } from '../../shared/pagination/pagination-c animations: [fadeInOut] }) export class TopLevelCommunityListComponent { - communitiesRDObs: Observable>; + communitiesRDObs: Observable>>; config: PaginationComponentOptions; sortConfig: SortOptions; diff --git a/src/app/+search-page/search-page.component.html b/src/app/+search-page/search-page.component.html index c4d679f72b..953de02ab4 100644 --- a/src/app/+search-page/search-page.component.html +++ b/src/app/+search-page/search-page.component.html @@ -8,7 +8,7 @@ [query]="query" [scope]="(scopeObjectRDObs | async)?.payload" [currentParams]="currentParams" - [scopes]="(scopeListRDObs | async)?.payload"> + [scopes]="(scopeListRDObs | async)?.payload?.page">

    -
diff --git a/src/app/+search-page/search-page.component.ts b/src/app/+search-page/search-page.component.ts index 153402d11f..3dcd0ccccf 100644 --- a/src/app/+search-page/search-page.component.ts +++ b/src/app/+search-page/search-page.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/ import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { CommunityDataService } from '../core/data/community-data.service'; +import { PaginatedList } from '../core/data/paginated-list'; import { RemoteData } from '../core/data/remote-data'; import { Community } from '../core/shared/community.model'; import { DSpaceObject } from '../core/shared/dspace-object.model'; @@ -36,7 +37,7 @@ export class SearchPageComponent implements OnInit, OnDestroy { resultsRDObs: Observable>>>; currentParams = {}; searchOptions: SearchOptions; - scopeListRDObs: Observable>; + scopeListRDObs: Observable>>; isMobileView: Observable; constructor(private service: SearchService, diff --git a/src/app/+search-page/search-service/search.service.ts b/src/app/+search-page/search-service/search.service.ts index 4b5ba7b702..a6648fedd7 100644 --- a/src/app/+search-page/search-service/search.service.ts +++ b/src/app/+search-page/search-service/search.service.ts @@ -1,6 +1,8 @@ import { Injectable, OnDestroy } from '@angular/core'; +import { PaginatedList } from '../../core/data/paginated-list'; import { RemoteData } from '../../core/data/remote-data'; import { Observable } from 'rxjs/Observable'; +import { RemoteDataError } from '../../core/data/remote-data-error'; import { SearchResult } from '../search-result.model'; import { ItemDataService } from '../../core/data/item-data.service'; import { PageInfo } from '../../core/shared/page-info.model'; @@ -100,26 +102,7 @@ export class SearchService implements OnDestroy { } search(query: string, scopeId?: string, searchOptions?: SearchOptions): Observable>>> { - this.searchOptions = this.searchOptions; - let self = `https://dspace7.4science.it/dspace-spring-rest/api/search?query=${query}`; - if (hasValue(scopeId)) { - self += `&scope=${scopeId}`; - } - if (isNotEmpty(searchOptions) && hasValue(searchOptions.pagination.currentPage)) { - self += `&page=${searchOptions.pagination.currentPage}`; - } - if (isNotEmpty(searchOptions) && hasValue(searchOptions.pagination.pageSize)) { - self += `&pageSize=${searchOptions.pagination.pageSize}`; - } - if (isNotEmpty(searchOptions) && hasValue(searchOptions.sort.direction)) { - self += `&sortDirection=${searchOptions.sort.direction}`; - } - if (isNotEmpty(searchOptions) && hasValue(searchOptions.sort.field)) { - self += `&sortField=${searchOptions.sort.field}`; - } - - const errorMessage = undefined; - const statusCode = '200'; + const error = new RemoteDataError('200', undefined); const returningPageInfo = new PageInfo(); if (isNotEmpty(searchOptions)) { @@ -137,13 +120,12 @@ export class SearchService implements OnDestroy { }); return itemsObs - .filter((rd: RemoteData) => rd.hasSucceeded) - .map((rd: RemoteData) => { + .filter((rd: RemoteData>) => rd.hasSucceeded) + .map((rd: RemoteData>) => { - const totalElements = rd.pageInfo.totalElements > 20 ? 20 : rd.pageInfo.totalElements; - const pageInfo = Object.assign({}, rd.pageInfo, { totalElements: totalElements }); + const totalElements = rd.payload.totalElements > 20 ? 20 : rd.payload.totalElements; - const payload = shuffle(rd.payload) + const page = shuffle(rd.payload.page) .map((item: Item, index: number) => { const mockResult: SearchResult = new ItemSearchResult(); mockResult.dspaceObject = item; @@ -154,24 +136,20 @@ export class SearchService implements OnDestroy { return mockResult; }); + const payload = Object.assign({}, rd.payload, { totalElements: totalElements, page }); + return new RemoteData( - self, rd.isRequestPending, rd.isResponsePending, rd.hasSucceeded, - errorMessage, - statusCode, - pageInfo, + error, payload ) }).startWith(new RemoteData( - '', true, false, undefined, undefined, - undefined, - undefined, undefined )); } @@ -180,17 +158,12 @@ export class SearchService implements OnDestroy { const requestPending = false; const responsePending = false; const isSuccessful = true; - const errorMessage = undefined; - const statusCode = '200'; - const returningPageInfo = new PageInfo(); + const error = new RemoteDataError('200', undefined); return Observable.of(new RemoteData( - 'https://dspace7.4science.it/dspace-spring-rest/api/search', requestPending, responsePending, isSuccessful, - errorMessage, - statusCode, - returningPageInfo, + error, this.config )); } @@ -198,12 +171,12 @@ export class SearchService implements OnDestroy { getFacetValuesFor(searchFilterConfigName: string): Observable> { const filterConfig = this.config.find((config: SearchFilterConfig) => config.name === searchFilterConfigName); return this.routeService.getQueryParameterValues(filterConfig.paramName).map((selectedValues: string[]) => { - const values: FacetValue[] = []; + const payload: FacetValue[] = []; const totalFilters = 13; for (let i = 0; i < totalFilters; i++) { const value = searchFilterConfigName + ' ' + (i + 1); if (!selectedValues.includes(value)) { - values.push({ + payload.push({ value: value, count: Math.floor(Math.random() * 20) + 20 * (totalFilters - i), // make sure first results have the highest (random) count search: decodeURI(this.router.url) + (this.router.url.includes('?') ? '&' : '?') + filterConfig.paramName + '=' + value @@ -213,18 +186,13 @@ export class SearchService implements OnDestroy { const requestPending = false; const responsePending = false; const isSuccessful = true; - const errorMessage = undefined; - const statusCode = '200'; - const returningPageInfo = new PageInfo(); + const error = new RemoteDataError('200', undefined);; return new RemoteData( - 'https://dspace7.4science.it/dspace-spring-rest/api/search', requestPending, responsePending, isSuccessful, - errorMessage, - statusCode, - returningPageInfo, - values + error, + payload ) } ) diff --git a/src/app/core/cache/builders/remote-data-build.service.ts b/src/app/core/cache/builders/remote-data-build.service.ts index 2e3fc01b52..eee6808d86 100644 --- a/src/app/core/cache/builders/remote-data-build.service.ts +++ b/src/app/core/cache/builders/remote-data-build.service.ts @@ -1,5 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; +import { PaginatedList } from '../../data/paginated-list'; +import { RemoteDataError } from '../../data/remote-data-error'; import { CacheableObject } from '../object-cache.reducer'; import { ObjectCacheService } from '../object-cache.service'; @@ -88,32 +90,18 @@ export class RemoteDataBuildService { const requestPending = hasValue(reqEntry.requestPending) ? reqEntry.requestPending : true; const responsePending = hasValue(reqEntry.responsePending) ? reqEntry.responsePending : false; let isSuccessFul: boolean; - let errorMessage: string; - let statusCode: string; - let pageInfo: PageInfo; + let error: RemoteDataError; if (hasValue(resEntry) && hasValue(resEntry.response)) { isSuccessFul = resEntry.response.isSuccessful; - errorMessage = isSuccessFul === false ? (resEntry.response as ErrorResponse).errorMessage : undefined; - statusCode = resEntry.response.statusCode; - - if (hasValue((resEntry.response as DSOSuccessResponse).pageInfo)) { - const resPageInfo = (resEntry.response as DSOSuccessResponse).pageInfo; - if (isNotEmpty(resPageInfo) && resPageInfo.currentPage >= 0) { - pageInfo = Object.assign({}, resPageInfo, { currentPage: resPageInfo.currentPage + 1 }); - } else { - pageInfo = resPageInfo; - } - } + const errorMessage = isSuccessFul === false ? (resEntry.response as ErrorResponse).errorMessage : undefined; + error = new RemoteDataError(resEntry.response.statusCode, errorMessage); } return new RemoteData( - href, requestPending, responsePending, isSuccessFul, - errorMessage, - statusCode, - pageInfo, + error, payload ); }); @@ -122,7 +110,7 @@ export class RemoteDataBuildService { buildList( hrefObs: string | Observable, normalizedType: GenericConstructor - ): Observable> { + ): Observable>> { if (typeof hrefObs === 'string') { hrefObs = Observable.of(hrefObs); } @@ -132,7 +120,7 @@ export class RemoteDataBuildService { const responseCacheObs = hrefObs.flatMap((href: string) => this.responseCache.get(href)) .filter((entry) => hasValue(entry)); - const payloadObs = responseCacheObs + const tDomainListObs = responseCacheObs .filter((entry: ResponseCacheEntry) => entry.response.isSuccessful) .map((entry: ResponseCacheEntry) => (entry.response as DSOSuccessResponse).resourceSelfLinks) .flatMap((resourceUUIDs: string[]) => { @@ -146,6 +134,27 @@ export class RemoteDataBuildService { .startWith([]) .distinctUntilChanged(); + const pageInfoObs = responseCacheObs + .filter((entry: ResponseCacheEntry) => entry.response.isSuccessful) + .map((entry: ResponseCacheEntry) => { + if (hasValue((entry.response as DSOSuccessResponse).pageInfo)) { + const resPageInfo = (entry.response as DSOSuccessResponse).pageInfo; + if (isNotEmpty(resPageInfo) && resPageInfo.currentPage >= 0) { + return Object.assign({}, resPageInfo, { currentPage: resPageInfo.currentPage + 1 }); + } else { + return resPageInfo; + } + } + }); + + const payloadObs = Observable.combineLatest(tDomainListObs, pageInfoObs, (tDomainList, pageInfo) => { + if (hasValue(pageInfo)) { + return new PaginatedList(pageInfo, tDomainList); + } else { + return tDomainList; + } + }); + return this.toRemoteDataObservable(hrefObs, requestObs, responseCacheObs, payloadObs); } @@ -209,35 +218,32 @@ export class RemoteDataBuildService { .every((b: boolean) => b === true); const errorMessage: string = arr - .map((d: RemoteData) => d.errorMessage) - .map((e: string, idx: number) => { + .map((d: RemoteData) => d.error) + .map((e: RemoteDataError, idx: number) => { if (hasValue(e)) { - return `[${idx}]: ${e}`; + return `[${idx}]: ${e.message}`; } }).filter((e: string) => hasValue(e)) .join(', '); const statusCode: string = arr - .map((d: RemoteData) => d.statusCode) - .map((c: string, idx: number) => { - if (hasValue(c)) { - return `[${idx}]: ${c}`; + .map((d: RemoteData) => d.error) + .map((e: RemoteDataError, idx: number) => { + if (hasValue(e)) { + return `[${idx}]: ${e.statusCode}`; } }).filter((c: string) => hasValue(c)) .join(', '); - const pageInfo = undefined; + const error = new RemoteDataError(statusCode, errorMessage); const payload: T[] = arr.map((d: RemoteData) => d.payload); return new RemoteData( - `dspace-angular://aggregated/object/${new Date().getTime()}`, requestPending, responsePending, isSuccessFul, - errorMessage, - statusCode, - pageInfo, + error, payload ); }) diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts index 5751173054..68fa2657f5 100644 --- a/src/app/core/data/data.service.ts +++ b/src/app/core/data/data.service.ts @@ -10,6 +10,7 @@ import { DSpaceObject } from '../shared/dspace-object.model'; import { GenericConstructor } from '../shared/generic-constructor'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { URLCombiner } from '../url-combiner/url-combiner'; +import { PaginatedList } from './paginated-list'; import { RemoteData } from './remote-data'; import { FindAllOptions, @@ -70,7 +71,7 @@ export abstract class DataService } } - findAll(options: FindAllOptions = {}): Observable> { + findAll(options: FindAllOptions = {}): Observable>> { const hrefObs = this.getEndpoint().filter((href: string) => isNotEmpty(href)) .flatMap((endpoint: string) => this.getFindAllHref(endpoint, options)); @@ -82,7 +83,7 @@ export abstract class DataService this.requestService.configure(request); }); - return this.rdbService.buildList(hrefObs, this.normalizedResourceType); + return this.rdbService.buildList(hrefObs, this.normalizedResourceType) as Observable>>; } getFindByIDHref(endpoint, resourceID): string { diff --git a/src/app/core/data/paginated-list.ts b/src/app/core/data/paginated-list.ts new file mode 100644 index 0000000000..f1d076927d --- /dev/null +++ b/src/app/core/data/paginated-list.ts @@ -0,0 +1,42 @@ +import { PageInfo } from '../shared/page-info.model'; + +export class PaginatedList { + + constructor( + private pageInfo: PageInfo, + public page: T[] + ) { + } + + get elementsPerPage(): number { + return this.pageInfo.elementsPerPage; + } + + set elementsPerPage(value: number) { + this.pageInfo.elementsPerPage = value; + } + + get totalElements(): number { + return this.pageInfo.totalElements; + } + + set totalElements(value: number) { + this.pageInfo.totalElements = value; + } + + get totalPages(): number { + return this.pageInfo.totalPages; + } + + set totalPages(value: number) { + this.pageInfo.totalPages = value; + } + + get currentPage(): number { + return this.pageInfo.currentPage; + } + + set currentPage(value: number) { + this.pageInfo.currentPage = value; + } +} diff --git a/src/app/core/data/remote-data-error.ts b/src/app/core/data/remote-data-error.ts new file mode 100644 index 0000000000..a2ff27a073 --- /dev/null +++ b/src/app/core/data/remote-data-error.ts @@ -0,0 +1,7 @@ +export class RemoteDataError { + constructor( + public statusCode: string, + public message: string + ) { + } +} diff --git a/src/app/core/data/remote-data.ts b/src/app/core/data/remote-data.ts index d8a2f79e66..41953260ac 100644 --- a/src/app/core/data/remote-data.ts +++ b/src/app/core/data/remote-data.ts @@ -1,5 +1,5 @@ -import { PageInfo } from '../shared/page-info.model'; import { hasValue } from '../../shared/empty.util'; +import { RemoteDataError } from './remote-data-error'; export enum RemoteDataState { RequestPending = 'RequestPending', @@ -13,13 +13,10 @@ export enum RemoteDataState { */ export class RemoteData { constructor( - public self: string, private requestPending: boolean, private responsePending: boolean, private isSuccessFul: boolean, - public errorMessage: string, - public statusCode: string, - public pageInfo: PageInfo, + public error: RemoteDataError, public payload: T ) { } diff --git a/src/app/core/data/request.models.ts b/src/app/core/data/request.models.ts index 3ab7dc0b8c..3a7141d22d 100644 --- a/src/app/core/data/request.models.ts +++ b/src/app/core/data/request.models.ts @@ -9,14 +9,24 @@ import { BrowseResponseParsingService } from './browse-response-parsing.service' import { ConfigResponseParsingService } from './config-response-parsing.service'; /* tslint:disable:max-classes-per-file */ + +/** + * Represents a Request Method. + * + * I didn't reuse the RequestMethod enum in @angular/http because + * it uses numbers. The string values here are more clear when + * debugging. + * + * The ones commented out are still unsupported in the rest of the codebase + */ export enum RestRequestMethod { Get = 'GET', Post = 'POST', - Put = 'PUT', - Delete = 'DELETE', - Options = 'OPTIONS', - Head = 'HEAD', - Patch = 'PATCH' + // Put = 'PUT', + // Delete = 'DELETE', + // Options = 'OPTIONS', + // Head = 'HEAD', + // Patch = 'PATCH' } export class RestRequest { diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index 0eee771a52..a075244648 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -12,7 +12,7 @@ import { ResponseCacheService } from '../cache/response-cache.service'; import { coreSelector, CoreState } from '../core.reducers'; import { keySelector } from '../shared/selectors'; import { RequestConfigureAction, RequestExecuteAction } from './request.actions'; -import { RestRequest } from './request.models'; +import { RestRequest, RestRequestMethod } from './request.models'; import { RequestEntry, RequestState } from './request.reducer'; @@ -30,11 +30,9 @@ export function requestStateSelector(): MemoizedSelector - ) { + constructor(private objectCache: ObjectCacheService, + private responseCache: ResponseCacheService, + private store: Store) { } isPending(href: string): boolean { @@ -59,6 +57,12 @@ export class RequestService { } configure(request: RestRequest): void { + if (request.method !== RestRequestMethod.Get || !this.isCachedOrPending(request)) { + this.dispatchRequest(request); + } + } + + private isCachedOrPending(request: RestRequest) { let isCached = this.objectCache.hasBySelfLink(request.href); if (!isCached && this.responseCache.has(request.href)) { const [successResponse, errorResponse] = this.responseCache.get(request.href) @@ -84,11 +88,13 @@ export class RequestService { const isPending = this.isPending(request.href); - if (!(isCached || isPending)) { - this.store.dispatch(new RequestConfigureAction(request)); - this.store.dispatch(new RequestExecuteAction(request.href)); - this.trackRequestsOnTheirWayToTheStore(request.href); - } + return isCached || isPending; + } + + private dispatchRequest(request: RestRequest) { + this.store.dispatch(new RequestConfigureAction(request)); + this.store.dispatch(new RequestExecuteAction(request.href)); + this.trackRequestsOnTheirWayToTheStore(request.href); } /** diff --git a/src/app/core/metadata/metadata.service.spec.ts b/src/app/core/metadata/metadata.service.spec.ts index 4c8775fcfb..110a46c1b9 100644 --- a/src/app/core/metadata/metadata.service.spec.ts +++ b/src/app/core/metadata/metadata.service.spec.ts @@ -11,6 +11,7 @@ import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { Store, StoreModule } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; +import { RemoteDataError } from '../data/remote-data-error'; import { MetadataService } from './metadata.service'; @@ -178,13 +179,10 @@ describe('MetadataService', () => { const mockRemoteData = (mockItem: Item): Observable> => { return Observable.of(new RemoteData( - '', false, false, true, - '', - '200', - {} as PageInfo, + new RemoteDataError('200', ''), MockItem )); } diff --git a/src/app/object-list/object-list.component.html b/src/app/object-list/object-list.component.html index 0d488b5298..897342ae0d 100644 --- a/src/app/object-list/object-list.component.html +++ b/src/app/object-list/object-list.component.html @@ -1,7 +1,7 @@
    -
  • +
diff --git a/src/app/object-list/object-list.component.ts b/src/app/object-list/object-list.component.ts index 0f7decadd7..b298522ebc 100644 --- a/src/app/object-list/object-list.component.ts +++ b/src/app/object-list/object-list.component.ts @@ -8,13 +8,12 @@ import { } from '@angular/core'; import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model'; +import { PaginatedList } from '../core/data/paginated-list'; import { RemoteData } from '../core/data/remote-data'; -import { PageInfo } from '../core/shared/page-info.model'; -import { ListableObject } from '../object-list/listable-object/listable-object.model'; +import { ListableObject } from './listable-object/listable-object.model'; import { fadeIn } from '../shared/animations/fade'; -import { hasValue } from '../shared/empty.util'; import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; @@ -32,13 +31,9 @@ export class ObjectListComponent { @Input() sortConfig: SortOptions; @Input() hideGear = false; @Input() hidePagerWhenSinglePage = true; - private _objects: RemoteData; - pageInfo: PageInfo; - @Input() set objects(objects: RemoteData) { + private _objects: RemoteData>; + @Input() set objects(objects: RemoteData>) { this._objects = objects; - if (hasValue(objects)) { - this.pageInfo = objects.pageInfo; - } } get objects() { return this._objects;