chore: 同步之前未提交的改动 (auto_config, ui, console)
This commit is contained in:
parent
c440186ce3
commit
3d109b4b11
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<form id="console-form" method="post" action="/console" style="display:contents">
|
||||
|
||||
{{range $i, $cd := .ConsoleDevices}}
|
||||
<div class="console-device-row">
|
||||
<div class="console-device-row" data-device-id="{{$cd.Device.DeviceID}}">
|
||||
<div class="console-header">
|
||||
<span class="status-dot {{if $cd.Device.Online}}ok{{else}}bad{{end}}"></span>
|
||||
<span class="console-device-name">{{$cd.Device.DisplayName}}</span>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user