feat: consolidate diagnostics domain

This commit is contained in:
tian 2026-04-27 10:41:09 +08:00
parent a0a1812b8a
commit fdd7a03378
5 changed files with 28 additions and 3 deletions

View File

@ -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 {

View File

@ -1,5 +1,6 @@
{{define "api"}}
<div class="card">
<div class="crumb">诊断 / 高级调试</div>
<h2>高级调试</h2>
</div>

View File

@ -2,6 +2,7 @@
<div class="card">
<div class="section-title">
<div>
<div class="crumb">诊断 / 审计记录</div>
<h2 class="title-with-icon">{{icon "audit"}}<span>审计记录</span></h2>
</div>
</div>

View File

@ -1,4 +1,9 @@
{{define "system"}}
<div class="card">
<div class="crumb">诊断 / 系统状态</div>
<div class="muted small" style="margin-top:8px">系统状态页负责平台健康、发现机制和接入策略查看。</div>
</div>
<div class="detail-grid">
<div class="card">
<h2 class="title-with-icon">{{icon "discovery"}}<span>设备发现与注册</span></h2>

View File

@ -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)
}
}
}