Feat: 优化拓扑节点显示为'主机名+IP地址'格式

- 前端显示两行: 第一行主机名,第二行IP地址
- 增加节点尺寸以适应更多文本
- 启用文本自动换行
- 后端确保主机名不为空
This commit is contained in:
Your Name
2026-04-25 23:13:36 +08:00
förälder 3de2668286
incheckning 4dc0b3100f
2 ändrade filer med 22 tillägg och 7 borttagningar
+7 -1
Visa fil
@@ -35,10 +35,16 @@ func (b *Builder) Build() models.TopologyGraph {
// 构建节点
nodeMap := make(map[string]models.TopologyNode)
for _, device := range b.devices {
// 优先使用主机名,如果没有则使用IP作为显示名
hostname := device.Hostname
if hostname == "" {
hostname = device.IP
}
node := models.TopologyNode{
ID: device.IP,
IP: device.IP,
Hostname: device.Hostname,
Hostname: hostname,
Type: string(device.Type),
Icon: getDeviceIcon(device.Type),
}