Просмотр исходного кода

Fixes #8279

A device that is part of a VC that has no name should display [virtual-chassis name]:[virtual-chassis position] as opposed to [device_type] in the rack rendering.
Jason Yates 4 лет назад
Родитель
Сommit
be8fef0228
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      netbox/dcim/svg.py

+ 6 - 1
netbox/dcim/svg.py

@@ -19,7 +19,12 @@ __all__ = (
 
 
 def get_device_name(device):
-    return device.name or str(device.device_type)
+    if device.virtual_chassis:
+        return f'{device.virtual_chassis.name}:{device.vc_position}'
+    elif device.name:
+        return device.name
+    else:
+        return str(device.device_type)
 
 
 class RackElevationSVG: