mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-12 18:26:36 +08:00
[优化] 添加访问日志地区解析功能,更新相关数据结构和前端展示
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user