From fe452735bee0ece44a604830cb7788c022ff9122 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Wed, 12 Feb 2020 12:48:13 -0600 Subject: [PATCH] Add Device Bay count to rack elevation names --- netbox/dcim/models/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/models/__init__.py b/netbox/dcim/models/__init__.py index c31f4c713..4adfebadf 100644 --- a/netbox/dcim/models/__init__.py +++ b/netbox/dcim/models/__init__.py @@ -389,6 +389,10 @@ class RackElevationHelperMixin: @staticmethod def _draw_device_front(drawing, device, start, end, text): + name = str(device) + if device.devicebay_count: + name += ' ({}/{})'.format(device.get_children().count(), device.devicebay_count) + color = device.device_role.color link = drawing.add( drawing.a( @@ -403,7 +407,7 @@ class RackElevationHelperMixin: )) link.add(drawing.rect(start, end, style='fill: #{}'.format(color), class_='slot')) hex_color = '#{}'.format(foreground_color(color)) - link.add(drawing.text(str(device), insert=text, fill=hex_color)) + link.add(drawing.text(str(name), insert=text, fill=hex_color)) @staticmethod def _draw_device_rear(drawing, device, start, end, text):