1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Extend device view to show local cable termination for all components

This commit is contained in:
Jeremy Stretch
2020-10-06 13:08:41 -04:00
parent d59f0891e4
commit d984dbd83b
9 changed files with 68 additions and 67 deletions

View File

@ -506,6 +506,7 @@
<th>MTU</th>
<th>Mode</th>
<th>Cable</th>
<th colspan="2">Cable Termination</th>
<th colspan="2">Connection</th>
<th></th>
</tr>
@ -566,7 +567,7 @@
<th>Position</th>
<th>Description</th>
<th>Cable</th>
<th colspan="2">Connection</th>
<th colspan="2">Cable Termination</th>
<th></th>
</tr>
</thead>
@ -623,7 +624,7 @@
<th>Positions</th>
<th>Description</th>
<th>Cable</th>
<th colspan="2">Connection</th>
<th colspan="2">Cable Termination</th>
<th></th>
</tr>
</thead>
@ -679,6 +680,7 @@
<th>Type</th>
<th>Description</th>
<th>Cable</th>
<th colspan="2">Cable Termination</th>
<th colspan="2">Connection</th>
<th></th>
</tr>
@ -732,6 +734,7 @@
<th>Type</th>
<th>Description</th>
<th>Cable</th>
<th colspan="2">Cable Termination</th>
<th colspan="2">Connection</th>
<th></th>
</tr>
@ -789,6 +792,7 @@
<th>Draw</th>
<th>Description</th>
<th>Cable</th>
<th colspan="2">Cable Termination</th>
<th colspan="2">Connection</th>
<th></th>
</tr>
@ -843,6 +847,7 @@
<th>Input/Leg</th>
<th>Description</th>
<th>Cable</th>
<th colspan="2">Cable Termination</th>
<th colspan="3">Connection</th>
<th></th>
</tr>

View File

@ -0,0 +1,14 @@
<td>
{% if termination.parent.provider %}
<i class="fa fa-fw fa-globe" title="Circuit"></i>
<a href="{{ termination.parent.get_absolute_url }}">
{{ termination.parent.provider }}
{{ termination.parent }}
</a>
{% else %}
<a href="{{ termination.parent.get_absolute_url }}">{{ termination.parent }}</a>
{% endif %}
</td>
<td>
<a href="{{ termination.get_absolute_url }}">{{ termination }}</a>
</td>

View File

@ -24,16 +24,19 @@
</td>
{# Cable #}
<td>
{% if cp.cable %}
{% if cp.cable %}
<td>
<a href="{{ cp.cable.get_absolute_url }}">{{ cp.cable }}</a>
<a href="{% url 'dcim:consoleport_trace' pk=cp.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
{% else %}
&mdash;
{% endif %}
</td>
</td>
{% include 'dcim/inc/cabletermination.html' with termination=cp.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>
</td>
{% endif %}
{# Connection #}
{% include 'dcim/inc/endpoint_connection.html' with path=cp.path %}

View File

@ -26,16 +26,19 @@
</td>
{# Cable #}
<td class="text-nowrap">
{% if csp.cable %}
{% if csp.cable %}
<td>
<a href="{{ csp.cable.get_absolute_url }}">{{ csp.cable }}</a>
<a href="{% url 'dcim:consoleserverport_trace' pk=csp.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
{% else %}
<span class="text-muted">&mdash;</span>
{% endif %}
</td>
</td>
{% include 'dcim/inc/cabletermination.html' with termination=csp.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>
</td>
{% endif %}
{# Connection #}
{% include 'dcim/inc/endpoint_connection.html' with path=csp.path %}

View File

@ -32,22 +32,7 @@
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
</td>
{% with far_end=frontport.get_cable_peer %}
<td>
{% if far_end.parent.provider %}
<i class="fa fa-fw fa-globe" title="Circuit"></i>
<a href="{{ far_end.parent.get_absolute_url }}">
{{ far_end.parent.provider }}
{{ far_end.parent }}
</a>
{% else %}
<a href="{{ far_end.parent.get_absolute_url }}">
{{ far_end.parent }}
</a>
{% endif %}
</td>
<td>{{ far_end }}</td>
{% endwith %}
{% include 'dcim/inc/cabletermination.html' with termination=frontport.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>

View File

@ -45,19 +45,19 @@
<td>{{ iface.get_mode_display|default:"&mdash;" }}</td>
{# Cable #}
<td class="text-nowrap">
{% if iface.cable %}
{% if iface.cable %}
<td>
<a href="{{ iface.cable.get_absolute_url }}">{{ iface.cable }}</a>
{% if iface.cable.color %}
<span class="inline-color-block" style="background-color: #{{ iface.cable.color }}">&nbsp;</span>
{% endif %}
<a href="{% url 'dcim:interface_trace' pk=iface.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
{% else %}
<span class="text-muted">&mdash;</span>
{% endif %}
</td>
</td>
{% include 'dcim/inc/cabletermination.html' with termination=iface.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>
</td>
{% endif %}
{# Connection or type #}
{% if iface.is_lag %}

View File

@ -37,16 +37,19 @@
</td>
{# Cable #}
<td class="text-nowrap">
{% if po.cable %}
{% if po.cable %}
<td>
<a href="{{ po.cable.get_absolute_url }}">{{ po.cable }}</a>
<a href="{% url 'dcim:poweroutlet_trace' pk=po.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
{% else %}
<span class="text-muted">&mdash;</span>
{% endif %}
</td>
</td>
{% include 'dcim/inc/cabletermination.html' with termination=po.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>
</td>
{% endif %}
{# Connection #}
{% with path=po.path %}

View File

@ -33,16 +33,19 @@
</td>
{# Cable #}
<td>
{% if pp.cable %}
{% if pp.cable %}
<td>
<a href="{{ pp.cable.get_absolute_url }}">{{ pp.cable }}</a>
<a href="{% url 'dcim:powerport_trace' pk=pp.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
{% else %}
&mdash;
{% endif %}
</td>
</td>
{% include 'dcim/inc/cabletermination.html' with termination=pp.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>
</td>
{% endif %}
{# Connection #}
{% include 'dcim/inc/endpoint_connection.html' with path=pp.path %}

View File

@ -31,22 +31,7 @@
<i class="fa fa-share-alt" aria-hidden="true"></i>
</a>
</td>
{% with far_end=rearport.get_cable_peer %}
<td>
{% if far_end.parent.provider %}
<i class="fa fa-fw fa-globe" title="Circuit"></i>
<a href="{{ far_end.parent.get_absolute_url }}">
{{ far_end.parent.provider }}
{{ far_end.parent }}
</a>
{% else %}
<a href="{{ far_end.parent.get_absolute_url }}">
{{ far_end.parent }}
</a>
{% endif %}
</td>
<td>{{ far_end }}</td>
{% endwith %}
{% include 'dcim/inc/cabletermination.html' with termination=rearport.get_cable_peer %}
{% else %}
<td colspan="3">
<span class="text-muted">Not connected</span>