[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
This commit is contained in:
Vito
2018-03-20 17:23:10 +00:00
committed by Eugenio Romano
parent 436a911e0d
commit ebec5ea8d7
3 changed files with 10 additions and 3 deletions

View File

@@ -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));

View File

@@ -22,6 +22,10 @@ import { PaginationQueryParams } from './pagination-query-params.interface';
export interface PaginatedComponent {
pagination: BehaviorSubject<Pagination>;
/**
* @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);
}

View File

@@ -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();