fix: console保存时合并UI新增的source到下发请求
This commit is contained in:
parent
6fcabebfe8
commit
6ff7acf283
@ -1301,15 +1301,27 @@ func (u *UI) actionConsoleSave(w http.ResponseWriter, r *http.Request) {
|
||||
continue
|
||||
}
|
||||
var sources []string
|
||||
// Merge: existing assignment sources + UI-added sources
|
||||
sourceSet := map[string]struct{}{}
|
||||
if assignment, err := u.preview.GetDeviceAssignment(dev.DeviceID); err == nil && assignment != nil {
|
||||
for _, ref := range assignment.RecognitionUnits {
|
||||
if unit, err := u.preview.GetRecognitionUnit(ref); err == nil && unit != nil {
|
||||
if unit.VideoSourceRef != "" {
|
||||
sources = append(sources, unit.VideoSourceRef)
|
||||
sourceSet[unit.VideoSourceRef] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Read UI-added sources from form (JS adds device_xxx_source hidden inputs)
|
||||
for _, src := range r.Form["device_"+dev.DeviceID+"_source"] {
|
||||
src = strings.TrimSpace(src)
|
||||
if src != "" {
|
||||
sourceSet[src] = struct{}{}
|
||||
}
|
||||
}
|
||||
for src := range sourceSet {
|
||||
sources = append(sources, src)
|
||||
}
|
||||
if len(features) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user