mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add GenericRelation to originating cable paths on PathEndpoint
This commit is contained in:
@@ -36,18 +36,7 @@
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if cp.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=cp.connected_endpoint.device.pk %}">{{ cp.connected_endpoint.device }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ cp.connected_endpoint }}
|
||||
</td>
|
||||
{% else %}
|
||||
<td colspan="2">
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% include 'dcim/inc/endpoint_connection.html' with paths=cp.paths.all %}
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right noprint">
|
||||
|
@@ -38,18 +38,7 @@
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if csp.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=csp.connected_endpoint.device.pk %}">{{ csp.connected_endpoint.device }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ csp.connected_endpoint }}
|
||||
</td>
|
||||
{% else %}
|
||||
<td colspan="2">
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% include 'dcim/inc/endpoint_connection.html' with paths=csp.paths.all %}
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right noprint">
|
||||
|
10
netbox/templates/dcim/inc/endpoint_connection.html
Normal file
10
netbox/templates/dcim/inc/endpoint_connection.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% if paths|length > 1 %}
|
||||
<td colspan="2">Multiple connections</td>
|
||||
{% elif paths %}
|
||||
{% with endpoint=paths.0.destination %}
|
||||
<td><a href="{{ endpoint.parent.get_absolute_url }}">{{ endpoint.parent }}</a></td>
|
||||
<td><a href="{{ endpoint.get_absolute_url }}">{{ endpoint }}</a></td>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<td colspan="2" class="text-muted">Not connected</td>
|
||||
{% endif %}
|
@@ -76,18 +76,7 @@
|
||||
{% elif iface.is_wireless %}
|
||||
<td colspan="2" class="text-muted">Wireless interface</td>
|
||||
{% else %}
|
||||
{% with path_count=iface.get_connections.count %}
|
||||
{% if path_count > 1 %}
|
||||
<td colspan="2">Multiple connections</td>
|
||||
{% elif path_count %}
|
||||
{% with endpoint=iface.get_connections.first.destination %}
|
||||
<td><a href="{{ endpoint.parent.get_absolute_url }}">{{ endpoint.parent }}</a></td>
|
||||
<td><a href="{{ endpoint.get_absolute_url }}">{{ endpoint }}</a></td>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<td colspan="2" class="text-muted">Not connected</td>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% include 'dcim/inc/endpoint_connection.html' with paths=iface.paths.all %}
|
||||
{% endif %}
|
||||
|
||||
{# Buttons #}
|
||||
|
@@ -49,27 +49,20 @@
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if po.connected_endpoint %}
|
||||
{% with pp=po.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=pp.device.pk %}">{{ pp.device }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ pp }}
|
||||
</td>
|
||||
<td>
|
||||
{% if pp.allocated_draw %}
|
||||
{{ pp.allocated_draw }}W{% if pp.maximum_draw %} ({{ pp.maximum_draw }}W max){% endif %}
|
||||
{% elif pp.maximum_draw %}
|
||||
{{ pp.maximum_draw }}W
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<td colspan="3">
|
||||
<span class="text-muted">Not connected</span>
|
||||
{% with paths=po.paths.all %}
|
||||
{% include 'dcim/inc/endpoint_connection.html' %}
|
||||
<td>
|
||||
{% if paths|length == 1 %}
|
||||
{% with pp=paths.0.destination %}
|
||||
{% if pp.allocated_draw %}
|
||||
{{ pp.allocated_draw }}W{% if pp.maximum_draw %} ({{ pp.maximum_draw }}W max){% endif %}
|
||||
{% elif pp.maximum_draw %}
|
||||
{{ pp.maximum_draw }}W
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right noprint">
|
||||
|
@@ -45,22 +45,7 @@
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if pp.connected_endpoint.device %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=pp.connected_endpoint.device.pk %}">{{ pp.connected_endpoint.device }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ pp.connected_endpoint }}
|
||||
</td>
|
||||
{% elif pp.connected_endpoint %}
|
||||
<td colspan="2">
|
||||
<a href="{{ pp.connected_endpoint.get_absolute_url }}">{{ pp.connected_endpoint }}</a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td colspan="2">
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% include 'dcim/inc/endpoint_connection.html' with paths=pp.paths.all %}
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right noprint">
|
||||
|
Reference in New Issue
Block a user