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

81 lines
3.4 KiB
HTML

{% extends 'base.html' %}
{% load helpers %}
{% block header %}
<h1>{% block title %}Cable Trace for {{ obj }}{% endblock %}</h1>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-5 col-sm-12 text-center">
{% for near_end, cable, far_end in path %}
{# Near end #}
{% if near_end.device %}
{% include 'dcim/trace/device.html' with device=near_end.device %}
{% include 'dcim/trace/termination.html' with termination=near_end %}
{% elif near_end.power_panel %}
{% include 'dcim/trace/powerfeed.html' with powerfeed=near_end %}
{% elif near_end.circuit %}
{% include 'dcim/trace/circuit.html' with circuit=near_end.circuit %}
{% include 'dcim/trace/termination.html' with termination=near_end %}
{% else %}
<h3 class="text-danger text-center">Split Paths!</h3>
{# TODO: Present the user with successive paths to choose from #}
{% endif %}
{# Cable #}
{% if cable %}
<div class="row">
{% include 'dcim/trace/cable.html' %}
</div>
{% 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 %}
{% elif far_end.power_panel %}
{% include 'dcim/trace/powerfeed.html' with powerfeed=far_end %}
{% elif far_end.circuit %}
{% include 'dcim/trace/termination.html' with termination=far_end %}
{% if forloop.last %}
{% include 'dcim/trace/circuit.html' with circuit=far_end.circuit %}
{% endif %}
{% endif %}
{% if forloop.last and far_end %}
<div class="row">
<div class="text-center">
<h3 class="text-success text-center">Trace completed!</h3>
<h5>Total segments: {{ path|length }}</h5>
{% if total_length %}
<h5>Total length: {{ total_length|floatformat:"-2" }} Meters<h5>
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="col-md-7 col-sm-12">
<h4 class="text-center">Related Paths</h4>
<ul class="nav nav-pills nav-stacked">
{% for cablepath in related_paths %}
<li role="presentation"{% if cablepath.pk == path.pk %} class="active"{% endif %}>
<a href="?cablepath_id={{ cablepath.pk }}">
From {{ cablepath.origin }} ({{ cablepath.origin.parent }})
to {{ cablepath.destination }} ({{ cablepath.destination.parent }})
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}