108555: Removed pageInfoState Input since it wasn't used and almost all the components gave the incorrect type of data to it

This commit is contained in:
Alexandre Vryghem
2024-04-18 19:27:26 +02:00
parent 45e8977db7
commit da31c4f253
19 changed files with 6 additions and 60 deletions

View File

@@ -36,7 +36,6 @@
<ng-template ngbNavContent> <ng-template ngbNavContent>
<ds-pagination <ds-pagination
[paginationOptions]="(paginationOptions$ | async)" [paginationOptions]="(paginationOptions$ | async)"
[pageInfoState]="(objectsSelected$|async)?.payload.pageInfo"
[collectionSize]="(objectsSelected$|async)?.payload?.totalElements" [collectionSize]="(objectsSelected$|async)?.payload?.totalElements"
[objects]="(objectsSelected$|async)" [objects]="(objectsSelected$|async)"
[showPaginator]="false" [showPaginator]="false"

View File

@@ -49,7 +49,6 @@
<ds-pagination <ds-pagination
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && !(searching$ | async)" *ngIf="(pageInfoState$ | async)?.totalElements > 0 && !(searching$ | async)"
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="pageInfoState$"
[collectionSize]="(pageInfoState$ | async)?.totalElements" [collectionSize]="(pageInfoState$ | async)?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -47,7 +47,6 @@
<ds-pagination <ds-pagination
*ngIf="(groups | async)?.payload?.totalElements > 0" *ngIf="(groups | async)?.payload?.totalElements > 0"
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="(groups | async)?.payload"
[collectionSize]="(groups | async)?.payload?.totalElements" [collectionSize]="(groups | async)?.payload?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"

View File

@@ -39,7 +39,6 @@
<ds-pagination *ngIf="(ePeopleSearchDtos | async)?.totalElements > 0" <ds-pagination *ngIf="(ePeopleSearchDtos | async)?.totalElements > 0"
[paginationOptions]="configSearch" [paginationOptions]="configSearch"
[pageInfoState]="(ePeopleSearchDtos | async)"
[collectionSize]="(ePeopleSearchDtos | async)?.totalElements" [collectionSize]="(ePeopleSearchDtos | async)?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">
@@ -103,7 +102,6 @@
<ds-pagination *ngIf="(ePeopleMembersOfGroupDtos | async)?.totalElements > 0" <ds-pagination *ngIf="(ePeopleMembersOfGroupDtos | async)?.totalElements > 0"
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="(ePeopleMembersOfGroupDtos | async)"
[collectionSize]="(ePeopleMembersOfGroupDtos | async)?.totalElements" [collectionSize]="(ePeopleMembersOfGroupDtos | async)?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -35,7 +35,6 @@
<ds-pagination *ngIf="(searchResults$ | async)?.payload?.totalElements > 0" <ds-pagination *ngIf="(searchResults$ | async)?.payload?.totalElements > 0"
[paginationOptions]="configSearch" [paginationOptions]="configSearch"
[pageInfoState]="(searchResults$ | async)?.payload"
[collectionSize]="(searchResults$ | async)?.payload?.totalElements" [collectionSize]="(searchResults$ | async)?.payload?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">
@@ -94,7 +93,6 @@
<ds-pagination *ngIf="(subGroups$ | async)?.payload?.totalElements > 0" <ds-pagination *ngIf="(subGroups$ | async)?.payload?.totalElements > 0"
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="(subGroups$ | async)?.payload"
[collectionSize]="(subGroups$ | async)?.payload?.totalElements" [collectionSize]="(subGroups$ | async)?.payload?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -37,7 +37,6 @@
<ds-pagination <ds-pagination
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && !(loading$ | async)" *ngIf="(pageInfoState$ | async)?.totalElements > 0 && !(loading$ | async)"
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="pageInfoState$"
[collectionSize]="(pageInfoState$ | async)?.totalElements" [collectionSize]="(pageInfoState$ | async)?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -11,7 +11,6 @@
<ds-pagination <ds-pagination
*ngIf="(bitstreamFormats | async)?.payload?.totalElements > 0" *ngIf="(bitstreamFormats | async)?.payload?.totalElements > 0"
[paginationOptions]="pageConfig" [paginationOptions]="pageConfig"
[pageInfoState]="(bitstreamFormats | async)?.payload"
[collectionSize]="(bitstreamFormats | async)?.payload?.totalElements" [collectionSize]="(bitstreamFormats | async)?.payload?.totalElements"
[hideGear]="false" [hideGear]="false"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -16,7 +16,6 @@
<ds-pagination <ds-pagination
*ngIf="fields?.totalElements > 0" *ngIf="fields?.totalElements > 0"
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="fields"
[collectionSize]="fields?.totalElements" [collectionSize]="fields?.totalElements"
[hideGear]="false" [hideGear]="false"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -3,7 +3,6 @@
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"
[hidePaginationDetail]="true" [hidePaginationDetail]="true"
[paginationOptions]="options" [paginationOptions]="options"
[pageInfoState]="(objectsRD$ | async)?.payload"
[collectionSize]="(objectsRD$ | async)?.payload?.totalElements"> [collectionSize]="(objectsRD$ | async)?.payload?.totalElements">
<ng-container *ngIf="!(loading$ | async)"> <ng-container *ngIf="!(loading$ | async)">
<div [id]="bundle.id" class="bundle-bitstreams-list" <div [id]="bundle.id" class="bundle-bitstreams-list"

