Show the peer device/port in component connection columns

Add ConceptComponent.peer, returning the component on the other end
of its cable (whichever termination isn't itself). Use it in the
component tables' "Connection" column (Device > Port, both linked,
mirroring NetBox's own link_peer style) instead of just linking to the
cable object, and on the component detail page's "Connected to" row
in place of the manual termination_a/b branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 10:58:47 +02:00
co-authored by Claude Sonnet 5
parent 8818065840
commit d500a7b184
3 changed files with 24 additions and 12 deletions
+8
View File
@@ -542,6 +542,14 @@ class ConceptComponent(NetBoxModel):
def is_connected(self):
return self.cable is not None
@property
def peer(self):
"""The component on the other end of this component's cable, if any."""
cable = self.cable
if cable is None:
return None
return cable.termination_b if cable.termination_a_id == self.pk else cable.termination_a
def get_paired_components(self):
"""
For a front or rear port, the port(s) on the other side it passes through to -