mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-09 19:03:48 +02:00
Redo the cable trace UI (WIP)
This commit is contained in:
@@ -7,66 +7,65 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-md-offset-1 text-center">
|
||||
<h4>Near End</h4>
|
||||
</div>
|
||||
<div class="col-md-3 text-center">
|
||||
{% if total_length %}<h5>Total length: {{ total_length|floatformat:"-2" }} Meters<h5>{% endif %}
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<h4>Far End</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-sm-12 text-center">
|
||||
{% for near_end, cable, far_end in path.origin.trace %}
|
||||
|
||||
{# 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 %}
|
||||
{% endif %}
|
||||
|
||||
{# Cable #}
|
||||
<div class="row">
|
||||
<div class="col-md-1 text-right">
|
||||
<h3>{{ forloop.counter }}</h3>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{% include 'dcim/inc/cable_trace_end.html' with end=near_end %}
|
||||
</div>
|
||||
<div class="col-md-3 text-center">
|
||||
{% if cable %}
|
||||
<h4>
|
||||
<a href="{% url 'dcim:cable' pk=cable.pk %}">
|
||||
{% if cable.label %}<code>{{ cable.label }}</code>{% else %}Cable #{{ cable.pk }}{% endif %}
|
||||
</a>
|
||||
</h4>
|
||||
<p><span class="label label-{{ cable.get_status_class }}">{{ cable.get_status_display }}</span></p>
|
||||
<p>{{ cable.get_type_display|default:"" }}</p>
|
||||
{% if cable.length %}{{ cable.length }} {{ cable.get_length_unit_display }}{% endif %}
|
||||
{% if cable.color %}
|
||||
<span class="label color-block center-block" style="background-color: #{{ cable.color }}"> </span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<h4 class="text-muted">No Cable</h4>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{% if far_end %}
|
||||
{% include 'dcim/inc/cable_trace_end.html' with end=far_end %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if cable %}
|
||||
{% include 'dcim/trace/cable.html' %}
|
||||
{% else %}
|
||||
<h4>No cable</h4>
|
||||
{% endif %}
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
{# 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 %}
|
||||
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="col-md-11 col-md-offset-1">
|
||||
<div class="text-center">
|
||||
<h3 class="text-success text-center">Trace completed!</h3>
|
||||
{% if total_length %}
|
||||
<h5>Total length: {{ total_length|floatformat:"-2" }} Meters<h5>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<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 }})</a>
|
||||
<a href="?cablepath_id={{ cablepath.pk }}">
|
||||
From {{ cablepath.origin }} ({{ cablepath.origin.parent }})
|
||||
to {{ cablepath.destination }} ({{ cablepath.destination.parent }})
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user