[优化] 添加访问日志地区解析功能,更新相关数据结构和前端展示

This commit is contained in:
ryan
2026-03-15 15:21:00 +08:00
parent 640dd6c82c
commit 7c89ad8c7b
14 changed files with 278 additions and 34 deletions
+6
View File
@@ -28,6 +28,7 @@ func TestListAccessLogsIncludesSummaryTotals(t *testing.T) {
NodeID: "node-a",
LoggedAt: now.Add(-5 * time.Minute),
RemoteAddr: "1.1.1.1",
Region: "United States",
Host: "a.example.com",
Path: "/alpha",
StatusCode: 200,
@@ -36,6 +37,7 @@ func TestListAccessLogsIncludesSummaryTotals(t *testing.T) {
NodeID: "node-a",
LoggedAt: now.Add(-4 * time.Minute),
RemoteAddr: "2.2.2.2",
Region: "China",
Host: "a.example.com",
Path: "/beta",
StatusCode: 404,
@@ -44,6 +46,7 @@ func TestListAccessLogsIncludesSummaryTotals(t *testing.T) {
NodeID: "node-b",
LoggedAt: now.Add(-3 * time.Minute),
RemoteAddr: "1.1.1.1",
Region: "United States",
Host: "b.example.com",
Path: "/gamma",
StatusCode: 502,
@@ -74,6 +77,9 @@ func TestListAccessLogsIncludesSummaryTotals(t *testing.T) {
if len(result.Items) != 2 {
t.Fatalf("expected current page items=2, got %d", len(result.Items))
}
if result.Items[1].Region == "" {
t.Fatalf("expected region to be returned, got %+v", result.Items[1])
}
if !result.HasMore {
t.Fatal("expected has_more to be true")
}