mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 12:06:53 -06:00
Fix interfaces row colors on device interfaces table
This commit is contained in:
parent
94bd27bcf5
commit
b07e88869a
@ -53,6 +53,16 @@ def get_cabletermination_row_class(record):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
def get_interface_row_class(record):
|
||||||
|
if not record.enabled:
|
||||||
|
return 'danger'
|
||||||
|
elif not record.is_connectable:
|
||||||
|
return 'primary'
|
||||||
|
else:
|
||||||
|
return get_cabletermination_row_class(record)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def get_interface_state_attribute(record):
|
def get_interface_state_attribute(record):
|
||||||
"""
|
"""
|
||||||
Get interface enabled state as string to attach to <tr/> DOM element.
|
Get interface enabled state as string to attach to <tr/> DOM element.
|
||||||
@ -534,7 +544,7 @@ class DeviceInterfaceTable(InterfaceTable):
|
|||||||
'cable', 'connection', 'actions',
|
'cable', 'connection', 'actions',
|
||||||
)
|
)
|
||||||
row_attrs = {
|
row_attrs = {
|
||||||
'class': get_cabletermination_row_class,
|
'class': get_interface_row_class,
|
||||||
'data-name': lambda record: record.name,
|
'data-name': lambda record: record.name,
|
||||||
'data-enabled': get_interface_state_attribute,
|
'data-enabled': get_interface_state_attribute,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user