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

Fixed interface connection rendering

Jeremy Stretch 7 лет назад
Родитель
Сommit
47c523a40b
2 измененных файлов с 4 добавлено и 4 удалено
  1. 1 1
      netbox/dcim/views.py
  2. 3 3
      netbox/templates/dcim/inc/interface.html

+ 1 - 1
netbox/dcim/views.py

@@ -1662,7 +1662,7 @@ class InterfaceView(View):
         interface = get_object_or_404(Interface, pk=pk)
         interface = get_object_or_404(Interface, pk=pk)
 
 
         # Get connected interface
         # Get connected interface
-        connected_interface = interface.connected_interface
+        connected_interface = interface.connected_endpoint
         if connected_interface is None and hasattr(interface, 'circuit_termination'):
         if connected_interface is None and hasattr(interface, 'circuit_termination'):
             peer_termination = interface.circuit_termination.get_peer_termination()
             peer_termination = interface.circuit_termination.get_peer_termination()
             if peer_termination is not None:
             if peer_termination is not None:

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

@@ -1,4 +1,4 @@
-<tr class="interface{% if not iface.enabled %} danger{% elif iface.connection and iface.connection.connection_status or iface.circuit_termination %} success{% elif iface.connection and not iface.connection.connection_status %} info{% elif iface.is_virtual %} warning{% endif %}" id="iface_{{ iface.name }}">
+<tr class="interface{% if not iface.enabled %} danger{% elif iface.connected_endpoint %} {% if iface.connection_status %}success{% else %}info{% endif %}{% elif iface.circuit_termination %} success{% elif iface.is_virtual %} warning{% endif %}" id="iface_{{ iface.name }}">
 
 
     {# Checkbox #}
     {# Checkbox #}
     {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
     {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
@@ -38,8 +38,8 @@
         <td colspan="2" class="text-muted">Virtual interface</td>
         <td colspan="2" class="text-muted">Virtual interface</td>
     {% elif iface.is_wireless %}
     {% elif iface.is_wireless %}
         <td colspan="2" class="text-muted">Wireless interface</td>
         <td colspan="2" class="text-muted">Wireless interface</td>
-    {% elif iface.connection %}
-        {% with iface.connected_interface as connected_iface %}
+    {% elif iface.connected_endpoint %}
+        {% with connected_iface=iface.connected_endpoint %}
             <td>
             <td>
                 <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
                 <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
             </td>
             </td>