Repository: netbox-community/netbox

Issue:
Add Hide/Show Connected to Device Interface Summary Filter
### NetBox version

v3.5.1

### Feature type

Change to existing functionality

### Proposed functionality

I'd love to see an option here to Hide/Show interfaces that are **connected**.

![image](https://github.com/netbox-community/netbox/assets/1522389/c5b3bd5e-dab4-4ebb-aac4-57bec3ce01b3)


### Use case

Makes it easier to summarize the connections a device's interfaces have at a glance, especially when the connected interfaces are buried into other pages.

### Database changes

None

### External dependencies

None
Add Hide/Show Connected to Device Interface Summary Filter
### NetBox version

v3.5.1

### Feature type

Change to existing functionality

### Proposed functionality

I'd love to see an option here to Hide/Show interfaces that are **connected**.

![image](https://github.com/netbox-community/netbox/assets/1522389/c5b3bd5e-dab4-4ebb-aac4-57bec3ce01b3)


### Use case

Makes it easier to summarize the connections a device's interfaces have at a glance, especially when the connected interfaces are buried into other pages.

### Database changes

None

### External dependencies

None


Discussion:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
This FR should not be stale, I'm willing to implement it once it is approved.
@stuntguy3000 I've assigned this to you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
This FR should not be stale, I'm willing to implement it once it is approved.
@stuntguy3000 I've assigned this to you.

Resolving patch:
diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py
--- a/netbox/dcim/tables/devices.py
+++ b/netbox/dcim/tables/devices.py
@@ -64,9 +64,19 @@ def get_interface_state_attribute(record):
     Get interface enabled state as string to attach to <tr/> DOM element.
     """
     if record.enabled:
-        return "enabled"
+        return 'enabled'
     else:
-        return "disabled"
+        return 'disabled'
+
+
+def get_interface_connected_attribute(record):
+    """
+    Get interface disconnected state as string to attach to <tr/> DOM element.
+    """
+    if record.mark_connected or record.cable:
+        return 'connected'
+    else:
+        return 'disconnected'
 
 
 #
@@ -674,6 +684,7 @@ class Meta(DeviceComponentTable.Meta):
             'data-name': lambda record: record.name,
             'data-enabled': get_interface_state_attribute,
             'data-type': lambda record: record.type,
+            'data-connected': get_interface_connected_attribute
         }
 
 


Test patch: