mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-15 12:08:17 -06:00
New visualisation of connected endpoint using new trace cache
This commit is contained in:
parent
e4f1aab044
commit
4e37175c3c
@ -487,3 +487,8 @@ td .progress {
|
|||||||
textarea {
|
textarea {
|
||||||
font-family: Consolas, Lucida Console, monospace;
|
font-family: Consolas, Lucida Console, monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dividers between path elements */
|
||||||
|
span.path-element + span.path-element:before {
|
||||||
|
content: ' ➞ ';
|
||||||
|
}
|
||||||
|
@ -72,58 +72,71 @@
|
|||||||
<td colspan="2" class="text-muted">Virtual interface</td>
|
<td colspan="2" class="text-muted">Virtual interface</td>
|
||||||
{% elif iface.is_wireless %}
|
{% elif iface.is_wireless %}
|
||||||
<td colspan="2" class="text-muted">Wireless interface</td>
|
<td colspan="2" class="text-muted">Wireless interface</td>
|
||||||
{% elif iface.connected_endpoint.name %}
|
{% elif iface.connected_endpoint %}
|
||||||
{# Connected to an Interface #}
|
{% with endpoint=iface.connected_endpoint previous_endpoint=iface.via_endpoints|last %}
|
||||||
<td>
|
{% if endpoint.positions and previous_endpoint.rear_port_position %}
|
||||||
<a href="{% url 'dcim:device' pk=iface.connected_endpoint.device.pk %}">
|
{# RearPort has positions, FrontPort has rear port position #}
|
||||||
{{ iface.connected_endpoint.device }}
|
{# Ending at a rear port isn't interesting if we know the front port #}
|
||||||
</a>
|
<td>
|
||||||
</td>
|
<a href="{% url 'dcim:device' pk=previous_endpoint.pk %}">
|
||||||
<td>
|
{{ previous_endpoint.device }}
|
||||||
<a href="{% url 'dcim:interface' pk=iface.connected_endpoint.pk %}">
|
</a>
|
||||||
<span title="{{ iface.connected_endpoint.get_type_display }}">
|
{% with path=iface.via_endpoints|slice:":-1" %}
|
||||||
{{ iface.connected_endpoint }}
|
{% include "dcim/inc/interface_path.html" %}
|
||||||
</span>
|
{% endwith %}
|
||||||
</a>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
{% elif iface.connected_endpoint.term_side %}
|
<a href="{% url 'dcim:device' pk=previous_endpoint.device_id %}">
|
||||||
{# Connected to a CircuitTermination #}
|
{{ previous_endpoint.name }}
|
||||||
{% with iface.connected_endpoint.get_peer_termination as peer_termination %}
|
</a>
|
||||||
{% if peer_termination %}
|
</td>
|
||||||
{% if peer_termination.connected_endpoint %}
|
{% elif endpoint.name and endpoint.device %}
|
||||||
<td>
|
{# Interface, FrontPort and RearPort have a name and a device #}
|
||||||
<a href="{% url 'dcim:device' pk=peer_termination.connected_endpoint.device.pk %}">
|
<td>
|
||||||
{{ peer_termination.connected_endpoint.device }}
|
<a href="{% url 'dcim:device' pk=endpoint.device.pk %}">
|
||||||
</a><br/>
|
{{ endpoint.device }}
|
||||||
<small>via <i class="fa fa-fw fa-globe" title="Circuit"></i>
|
</a>
|
||||||
<a href="{{ iface.connected_endpoint.circuit.get_absolute_url }}">
|
{% with path=iface.via_endpoints %}
|
||||||
{{ iface.connected_endpoint.circuit.provider }}
|
{% include "dcim/inc/interface_path.html" %}
|
||||||
{{ iface.connected_endpoint.circuit }}
|
{% endwith %}
|
||||||
</a>
|
</td>
|
||||||
</small>
|
<td>
|
||||||
</td>
|
{% if endpoint.get_type_display %}
|
||||||
<td>
|
<a href="{% url 'dcim:interface' pk=endpoint.pk %}">
|
||||||
{{ peer_termination.connected_endpoint }}
|
<span title="{{ endpoint.get_type_display }}">
|
||||||
</td>
|
{{ endpoint.name }}
|
||||||
{% else %}
|
</span>
|
||||||
<td colspan="2">
|
|
||||||
<a href="{% url 'dcim:site' slug=peer_termination.site.slug %}">
|
|
||||||
{{ peer_termination.site }}
|
|
||||||
</a>
|
</a>
|
||||||
via <i class="fa fa-fw fa-globe" title="Circuit"></i>
|
{% else %}
|
||||||
<a href="{{ iface.connected_endpoint.circuit.get_absolute_url }}">
|
<a href="{% url 'dcim:device' pk=endpoint.device.pk %}">
|
||||||
{{ iface.connected_endpoint.circuit.provider }}
|
{{ endpoint.name }}
|
||||||
{{ iface.connected_endpoint.circuit }}
|
|
||||||
</a>
|
</a>
|
||||||
</td>
|
{% endif %}
|
||||||
{% endif %}
|
</td>
|
||||||
|
{% elif endpoint.circuit %}
|
||||||
|
{# CircuitTermination has a circuit #}
|
||||||
|
<td colspan="2">
|
||||||
|
{% if endpoint.circuit == previous_endpoint.circuit %}
|
||||||
|
{# We have the remote endpoint, show the remote site #}
|
||||||
|
<a href="{% url 'dcim:site' slug=endpoint.site.slug %}">
|
||||||
|
{{ endpoint.site }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{# We have the local endpoint, show the circuit #}
|
||||||
|
<i class="fa fa-fw fa-globe" title="Circuit"></i>
|
||||||
|
<a href="{{ endpoint.circuit.get_absolute_url }}">
|
||||||
|
{{ endpoint.circuit.provider }}
|
||||||
|
{{ endpoint.circuit.cid }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% with path=iface.via_endpoints %}
|
||||||
|
{% include "dcim/inc/interface_path.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<i class="fa fa-fw fa-globe" title="Circuit"></i>
|
<span class="text-muted">Unknown endpoint type</span>
|
||||||
<a href="{{ iface.connected_endpoint.circuit.get_absolute_url }}">
|
|
||||||
{{ iface.connected_endpoint.circuit.provider }}
|
|
||||||
{{ iface.connected_endpoint.circuit }}
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
26
netbox/templates/dcim/inc/interface_path.html
Normal file
26
netbox/templates/dcim/inc/interface_path.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{% if path %}
|
||||||
|
<br>
|
||||||
|
<small>
|
||||||
|
via
|
||||||
|
{% for endpoint in path %}
|
||||||
|
{% ifchanged %}
|
||||||
|
{% if endpoint.positions %}
|
||||||
|
{# Don't show RearPort #}
|
||||||
|
{% elif endpoint.rear_port_position %}
|
||||||
|
<span class="path-element">
|
||||||
|
<a href="{% url 'dcim:device' pk=endpoint.device.pk %}">
|
||||||
|
{{ endpoint.device }}
|
||||||
|
</a>
|
||||||
|
{{ endpoint.name }}
|
||||||
|
</span>
|
||||||
|
{% elif endpoint.circuit %}
|
||||||
|
<span class="path-element">
|
||||||
|
<a href="{% url 'circuits:circuit' pk=endpoint.circuit.pk %}">
|
||||||
|
{{ endpoint.circuit }}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endifchanged %}
|
||||||
|
{% endfor %}
|
||||||
|
</small>
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user