diff --git a/client/src/app/site/base/list-view-base.ts b/client/src/app/site/base/list-view-base.ts index 2f0582c2e..04a23b42a 100644 --- a/client/src/app/site/base/list-view-base.ts +++ b/client/src/app/site/base/list-view-base.ts @@ -38,12 +38,12 @@ export abstract class ListViewBaseComponent, public sortService?: BaseSortListService ) { super(titleService, translate, matSnackBar); this.selectedRows = []; try { - this.storageKey = (>route.component).name; + this.paginationStorageKey = (>route.component).name; } catch (e) { - this.storageKey = ''; + this.paginationStorageKey = ''; } } @@ -101,7 +101,7 @@ export abstract class ListViewBaseComponent { + public initTable(): void { this.dataSource = new MatTableDataSource(); this.dataSource.paginator = this.paginator; // Set the initial page settings. @@ -173,13 +173,13 @@ export abstract class ListViewBaseComponent { // If the storage is not available - like in history mode - do nothing. if (this.storage) { - this.storageObject = (await this.storage.get('Pagination')) || {}; + this.paginationStorageObject = (await this.storage.get('Pagination')) || {}; // Set the number of items per page -- by default to 25. - this.paginator.pageSize = this.storageObject[this.storageKey] || 25; + this.paginator.pageSize = this.paginationStorageObject[this.paginationStorageKey] || 25; // Subscription to page change events, like size, index. this.subscriptions.push( - this.paginator.page.subscribe(async (event: PageEvent) => { - await this.setPageSettings(event.pageSize); + this.paginator.page.subscribe((event: PageEvent) => { + this.setPageSettings(event.pageSize); }) ); } @@ -191,8 +191,10 @@ export abstract class ListViewBaseComponent { - this.storageObject[this.storageKey] = size; - await this.storage.set('Pagination', this.storageObject); + if (this.paginationStorageObject) { + this.paginationStorageObject[this.paginationStorageKey] = size; + await this.storage.set('Pagination', this.paginationStorageObject); + } } /** diff --git a/client/src/app/site/history/components/history-list/history-list.component.ts b/client/src/app/site/history/components/history-list/history-list.component.ts index 6bbc87c34..b50ecd3ce 100644 --- a/client/src/app/site/history/components/history-list/history-list.component.ts +++ b/client/src/app/site/history/components/history-list/history-list.component.ts @@ -51,7 +51,7 @@ export class HistoryListComponent extends ListViewBaseComponent implem titleService: Title, protected translate: TranslateService, // protected required for ng-translate-extract matSnackBar: MatSnackBar, - storage: StorageService, route: ActivatedRoute, + storage: StorageService, private repo: TagRepositoryService, private promptService: PromptService ) { diff --git a/client/src/app/site/users/components/user-list/user-list.component.ts b/client/src/app/site/users/components/user-list/user-list.component.ts index 2dfb1f0ab..a2ed21735 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.ts +++ b/client/src/app/site/users/components/user-list/user-list.component.ts @@ -134,12 +134,12 @@ export class UserListComponent extends ListViewBaseComponent imp titleService: Title, protected translate: TranslateService, // protected required for ng-translate-extract matSnackBar: MatSnackBar, + route: ActivatedRoute, storage: StorageService, private repo: UserRepositoryService, private groupRepo: GroupRepositoryService, private choiceService: ChoiceService, private router: Router, - protected route: ActivatedRoute, private operator: OperatorService, private vp: ViewportService, protected csvExport: CsvExportService,