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

Extended Cables to connect CircuitTerminations

This commit is contained in:
Jeremy Stretch
2018-10-30 12:16:22 -04:00
parent cbfb25f003
commit 4df74780b8
22 changed files with 305 additions and 199 deletions

View File

@@ -41,9 +41,6 @@
</div>
</div>
{% render_field form.site %}
{% render_field form.rack %}
{% render_field form.device %}
{% render_field form.interface %}
</div>
</div>
<div class="panel panel-default">

View File

@@ -39,10 +39,17 @@
<tr>
<td>Termination</td>
<td>
{% if termination.interface %}
<a href="{% url 'dcim:device' pk=termination.interface.device.pk %}">{{ termination.interface.device }}</a>
<i class="fa fa-angle-right"></i> {{ termination.interface }}
{% if termination.connected_endpoint %}
<a href="{% url 'dcim:device' pk=termination.connected_endpoint.device.pk %}">{{ termination.connected_endpoint.device }}</a>
<i class="fa fa-angle-right"></i> {{ termination.connected_endpoint }}
{% else %}
{% if perms.circuits.change_circuittermination %}
<div class="pull-right">
<a href="{% url 'circuits:circuittermination_connect' termination_a_id=termination.pk %}?return_url={{ circuit.get_absolute_url }}" class="btn btn-success btn-xs" title="Connect">
<i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i> Connect
</a>
</div>
{% endif %}
<span class="text-muted">Not defined</span>
{% endif %}
</td>
@@ -61,8 +68,8 @@
<tr>
<td>IP Addressing</td>
<td>
{% if termination.interface %}
{% for ip in termination.interface.ip_addresses.all %}
{% if termination.connected_endpoint %}
{% for ip in termination.connected_endpoint.ip_addresses.all %}
{% if not forloop.first %}<br />{% endif %}
<a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a> ({{ ip.vrf|default:"Global" }})
{% empty %}

View File

@@ -29,30 +29,59 @@
<strong>A Side</strong>
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-3 control-label required">Site</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.device.site }}</p>
{% if termination_a.device %}
{# Device component #}
<div class="form-group">
<label class="col-md-3 control-label required">Site</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.device.site }}</p>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label required">Rack</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.device.rack|default:"None" }}</p>
<div class="form-group">
<label class="col-md-3 control-label required">Rack</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.device.rack|default:"None" }}</p>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label required">Device</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.device }}</p>
<div class="form-group">
<label class="col-md-3 control-label required">Device</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.device }}</p>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label required">Name</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a }}</p>
<div class="form-group">
<label class="col-md-3 control-label required">Name</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a }}</p>
</div>
</div>
</div>
{% else %}
{# Circuit termination #}
<div class="form-group">
<label class="col-md-3 control-label required">Site</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.site }}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label required">Provider</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.circuit.provider }}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label required">Circuit</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.circuit.cid }}</p>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label required">Side</label>
<div class="col-md-9">
<p class="form-control-static">{{ termination_a.term_side }}</p>
</div>
</div>
{% endif %}
</div>
</div>
</div>

View File

@@ -1,12 +1,29 @@
<table class="table table-hover panel-body attr-table">
<tr>
<td>Device</td>
<td>
<a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
</td>
</tr>
<tr>
<td>Component</td>
<td>{{ termination }}</td>
</tr>
{% if termination.device %}
{# Device component #}
<tr>
<td>Device</td>
<td>
<a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
</td>
</tr>
<tr>
<td>Component</td>
<td>{{ termination }}</td>
</tr>
{% else %}
{# Circuit termination #}
<tr>
<td>Provider</td>
<td>
<a href="{{ termination.circuit.provider.get_absolute_url }}">{{ termination.circuit.provider }}</a>
</td>
</tr>
<tr>
<td>Circuit</td>
<td>
<a href="{{ termination.circuit.get_absolute_url }}">{{ termination.circuit }}</a> (Side {{ termination.term_side }})
</td>
</tr>
{% endif %}
</table>

View File

@@ -50,17 +50,17 @@
<td colspan="2" class="text-muted">Virtual interface</td>
{% elif iface.is_wireless %}
<td colspan="2" class="text-muted">Wireless interface</td>
{% elif iface.connected_endpoint %}
{% with connected_iface=iface.connected_endpoint %}
<td>
<a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
</td>
<td>
<a href="{% url 'dcim:interface' pk=connected_iface.pk %}"><span title="{{ connected_iface.get_form_factor_display }}">{{ connected_iface }}</span></a>
</td>
{% endwith %}
{% elif iface.circuit_termination %}
{% with iface.circuit_termination.get_peer_termination as peer_termination %}
{% elif iface.connected_endpoint.name %}
{# Connected to an Interface #}
<td>
<a href="{% url 'dcim:device' pk=iface.connected_endpoint.device.pk %}">{{ iface.connected_endpoint.device }}</a>
</td>
<td>
<a href="{% url 'dcim:interface' pk=iface.connected_endpoint.pk %}"><span title="{{ iface.connected_endpoint.get_form_factor_display }}">{{ iface.connected_endpoint }}</span></a>
</td>
{% elif iface.connected_endpoint.term_side %}
{# Connected to a CircuitTermination #}
{% with iface.connected_endpoint.get_peer_termination as peer_termination %}
<td colspan="2">
<i class="fa fa-fw fa-globe" title="Circuit"></i>
{% if peer_termination %}
@@ -72,7 +72,7 @@
{% endif %}
via
{% endif %}
<a href="{% url 'circuits:circuit' pk=iface.circuit_termination.circuit_id %}">{{ iface.circuit_termination.circuit }}</a>
<a href="{% url 'circuits:circuit' pk=iface.connected_endpoint.circuit_id %}">{{ iface.connected_endpoint.circuit }}</a>
</td>
{% endwith %}
{% else %}
@@ -84,7 +84,7 @@
{# Buttons #}
<td class="text-right text-nowrap">
{% if show_graphs %}
{% if iface.circuit_termination or iface.connected_endpoint %}
{% if iface.connected_endpoint %}
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#graphs_modal" data-obj="{{ device.name }} - {{ iface.name }}" data-url="{% url 'dcim-api:interface-graphs' pk=iface.pk %}" title="Show graphs">
<i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
</button>
@@ -110,13 +110,6 @@
<a href="{% url 'dcim:cable_delete' pk=iface.cable.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs" title="Remove cable">
<i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
</a>
{% elif iface.circuit_termination and perms.circuits.change_circuittermination %}
<button class="btn btn-warning btn-xs interface-toggle connected" disabled="disabled" title="Circuits cannot be marked as planned or connected">
<i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
</button>
<a href="{% url 'circuits:circuittermination_edit' pk=iface.circuit_termination.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs" title="Edit circuit termination">
<i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
</a>
{% else %}
<a href="{% url 'dcim:interface_connect' termination_a_id=iface.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-success btn-xs" title="Connect">
<i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>