fix: ensureDevicesLoaded 有设备离线即触发搜索,全页面受益

This commit is contained in:
tian 2026-07-24 11:20:51 +08:00
parent 5c53b07301
commit 31c1a09b86

View File

@ -907,15 +907,15 @@ func (u *UI) ensureDevicesLoaded() {
}
devices := u.registry.GetDevices()
if len(devices) > 0 {
// Check if any device is online; if not, try discovery to refresh
hasOnline := false
// Check if any device is offline; trigger discovery to refresh
hasOffline := false
for _, d := range devices {
if d.Online {
hasOnline = true
if !d.Online {
hasOffline = true
break
}
}
if hasOnline {
if !hasOffline {
return
}
}
@ -1361,10 +1361,6 @@ func (u *UI) actionConsoleSave(w http.ResponseWriter, r *http.Request) {
func (u *UI) pageWizard(w http.ResponseWriter, r *http.Request) {
u.ensureDevicesLoaded()
// Force a fresh discovery to pick up all devices reliably.
if u.discovery != nil {
u.discovery.SearchDefault()
}
data := PageData{Title: "部署向导"}
data.Devices = u.registry.GetDevices()
if u.preview != nil {