diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 6c7b1c971..d66213a78 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -506,6 +506,7 @@ MTU Mode Cable + Cable Termination Connection @@ -566,7 +567,7 @@ Position Description Cable - Connection + Cable Termination @@ -623,7 +624,7 @@ Positions Description Cable - Connection + Cable Termination @@ -679,6 +680,7 @@ Type Description Cable + Cable Termination Connection @@ -732,6 +734,7 @@ Type Description Cable + Cable Termination Connection @@ -789,6 +792,7 @@ Draw Description Cable + Cable Termination Connection @@ -843,6 +847,7 @@ Input/Leg Description Cable + Cable Termination Connection diff --git a/netbox/templates/dcim/inc/cabletermination.html b/netbox/templates/dcim/inc/cabletermination.html new file mode 100644 index 000000000..e4b28fbcf --- /dev/null +++ b/netbox/templates/dcim/inc/cabletermination.html @@ -0,0 +1,14 @@ + + {% if termination.parent.provider %} + + + {{ termination.parent.provider }} + {{ termination.parent }} + + {% else %} + {{ termination.parent }} + {% endif %} + + + {{ termination }} + diff --git a/netbox/templates/dcim/inc/consoleport.html b/netbox/templates/dcim/inc/consoleport.html index 912404be3..ace09cfe2 100644 --- a/netbox/templates/dcim/inc/consoleport.html +++ b/netbox/templates/dcim/inc/consoleport.html @@ -24,16 +24,19 @@ {# Cable #} - - {% if cp.cable %} + {% if cp.cable %} + {{ cp.cable }} - {% else %} - — - {% endif %} - + + {% include 'dcim/inc/cabletermination.html' with termination=cp.get_cable_peer %} + {% else %} + + Not connected + + {% endif %} {# Connection #} {% include 'dcim/inc/endpoint_connection.html' with path=cp.path %} diff --git a/netbox/templates/dcim/inc/consoleserverport.html b/netbox/templates/dcim/inc/consoleserverport.html index b7a5c6b56..025b0bf02 100644 --- a/netbox/templates/dcim/inc/consoleserverport.html +++ b/netbox/templates/dcim/inc/consoleserverport.html @@ -26,16 +26,19 @@ {# Cable #} - - {% if csp.cable %} + {% if csp.cable %} + {{ csp.cable }} - {% else %} - - {% endif %} - + + {% include 'dcim/inc/cabletermination.html' with termination=csp.get_cable_peer %} + {% else %} + + Not connected + + {% endif %} {# Connection #} {% include 'dcim/inc/endpoint_connection.html' with path=csp.path %} diff --git a/netbox/templates/dcim/inc/frontport.html b/netbox/templates/dcim/inc/frontport.html index d362b6003..91374cb1e 100644 --- a/netbox/templates/dcim/inc/frontport.html +++ b/netbox/templates/dcim/inc/frontport.html @@ -32,22 +32,7 @@ - {% with far_end=frontport.get_cable_peer %} - - {% if far_end.parent.provider %} - - - {{ far_end.parent.provider }} - {{ far_end.parent }} - - {% else %} - - {{ far_end.parent }} - - {% endif %} - - {{ far_end }} - {% endwith %} + {% include 'dcim/inc/cabletermination.html' with termination=frontport.get_cable_peer %} {% else %} Not connected diff --git a/netbox/templates/dcim/inc/interface.html b/netbox/templates/dcim/inc/interface.html index 159551192..efaed7ecf 100644 --- a/netbox/templates/dcim/inc/interface.html +++ b/netbox/templates/dcim/inc/interface.html @@ -45,19 +45,19 @@ {{ iface.get_mode_display|default:"—" }} {# Cable #} - - {% if iface.cable %} + {% if iface.cable %} + {{ iface.cable }} - {% if iface.cable.color %} -   - {% endif %} - {% else %} - - {% endif %} - + + {% include 'dcim/inc/cabletermination.html' with termination=iface.get_cable_peer %} + {% else %} + + Not connected + + {% endif %} {# Connection or type #} {% if iface.is_lag %} diff --git a/netbox/templates/dcim/inc/poweroutlet.html b/netbox/templates/dcim/inc/poweroutlet.html index b3e003e99..38eb7b8a6 100644 --- a/netbox/templates/dcim/inc/poweroutlet.html +++ b/netbox/templates/dcim/inc/poweroutlet.html @@ -37,16 +37,19 @@ {# Cable #} - - {% if po.cable %} + {% if po.cable %} + {{ po.cable }} - {% else %} - - {% endif %} - + + {% include 'dcim/inc/cabletermination.html' with termination=po.get_cable_peer %} + {% else %} + + Not connected + + {% endif %} {# Connection #} {% with path=po.path %} diff --git a/netbox/templates/dcim/inc/powerport.html b/netbox/templates/dcim/inc/powerport.html index c65b685d7..c5c18c093 100644 --- a/netbox/templates/dcim/inc/powerport.html +++ b/netbox/templates/dcim/inc/powerport.html @@ -33,16 +33,19 @@ {# Cable #} - - {% if pp.cable %} + {% if pp.cable %} + {{ pp.cable }} - {% else %} - — - {% endif %} - + + {% include 'dcim/inc/cabletermination.html' with termination=pp.get_cable_peer %} + {% else %} + + Not connected + + {% endif %} {# Connection #} {% include 'dcim/inc/endpoint_connection.html' with path=pp.path %} diff --git a/netbox/templates/dcim/inc/rearport.html b/netbox/templates/dcim/inc/rearport.html index ce6edc883..fd5ee620c 100644 --- a/netbox/templates/dcim/inc/rearport.html +++ b/netbox/templates/dcim/inc/rearport.html @@ -31,22 +31,7 @@ - {% with far_end=rearport.get_cable_peer %} - - {% if far_end.parent.provider %} - - - {{ far_end.parent.provider }} - {{ far_end.parent }} - - {% else %} - - {{ far_end.parent }} - - {% endif %} - - {{ far_end }} - {% endwith %} + {% include 'dcim/inc/cabletermination.html' with termination=rearport.get_cable_peer %} {% else %} Not connected