diff --git a/CHANGELOG.md b/CHANGELOG.md index 543730f..6cca37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ All notable changes to Flypaper are documented in this file. The format follows 24 hours, and the catch list marks them with an "Abgelehnt" badge. Outcomes are shown in German. Top lists and hold times still count only real catches. - The "Haltezeit gesamt" metric shows the average hold time per catch below it. +- Dashboard polish: equal metric tiles with a one-line note each (unique IPs show the last + 24 hours), map and top 10 card of equal height with a larger legend and visible + small-country markers, country and provider names in the regular font with a separate share + column, and German number formats throughout (e.g. `1.675` bytes, `15.11. 20:01:50`). ## [0.3.1] - 2026-11-15 diff --git a/src/Flypaper.Storage/Dashboard/DashboardData.cs b/src/Flypaper.Storage/Dashboard/DashboardData.cs index 3744061..ba53ce8 100644 --- a/src/Flypaper.Storage/Dashboard/DashboardData.cs +++ b/src/Flypaper.Storage/Dashboard/DashboardData.cs @@ -8,6 +8,7 @@ public sealed record DashboardData( int Rejected, int RejectedLast24Hours, int UniqueIps, + int UniqueIpsLast24Hours, TimeSpan TotalHoldTime, IReadOnlyList Recent, IReadOnlyList TopIps, diff --git a/src/Flypaper.Storage/Dashboard/DashboardQueries.cs b/src/Flypaper.Storage/Dashboard/DashboardQueries.cs index 6ff1f30..d150898 100644 --- a/src/Flypaper.Storage/Dashboard/DashboardQueries.cs +++ b/src/Flypaper.Storage/Dashboard/DashboardQueries.cs @@ -39,6 +39,7 @@ public sealed class DashboardQueries(IDbContextFactory dbCont await events.CountAsync(e => e.Outcome == TrapOutcome.Rejected, ct), await events.CountAsync(e => e.Outcome == TrapOutcome.Rejected && e.StartedAt >= since, ct), await events.Select(e => e.RemoteIp).Distinct().CountAsync(ct), + await events.Where(e => e.StartedAt >= since).Select(e => e.RemoteIp).Distinct().CountAsync(ct), TimeSpan.FromMilliseconds(await catches.SumAsync(e => e.DurationMs, ct)), await events.OrderByDescending(e => e.Id).Take(RecentCount).ToListAsync(ct), await TopAsync(catches.GroupBy(e => e.RemoteIp), ct), diff --git a/src/Flypaper.Web/Components/Pages/Dashboard/DashboardPage.razor b/src/Flypaper.Web/Components/Pages/Dashboard/DashboardPage.razor index 6c3e754..cd815e7 100644 --- a/src/Flypaper.Web/Components/Pages/Dashboard/DashboardPage.razor +++ b/src/Flypaper.Web/Components/Pages/Dashboard/DashboardPage.razor @@ -24,19 +24,20 @@ var active = Governor.ActiveConnections; var tabs = TopTabs(data);
-
+
Gerade in der Falle - @active.ToString("N0") - @(active == 1 ? "Bot wird festgehalten" : "Bots werden festgehalten") + @Formatting.Number(active) + @(active == 1 ? "Bot festgehalten" : "Bots festgehalten")
-
+
Fänge gesamt - @data.TotalCatches.ToString("N0") - +@data.CatchesLast24Hours.ToString("N0") in den letzten 24 h + @Formatting.Number(data.TotalCatches) + +@Formatting.Number(data.CatchesLast24Hours) in 24 h
Eindeutige IPs - @data.UniqueIps.ToString("N0") + @Formatting.Number(data.UniqueIps) + @Formatting.Number(data.UniqueIpsLast24Hours) in 24 h aktiv
Haltezeit gesamt @@ -45,8 +46,8 @@
Abgelehnt - @data.Rejected.ToString("N0") - +@data.RejectedLast24Hours.ToString("N0") in 24 h · Verbindungslimit erreicht + @Formatting.Number(data.Rejected) + +@Formatting.Number(data.RejectedLast24Hours) in 24 h · Limit erreicht
@@ -112,9 +113,9 @@ var provider = Formatting.Provider(trapEvent.Asn, trapEvent.Provider); var target = Formatting.Target(trapEvent.Target); var duration = Formatting.Duration(TimeSpan.FromMilliseconds(trapEvent.DurationMs)); - var bytes = trapEvent.BytesSent.ToString("N0"); + var bytes = Formatting.Number(trapEvent.BytesSent); - @started.ToString("dd.MM.") @started.ToString("HH:mm:ss") + @started.ToString("dd.MM.") @started.ToString("HH:mm:ss") @trapEvent.RemoteIp @if (trapEvent.CountryCode is { } countryCode) diff --git a/src/Flypaper.Web/Components/Pages/Dashboard/TopTable.razor b/src/Flypaper.Web/Components/Pages/Dashboard/TopTable.razor index 2f5322a..f344f9c 100644 --- a/src/Flypaper.Web/Components/Pages/Dashboard/TopTable.razor +++ b/src/Flypaper.Web/Components/Pages/Dashboard/TopTable.razor @@ -10,12 +10,14 @@ else + + @@ -23,10 +25,27 @@ else @foreach (var entry in Entries) { + var key = KeyFormatter?.Invoke(entry.Key) ?? entry.Key; + var label = LabelFormatter is null ? entry.Label : LabelFormatter(entry.Key, entry.Label); var share = (entry.Count * 100.0 / Entries[0].Count).ToString("0.#", CultureInfo.InvariantCulture); - - - + + + + } @@ -44,11 +63,4 @@ else [Parameter] public Func? KeyFormatter { get; set; } [Parameter] public Func? LabelFormatter { get; set; } - - private string Display(TopEntry entry) - { - var key = KeyFormatter?.Invoke(entry.Key) ?? entry.Key; - var label = LabelFormatter is null ? entry.Label : LabelFormatter(entry.Key, entry.Label); - return label is null ? key : $"{key} · {label}"; - } } diff --git a/src/Flypaper.Web/Components/Pages/Dashboard/WorldMap.razor b/src/Flypaper.Web/Components/Pages/Dashboard/WorldMap.razor index 5fa5d9d..9465baa 100644 --- a/src/Flypaper.Web/Components/Pages/Dashboard/WorldMap.razor +++ b/src/Flypaper.Web/Components/Pages/Dashboard/WorldMap.razor @@ -12,7 +12,7 @@ { } - @_max.ToString("N0") + @Formatting.Number(_max) } diff --git a/src/Flypaper.Web/Components/Pages/Settings/HoldMethodSection.razor b/src/Flypaper.Web/Components/Pages/Settings/HoldMethodSection.razor index 989f430..ed7acfc 100644 --- a/src/Flypaper.Web/Components/Pages/Settings/HoldMethodSection.razor +++ b/src/Flypaper.Web/Components/Pages/Settings/HoldMethodSection.razor @@ -107,7 +107,7 @@ var bytesPerSecond = HoldMethodSettings.AverageBytesPerSecond( TimeSpan.FromMilliseconds(minDelay), TimeSpan.FromMilliseconds(maxDelay), minChunk, maxChunk); - return bytesPerSecond.ToString(bytesPerSecond < 10 ? "0.0" : "N0", CultureInfo.GetCultureInfo("de-DE")); + return bytesPerSecond.ToString(bytesPerSecond < 10 ? "0.0" : "N0", Formatting.German); } } diff --git a/src/Flypaper.Web/Components/Pages/Settings/TrapDataSection.razor b/src/Flypaper.Web/Components/Pages/Settings/TrapDataSection.razor index d5b5cda..f869927 100644 --- a/src/Flypaper.Web/Components/Pages/Settings/TrapDataSection.razor +++ b/src/Flypaper.Web/Components/Pages/Settings/TrapDataSection.razor @@ -5,12 +5,12 @@ @if (Deleted is { } deleted) { - @deleted.ToString("N0") @(deleted == 1 ? "Fang" : "Fänge") gelöscht. + @Formatting.Number(deleted) @(deleted == 1 ? "Fang" : "Fänge") gelöscht. }
-
Fänge@(_stats?.Count.ToString("N0") ?? "–")
+
Fänge@((_stats is null ? null : Formatting.Number(_stats.Count)) ?? "–")
Ältester Fang@(_stats?.Oldest?.ToLocalTime().ToString("dd.MM.yyyy") ?? "–")
Datenbank@Formatting.Bytes(_stats?.DatabaseBytes)
diff --git a/src/Flypaper.Web/Components/Shared/Formatting.cs b/src/Flypaper.Web/Components/Shared/Formatting.cs index 266749f..1880cba 100644 --- a/src/Flypaper.Web/Components/Shared/Formatting.cs +++ b/src/Flypaper.Web/Components/Shared/Formatting.cs @@ -1,7 +1,13 @@ +using System.Globalization; + namespace Flypaper.Web.Components.Shared; public static class Formatting { + public static readonly CultureInfo German = CultureInfo.GetCultureInfo("de-DE"); + + public static string Number(long value) => value.ToString("N0", German); + public static string Duration(TimeSpan duration) => duration switch { { TotalDays: >= 1 } => $"{(int)duration.TotalDays}\u00a0d {duration.Hours}\u00a0h", diff --git a/src/Flypaper.Web/wwwroot/app.css b/src/Flypaper.Web/wwwroot/app.css index 4c7a8ef..022e4fa 100644 --- a/src/Flypaper.Web/wwwroot/app.css +++ b/src/Flypaper.Web/wwwroot/app.css @@ -42,7 +42,7 @@ h1:focus { } .page { - max-width: 1280px; + max-width: 1440px; margin: 0 auto; padding: 24px 16px 48px; } @@ -58,7 +58,7 @@ h2 { .metrics { display: grid; - grid-template-columns: repeat(2, minmax(0, 1.4fr)) repeat(3, minmax(0, 1fr)); + grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; } @@ -85,33 +85,32 @@ h2 { } .metric .value { - margin-top: 4px; - font-size: 22px; + margin: 6px 0 2px; + font-size: 28px; font-weight: 600; + line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; } .metric .sub { + overflow: hidden; color: var(--muted); font-size: 12px; + white-space: nowrap; + text-overflow: ellipsis; } -.metric-hero .value { - font-size: 32px; - line-height: 1.15; -} - -.metric-hero.live { +.metric.live { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); } -.metric-hero.live .value { +.metric.live .value { color: var(--accent); } -.metric-hero.live .label::before, +.metric.live .label::before, .live-dot { content: ""; display: inline-block; @@ -135,7 +134,7 @@ h2 { } @media (prefers-reduced-motion: reduce) { - .metric-hero.live .label::before, + .metric.live .label::before, .live-dot { animation: none; } @@ -182,9 +181,18 @@ code { .origin { display: grid; - grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); + grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; - align-items: start; + margin-bottom: 16px; +} + +.origin > .card { + margin-bottom: 0; +} + +.map-card { + display: flex; + flex-direction: column; } .origin > * { @@ -236,12 +244,33 @@ code { table-layout: fixed; } -.top-table .count { +.top-table .share { width: 64px; } +.top-table .count { + width: 60px; +} + .top-table .hold { - width: 104px; + width: 96px; +} + +.top-table .flag { + margin-right: 6px; +} + +.top-key { + margin-left: 6px; + color: var(--muted); + font-size: 12px; +} + +.share-bar { + display: block; + height: 6px; + border-radius: 3px; + background: linear-gradient(to right, var(--accent) var(--share), color-mix(in srgb, var(--text) 8%, transparent) var(--share)); } .top-table .clip { @@ -669,8 +698,9 @@ tbody th { } .world-map .marker .dot { - stroke: var(--surface); + stroke: var(--text); stroke-width: 1.5; + stroke-opacity: 0.85; } .world-map .marker:hover .dot { @@ -715,9 +745,10 @@ tbody th { .map-legend { display: flex; align-items: center; - gap: 4px; + gap: 5px; color: var(--muted); - font-size: 12px; + font-size: 13px; + font-variant-numeric: tabular-nums; } .map-legend .level-0 { @@ -726,6 +757,9 @@ tbody th { .map-wrap { position: relative; + display: flex; + flex: 1; + align-items: center; } .map-empty { @@ -743,17 +777,10 @@ tbody th { white-space: nowrap; } -td.bar { - background-image: linear-gradient(to right, color-mix(in srgb, var(--accent) 70%, transparent) var(--share), transparent var(--share)); - background-repeat: no-repeat; - background-size: 100% 3px; - background-position: 0 calc(100% - 3px); -} - .map-legend .swatch { - width: 18px; - height: 10px; - border-radius: 2px; + width: 22px; + height: 12px; + border-radius: 3px; } .detail { @@ -789,7 +816,7 @@ button.danger { grid-column: span 2; } - .metric-hero { + .metric:nth-child(n + 4) { grid-column: span 3; } @@ -804,7 +831,7 @@ button.danger { } .metric, - .metric-hero { + .metric:nth-child(n + 4) { grid-column: span 1; } @@ -812,8 +839,19 @@ button.danger { grid-column: span 2; } - .metric-hero .value { - font-size: 26px; + .metric .value { + font-size: 24px; + } + + .top-table .share, + .top-table th:nth-child(2), + .top-table td:nth-child(2), + .top-key { + display: none; + } + + .top-table .hold { + width: 84px; } .nav .brand { @@ -1379,3 +1417,12 @@ button.danger-text { gap: 2px; } } + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; +}
@KeyLabelAnteil Fänge Haltezeit