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

111 lines
4.6 KiB
HTML
Raw Normal View History

{% extends 'base/layout.html' %}
{% load helpers %}
{% block title %}Cable Trace for {{ object|meta:"verbose_name"|bettertitle }} {{ object }}{% endblock %}
{% block content %}
<div class="row">
{# Cable trace SVG & options #}
2021-04-30 15:55:37 -07:00
<div class="col col-md-5">
{% if path %}
2021-07-29 10:08:43 -04:00
<div class="text-center my-3">
2022-07-14 10:37:27 -04:00
<object data="{{ svg_url }}" class="rack_elevation"></object>
<div>
2021-07-29 10:08:43 -04:00
<a class="btn btn-outline-primary btn-sm my-3" href="{{ svg_url }}">
<i class="mdi mdi-file-download"></i> Download SVG
</a>
2022-07-14 10:37:27 -04:00
</div>
</div>
2021-07-29 10:08:43 -04:00
<div class="trace-end">
{% if path.is_split %}
<h3 class="text-danger">Path split!</h3>
<p>Select a node below to continue:</p>
<ul class="text-start">
{% for next_node in path.get_split_nodes %}
{% if next_node.cable %}
{% with viewname=next_node|viewname:"trace" %}
<li>
<a href="{% url viewname pk=next_node.pk %}">{{ next_node|meta:"verbose_name"|bettertitle }} {{ next_node }}</a>
(Cable {{ next_node.cable|linkify }})
</li>
{% endwith %}
{% else %}
<li class="text-muted">{{ next_node }}</li>
{% endif %}
{% endfor %}
</ul>
{% else %}
<h3 class="text-center text-success">Trace Completed</h3>
<table class="table">
<tr>
<th scope="row">Total segments</th>
<td>{{ path.segment_count }}</td>
</tr>
<tr>
<th scope="row">Total length</th>
<td>
{% if total_length %}
{{ total_length|floatformat:"-2" }}{% if not is_definitive %}+{% endif %} Meters /
{{ total_length|meters_to_feet|floatformat:"-2" }} Feet
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
</tr>
</table>
{% endif %}
2020-11-13 12:12:25 -05:00
</div>
{% else %}
<h3 class="text-center text-muted my-3">
No paths found
</h3>
{% endif %}
</div>
{# Related paths #}
<div class="col col-md-7">
2021-04-15 16:53:04 -07:00
<div class="card">
<h5 class="card-header">
Related Paths
</h5>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th>Origin</th>
<th>Destination</th>
<th>Segments</th>
2020-11-13 12:12:25 -05:00
</tr>
2021-04-15 16:53:04 -07:00
</thead>
<tbody>
{% for cablepath in related_paths %}
<tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
<td>
2022-07-14 10:37:27 -04:00
<a href="?cablepath_id={{ cablepath.pk }}">{{ cablepath.origins|join:", " }}</a>
2021-04-15 16:53:04 -07:00
</td>
<td>
2022-07-14 10:37:27 -04:00
{% if cablepath.destinations %}
{{ cablepath.destinations|join:", " }}
2021-04-15 16:53:04 -07:00
{% else %}
<span class="text-muted">Incomplete</span>
{% endif %}
</td>
2022-07-14 10:37:27 -04:00
<td>
2021-04-15 16:53:04 -07:00
{{ cablepath.segment_count }}
</td>
</tr>
{% empty %}
<td colspan="3" class="text-muted">
None found
</td>
{% endfor %}
</tbody>
</table>
</div>
2020-11-13 12:12:25 -05:00
</div>
2020-10-02 14:54:16 -04:00
</div>
</div>
{% endblock %}