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

Added dedicated cable trace view; removed modal

This commit is contained in:
Jeremy Stretch
2018-10-30 16:30:03 -04:00
parent 669fe1f192
commit 470aabe1d7
9 changed files with 111 additions and 10 deletions

View File

@@ -0,0 +1,42 @@
{% 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-4 col-md-offset-1 text-center">
<h4>Near End</h4>
</div>
<div class="col-md-4 col-md-offset-3 text-center">
<h4>Far End</h4>
</div>
</div>
{% for near_end, cable, far_end in trace %}
<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">
<h4>
<a href="{% url 'dcim:cable' pk=cable.pk %}">
{% if cable.label %}<code>{{ cable.label }}</code>{% else %}Cable #{{ cable.pk }}{% endif %}
</a>
</h4>
{{ cable.get_status_display }}<br />
{{ cable.get_type_display|default:"" }}
{% if cable.length %}- {{ cable.length }}{{ cable.length_unit }}{% endif %}
<span class="label color-block center-block" style="background-color: #{{ cable.color }}">&nbsp;</span>
</div>
<div class="col-md-4">
{% include 'dcim/inc/cable_trace_end.html' with end=far_end %}
</div>
</div>
{% if not forloop.last %}<hr />{% endif %}
{% endfor %}
{% endblock %}

View File

@@ -777,7 +777,6 @@
</div>
</div>
{% include 'inc/modal.html' with modal_name='graphs' %}
{% include 'inc/modal.html' with modal_name='cabletrace' %}
{% include 'secrets/inc/private_key_modal.html' %}
{% endblock %}
@@ -848,7 +847,6 @@ $('button.toggle-ips').click(function() {
return false;
});
</script>
<script src="{% static 'js/cabletrace.js' %}?v{{ settings.VERSION }}"></script>
<script src="{% static 'js/graphs.js' %}?v{{ settings.VERSION }}"></script>
<script src="{% static 'js/secrets.js' %}?v{{ settings.VERSION }}"></script>
{% endblock %}

View File

@@ -0,0 +1,27 @@
{% load helpers %}
<div class="panel panel-default">
<div class="panel-heading text-center">
{% if end.device %}
<strong><a href="{{ end.device.get_absolute_url }}">{{ end.device }}</a></strong>
{% else %}
<strong><a href="{{ end.circuit.get_absolute_url }}">{{ end.circuit }}</a></strong>
{% endif %}
</div>
<div class="panel-body text-center">
{% if end.device %}
{# Device component #}
{% with model=end|model_name %}
<strong>{{ model|bettertitle }} {{ end }}</strong><br />
{% if model == 'interface' %}
{{ end.get_form_factor_display }}
{% elif model == 'front port' or model == 'rear port' %}
{{ end.get_type_display }}
{% endif %}
{% endwith %}
{% else %}
{# Circuit termination #}
<strong>Side {{ end.term_side }}</strong>
{% endif %}
</div>
</div>

View File

@@ -32,9 +32,9 @@
<td>
{% if iface.cable %}
<a href="{{ iface.cable.get_absolute_url }}">{{ iface.cable }}</a>
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#cabletrace_modal" data-obj="{{ device.name }} - {{ iface.name }}" data-url="{% url 'dcim-api:interface-trace' pk=iface.pk %}" title="Trace cable">
<a href="{% url 'dcim:interface_trace' pk=iface.pk %}" class="btn btn-primary btn-xs" title="Trace">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</button>
</a>
{% else %}
&mdash;
{% endif %}