Add pagination handling with pageSize and pageChange EventEmitter

Introduced `pageSize` in `bans.component.ts` to manage pagination logic and updated `buttonActive` to account for page size constraints. Added `pageChange` EventEmitter in `history.component.ts` to notify the parent component of page changes. Updated the template to bind `pageChange` for dynamic page size updates.
This commit is contained in:
2025-04-12 22:11:40 +02:00
parent d535dd1ba9
commit a5adb031bd
3 changed files with 10 additions and 3 deletions
@@ -1,4 +1,4 @@
import {Component, Input, OnChanges, OnInit} from '@angular/core';
import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core';
import {BASE_PATH, HistoryService, PunishmentHistoryInner} from '../../../api';
import {map, Observable, shareReplay} from 'rxjs';
import {NgForOf, NgIf, NgOptimizedImage} from '@angular/common';
@@ -25,6 +25,8 @@ export class HistoryComponent implements OnInit, OnChanges {
@Input() page: number = 0;
@Input() searchTerm: string = '';
@Output() pageChange = new EventEmitter<number>();
private uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
public history: PunishmentHistoryInner[] = []
@@ -34,6 +36,7 @@ export class HistoryComponent implements OnInit, OnChanges {
ngOnChanges(): void {
this.reloadHistory();
this.pageChange.emit(this.page);
}
ngOnInit(): void {