mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #4290: Include device name in tooltip on rack elevations
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
* [#3949](https://github.com/netbox-community/netbox/issues/3949) - Revised the installation docs and upgrade script to employ a Python virtual environment
|
||||
* [#4281](https://github.com/netbox-community/netbox/issues/4281) - Allow filtering device component list views by type
|
||||
* [#4284](https://github.com/netbox-community/netbox/issues/4284) - Add MRJ21 port and cable types
|
||||
* [#4290](https://github.com/netbox-community/netbox/issues/4290) - Include device name in tooltip on rack elevations
|
||||
* [#4305](https://github.com/netbox-community/netbox/issues/4305) - Add 10-inch option for rack width
|
||||
|
||||
## Bug Fixes
|
||||
|
@ -20,6 +20,16 @@ class RackElevationSVG:
|
||||
self.rack = rack
|
||||
self.include_images = include_images
|
||||
|
||||
def _get_device_description(self, device):
|
||||
return '{} ({}) — {} ({}U) {} {}'.format(
|
||||
device.name,
|
||||
device.device_role,
|
||||
device.device_type.display_name,
|
||||
device.device_type.u_height,
|
||||
device.asset_tag or '',
|
||||
device.serial or ''
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _add_gradient(drawing, id_, color):
|
||||
gradient = drawing.linearGradient(
|
||||
@ -64,10 +74,7 @@ class RackElevationSVG:
|
||||
fill='black'
|
||||
)
|
||||
)
|
||||
link.set_desc('{} — {} ({}U) {} {}'.format(
|
||||
device.device_role, device.device_type.display_name,
|
||||
device.device_type.u_height, device.asset_tag or '', device.serial or ''
|
||||
))
|
||||
link.set_desc(self._get_device_description(device))
|
||||
link.add(drawing.rect(start, end, style='fill: #{}'.format(color), class_='slot'))
|
||||
hex_color = '#{}'.format(foreground_color(color))
|
||||
link.add(drawing.text(str(name), insert=text, fill=hex_color))
|
||||
@ -81,10 +88,7 @@ class RackElevationSVG:
|
||||
|
||||
def _draw_device_rear(self, drawing, device, start, end, text):
|
||||
rect = drawing.rect(start, end, class_="slot blocked")
|
||||
rect.set_desc('{} — {} ({}U) {} {}'.format(
|
||||
device.device_role, device.device_type.display_name,
|
||||
device.device_type.u_height, device.asset_tag or '', device.serial or ''
|
||||
))
|
||||
rect.set_desc(self._get_device_description(device))
|
||||
drawing.add(rect)
|
||||
drawing.add(drawing.text(str(device), insert=text))
|
||||
|
||||
|
Reference in New Issue
Block a user