From abf34a6b48c7fd716cefa527f55ff5df9d762f68 Mon Sep 17 00:00:00 2001 From: Cilibiu Bogdan Date: Mon, 16 Apr 2018 16:21:13 +0300 Subject: [PATCH] [ACA-1301] Document List - page sizes (#299) * pagination sizes * retire documentList supportedPageSizes * fix tests --- src/app.config.json | 1 + src/app/app.component.ts | 1 + src/app/app.module.ts | 2 + src/app/common/pipes/app-config.pipe.ts | 39 +++++++++++++++++++ .../favorites/favorites.component.html | 1 + .../favorites/favorites.component.spec.ts | 4 +- src/app/components/files/files.component.html | 2 +- .../components/files/files.component.spec.ts | 4 +- .../libraries/libraries.component.html | 1 + .../libraries/libraries.component.spec.ts | 4 +- .../recent-files/recent-files.component.html | 1 + .../recent-files.component.spec.ts | 4 +- .../shared-files/shared-files.component.html | 1 + .../shared-files.component.spec.ts | 4 +- .../trashcan/trashcan.component.html | 1 + .../trashcan/trashcan.component.spec.ts | 4 +- 16 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 src/app/common/pipes/app-config.pipe.ts diff --git a/src/app.config.json b/src/app.config.json index 1733af116..3ffc5faae 100644 --- a/src/app.config.json +++ b/src/app.config.json @@ -7,6 +7,7 @@ "headerColor": "#2196F3", "languagePicker": false, "pagination": { + "size": 25, "supportedPageSizes": [ 25, 50, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a69ded848..439960187 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -42,6 +42,7 @@ export class AppComponent implements OnInit { config: AppConfigService) { // TODO: remove once ADF 2.3.0 is out (needs bug fixes) preferences.defaults.supportedPageSizes = config.get('pagination.supportedPageSizes'); + preferences.defaults.paginationSize = config.get('pagination.size'); } ngOnInit() { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2b8d19b89..f28690446 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -59,6 +59,7 @@ import { NodePermanentDeleteDirective } from './common/directives/node-permanent import { NodeUnshareDirective } from './common/directives/node-unshare.directive'; import { NodeInfoDirective } from './common/directives/node-info.directive'; import { NodeVersionsDirective } from './common/directives/node-versions.directive'; +import { AppConfigPipe } from './common/pipes/app-config.pipe'; import { VersionManagerDialogAdapterComponent } from './components/versions-dialog/version-manager-dialog-adapter.component'; import { BrowsingFilesService } from './common/services/browsing-files.service'; import { ContentManagementService } from './common/services/content-management.service'; @@ -112,6 +113,7 @@ import { SearchComponent } from './components/search/search.component'; NodeUnshareDirective, NodeInfoDirective, NodeVersionsDirective, + AppConfigPipe, VersionManagerDialogAdapterComponent, SearchComponent ], diff --git a/src/app/common/pipes/app-config.pipe.ts b/src/app/common/pipes/app-config.pipe.ts new file mode 100644 index 000000000..46470d69a --- /dev/null +++ b/src/app/common/pipes/app-config.pipe.ts @@ -0,0 +1,39 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { Pipe, PipeTransform } from '@angular/core'; +import { AppConfigService } from '@alfresco/adf-core'; + +@Pipe({ + name: 'appConfig', + pure: true +}) +export class AppConfigPipe implements PipeTransform { + constructor(private config: AppConfigService) {} + + transform(value: string, fallback: any): any { + return this.config.get(value, fallback); + } +} diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html index ff5df6d84..8b54addb1 100644 --- a/src/app/components/favorites/favorites.component.html +++ b/src/app/components/favorites/favorites.component.html @@ -171,6 +171,7 @@ diff --git a/src/app/components/favorites/favorites.component.spec.ts b/src/app/components/favorites/favorites.component.spec.ts index 47cdb3583..13f571a1d 100644 --- a/src/app/components/favorites/favorites.component.spec.ts +++ b/src/app/components/favorites/favorites.component.spec.ts @@ -46,6 +46,7 @@ import { DocumentListService } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../common/services/content-management.service'; import { NodeInfoDirective } from '../../common/directives/node-info.directive'; import { NodePermissionService } from '../../common/services/node-permission.service'; +import { AppConfigPipe } from '../../common/pipes/app-config.pipe'; import { FavoritesComponent } from './favorites.component'; @@ -105,7 +106,8 @@ describe('Favorites Routed Component', () => { NodeFavoriteDirective, NodeInfoDirective, DocumentListComponent, - FavoritesComponent + FavoritesComponent, + AppConfigPipe ], providers: [ { provide: ActivatedRoute, useValue: { diff --git a/src/app/components/files/files.component.html b/src/app/components/files/files.component.html index 7dfcdfbc2..27c2380e7 100644 --- a/src/app/components/files/files.component.html +++ b/src/app/components/files/files.component.html @@ -172,7 +172,7 @@ diff --git a/src/app/components/files/files.component.spec.ts b/src/app/components/files/files.component.spec.ts index e2b888065..dbe1ebca9 100644 --- a/src/app/components/files/files.component.spec.ts +++ b/src/app/components/files/files.component.spec.ts @@ -47,6 +47,7 @@ import { BrowsingFilesService } from '../../common/services/browsing-files.servi import { NodeActionsService } from '../../common/services/node-actions.service'; import { NodePermissionService } from '../../common/services/node-permission.service'; import { NodeInfoDirective } from '../../common/directives/node-info.directive'; +import { AppConfigPipe } from '../../common/pipes/app-config.pipe'; import { FilesComponent } from './files.component'; @@ -84,7 +85,8 @@ describe('FilesComponent', () => { NodeFavoriteDirective, NodeInfoDirective, DocumentListComponent, - FileSizePipe + FileSizePipe, + AppConfigPipe ], providers: [ { provide: ActivatedRoute, useValue: { diff --git a/src/app/components/libraries/libraries.component.html b/src/app/components/libraries/libraries.component.html index 49cce6b07..aed07e6e6 100644 --- a/src/app/components/libraries/libraries.component.html +++ b/src/app/components/libraries/libraries.component.html @@ -68,6 +68,7 @@ diff --git a/src/app/components/libraries/libraries.component.spec.ts b/src/app/components/libraries/libraries.component.spec.ts index c057391c2..a04008200 100644 --- a/src/app/components/libraries/libraries.component.spec.ts +++ b/src/app/components/libraries/libraries.component.spec.ts @@ -42,6 +42,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/material'; import { DocumentListService } from '@alfresco/adf-content-services'; import { ShareDataTableAdapter } from '@alfresco/adf-content-services'; +import { AppConfigPipe } from '../../common/pipes/app-config.pipe'; import { LibrariesComponent } from './libraries.component'; @@ -87,7 +88,8 @@ describe('Libraries Routed Component', () => { NodeNameTooltipPipe, NodeFavoriteDirective, DocumentListComponent, - LibrariesComponent + LibrariesComponent, + AppConfigPipe ], providers: [ { provide: ActivatedRoute, useValue: { diff --git a/src/app/components/recent-files/recent-files.component.html b/src/app/components/recent-files/recent-files.component.html index 197197a99..18aa9a7db 100644 --- a/src/app/components/recent-files/recent-files.component.html +++ b/src/app/components/recent-files/recent-files.component.html @@ -159,6 +159,7 @@ diff --git a/src/app/components/recent-files/recent-files.component.spec.ts b/src/app/components/recent-files/recent-files.component.spec.ts index f5e4df565..e688f387d 100644 --- a/src/app/components/recent-files/recent-files.component.spec.ts +++ b/src/app/components/recent-files/recent-files.component.spec.ts @@ -42,6 +42,7 @@ import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/materi import { DocumentListService } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../common/services/content-management.service'; import { NodeInfoDirective } from '../../common/directives/node-info.directive'; +import { AppConfigPipe } from '../../common/pipes/app-config.pipe'; import { RecentFilesComponent } from './recent-files.component'; @@ -83,7 +84,8 @@ describe('RecentFiles Routed Component', () => { NodeFavoriteDirective, NodeInfoDirective, DocumentListComponent, - RecentFilesComponent + RecentFilesComponent, + AppConfigPipe ], providers: [ { provide: ActivatedRoute, useValue: { diff --git a/src/app/components/shared-files/shared-files.component.html b/src/app/components/shared-files/shared-files.component.html index e0382f5ef..d6f050d87 100644 --- a/src/app/components/shared-files/shared-files.component.html +++ b/src/app/components/shared-files/shared-files.component.html @@ -176,6 +176,7 @@ diff --git a/src/app/components/shared-files/shared-files.component.spec.ts b/src/app/components/shared-files/shared-files.component.spec.ts index 79246210f..8c4371f8f 100644 --- a/src/app/components/shared-files/shared-files.component.spec.ts +++ b/src/app/components/shared-files/shared-files.component.spec.ts @@ -43,6 +43,7 @@ import { DocumentListService } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../common/services/content-management.service'; import { NodeInfoDirective } from '../../common/directives/node-info.directive'; import { NodePermissionService } from '../../common/services/node-permission.service'; +import { AppConfigPipe } from '../../common/pipes/app-config.pipe'; import { SharedFilesComponent } from './shared-files.component'; @@ -83,7 +84,8 @@ describe('SharedFilesComponent', () => { NodeFavoriteDirective, NodeInfoDirective, DocumentListComponent, - SharedFilesComponent + SharedFilesComponent, + AppConfigPipe ], providers: [ { provide: ActivatedRoute, useValue: { diff --git a/src/app/components/trashcan/trashcan.component.html b/src/app/components/trashcan/trashcan.component.html index 8392a9967..109c57a0f 100644 --- a/src/app/components/trashcan/trashcan.component.html +++ b/src/app/components/trashcan/trashcan.component.html @@ -100,6 +100,7 @@ diff --git a/src/app/components/trashcan/trashcan.component.spec.ts b/src/app/components/trashcan/trashcan.component.spec.ts index 8a71512a3..df6b8a078 100644 --- a/src/app/components/trashcan/trashcan.component.spec.ts +++ b/src/app/components/trashcan/trashcan.component.spec.ts @@ -42,6 +42,7 @@ import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/materi import { DocumentListService } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../common/services/content-management.service'; import { NodeInfoDirective } from '../../common/directives/node-info.directive'; +import { AppConfigPipe } from '../../common/pipes/app-config.pipe'; import { TrashcanComponent } from './trashcan.component'; @@ -79,7 +80,8 @@ describe('TrashcanComponent', () => { NodeFavoriteDirective, NodeInfoDirective, DocumentListComponent, - TrashcanComponent + TrashcanComponent, + AppConfigPipe ], providers: [ { provide: ActivatedRoute, useValue: {