1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #4247: Add option to show/hide enabled/disabled interfaces on device

This commit is contained in:
checktheroads
2021-05-26 16:32:09 -07:00
parent 587335e3ba
commit e004f872f9
13 changed files with 378 additions and 21 deletions

View File

@@ -52,10 +52,20 @@ def get_cabletermination_row_class(record):
return ''
def get_interface_state_attribute(record):
"""
Get interface enabled state as string to attach to <tr/> DOM element.
"""
if record.enabled:
return "enabled"
else:
return "disabled"
#
# Device roles
#
class DeviceRoleTable(BaseTable):
pk = ToggleColumn()
name = tables.Column(
@@ -528,6 +538,7 @@ class DeviceInterfaceTable(InterfaceTable):
row_attrs = {
'class': get_cabletermination_row_class,
'data-name': lambda record: record.name,
'data-enabled': get_interface_state_attribute,
}