Replace references to Interface.connection with connected_endpoint

This commit is contained in:
Jeremy Stretch 2018-10-29 14:12:02 -04:00
parent 8ebf7a7ad0
commit e75ef5fd2d
3 changed files with 23 additions and 27 deletions

View File

@ -22,15 +22,13 @@
{% for iface in interfaces %} {% for iface in interfaces %}
<tr id="{{ iface.name }}"> <tr id="{{ iface.name }}">
<td>{{ iface }}</td> <td>{{ iface }}</td>
{% if iface.connection %} {% if iface.connected_endpoint %}
{% with iface.connected_interface as connected_iface %} <td class="configured_device" data="{{ iface.connected_endpoint.device }}">
<td class="configured_device" data="{{ connected_iface.device }}"> <a href="{% url 'dcim:device' pk=iface.connected_endpoint.device.pk %}">{{ iface.connected_endpoint.device }}</a>
<a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a> </td>
</td> <td class="configured_interface" data="{{ iface.connected_endpoint }}">
<td class="configured_interface" data="{{ connected_iface }}"> <span title="{{ iface.connected_endpoint.get_form_factor_display }}">{{ iface.connected_endpoint }}</span>
<span title="{{ connected_iface.get_form_factor_display }}">{{ connected_iface }}</span> </td>
</td>
{% endwith %}
{% else %} {% else %}
<td colspan="2">None</td> <td colspan="2">None</td>
{% endif %} {% endif %}

View File

@ -81,7 +81,7 @@
{# Buttons #} {# Buttons #}
<td class="text-right text-nowrap"> <td class="text-right text-nowrap">
{% if show_graphs %} {% if show_graphs %}
{% if iface.circuit_termination or iface.connection %} {% if iface.circuit_termination or 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"> <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> <i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
</button> </button>
@ -94,17 +94,17 @@
{% endif %} {% endif %}
{% if perms.dcim.change_interface %} {% if perms.dcim.change_interface %}
{% if not iface.is_virtual %} {% if not iface.is_virtual %}
{% if iface.connection %} {% if iface.cable %}
{% if iface.connection.connection_status %} {% if iface.cable.status %}
<a href="#" class="btn btn-warning btn-xs interface-toggle connected" data="{{ iface.connection.pk }}" title="Mark planned"> <a href="#" class="btn btn-warning btn-xs interface-toggle connected" data="{{ iface.cable.pk }}" title="Mark planned">
<i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i> <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
</a> </a>
{% else %} {% else %}
<a href="#" class="btn btn-success btn-xs interface-toggle" data="{{ iface.connection.pk }}" title="Mark installed"> <a href="#" class="btn btn-success btn-xs interface-toggle" data="{{ iface.cable.pk }}" title="Mark installed">
<i class="fa fa-plug" aria-hidden="true"></i> <i class="fa fa-plug" aria-hidden="true"></i>
</a> </a>
{% endif %} {% endif %}
<a href="{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs" title="Disconnect"> <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> <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
</a> </a>
{% elif iface.circuit_termination and perms.circuits.change_circuittermination %} {% elif iface.circuit_termination and perms.circuits.change_circuittermination %}

View File

@ -196,18 +196,16 @@
<td>802.1Q Mode</td> <td>802.1Q Mode</td>
<td>{{ connected_interface.get_mode_display }}</td> <td>{{ connected_interface.get_mode_display }}</td>
</tr> </tr>
{% if interface.connection %} <tr>
<tr> <td>Connection Status</td>
<td>Connection Status</td> <td>
<td> {% if interface.connection_status %}
{% if interface.connection.connection_status %} <span class="label label-success">{{ interface.get_connection_status_display }}</span>
<span class="label label-success">{{ interface.connection.get_connection_status_display }}</span> {% else %}
{% else %} <span class="label label-info">{{ interface.get_connection_status_display }}</span>
<span class="label label-info">{{ interface.connection.get_connection_status_display }}</span> {% endif %}
{% endif %} </td>
</td> </tr>
</tr>
{% endif %}
</table> </table>
{% else %} {% else %}
<div class="panel-body text-muted"> <div class="panel-body text-muted">