Просмотр исходного кода

Replace references to Interface.connection with connected_endpoint

Jeremy Stretch 7 лет назад
Родитель
Сommit
e75ef5fd2d

+ 7 - 9
netbox/templates/dcim/device_lldp_neighbors.html

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

+ 6 - 6
netbox/templates/dcim/inc/interface.html

@@ -81,7 +81,7 @@
     {# Buttons #}
     <td class="text-right text-nowrap">
         {% 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">
                     <i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
                 </button>
@@ -94,17 +94,17 @@
         {% endif %}
         {% if perms.dcim.change_interface %}
             {% if not iface.is_virtual %}
-                {% if iface.connection %}
-                    {% if iface.connection.connection_status %}
-                        <a href="#" class="btn btn-warning btn-xs interface-toggle connected" data="{{ iface.connection.pk }}" title="Mark planned">
+                {% if iface.cable %}
+                    {% if iface.cable.status %}
+                        <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>
                         </a>
                     {% 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>
                         </a>
                     {% 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>
                     </a>
                 {% elif iface.circuit_termination and perms.circuits.change_circuittermination %}

+ 10 - 12
netbox/templates/dcim/interface.html

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