From eab09924bae5785149959cb6d9efb544b5a2db98 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Mon, 19 Aug 2019 16:22:44 +0900 Subject: [PATCH] pagination is modified --- .../users/user/component/list.component.html | 4 ++-- .../users/user/component/list.data-source.ts | 11 ++++++++++ src/index.html | 2 +- src/modules/common/data/model/page.ts | 22 +++++++++---------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/app/pages/users/user/component/list.component.html b/src/app/pages/users/user/component/list.component.html index c7faaa7..0a7b9a7 100644 --- a/src/app/pages/users/user/component/list.component.html +++ b/src/app/pages/users/user/component/list.component.html @@ -153,9 +153,9 @@ diff --git a/src/app/pages/users/user/component/list.data-source.ts b/src/app/pages/users/user/component/list.data-source.ts index 0fe18ae..50f66b6 100644 --- a/src/app/pages/users/user/component/list.data-source.ts +++ b/src/app/pages/users/user/component/list.data-source.ts @@ -9,9 +9,11 @@ import { CollectionViewer } from '@angular/cdk/collections'; import { User } from 'src/modules/user/model/user.model'; import { UserService } from 'src/modules/user/service/user.service'; +import { Page } from 'src/modules/common/data/model/page'; export class UsersDataSource extends DataSource { private filterSubject = new BehaviorSubject(''); + private pageSubject = new BehaviorSubject>({}); constructor( private userService: UserService, @@ -30,6 +32,14 @@ export class UsersDataSource extends DataSource { this.filterSubject.next(filter); } + get page(): Page { + return this.pageSubject.value; + } + + set page(value: Page) { + this.pageSubject.next(value); + } + connect( collectionViewer: CollectionViewer ): Observable { @@ -49,6 +59,7 @@ export class UsersDataSource extends DataSource { return this.userService.getUsers().pipe( map(page => { + this.page = page; return page.content; }) ); diff --git a/src/index.html b/src/index.html index 2740eee..b27b2d2 100644 --- a/src/index.html +++ b/src/index.html @@ -1,7 +1,7 @@ - UCAP APM + Banana Sound Backend diff --git a/src/modules/common/data/model/page.ts b/src/modules/common/data/model/page.ts index e858820..9b691d4 100644 --- a/src/modules/common/data/model/page.ts +++ b/src/modules/common/data/model/page.ts @@ -13,15 +13,15 @@ export interface Pageable { } export interface Page { - content: T[] | null; - empty: boolean; - first: boolean; - last: boolean; - number: number; - numberOfElements: number; - pageable: Pageable; - size: number; - sort: Sort; - totalElements: number; - totalPages: number; + content?: T[] | null; + empty?: boolean; + first?: boolean; + last?: boolean; + number?: number; + numberOfElements?: number; + pageable?: Pageable; + size?: number; + sort?: Sort; + totalElements?: number; + totalPages?: number; }