feat: 模型/资源/人脸库页设备名旁显示IP;设备列表按IP+名称排序
This commit is contained in:
parent
3eb966a560
commit
3ae6f71cf9
@ -38,6 +38,7 @@ type ModelStatusCell struct {
|
|||||||
type ModelStatusRow struct {
|
type ModelStatusRow struct {
|
||||||
DeviceID string `json:"device_id"`
|
DeviceID string `json:"device_id"`
|
||||||
DeviceName string `json:"device_name"`
|
DeviceName string `json:"device_name"`
|
||||||
|
DeviceIP string `json:"device_ip"`
|
||||||
Online bool `json:"online"`
|
Online bool `json:"online"`
|
||||||
NeedsSync bool `json:"needs_sync"`
|
NeedsSync bool `json:"needs_sync"`
|
||||||
Cells []ModelStatusCell `json:"cells"`
|
Cells []ModelStatusCell `json:"cells"`
|
||||||
@ -175,6 +176,7 @@ func BuildModelStatusBoard(standardModels []storage.StandardModelRecord, devices
|
|||||||
row := ModelStatusRow{
|
row := ModelStatusRow{
|
||||||
DeviceID: device.DeviceID,
|
DeviceID: device.DeviceID,
|
||||||
DeviceName: device.DisplayName(),
|
DeviceName: device.DisplayName(),
|
||||||
|
DeviceIP: device.IP,
|
||||||
Online: device.Online,
|
Online: device.Online,
|
||||||
Cells: make([]ModelStatusCell, 0, len(standardModels)),
|
Cells: make([]ModelStatusCell, 0, len(standardModels)),
|
||||||
ExtraModels: make([]InstalledModelStatus, 0),
|
ExtraModels: make([]InstalledModelStatus, 0),
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -158,6 +159,12 @@ func (s *RegistryService) GetDevices() []*models.Device {
|
|||||||
for _, dev := range s.devices {
|
for _, dev := range s.devices {
|
||||||
list = append(list, dev)
|
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
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="table-key">{{.DeviceName}}</div>
|
<div class="table-key">{{.DeviceName}}</div>
|
||||||
<div class="muted small mono">{{.DeviceID}}</div>
|
<div class="muted small mono">{{.DeviceIP}}</div>
|
||||||
</td>
|
</td>
|
||||||
{{range .Cells}}
|
{{range .Cells}}
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@ -85,7 +85,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="table-key">{{.DeviceName}}</div>
|
<div class="table-key">{{.DeviceName}}</div>
|
||||||
<div class="muted small mono">{{.DeviceID}}</div>
|
<div class="muted small mono">{{.DeviceIP}}</div>
|
||||||
</td>
|
</td>
|
||||||
{{range .Cells}}
|
{{range .Cells}}
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user