View File

@@ -10,7 +10,6 @@
<ng-container *ngVar="updates | dsObjectValues as updateValues"> <ng-container *ngVar="updates | dsObjectValues as updateValues">
<ds-pagination <ds-pagination
[paginationOptions]="paginationConfig" [paginationOptions]="paginationConfig"
[pageInfoState]="(relationshipsRd$ | async)?.payload?.pageInfo"
[collectionSize]="(relationshipsRd$ | async)?.payload?.totalElements + (this.nbAddedFields$ | async)" [collectionSize]="(relationshipsRd$ | async)?.payload?.totalElements + (this.nbAddedFields$ | async)"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -6,7 +6,6 @@
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"
[paginationOptions]="originalOptions" [paginationOptions]="originalOptions"
[pageInfoState]="originals"
[collectionSize]="originals?.totalElements" [collectionSize]="originals?.totalElements"
[retainScrollPosition]="true"> [retainScrollPosition]="true">
@@ -49,7 +48,6 @@
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"
[paginationOptions]="licenseOptions" [paginationOptions]="licenseOptions"
[pageInfoState]="licenses"
[collectionSize]="licenses?.totalElements" [collectionSize]="licenses?.totalElements"
[retainScrollPosition]="true"> [retainScrollPosition]="true">

View File

@@ -10,7 +10,6 @@
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"
[paginationOptions]="options" [paginationOptions]="options"
[pageInfoState]="versions"
[collectionSize]="versions?.totalElements" [collectionSize]="versions?.totalElements"
[retainScrollPosition]="true"> [retainScrollPosition]="true">
<table class="table table-striped table-bordered align-middle my-2"> <table class="table table-striped table-bordered align-middle my-2">

View File

@@ -17,7 +17,6 @@
</div> </div>
<ds-pagination *ngIf="(processesRD$ | async)?.payload?.totalElements > 0" <ds-pagination *ngIf="(processesRD$ | async)?.payload?.totalElements > 0"
[paginationOptions]="pageConfig" [paginationOptions]="pageConfig"
[pageInfoState]="(processesRD$ | async)?.payload"
[collectionSize]="(processesRD$ | async)?.payload?.totalElements" [collectionSize]="(processesRD$ | async)?.payload?.totalElements"
[hideGear]="true" [hideGear]="true"
[hidePagerWhenSinglePage]="true"> [hidePagerWhenSinglePage]="true">

View File

@@ -1,6 +1,5 @@
<ds-pagination <ds-pagination
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="objects?.payload"
[collectionSize]="objects?.payload?.totalElements" [collectionSize]="objects?.payload?.totalElements"
[sortOptions]="sortConfig" [sortOptions]="sortConfig"
[objects]="objects" [objects]="objects"

View File

@@ -1,6 +1,5 @@
<ds-pagination <ds-pagination
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="objects?.payload"
[collectionSize]="objects?.payload?.totalElements" [collectionSize]="objects?.payload?.totalElements"
[sortOptions]="sortConfig" [sortOptions]="sortConfig"
[hideGear]="hideGear" [hideGear]="hideGear"

View File

@@ -1,6 +1,5 @@
<ds-pagination <ds-pagination
[paginationOptions]="config" [paginationOptions]="config"
[pageInfoState]="objects?.payload"
[collectionSize]="objects?.payload?.totalElements" [collectionSize]="objects?.payload?.totalElements"
[objects]="objects" [objects]="objects"
[sortOptions]="sortConfig" [sortOptions]="sortConfig"

View File

@@ -3,7 +3,6 @@
*ngIf="collectionsRD?.payload?.totalElements > 0 || collectionsRD?.payload?.page?.length > 0" *ngIf="collectionsRD?.payload?.totalElements > 0 || collectionsRD?.payload?.page?.length > 0"
[paginationOptions]="paginationOptions" [paginationOptions]="paginationOptions"
[sortOptions]="sortOptions" [sortOptions]="sortOptions"
[pageInfoState]="collectionsRD?.payload"
[collectionSize]="collectionsRD?.payload?.totalElements" [collectionSize]="collectionsRD?.payload?.totalElements"
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"
[hideGear]="true"> [hideGear]="true">

View File

