diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index c22e673b78c..4be5c7634df 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -53,6 +53,14 @@ def get_cabletermination_row_class(record): return '' +def get_interface_row_class(record): + if not record.enabled: + return 'danger' + elif record.is_virtual: + return 'primary' + return get_cabletermination_row_class(record) + + def get_interface_state_attribute(record): """ Get interface enabled state as string to attach to DOM element. @@ -501,8 +509,8 @@ class Meta(DeviceComponentTable.Meta): class DeviceInterfaceTable(InterfaceTable): name = tables.TemplateColumn( - template_code=' {{ value }}', order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} @@ -534,7 +542,7 @@ class Meta(DeviceComponentTable.Meta): 'cable', 'connection', 'actions', ) row_attrs = { - 'class': get_cabletermination_row_class, + 'class': get_interface_row_class, 'data-name': lambda record: record.name, 'data-enabled': get_interface_state_attribute, }