From fdd7a0337852ec589da3e10d8f614674be80333c Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Mon, 27 Apr 2026 10:41:09 +0800 Subject: [PATCH] feat: consolidate diagnostics domain --- internal/web/ui.go | 6 +++--- internal/web/ui/templates/api.html | 1 + internal/web/ui/templates/audit.html | 1 + internal/web/ui/templates/system.html | 5 +++++ internal/web/ui_test.go | 18 ++++++++++++++++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/internal/web/ui.go b/internal/web/ui.go index 5d14ce7..7476b02 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -1049,7 +1049,7 @@ func (u *UI) pageLogs(w http.ResponseWriter, r *http.Request) { } func (u *UI) pageAPIConsole(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/ui/system", http.StatusFound) + u.render(w, r, "api", PageData{Title: "高级调试"}) } func (u *UI) pageAssets(w http.ResponseWriter, r *http.Request) { @@ -1259,11 +1259,11 @@ func (u *UI) pageAudit(w http.ResponseWriter, r *http.Request) { if u.tasks != nil { tasks = u.tasks.ListTasks() } - u.render(w, r, "audit", PageData{Title: "操作审计", Tasks: tasks}) + u.render(w, r, "audit", PageData{Title: "审计记录", Tasks: tasks}) } func (u *UI) pageSystem(w http.ResponseWriter, r *http.Request) { - u.render(w, r, "system", PageData{Title: "系统", Devices: u.registry.GetDevices()}) + u.render(w, r, "system", PageData{Title: "系统状态", Devices: u.registry.GetDevices()}) } func urlQueryEscape(s string) string { diff --git a/internal/web/ui/templates/api.html b/internal/web/ui/templates/api.html index 629783a..920b72a 100644 --- a/internal/web/ui/templates/api.html +++ b/internal/web/ui/templates/api.html @@ -1,5 +1,6 @@ {{define "api"}}
+
诊断 / 高级调试

高级调试

diff --git a/internal/web/ui/templates/audit.html b/internal/web/ui/templates/audit.html index a868d13..a46612b 100644 --- a/internal/web/ui/templates/audit.html +++ b/internal/web/ui/templates/audit.html @@ -2,6 +2,7 @@
+
诊断 / 审计记录

{{icon "audit"}}审计记录

diff --git a/internal/web/ui/templates/system.html b/internal/web/ui/templates/system.html index 9d8ddbe..e84a074 100644 --- a/internal/web/ui/templates/system.html +++ b/internal/web/ui/templates/system.html @@ -1,4 +1,9 @@ {{define "system"}} +
+
诊断 / 系统状态
+
系统状态页负责平台健康、发现机制和接入策略查看。
+
+

{{icon "discovery"}}设备发现与注册

diff --git a/internal/web/ui_test.go b/internal/web/ui_test.go index 2ee04da..3121fb5 100644 --- a/internal/web/ui_test.go +++ b/internal/web/ui_test.go @@ -2186,3 +2186,21 @@ func TestUI_TaskDetailPresentsExecutionSections(t *testing.T) { } } } + +func TestUI_DiagnosticsSecondaryPagesUseDiagnosticsCrumb(t *testing.T) { + ui := newTestUI(t) + + for _, item := range []struct { + path string + want string + }{ + {path: "/ui/system", want: "诊断 / 系统状态"}, + {path: "/ui/audit", want: "诊断 / 审计记录"}, + {path: "/ui/api", want: "诊断 / 高级调试"}, + } { + html := renderPage(t, ui, item.path) + if !strings.Contains(html, item.want) { + t.Fatalf("expected %s to contain crumb %q, got: %s", item.path, item.want, html) + } + } +}