mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Merge pull request #4154 from netbox-community/4138-device_bays_in_rack_elevations
Fixes: #4138 - Add Device Bay count to rack elevation
This commit is contained in:
commit
df3fef8bb1
@ -389,6 +389,10 @@ class RackElevationHelperMixin:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _draw_device_front(drawing, device, start, end, text):
|
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
|
color = device.device_role.color
|
||||||
link = drawing.add(
|
link = drawing.add(
|
||||||
drawing.a(
|
drawing.a(
|
||||||
@ -403,7 +407,7 @@ class RackElevationHelperMixin:
|
|||||||
))
|
))
|
||||||
link.add(drawing.rect(start, end, style='fill: #{}'.format(color), class_='slot'))
|
link.add(drawing.rect(start, end, style='fill: #{}'.format(color), class_='slot'))
|
||||||
hex_color = '#{}'.format(foreground_color(color))
|
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
|
@staticmethod
|
||||||
def _draw_device_rear(drawing, device, start, end, text):
|
def _draw_device_rear(drawing, device, start, end, text):
|
||||||
|
Loading…
Reference in New Issue
Block a user