From 8060617edc396d29b637a612e3e50ddd514336db Mon Sep 17 00:00:00 2001 From: Patrick Hurrelmann Date: Mon, 26 Sep 2022 14:53:05 +0200 Subject: [PATCH] Fixes: #10460 Fix view for connection details * assumes only one connection for power related connections * consoleport and consoleserver allow multiple connections on the view * interface allows mutliple connections and old circuit details removed (circuit is broken since at least 2.7) --- netbox/templates/dcim/consoleport.html | 12 +++--- netbox/templates/dcim/consoleserverport.html | 12 +++--- netbox/templates/dcim/interface.html | 39 ++++++-------------- netbox/templates/dcim/powerfeed.html | 18 ++++----- netbox/templates/dcim/poweroutlet.html | 10 ++--- netbox/templates/dcim/powerport.html | 12 +++--- 6 files changed, 44 insertions(+), 59 deletions(-) diff --git a/netbox/templates/dcim/consoleport.html b/netbox/templates/dcim/consoleport.html index 39ffbf552..92b3c6393 100644 --- a/netbox/templates/dcim/consoleport.html +++ b/netbox/templates/dcim/consoleport.html @@ -72,22 +72,22 @@ - {% if object.connected_endpoint %} + {% for endpoint in object.connected_endpoints %} Device - {{ object.connected_endpoint.device|linkify }} + {{ endpoint.device|linkify }} Name - {{ object.connected_endpoint|linkify:"name" }} + {{ endpoint|linkify:"name" }} Type - {{ object.connected_endpoint.get_type_display|placeholder }} + {{ endpoint.get_type_display|placeholder }} Description - {{ object.connected_endpoint.description|placeholder }} + {{ endpoint.description|placeholder }} Path Status @@ -99,7 +99,7 @@ {% endif %} - {% endif %} + {% endfor %} {% else %}
diff --git a/netbox/templates/dcim/consoleserverport.html b/netbox/templates/dcim/consoleserverport.html index 642e758a3..fdd0220e6 100644 --- a/netbox/templates/dcim/consoleserverport.html +++ b/netbox/templates/dcim/consoleserverport.html @@ -72,24 +72,24 @@ - {% if object.connected_endpoint %} + {% for endpoint in object.connected_endpoints %} Device - {{ object.connected_endpoint.device|linkify }} + {{ endpoint.device|linkify }} Name - {{ object.connected_endpoint|linkify:"name" }} + {{ endpoint|linkify:"name" }} Type - {{ object.connected_endpoint.get_type_display|placeholder }} + {{ endpoint.get_type_display|placeholder }} Description - {{ object.connected_endpoint.description|placeholder }} + {{ endpoint.description|placeholder }} Path Status @@ -101,7 +101,7 @@ {% endif %} - {% endif %} + {% endfor %} {% else %}
diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index 1216f3e88..10c5b620f 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -165,57 +165,42 @@ - {% if object.connected_endpoint.device %} - {% with iface=object.connected_endpoint %} + {% for endpoint in object.connected_endpoints %} + {% if endpoint.device %} Device - {{ iface.device|linkify }} + {{ endpoint.device|linkify }} Name - {{ iface|linkify:"name" }} + {{ endpoint|linkify:"name" }} Type - {{ iface.get_type_display }} + {{ endpoint.get_type_display }} LAG - {{ iface.lag|linkify|placeholder }} + {{ endpoint.lag|linkify|placeholder }} Description - {{ iface.description|placeholder }} + {{ endpoint.description|placeholder }} MTU - {{ iface.mtu|placeholder }} + {{ endpoint.mtu|placeholder }} MAC Address - {{ iface.mac_address|placeholder }} + {{ endpoint.mac_address|placeholder }} 802.1Q Mode - {{ iface.get_mode_display }} + {{ endpoint.get_mode_display }} - {% endwith %} - {% elif object.connected_endpoint.circuit %} - {% with ct=object.connected_endpoint %} - - Provider - {{ ct.circuit.provider|linkify }} - - - Circuit - {{ ct.circuit|linkify }} - - - Side - {{ ct.term_side }} - - {% endwith %} - {% endif %} + {% endif %} + {% endfor %} Path Status diff --git a/netbox/templates/dcim/powerfeed.html b/netbox/templates/dcim/powerfeed.html index 584454df8..6d0b1fd0e 100644 --- a/netbox/templates/dcim/powerfeed.html +++ b/netbox/templates/dcim/powerfeed.html @@ -41,8 +41,8 @@ Connected Device - {% if object.connected_endpoint %} - {{ object.connected_endpoint.device|linkify }} ({{ object.connected_endpoint }}) + {% if object.connected_endpoints %} + {{ object.connected_endpoints.0.device|linkify }} ({{ object.connected_endpoints.0|linkify:"name" }}) {% else %} {{ ''|placeholder }} {% endif %} @@ -50,7 +50,7 @@ Utilization (Allocated) - {% with utilization=object.connected_endpoint.get_power_draw %} + {% with utilization=object.connected_endpoints.0.get_power_draw %} {% if utilization %} {{ utilization.allocated }}VA / {{ object.available_power }}VA @@ -120,22 +120,22 @@ - {% if object.connected_endpoint %} + {% for endpoint in object.connected_endpoints %} Device - {{ object.connected_endpoint.device|linkify }} + {{ endpoint.device|linkify }} Name - {{ object.connected_endpoint|linkify:"name" }} + {{ endpoint|linkify:"name" }} Type - {{ object.connected_endpoint.get_type_display|placeholder }} + {{ endpoint.get_type_display|placeholder }} Description - {{ object.connected_endpoint.description|placeholder }} + {{ endpoint.description|placeholder }} Path Status @@ -147,7 +147,7 @@ {% endif %} - {% endif %} + {% endfor %} {% else %}
diff --git a/netbox/templates/dcim/poweroutlet.html b/netbox/templates/dcim/poweroutlet.html index 26f4a07f8..d9632d800 100644 --- a/netbox/templates/dcim/poweroutlet.html +++ b/netbox/templates/dcim/poweroutlet.html @@ -78,22 +78,22 @@ - {% if object.connected_endpoint %} + {% if object.connected_endpoints %} Device - {{ object.connected_endpoint.device|linkify }} + {{ object.connected_endpoints.0.device|linkify }} Name - {{ object.connected_endpoint|linkify:"name" }} + {{ object.connected_endpoints.0|linkify:"name" }} Type - {{ object.connected_endpoint.get_type_display|placeholder }} + {{ object.connected_endpoints.0.get_type_display|placeholder }} Description - {{ object.connected_endpoint.description|placeholder }} + {{ object.connected_endpoints.0.description|placeholder }} Path Status diff --git a/netbox/templates/dcim/powerport.html b/netbox/templates/dcim/powerport.html index c5eccbf14..4c500fd38 100644 --- a/netbox/templates/dcim/powerport.html +++ b/netbox/templates/dcim/powerport.html @@ -78,22 +78,22 @@ - {% if object.connected_endpoint %} + {% if object.connected_endpoints %} Device - {{ object.connected_endpoint.device|linkify }} + {{ object.connected_endpoints.0.device|linkify }} Name - {{ object.connected_endpoint|linkify:"name" }} + {{ object.connected_endpoints.0|linkify:"name" }} Type - {{ object.connected_endpoint.get_type_display|placeholder }} + {{ object.connected_endpoints.0.get_type_display|placeholder }} Description - {{ object.connected_endpoint.description|placeholder }} + {{ object.connected_endpoints.0.description|placeholder }} Path Status @@ -105,7 +105,7 @@ {% endif %} - {% endif %} + {% endfor %} {% else %}