Add status to rack elevation device tooltip (#18083)

* Add status to rack elevation device tooltip

* Use get method for status display

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Martin Rødvand 2024-12-05 02:59:58 +01:00 committed by GitHub
parent b4265b74f4
commit 1e845e6b46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,7 @@ def get_device_description(device):
Name: <name> Name: <name>
Role: <role> Role: <role>
Status: <status>
Device Type: <manufacturer> <model> (<u_height>) Device Type: <manufacturer> <model> (<u_height>)
Asset tag: <asset_tag> (if defined) Asset tag: <asset_tag> (if defined)
Serial: <serial> (if defined) Serial: <serial> (if defined)
@ -55,6 +56,7 @@ def get_device_description(device):
""" """
description = f'Name: {device.name}' description = f'Name: {device.name}'
description += f'\nRole: {device.role}' description += f'\nRole: {device.role}'
description += f'\nStatus: {device.get_status_display()}'
u_height = f'{floatformat(device.device_type.u_height)}U' u_height = f'{floatformat(device.device_type.u_height)}U'
description += f'\nDevice Type: {device.device_type.manufacturer.name} {device.device_type.model} ({u_height})' description += f'\nDevice Type: {device.device_type.manufacturer.name} {device.device_type.model} ({u_height})'
if device.asset_tag: if device.asset_tag: