From d3f564d66f22df86869f42486256de2a4de7eb24 Mon Sep 17 00:00:00 2001 From: Lukas Date: Sun, 5 Apr 2026 20:59:28 +0200 Subject: [PATCH] Remove inline map count labels and hide archive source badges --- Docs/Features.md | 14 ++++++++++---- frontend/src/components/WorldMap.tsx | 11 ----------- frontend/src/pages/DashboardPage.tsx | 5 +---- frontend/src/pages/HistoryPage.tsx | 22 ---------------------- frontend/src/pages/MapPage.tsx | 3 --- 5 files changed, 11 insertions(+), 44 deletions(-) diff --git a/Docs/Features.md b/Docs/Features.md index 058fbe9..3989f4f 100644 --- a/Docs/Features.md +++ b/Docs/Features.md @@ -52,6 +52,8 @@ The main landing page after login. Shows recent ban activity at a glance. - Last 7 days (week) - Last 30 days (month) - Last 365 days (year) +- **Data source selection:** The "Last 24 hours" preset queries fail2ban's live database directly for real-time accuracy. All longer presets (7 days, 30 days, 365 days) query the BanGUI long-term archive, because fail2ban's own database only retains the last 24 hours by default. +- A **data-source badge** next to the time-range selector indicates whether the current view is showing **Live (fail2ban DB)** or **Archive (BanGUI DB)** data. --- @@ -70,14 +72,16 @@ A geographical overview of ban activity. - Colors are smoothly interpolated between the thresholds (e.g., 35 bans shows a yellow-green blend) - The color threshold values are configurable through the application settings - **Interactive zoom and pan:** Users can zoom in/out using mouse wheel or touch gestures, and pan by clicking and dragging. This allows detailed inspection of densely-affected regions. Zoom controls (zoom in, zoom out, reset view) are provided as overlay buttons in the top-right corner. -- For every country that has bans, the total count is displayed centred inside that country's borders in the selected time range. -- Countries with zero banned IPs show no number and no label — they remain blank and transparent. +- For every country that has bans, the total count is shown only in the country tooltip, not rendered on the map itself. +- Countries with zero banned IPs show no tooltip and remain blank and transparent. - Clicking a country filters the companion table below to show only bans from that country. - Time-range selector with the same quick presets: - Last 24 hours - Last 7 days - Last 30 days - Last 365 days +- **Data source selection:** Same rule as the Dashboard — "Last 24 hours" uses the live fail2ban database; all other ranges use the BanGUI archive. +- A **data-source badge** is displayed alongside the time-range selector indicating **Live (fail2ban DB)** or **Archive (BanGUI DB)**. --- @@ -245,13 +249,15 @@ A page to inspect and modify the fail2ban configuration without leaving the web ## 7. Ban History -A view for exploring historical ban data stored in the fail2ban database. +A view for exploring historical ban data stored in the BanGUI long-term archive. ### History Table - Browse all past bans across all jails, not just the currently active ones. - **Columns:** Time of ban, IP address, jail, ban duration, ban count (how many times this IP was banned), country. - Filter by jail, by IP address, or by time range. +- The default time range on first load is **Last 7 days** and the data source is always the **BanGUI archive**, ensuring the full retention window is visible regardless of fail2ban's `dbpurgeage` setting. +- A **data-source badge** is displayed indicating **Archive (BanGUI DB)**. - See at a glance which IPs are repeat offenders (high ban count). ### Per-IP History @@ -265,7 +271,7 @@ A view for exploring historical ban data stored in the fail2ban database. - On each configured sync cycle (default every 5 minutes), BanGUI reads latest entries from fail2ban `bans` table and appends any new events to BanGUI history storage. - Supports both `ban` and `unban` events; audit record includes: `timestamp`, `ip`, `jail`, `action`, `duration`, `origin` (manual, auto, blocklist, etc.), `failures`, `matches`, and optional `country` / `ASN` enrichment. - Includes incremental import logic with dedupe: using unique constraint on (ip, jail, action, timeofban) to prevent duplication across sync cycles. -- Provides backfill mode for initial startup: import last N days (configurable, default 7 days) of existing fail2ban history into BanGUI to avoid dark gaps after restart. +- Provides backfill mode for initial startup: import the last 7.5 days of existing fail2ban history into BanGUI to avoid dark gaps after restart. Requires fail2ban's `dbpurgeage` to be set to at least `648000` (7.5 days) — BanGUI ships with this value pre-configured in its Docker setup. - Includes configurable archive purge policy in BanGUI (default 365 days), separate from fail2ban `dbpurgeage`, to keep app storage bounded while preserving audit data. - Expose API endpoints for querying persistent history, with filters for timeframe, jail, origin, IP, and current ban status. - On fail2ban connectivity failure, BanGUI continues serving historical data; next successful sync resumes ingestion without data loss. diff --git a/frontend/src/components/WorldMap.tsx b/frontend/src/components/WorldMap.tsx index ab4952e..d771bb1 100644 --- a/frontend/src/components/WorldMap.tsx +++ b/frontend/src/components/WorldMap.tsx @@ -410,17 +410,6 @@ export function WorldMap({ setTooltip(null); }} /> - {count > 0 && isCentroidValid && ( - - {count} - - )} ); })} diff --git a/frontend/src/pages/DashboardPage.tsx b/frontend/src/pages/DashboardPage.tsx index 60921fa..b8fe6a1 100644 --- a/frontend/src/pages/DashboardPage.tsx +++ b/frontend/src/pages/DashboardPage.tsx @@ -7,7 +7,7 @@ */ import { useState } from "react"; -import { Badge, Text, makeStyles, tokens } from "@fluentui/react-components"; +import { Text, makeStyles, tokens } from "@fluentui/react-components"; import { BanTable } from "../components/BanTable"; import { BanTrendChart } from "../components/BanTrendChart"; import { ChartStateWrapper } from "../components/ChartStateWrapper"; @@ -95,9 +95,6 @@ export function DashboardPage(): React.JSX.Element { originFilter={originFilter} onOriginFilterChange={setOriginFilter} /> - - {source === "archive" ? "Archive (BanGUI DB)" : "Live (fail2ban DB)"} - {/* ------------------------------------------------------------------ */} diff --git a/frontend/src/pages/HistoryPage.tsx b/frontend/src/pages/HistoryPage.tsx index 83de3fc..f584380 100644 --- a/frontend/src/pages/HistoryPage.tsx +++ b/frontend/src/pages/HistoryPage.tsx @@ -402,8 +402,6 @@ export function HistoryPage(): React.JSX.Element { const { items, total, page, loading, error, setPage, refresh } = useHistory(appliedQuery); - const sourceLabel = "Archive (BanGUI DB)"; - useEffect((): void => { const nextQuery: HistoryQuery = { range, @@ -490,27 +488,7 @@ export function HistoryPage(): React.JSX.Element { setIpFilter(value); }} /> - - {sourceLabel} - - - {/* ---------------------------------------------------------------- */} - {/* Error / loading state */} - {/* ---------------------------------------------------------------- */} - {error && ( - - {error} - - )} - - {loading && !error && ( -
- -
- )} {/* ---------------------------------------------------------------- */} {/* Summary */} diff --git a/frontend/src/pages/MapPage.tsx b/frontend/src/pages/MapPage.tsx index 60ce55f..98a82a1 100644 --- a/frontend/src/pages/MapPage.tsx +++ b/frontend/src/pages/MapPage.tsx @@ -165,9 +165,6 @@ export function MapPage(): React.JSX.Element { setSelectedCountry(null); }} /> - - {source === "archive" ? "Archive (BanGUI DB)" : "Live (fail2ban DB)"} -