diff --git a/src/app/core/data/base/put-data.ts b/src/app/core/data/base/put-data.ts index bd2a8d2929..6cd61791e7 100644 --- a/src/app/core/data/base/put-data.ts +++ b/src/app/core/data/base/put-data.ts @@ -55,7 +55,7 @@ export class PutDataImpl extends BaseDataService i */ put(object: T): Observable> { const requestId = this.requestService.generateRequestId(); - const serializedObject = new DSpaceSerializer(object.constructor as GenericConstructor<{}>).serialize(object); + const serializedObject = new DSpaceSerializer(object.constructor as GenericConstructor).serialize(object); const request = new PutRequest(requestId, object._links.self.href, serializedObject); if (hasValue(this.responseMsToLive)) { diff --git a/src/app/core/pagination/pagination-route-params.interface.ts b/src/app/core/pagination/pagination-route-params.interface.ts new file mode 100644 index 0000000000..029b27f255 --- /dev/null +++ b/src/app/core/pagination/pagination-route-params.interface.ts @@ -0,0 +1,15 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +import { SortDirection } from '../cache/models/sort-options.model'; + +export interface PaginationRouteParams { + page?: number + pageSize?: number + sortField?: string + sortDirection?: SortDirection +} diff --git a/src/app/core/pagination/pagination.service.ts b/src/app/core/pagination/pagination.service.ts index ce4c3adc3c..90d307ff4f 100644 --- a/src/app/core/pagination/pagination.service.ts +++ b/src/app/core/pagination/pagination.service.ts @@ -9,6 +9,7 @@ import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util'; import { difference } from '../../shared/object.util'; import { FindListOptions } from '../data/find-list-options.model'; import { isNumeric } from '../../shared/numeric.util'; +import { PaginationRouteParams } from './pagination-route-params.interface'; @Injectable({ providedIn: 'root', @@ -121,13 +122,8 @@ export class PaginationService { */ updateRoute( paginationId: string, - params: { - page?: number - pageSize?: number - sortField?: string - sortDirection?: SortDirection - }, - extraParams?, + params: PaginationRouteParams, + extraParams?: Record, retainScrollPosition?: boolean, navigationExtras?: NavigationExtras, ) { @@ -147,13 +143,8 @@ export class PaginationService { updateRouteWithUrl( paginationId: string, url: string[], - params: { - page?: number - pageSize?: number - sortField?: string - sortDirection?: SortDirection - }, - extraParams?, + params: PaginationRouteParams, + extraParams?: Record, retainScrollPosition?: boolean, navigationExtras?: NavigationExtras, ) { @@ -219,12 +210,7 @@ export class PaginationService { ); } - private getParametersWithIdName(paginationId: string, params: { - page?: number - pageSize?: number - sortField?: string - sortDirection?: SortDirection - }) { + private getParametersWithIdName(paginationId: string, params: PaginationRouteParams) { const paramsWithIdName = {}; if (hasValue(params.page)) { paramsWithIdName[`${paginationId}.page`] = `${params.page}`; diff --git a/src/app/home-page/recent-item-list/recent-item-list.component.ts b/src/app/home-page/recent-item-list/recent-item-list.component.ts index 9a8535d970..93bf4a6abf 100644 --- a/src/app/home-page/recent-item-list/recent-item-list.component.ts +++ b/src/app/home-page/recent-item-list/recent-item-list.component.ts @@ -48,7 +48,7 @@ export class RecentItemListComponent implements OnInit { public searchConfigurationService: SearchConfigurationService, protected elementRef: ElementRef, @Inject(APP_CONFIG) private appConfig: AppConfig, - @Inject(PLATFORM_ID) private platformId: Object, + @Inject(PLATFORM_ID) private platformId: any, ) { this.paginationConfig = Object.assign(new PaginationComponentOptions(), { diff --git a/src/app/item-page/simple/related-items/related-items-component.ts b/src/app/item-page/simple/related-items/related-items-component.ts index 2746670abe..29b7425314 100644 --- a/src/app/item-page/simple/related-items/related-items-component.ts +++ b/src/app/item-page/simple/related-items/related-items-component.ts @@ -65,7 +65,7 @@ export class RelatedItemsComponent extends AbstractIncrementalListComponent {}; + function: () => void; } diff --git a/src/app/shared/mocks/action.mock.ts b/src/app/shared/mocks/action.mock.ts index e227946f64..f5c7c683b0 100644 --- a/src/app/shared/mocks/action.mock.ts +++ b/src/app/shared/mocks/action.mock.ts @@ -2,5 +2,5 @@ import { Action } from '@ngrx/store'; export class ActionMock implements Action { type = null; - payload: {}; + payload: any; } diff --git a/src/app/shared/mocks/active-router.mock.ts b/src/app/shared/mocks/active-router.mock.ts index 672cdcd8f6..12fb45df6b 100644 --- a/src/app/shared/mocks/active-router.mock.ts +++ b/src/app/shared/mocks/active-router.mock.ts @@ -22,7 +22,7 @@ export class MockActivatedRoute { // Test parameters get testParams() { return this._testParams; } - set testParams(params: {}) { + set testParams(params: any) { this._testParams = params; this.subject.next(params); } diff --git a/src/app/shared/object-collection/object-collection.component.ts b/src/app/shared/object-collection/object-collection.component.ts index e1f9182562..d16b57af28 100644 --- a/src/app/shared/object-collection/object-collection.component.ts +++ b/src/app/shared/object-collection/object-collection.component.ts @@ -189,7 +189,7 @@ export class ObjectCollectionComponent implements OnInit { private route: ActivatedRoute, private router: Router, private elementRef: ElementRef, - @Inject(PLATFORM_ID) private platformId: Object) { + @Inject(PLATFORM_ID) private platformId: any) { } ngOnInit(): void { diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index aa6f727c50..3938ca2446 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -24,6 +24,7 @@ import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list.model'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { ViewMode } from '../../core/shared/view-mode.model'; +import { PaginationRouteParams } from '../../core/pagination/pagination-route-params.interface'; /** * The default pagination controls component. @@ -273,7 +274,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The page being navigated to. */ public doPageChange(page: number) { - this.updateParams({page: page.toString()}); + this.updateParams({page: page}); this.emitPaginationChange(); } @@ -284,7 +285,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The page size being navigated to. */ public doPageSizeChange(pageSize: number) { - this.updateParams({ pageId: this.id, page: 1, pageSize: pageSize }); + this.updateParams({ page: 1, pageSize: pageSize }); this.emitPaginationChange(); } @@ -295,7 +296,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The sort direction being navigated to. */ public doSortDirectionChange(sortDirection: SortDirection) { - this.updateParams({ pageId: this.id, page: 1, sortDirection: sortDirection }); + this.updateParams({ page: 1, sortDirection: sortDirection }); this.emitPaginationChange(); } @@ -306,7 +307,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The sort field being navigated to. */ public doSortFieldChange(field: string) { - this.updateParams({ pageId: this.id, page: 1, sortField: field }); + this.updateParams({ page: 1, sortField: field }); this.emitPaginationChange(); } @@ -321,7 +322,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * Update the current query params and optionally update the route * @param params */ - private updateParams(params: {}) { + private updateParams(params: PaginationRouteParams) { this.paginationService.updateRoute(this.id, params, {}, this.retainScrollPosition); } @@ -407,7 +408,7 @@ export class PaginationComponent implements OnDestroy, OnInit { */ updatePagination(value: number) { this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(take(1)).subscribe((currentPaginationOptions) => { - this.updateParams({page: (currentPaginationOptions.currentPage + value).toString()}); + this.updateParams({ page: (currentPaginationOptions.currentPage + value) }); }); } diff --git a/src/app/shared/testing/action.mock.ts b/src/app/shared/testing/action.mock.ts index e227946f64..fc1e741c20 100644 --- a/src/app/shared/testing/action.mock.ts +++ b/src/app/shared/testing/action.mock.ts @@ -2,5 +2,5 @@ import { Action } from '@ngrx/store'; export class ActionMock implements Action { type = null; - payload: {}; + payload: unknown; } diff --git a/src/app/shared/testing/active-router.stub.ts b/src/app/shared/testing/active-router.stub.ts index 495920555b..28993a9a04 100644 --- a/src/app/shared/testing/active-router.stub.ts +++ b/src/app/shared/testing/active-router.stub.ts @@ -35,7 +35,7 @@ export class ActivatedRouteStub { return this._testParams; } - set testParams(params: {}) { + set testParams(params: unknown) { this._testParams = params; this.subject.next(params); } @@ -45,7 +45,7 @@ export class ActivatedRouteStub { return this._testParams; } - set testData(data: {}) { + set testData(data: unknown) { this._testData = data; this.dataSubject.next(data); } diff --git a/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts b/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts index 27bdb14f1d..c564663044 100644 --- a/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts +++ b/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts @@ -48,7 +48,7 @@ export class SystemWideAlertBannerComponent implements OnInit, OnDestroy { subscriptions: Subscription[] = []; constructor( - @Inject(PLATFORM_ID) protected platformId: Object, + @Inject(PLATFORM_ID) protected platformId: any, protected systemWideAlertDataService: SystemWideAlertDataService, protected notificationsService: NotificationsService, ) {