package handler import ( "html/template" "net/http" ) // DashboardHandler 是前端页面路由处理器 type DashboardHandler struct { templates *template.Template } func NewDashboardHandler() *DashboardHandler { tmpl := template.Must(template.New("dashboard").Parse(dashboardHTML)) return &DashboardHandler{templates: tmpl} } // RegisterRoutes 注册页面路由 func (h *DashboardHandler) RegisterRoutes(mux *http.ServeMux) { mux.HandleFunc("GET /ops/dashboard", h.Dashboard) mux.HandleFunc("GET /ops/dashboard/logs", h.Dashboard) mux.HandleFunc("GET /ops/dashboard/rules", h.Dashboard) mux.HandleFunc("GET /ops/dashboard/alerts", h.Dashboard) mux.HandleFunc("GET /ops/dashboard/channels", h.Dashboard) } // Dashboard 首页 func (h *DashboardHandler) Dashboard(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") _ = h.templates.ExecuteTemplate(w, "dashboard", nil) } const dashboardHTML = ` AI-Ops 运维看板
AI-Ops 运维看板 · 规则 / 事件 / 渠道 / 日志
QPS
-
平均延迟
-
P99
-
错误率
-

告警事件

告警规则

通知渠道

日志

`