feat: fix dashboard real-time data sync, stabilize node order and eliminate UI jitter

This commit is contained in:
kory
2026-09-30 13:16:27 +08:00
parent 512e7c91c8
commit 57c99ac72b
20 changed files with 2133 additions and 90 deletions
+40
View File
@@ -53,6 +53,10 @@ func (p *Panel) Handler() http.Handler {
mux.HandleFunc("/panel/api/mcp/test", p.protected(p.testMCP))
mux.HandleFunc("/panel/api/security/settings", p.protected(p.securitySettings))
mux.HandleFunc("/panel/api/security/settings/update", p.protected(p.updateSecuritySettings))
mux.HandleFunc("/panel/api/notifications/webhooks", p.protected(p.webhookTargets))
mux.HandleFunc("/panel/api/notifications/webhook/update", p.protected(p.updateWebhookTarget))
mux.HandleFunc("/panel/api/notifications/webhook/delete", p.protected(p.deleteWebhookTarget))
mux.HandleFunc("/panel/api/notifications/webhook/test", p.protected(p.testWebhook))
mux.HandleFunc("/", p.probe)
return mux
}
@@ -121,6 +125,42 @@ func (p *Panel) testMCP(w http.ResponseWriter, r *http.Request) {
http.Error(w, "MCP API unavailable", 501)
}
type notificationPanelRunner interface {
WebhookTargetsJSON(http.ResponseWriter, *http.Request)
UpdateWebhookTargetJSON(http.ResponseWriter, *http.Request)
DeleteWebhookTargetJSON(http.ResponseWriter, *http.Request)
TestWebhookJSON(http.ResponseWriter, *http.Request)
}
func (p *Panel) webhookTargets(w http.ResponseWriter, r *http.Request) {
if v, ok := p.Runner.(notificationPanelRunner); ok {
v.WebhookTargetsJSON(w, r)
return
}
http.Error(w, "notification API unavailable", 501)
}
func (p *Panel) updateWebhookTarget(w http.ResponseWriter, r *http.Request) {
if v, ok := p.Runner.(notificationPanelRunner); ok {
v.UpdateWebhookTargetJSON(w, r)
return
}
http.Error(w, "notification API unavailable", 501)
}
func (p *Panel) deleteWebhookTarget(w http.ResponseWriter, r *http.Request) {
if v, ok := p.Runner.(notificationPanelRunner); ok {
v.DeleteWebhookTargetJSON(w, r)
return
}
http.Error(w, "notification API unavailable", 501)
}
func (p *Panel) testWebhook(w http.ResponseWriter, r *http.Request) {
if v, ok := p.Runner.(notificationPanelRunner); ok {
v.TestWebhookJSON(w, r)
return
}
http.Error(w, "notification API unavailable", 501)
}
func (p *Panel) handleDevices(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodDelete {
p.Runner.DeleteDevice(w, r)