From 3d109b4b11cd412dedae9e144ba41dc01a3c1ff0 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Wed, 22 Jul 2026 11:16:25 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=90=8C=E6=AD=A5=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E6=9C=AA=E6=8F=90=E4=BA=A4=E7=9A=84=E6=94=B9=E5=8A=A8=20(auto?= =?UTF-8?q?=5Fconfig,=20ui,=20console)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/service/auto_config.go | 9 +++++++++ internal/web/ui.go | 11 +++++++++++ internal/web/ui/templates/console.html | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/internal/service/auto_config.go b/internal/service/auto_config.go index 984674f..10675e5 100644 --- a/internal/service/auto_config.go +++ b/internal/service/auto_config.go @@ -714,6 +714,15 @@ func injectIntegrationsIntoConfig(config map[string]any, preview *ConfigPreviewS setDefault(extAPI, "token_json_path", "responseBody.token") setDefault(extAPI, "token_cache_sec", float64(1200)) } + // Always add agent alarm reporting (http action to local agent) + if _, ok := actions["http"]; !ok { + actions["http"] = map[string]any{ + "enable": true, + "url": "http://127.0.0.1:9100/v1/alarms/report", + "method": "POST", + "timeout_ms": 3000, + } + } } } } diff --git a/internal/web/ui.go b/internal/web/ui.go index 6aac45e..4696280 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -1265,11 +1265,22 @@ func (u *UI) actionConsoleSave(w http.ResponseWriter, r *http.Request) { devices := u.registry.GetDevices() // Step 1: collect form features per device. + // Only process devices listed in dirty_device_ids (client-side change detection). + dirtyIDs := strings.Split(strings.TrimSpace(r.FormValue("dirty_device_ids")), ",") + dirtySet := map[string]bool{} + for _, id := range dirtyIDs { + if id != "" { + dirtySet[id] = true + } + } formFeatures := map[string][]string{} for _, dev := range devices { if dev == nil || dev.DeviceID == "" { continue } + if len(dirtySet) > 0 && !dirtySet[dev.DeviceID] { + continue + } features := cleanFormList(r.Form["device_"+dev.DeviceID+"_feature"]) if len(features) > 0 { formFeatures[dev.DeviceID] = features diff --git a/internal/web/ui/templates/console.html b/internal/web/ui/templates/console.html index bb5cf81..b03991b 100644 --- a/internal/web/ui/templates/console.html +++ b/internal/web/ui/templates/console.html @@ -24,7 +24,7 @@