From ebec5ea8d73549c825cefea59400ee25401fcebd Mon Sep 17 00:00:00 2001 From: Vito Date: Tue, 20 Mar 2018 17:23:10 +0000 Subject: [PATCH] [ADF-2444] supportedPageSize is used only via input parameter (#3087) * [ADF-2444] supportedPageSize is used only via input parameter * [ADF-2444] removed white space * [ADF-2444] added deprecation to supportedPageSize attribute of paginated interface --- demo-shell/src/app/components/files/files.component.ts | 8 ++++++-- lib/core/pagination/paginated-component.interface.ts | 4 ++++ lib/core/pagination/pagination.component.ts | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 87c63906ec..31b37aecb6 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -33,7 +33,7 @@ import { AuthenticationService, ContentService, TranslationService, FileUploadEvent, FolderCreatedEvent, LogService, NotificationService, UploadService, DataColumn, DataRow, UserPreferencesService, - PaginationComponent, FormValues, DisplayMode + PaginationComponent, FormValues, DisplayMode, UserPreferenceValues } from '@alfresco/adf-core'; import { DocumentListComponent, PermissionStyleModel } from '@alfresco/adf-content-services'; @@ -159,6 +159,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { private preference: UserPreferencesService, @Optional() private route: ActivatedRoute, public authenticationService: AuthenticationService) { + this.preference.select(UserPreferenceValues.SupportedPageSizes) + .subscribe((pages) => { + this.supportedPages = pages; + }); } showFile(event) { @@ -205,7 +209,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { this.contentService.folderCreated.subscribe(value => this.onFolderCreated(value)); this.onCreateFolder = this.contentService.folderCreate.subscribe(value => this.onFolderAction(value)); this.onEditFolder = this.contentService.folderEdit.subscribe(value => this.onFolderAction(value)); - this.supportedPages = this.preference.getDefaultPageSizes(); + this.supportedPages = this.supportedPages ? this.supportedPages : this.preference.getDefaultPageSizes(); // this.permissionsStyle.push(new PermissionStyleModel('document-list__create', PermissionsEnum.CREATE)); // this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', PermissionsEnum.NOT_CREATE, false, true)); diff --git a/lib/core/pagination/paginated-component.interface.ts b/lib/core/pagination/paginated-component.interface.ts index 34bfd53733..7d19580dbd 100644 --- a/lib/core/pagination/paginated-component.interface.ts +++ b/lib/core/pagination/paginated-component.interface.ts @@ -22,6 +22,10 @@ import { PaginationQueryParams } from './pagination-query-params.interface'; export interface PaginatedComponent { pagination: BehaviorSubject; + /** + * @deprecated : the supported page size should be retrieved via the user preferences + * and given to the pagination component, and not retrieved by the paginated object + */ supportedPageSizes: number[]; updatePagination(params: PaginationQueryParams); } diff --git a/lib/core/pagination/pagination.component.ts b/lib/core/pagination/pagination.component.ts index c84c56911c..a998e87b5c 100644 --- a/lib/core/pagination/pagination.component.ts +++ b/lib/core/pagination/pagination.component.ts @@ -95,7 +95,6 @@ export class PaginationComponent implements OnInit, OnDestroy { ngOnInit() { if (this.target) { - this.supportedPageSizes = this.target.supportedPageSizes; this.paginationSubscription = this.target.pagination.subscribe(page => { this.pagination = page; this.cdr.detectChanges();