feat: Task 4 — paginated banned-IPs section on jail detail page
Backend:
- Add JailBannedIpsResponse Pydantic model (ban.py)
- Add get_jail_banned_ips() service: server-side pagination, optional
IP substring search, geo enrichment on page slice only (jail_service.py)
- Add GET /api/jails/{name}/banned endpoint with page/page_size/search
query params, 400/404/502 error handling (routers/jails.py)
- 23 new tests: 13 service tests + 10 router tests (all passing)
Frontend:
- Add JailBannedIpsResponse TS interface (types/jail.ts)
- Add jailBanned endpoint helper (api/endpoints.ts)
- Add fetchJailBannedIps() API function (api/jails.ts)
- Add BannedIpsSection component: Fluent UI DataGrid, debounced search
(300 ms), prev/next pagination, page-size dropdown, per-row unban
button, loading spinner, empty state, error MessageBar (BannedIpsSection.tsx)
- Mount BannedIpsSection in JailDetailPage between stats and patterns
- 12 new Vitest tests for BannedIpsSection (all passing)
This commit is contained in:
@@ -198,6 +198,26 @@ export interface UnbanAllResponse {
|
||||
count: number;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Jail-specific paginated bans
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Paginated response from `GET /api/jails/{name}/banned`.
|
||||
*
|
||||
* Mirrors `JailBannedIpsResponse` from `backend/app/models/ban.py`.
|
||||
*/
|
||||
export interface JailBannedIpsResponse {
|
||||
/** Active ban entries for the current page. */
|
||||
items: ActiveBan[];
|
||||
/** Total matching entries (after applying any search filter). */
|
||||
total: number;
|
||||
/** Current page number (1-based). */
|
||||
page: number;
|
||||
/** Number of items per page. */
|
||||
page_size: number;
|
||||
}
|
||||
|
||||
export interface GeoDetail {
|
||||
/** ISO 3166-1 alpha-2 country code (e.g. `"DE"`), or `null`. */
|
||||
country_code: string | null;
|
||||
|
||||
Reference in New Issue
Block a user