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>
<ds-pagination
[paginationOptions]="(paginationOptions$ | async)"
[pageInfoState]="(objectsSelected$|async)?.payload.pageInfo"
[collectionSize]="(objectsSelected$|async)?.payload?.totalElements"
[objects]="(objectsSelected$|async)"
[showPaginator]="false"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,11 +13,9 @@ import {
import { Observable, of as observableOf, Subscription } from 'rxjs';
import { HostWindowService } from '../host-window.service';
import { HostWindowState } from '../search/host-window.reducer';
import { PaginationComponentOptions } from './pagination-component-options.model';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { hasValue } from '../empty.util';
import { PageInfo } from '../../core/shared/page-info.model';
import { PaginationService } from '../../core/pagination/pagination.service';
import { map, take } from 'rxjs/operators';
import { RemoteData } from '../../core/data/remote-data';
@@ -47,11 +45,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
*/
@Input() collectionSize: number;
/**
* Page state of a Remote paginated objects.
*/
@Input() pageInfoState: Observable<PageInfo> = undefined;
/**
* Configuration for the NgbPagination component.
*/
@@ -136,18 +129,13 @@ export class PaginationComponent implements OnDestroy, OnInit {
/**
* Current page.
*/
public currentPage$;
public currentPage$: Observable<number>;
/**
* Current page in the state of a Remote paginated objects.
*/
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.
* 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.
*/
public pageSize$;
public pageSize$: Observable<number>;
/**
* 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
*/
public sortField$;
public sortField$: Observable<string>;
public defaultSortField = 'name';
/**
@@ -237,7 +225,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
map((currentPagination) => currentPagination.pageSize)
);
let sortOptions;
let sortOptions: SortOptions;
if (this.sortOptions) {
sortOptions = this.sortOptions;
} 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,
private paginationService: PaginationService,
public hostWindowService: HostWindowService) {
@@ -299,17 +277,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
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
*/
@@ -333,8 +300,8 @@ export class PaginationComponent implements OnDestroy, OnInit {
if (collectionSize) {
showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(
map((currentPaginationOptions) => {
let firstItem;
let lastItem;
let firstItem: number;
let lastItem: number;
const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage;
firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1;