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 @@
{{range $i, $cd := .ConsoleDevices}} -
+
{{$cd.Device.DisplayName}}