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

Fixes #10118: Fix display of connected LLDP neighbors for devices

jeremystretch 3 лет назад
Родитель
Сommit
a416ff6314
2 измененных файлов с 21 добавлено и 18 удалено
  1. 2 1
      docs/release-notes/version-3.3.md
  2. 19 17
      netbox/templates/dcim/device/lldp_neighbors.html

+ 2 - 1
docs/release-notes/version-3.3.md

@@ -29,7 +29,8 @@
 * [#10094](https://github.com/netbox-community/netbox/issues/10094) - Fix 404 when using "create and add another" to add contact assignments
 * [#10108](https://github.com/netbox-community/netbox/issues/10108) - Linkify inside NAT IPs for primary device IPs in UI
 * [#10109](https://github.com/netbox-community/netbox/issues/10109) - Fix available prefixes calculation for container prefixes in the global table
-* [#10111](https://github.com/netbox-community/netbox/issues/10111) - Wrap search QS to catch ValueError on identifier field
+* [#10111](https://github.com/netbox-community/netbox/issues/10111) - Fix ValueError exception when searching for L2VPN objects
+* [#10118](https://github.com/netbox-community/netbox/issues/10118) - Fix display of connected LLDP neighbors for devices
 * [#10134](https://github.com/netbox-community/netbox/issues/10134) - Custom fields data serializer should return a 400 response for invalid data
 * [#10135](https://github.com/netbox-community/netbox/issues/10135) - Fix SSO support for SAML2 IDPs
 * [#10147](https://github.com/netbox-community/netbox/issues/10147) - Permit the creation of 0U device types via REST API

+ 19 - 17
netbox/templates/dcim/device/lldp_neighbors.html

@@ -32,23 +32,25 @@
                     {% for iface in interfaces %}
                         <tr id="{{ iface.name }}">
                             <td>{{ iface }}</td>
-                            {% if iface.connected_endpoint.device %}
-                                <td class="configured_device" data="{{ iface.connected_endpoint.device.name }}" data-chassis="{{ iface.connected_endpoint.device.virtual_chassis.name }}">
-                                    <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.name }}">
-                                    <span title="{{ iface.connected_endpoint.get_type_display }}">{{ iface.connected_endpoint }}</span>
-                                </td>
-                            {% elif iface.connected_endpoint.circuit %}
-                                {% with circuit=iface.connected_endpoint.circuit %}
-                                    <td colspan="2">
-                                        <i class="mdi mdi-lightning-bolt" title="Circuit"></i>
-                                        <a href="{{ circuit.get_absolute_url }}">{{ circuit.provider }} {{ circuit }}</a>
-                                    </td>
-                                {% endwith %}
-                            {% else %}
-                                <td class="text-muted" colspan="2">None</td>
-                            {% endif %}
+                            {% with peer=iface.connected_endpoints.0 %}
+                              {% if peer.device %}
+                                  <td class="configured_device" data="{{ peer.device.name }}" data-chassis="{{ peer.device.virtual_chassis.name }}">
+                                      <a href="{% url 'dcim:device' pk=peer.device.pk %}">{{ peer.device }}</a>
+                                  </td>
+                                  <td class="configured_interface" data="{{ peer.name }}">
+                                      <span title="{{ peer.get_type_display }}">{{ peer }}</span>
+                                  </td>
+                              {% elif peer.circuit %}
+                                  {% with circuit=peer.circuit %}
+                                      <td colspan="2">
+                                          <i class="mdi mdi-lightning-bolt" title="Circuit"></i>
+                                          <a href="{{ circuit.get_absolute_url }}">{{ circuit.provider }} {{ circuit }}</a>
+                                      </td>
+                                  {% endwith %}
+                              {% else %}
+                                  <td class="text-muted" colspan="2">None</td>
+                              {% endif %}
+                            {% endwith %}
                             <td class="device"></td>
                             <td class="interface"></td>
                         </tr>