feat: 模型/资源/人脸库页设备名旁显示IP;设备列表按IP+名称排序

This commit is contained in:
tian 2026-07-24 20:18:11 +08:00
parent 3eb966a560
commit 3ae6f71cf9
5 changed files with 11 additions and 2 deletions

View File

@ -38,6 +38,7 @@ type ModelStatusCell struct {
type ModelStatusRow struct {
DeviceID string `json:"device_id"`
DeviceName string `json:"device_name"`
DeviceIP string `json:"device_ip"`
Online bool `json:"online"`
NeedsSync bool `json:"needs_sync"`
Cells []ModelStatusCell `json:"cells"`
@ -175,6 +176,7 @@ func BuildModelStatusBoard(standardModels []storage.StandardModelRecord, devices
row := ModelStatusRow{
DeviceID: device.DeviceID,
DeviceName: device.DisplayName(),
DeviceIP: device.IP,
Online: device.Online,
Cells: make([]ModelStatusCell, 0, len(standardModels)),
ExtraModels: make([]InstalledModelStatus, 0),

View File

@ -2,6 +2,7 @@ package service
import (
"encoding/json"
"sort"
"strings"
"sync"
"time"
@ -158,6 +159,12 @@ func (s *RegistryService) GetDevices() []*models.Device {
for _, dev := range s.devices {
list = append(list, dev)
}
sort.Slice(list, func(i, j int) bool {
if list[i].IP != list[j].IP {
return list[i].IP < list[j].IP
}
return list[i].DisplayName() < list[j].DisplayName()
})
return list
}

View File

@ -87,7 +87,7 @@
<tr>
<td>
<div class="table-key">{{.DeviceName}}</div>
<div class="muted small mono">{{.DeviceID}}</div>
<div class="muted small mono">{{.DeviceIP}}</div>
</td>
{{range .Cells}}
<td>

View File

@ -85,7 +85,7 @@
<tr>
<td>
<div class="table-key">{{.DeviceName}}</div>
<div class="muted small mono">{{.DeviceID}}</div>
<div class="muted small mono">{{.DeviceIP}}</div>
</td>
{{range .Cells}}
<td>

Binary file not shown.