Feat: 优化拓扑节点显示为'主机名+IP地址'格式
- 前端显示两行: 第一行主机名,第二行IP地址 - 增加节点尺寸以适应更多文本 - 启用文本自动换行 - 后端确保主机名不为空
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user