From 13d7720fd71afeaf43e7f4e1b4bb0528d7f1311d Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 17 Nov 2022 11:47:34 -0800 Subject: [PATCH 1/2] 10236 fix device detail for power-feed --- netbox/templates/dcim/device.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index b0cd76de485..a1e87c2a891 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -247,10 +247,15 @@
Leg {{ leg.name }} {{ leg.outlet_count }} {{ leg.allocated }} - {{ powerfeed.available_power|divide:3 }}VA - {% with phase_available=powerfeed.available_power|divide:3 %} - {% utilization_graph leg.allocated|percentage:phase_available %} - {% endwith %} + {% if powerfeed.available_power %} + {{ powerfeed.available_power|divide:3 }}VA + {% with phase_available=powerfeed.available_power|divide:3 %} + {% utilization_graph leg.allocated|percentage:phase_available %} + {% endwith %} + {% else %} + — + — + {% endif %} {% endfor %} {% endwith %} From e66974ef4eb88f8791ad2ddbe2ab72abc9b645d5 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 17 Nov 2022 16:45:20 -0800 Subject: [PATCH 2/2] 10236 optimize with statement --- netbox/templates/dcim/device.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index a1e87c2a891..19e7e6e3cff 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -248,8 +248,8 @@
{{ leg.outlet_count }} {{ leg.allocated }} {% if powerfeed.available_power %} - {{ powerfeed.available_power|divide:3 }}VA {% with phase_available=powerfeed.available_power|divide:3 %} + {{ phase_available }}VA {% utilization_graph leg.allocated|percentage:phase_available %} {% endwith %} {% else %}