@@ -3,7 +3,6 @@
*ngIf="itemsRD?.payload?.totalElements > 0" *ngIf="itemsRD?.payload?.totalElements > 0"
[paginationOptions]="paginationOptions" [paginationOptions]="paginationOptions"
[sortOptions]="sortOptions" [sortOptions]="sortOptions"
[pageInfoState]="itemsRD?.payload"
[collectionSize]="itemsRD?.payload?.totalElements" [collectionSize]="itemsRD?.payload?.totalElements"
[hidePagerWhenSinglePage]="true" [hidePagerWhenSinglePage]="true"
[hideGear]="true"> [hideGear]="true">

View File

@@ -13,11 +13,9 @@ import {
import { Observable, of as observableOf, Subscription } from 'rxjs'; import { Observable, of as observableOf, Subscription } from 'rxjs';
import { HostWindowService } from '../host-window.service'; import { HostWindowService } from '../host-window.service';
import { HostWindowState } from '../search/host-window.reducer';
import { PaginationComponentOptions } from './pagination-component-options.model'; import { PaginationComponentOptions } from './pagination-component-options.model';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { hasValue } from '../empty.util'; import { hasValue } from '../empty.util';
import { PageInfo } from '../../core/shared/page-info.model';
import { PaginationService } from '../../core/pagination/pagination.service'; import { PaginationService } from '../../core/pagination/pagination.service';
import { map, take } from 'rxjs/operators'; import { map, take } from 'rxjs/operators';
import { RemoteData } from '../../core/data/remote-data'; import { RemoteData } from '../../core/data/remote-data';
@@ -47,11 +45,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
*/ */
@Input() collectionSize: number; @Input() collectionSize: number;
/**
* Page state of a Remote paginated objects.
*/
@Input() pageInfoState: Observable<PageInfo> = undefined;
/** /**
* Configuration for the NgbPagination component. * Configuration for the NgbPagination component.
*/ */
@@ -136,18 +129,13 @@ export class PaginationComponent implements OnDestroy, OnInit {
/** /**
* Current page. * Current page.
*/ */
public currentPage$; public currentPage$: Observable<number>;
/** /**
* Current page in the state of a Remote paginated objects. * Current page in the state of a Remote paginated objects.
*/ */
public currentPageState: number = undefined; public currentPageState: number = undefined;
/**
* An observable of HostWindowState type
*/
public hostWindow: Observable<HostWindowState>;
/** /**
* ID for the pagination instance. This ID is used in the routing to retrieve the pagination options. * ID for the pagination instance. This ID is used in the routing to retrieve the pagination options.
* This ID needs to be unique between different pagination components when more than one will be displayed on the same page. * This ID needs to be unique between different pagination components when more than one will be displayed on the same page.
@@ -162,7 +150,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
/** /**
* Number of items per page. * Number of items per page.
*/ */
public pageSize$; public pageSize$: Observable<number>;
/** /**
* Declare SortDirection enumeration to use it in the template * Declare SortDirection enumeration to use it in the template
@@ -183,7 +171,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
/** /**
* Name of the field that's used to sort by * Name of the field that's used to sort by
*/ */
public sortField$; public sortField$: Observable<string>;
public defaultSortField = 'name'; public defaultSortField = 'name';
/** /**
@@ -237,7 +225,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
map((currentPagination) => currentPagination.pageSize) map((currentPagination) => currentPagination.pageSize)
); );
let sortOptions; let sortOptions: SortOptions;
if (this.sortOptions) { if (this.sortOptions) {
sortOptions = this.sortOptions; sortOptions = this.sortOptions;
} else { } else {
@@ -251,16 +239,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
); );
} }
/**
* @param cdRef
* ChangeDetectorRef is a singleton service provided by Angular.
* @param route
* Route is a singleton service provided by Angular.
* @param router
* Router is a singleton service provided by Angular.
* @param hostWindowService
* the HostWindowService singleton.
*/
constructor(private cdRef: ChangeDetectorRef, constructor(private cdRef: ChangeDetectorRef,
private paginationService: PaginationService, private paginationService: PaginationService,
public hostWindowService: HostWindowService) { public hostWindowService: HostWindowService) {
@@ -299,17 +277,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
this.emitPaginationChange(); this.emitPaginationChange();
} }
/**
* Method to change the route to the given sort field
*
* @param sortField
* The sort field being navigated to.
*/
public doSortFieldChange(field: string) {
this.updateParams({ pageId: this.id, page: 1, sortField: field });
this.emitPaginationChange();
}
/** /**
* Method to emit a general pagination change event * Method to emit a general pagination change event
*/ */
@@ -333,8 +300,8 @@ export class PaginationComponent implements OnDestroy, OnInit {
if (collectionSize) { if (collectionSize) {
showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe( showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(
map((currentPaginationOptions) => { map((currentPaginationOptions) => {
let firstItem; let firstItem: number;
let lastItem; let lastItem: number;
const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage; const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage;
firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1; firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1;