mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Fix up related paths list
This commit is contained in:
parent
eb5f6167a5
commit
424d72a7b3
@ -230,6 +230,7 @@ table.report th a {
|
|||||||
/* Cable tracing */
|
/* Cable tracing */
|
||||||
.cable-trace {
|
.cable-trace {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
|
margin: 16px auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.cable-trace .node {
|
.cable-trace .node {
|
||||||
|
@ -7,76 +7,106 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-5 col-sm-12 cable-trace">
|
<div class="col-md-5 col-sm-12">
|
||||||
{% with traced_path=path.origin.trace %}
|
<div class="cable-trace">
|
||||||
{% for near_end, cable, far_end in traced_path %}
|
{% with traced_path=path.origin.trace %}
|
||||||
|
{% for near_end, cable, far_end in traced_path %}
|
||||||
|
|
||||||
{# Near end #}
|
{# Near end #}
|
||||||
{% if near_end.device %}
|
{% if near_end.device %}
|
||||||
{% include 'dcim/trace/device.html' with device=near_end.device %}
|
{% include 'dcim/trace/device.html' with device=near_end.device %}
|
||||||
{% include 'dcim/trace/termination.html' with termination=near_end %}
|
{% include 'dcim/trace/termination.html' with termination=near_end %}
|
||||||
{% elif near_end.power_panel %}
|
{% elif near_end.power_panel %}
|
||||||
{% include 'dcim/trace/powerpanel.html' with powerpanel=near_end.power_panel %}
|
{% include 'dcim/trace/powerpanel.html' with powerpanel=near_end.power_panel %}
|
||||||
{% include 'dcim/trace/termination.html' with termination=far_end%}
|
{% include 'dcim/trace/termination.html' with termination=far_end%}
|
||||||
{% elif near_end.circuit %}
|
{% elif near_end.circuit %}
|
||||||
{% include 'dcim/trace/circuit.html' with circuit=near_end.circuit %}
|
{% include 'dcim/trace/circuit.html' with circuit=near_end.circuit %}
|
||||||
{% include 'dcim/trace/termination.html' with termination=near_end %}
|
{% include 'dcim/trace/termination.html' with termination=near_end %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<h3 class="text-danger text-center">Split Paths!</h3>
|
<h3 class="text-danger text-center">Split Paths!</h3>
|
||||||
{# TODO: Present the user with successive paths to choose from #}
|
{# TODO: Present the user with successive paths to choose from #}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{# Cable #}
|
|
||||||
{% if cable %}
|
|
||||||
{% include 'dcim/trace/cable.html' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{# Far end #}
|
|
||||||
{% if far_end.device %}
|
|
||||||
{% include 'dcim/trace/termination.html' with termination=far_end %}
|
|
||||||
{% if forloop.last %}
|
|
||||||
{% include 'dcim/trace/device.html' with device=far_end.device %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif far_end.power_panel %}
|
|
||||||
{% include 'dcim/trace/termination.html' with termination=far_end %}
|
{# Cable #}
|
||||||
{% include 'dcim/trace/powerpanel.html' with powerpanel=far_end.power_panel %}
|
{% if cable %}
|
||||||
{% elif far_end.circuit %}
|
{% include 'dcim/trace/cable.html' %}
|
||||||
{% include 'dcim/trace/termination.html' with termination=far_end %}
|
|
||||||
{% if forloop.last %}
|
|
||||||
{% include 'dcim/trace/circuit.html' with circuit=far_end.circuit %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if forloop.last %}
|
{# Far end #}
|
||||||
<div class="trace-end">
|
{% if far_end.device %}
|
||||||
<h3{% if far_end %} class="text-success"{% endif %}>Trace completed</h3>
|
{% include 'dcim/trace/termination.html' with termination=far_end %}
|
||||||
<h5>Total segments: {{ traced_path|length }}</h5>
|
{% if forloop.last %}
|
||||||
<h5>Total length:
|
{% include 'dcim/trace/device.html' with device=far_end.device %}
|
||||||
{% if total_length %}
|
{% endif %}
|
||||||
{{ total_length|floatformat:"-2" }} Meters
|
{% elif far_end.power_panel %}
|
||||||
{% else %}
|
{% include 'dcim/trace/termination.html' with termination=far_end %}
|
||||||
<span class="text-muted">N/A</span>
|
{% include 'dcim/trace/powerpanel.html' with powerpanel=far_end.power_panel %}
|
||||||
{% endif %}
|
{% elif far_end.circuit %}
|
||||||
<h5>
|
{% include 'dcim/trace/termination.html' with termination=far_end %}
|
||||||
</div>
|
{% if forloop.last %}
|
||||||
{% endif %}
|
{% include 'dcim/trace/circuit.html' with circuit=far_end.circuit %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% if forloop.last %}
|
||||||
{% endwith %}
|
<div class="trace-end">
|
||||||
|
<h3{% if far_end %} class="text-success"{% endif %}>Trace completed</h3>
|
||||||
|
<h5>Total segments: {{ traced_path|length }}</h5>
|
||||||
|
<h5>Total length:
|
||||||
|
{% if total_length %}
|
||||||
|
{{ total_length|floatformat:"-2" }} Meters
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">N/A</span>
|
||||||
|
{% endif %}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-7 col-sm-12">
|
<div class="col-md-7 col-sm-12">
|
||||||
|
|
||||||
<h4 class="text-center">Related Paths</h4>
|
<div class="panel panel-default">
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<div class="panel-heading">
|
||||||
{% for cablepath in related_paths %}
|
<strong>Related Paths</strong>
|
||||||
<li role="presentation"{% if cablepath.pk == path.pk %} class="active"{% endif %}>
|
</div>
|
||||||
<a href="?cablepath_id={{ cablepath.pk }}">
|
<table class="table table-hover panel-body">
|
||||||
From {{ cablepath.origin }} ({{ cablepath.origin.parent }})
|
<thead>
|
||||||
to {{ cablepath.destination }} ({{ cablepath.destination.parent }})
|
<tr>
|
||||||
</a>
|
<th>Origin</th>
|
||||||
</li>
|
<th>Destination</th>
|
||||||
{% endfor %}
|
<th>Segments</th>
|
||||||
</ul>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for cablepath in related_paths %}
|
||||||
|
<tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
|
||||||
|
<td>
|
||||||
|
<a href="?cablepath_id={{ cablepath.pk }}">
|
||||||
|
{{ cablepath.origin.parent }} / {{ cablepath.origin }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if cablepath.destination %}
|
||||||
|
{{ cablepath.destination }} ({{ cablepath.destination.parent }})
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">Incomplete</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
{{ cablepath.segment_count }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<td colspan="3" class="text-muted">
|
||||||
|
None found
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user