Show the strategy of each catch in the dashboard
Add a Strategie column to the catch list (searchable, filterable) and a Strategien tab to the Top 10 card. The MCP top tool accepts strategies. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d3e6f8842
commit
b7027e2a72
15 files changed
+83
-24
No files matched your search
@@ -10,10 +10,10 @@ public sealed class DashboardFilterTests
|
||||
[Fact]
|
||||
public void Parses_all_parameters()
|
||||
{
|
||||
var filter = DashboardFilter.Parse("24h", "Abgelehnt", "hk", "as4134", " 203.0.113.9 ", "GET /.env", " wp ", "100");
|
||||
var filter = DashboardFilter.Parse("24h", "Abgelehnt", "hk", "as4134", " 203.0.113.9 ", "GET /.env", " env-drip ", " wp ", "100");
|
||||
|
||||
filter.ShouldBe(new DashboardFilter("24h", "abgelehnt", "HK", "AS4134", "203.0.113.9", "GET /.env", "wp", 100));
|
||||
filter.ToRecentFilter().ShouldBe(new RecentFilter(TimeSpan.FromHours(24), TrapOutcome.Rejected, "HK", 4134, "203.0.113.9", "GET /.env", "wp", 100));
|
||||
filter.ShouldBe(new DashboardFilter("24h", "abgelehnt", "HK", "AS4134", "203.0.113.9", "GET /.env", "env-drip", "wp", 100));
|
||||
filter.ToRecentFilter().ShouldBe(new RecentFilter(TimeSpan.FromHours(24), TrapOutcome.Rejected, "HK", 4134, "203.0.113.9", "GET /.env", "env-drip", "wp", 100));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -21,12 +21,12 @@ public sealed class DashboardFilterTests
|
||||
[InlineData("zeitlimit", TrapOutcome.Timeout)]
|
||||
[InlineData("abgelehnt", TrapOutcome.Rejected)]
|
||||
public void Maps_outcomes(string value, TrapOutcome expected) =>
|
||||
DashboardFilter.Parse(null, value, null, null, null, null, null, null).ToRecentFilter().Outcome.ShouldBe(expected);
|
||||
DashboardFilter.Parse(null, value, null, null, null, null, null, null, null).ToRecentFilter().Outcome.ShouldBe(expected);
|
||||
|
||||
[Fact]
|
||||
public void Ignores_invalid_values()
|
||||
{
|
||||
var filter = DashboardFilter.Parse("gestern", "kaputt", "Hongkong", "Chinanet", "not-an-ip", " ", "", "viele");
|
||||
var filter = DashboardFilter.Parse("gestern", "kaputt", "Hongkong", "Chinanet", "not-an-ip", " ", " ", "", "viele");
|
||||
|
||||
filter.ShouldBe(new DashboardFilter());
|
||||
filter.IsEmpty.ShouldBeTrue();
|
||||
@@ -38,23 +38,23 @@ public sealed class DashboardFilterTests
|
||||
[InlineData("100000", RecentFilter.MaxLimit)]
|
||||
[InlineData(null, RecentFilter.DefaultLimit)]
|
||||
public void Clamps_the_limit(string? limit, int expected) =>
|
||||
DashboardFilter.Parse(null, null, null, null, null, null, null, limit).Limit.ShouldBe(expected);
|
||||
DashboardFilter.Parse(null, null, null, null, null, null, null, null, limit).Limit.ShouldBe(expected);
|
||||
|
||||
[Fact]
|
||||
public void Builds_links_without_defaults_and_with_escaping()
|
||||
{
|
||||
new DashboardFilter().Href().ShouldBe("/#faenge");
|
||||
new DashboardFilter(Land: "CN", Ziel: "GET example.com/a&b", Limit: 100).Href("f50")
|
||||
.ShouldBe("/?land=CN&ziel=GET%20example.com%2Fa%26b&limit=100#f50");
|
||||
new DashboardFilter(Land: "CN", Ziel: "GET example.com/a&b", Strategie: "html-drip 50-500ms 1-1024B", Limit: 100).Href("f50")
|
||||
.ShouldBe("/?land=CN&ziel=GET%20example.com%2Fa%26b&strategie=html-drip%2050-500ms%201-1024B&limit=100#f50");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Links_round_trip()
|
||||
{
|
||||
var filter = new DashboardFilter("7d", "zeitlimit", "TW", "AS3462", "2001:db8::1", "POST /xmlrpc.php", "curl", 200);
|
||||
var filter = new DashboardFilter("7d", "zeitlimit", "TW", "AS3462", "2001:db8::1", "POST /xmlrpc.php", "hikvision-drip", "curl", 200);
|
||||
var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(new Uri("http://x" + filter.Href()).Query);
|
||||
|
||||
DashboardFilter.Parse(query["zeit"], query["ausgang"], query["land"], query["provider"], query["ip"], query["ziel"], query["q"], query["limit"])
|
||||
DashboardFilter.Parse(query["zeit"], query["ausgang"], query["land"], query["provider"], query["ip"], query["ziel"], query["strategie"], query["q"], query["limit"])
|
||||
.ShouldBe(filter);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user