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:
@@ -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 -
|
||||
|
||||
Reference in New Issue
Block a user