{% comment %} Inner body of the "Connection" panel for a CableTermination. Renders the attached cable plus compact lists of *all* cable peers and *all* connected endpoints, so multi-termination ("breakout") cables are shown fully rather than only the first peer. Required context: - `object`: the CableTermination being rendered (the old detail templates supply this directly; the `ConnectionPanel` UI component overrides it to the relevant termination). - `trace_url_name`: the trace view name for this termination type (e.g. 'dcim:interface_trace'). Front/rear ports are not PathEndpoints, so `cable_paths` is empty and the "Connection" row is omitted for them. This fragment does NOT render its own `card`/`card-body` wrapper, so it composes cleanly inside both the old detail-view card (`dcim/inc/connection.html`) and the UI component framework panel body wrapper. {% endcomment %} {% load helpers %} {% load cables %} {% if object.cable %} {% with is_breakout=object.cable.cable_type.is_breakout %} {# Value columns span everything to the right of the label: +1 for the Connector column on breakout cables. #} {% with peers=object.get_cable_peers paths=object.cable_paths.all trunk_children=object.get_breakout_trunk_child_interfaces %} {% for peer in peers %} {% if forloop.first %} {% endif %} {% if is_breakout %}{% endif %} {% empty %} {% endfor %} {% for path in paths %} {% if forloop.first %} {% endif %} {% if is_breakout %}{% endif %} {% if path.destination %} {% else %} {% endif %} {% endfor %} {% endwith %}
Cable {{ object.cable|hyperlinked_object }} {% include 'dcim/inc/cable_actions.html' with trace_url_name=trace_url_name %}
Cable Status {{ object.cable.status|hyperlinked_object_with_color }}
Cable Peer{{ peers|length|pluralize }}{{ peer.cable_termination.connector }}{{ peer.parent|hyperlinked_object }} {{ peer|hyperlinked_object }} {# Breakout: when this fan-out-side termination's trunk peer has a child (sub)interface mapped to this lane, show it in brackets. Mirrors `_breakout_child_brackets` in dcim/tables/template_code.py. #} {% for entry in trunk_children %}{% if entry.child_interface and entry.trunk_interface == peer %} [{{ entry.child_interface|hyperlinked_object }}]{% endif %}{% endfor %}
Cable Peer {{ ""|placeholder }}
Endpoint{{ paths|length|pluralize }}{{ path.peer_connector }}{{ path.destination.parent|hyperlinked_object }} {{ path.destination|hyperlinked_object }} {# Breakout: annotate the trunk-side endpoint with its mapped child (sub)interface. Uses the fully-traced path, so it works even when the breakout cable is reached through patch-panel front/rear ports. #} {% with trunk_child=path.destination|breakout_trunk_child_interface:object %}{% if trunk_child %} [{{ trunk_child|hyperlinked_object }}]{% endif %}{% endwith %} {% if path.is_active %} Reachable {% else %} Not Reachable {% endif %} {{ ""|placeholder }} {{ ""|placeholder }} {{ ""|placeholder }}
{% endwith %} {% else %} Not connected {% if perms.dcim.add_cable %} {% include 'dcim/inc/cable_add_button.html' with termination=object %} {% endif %} {% endif %}