Explorar o código

10236 fix device detail for power-feed (#10961)

* 10236 fix device detail for power-feed

* 10236 optimize with statement
Arthur Hanson %!s(int64=3) %!d(string=hai) anos
pai
achega
dd2520d675
Modificáronse 1 ficheiros con 9 adicións e 4 borrados
  1. 9 4
      netbox/templates/dcim/device.html

+ 9 - 4
netbox/templates/dcim/device.html

@@ -247,10 +247,15 @@
                                             <td style="padding-left: 20px">Leg {{ leg.name }}</td>
                                             <td>{{ leg.outlet_count }}</td>
                                             <td>{{ leg.allocated }}</td>
-                                            <td>{{ powerfeed.available_power|divide:3 }}VA</td>
-                                            {% with phase_available=powerfeed.available_power|divide:3 %}
-                                                <td>{% utilization_graph leg.allocated|percentage:phase_available %}</td>
-                                            {% endwith %}
+                                            {% if powerfeed.available_power %}
+                                                {% with phase_available=powerfeed.available_power|divide:3 %}
+                                                    <td>{{ phase_available }}VA</td>
+                                                    <td>{% utilization_graph leg.allocated|percentage:phase_available %}</td>
+                                                {% endwith %}
+                                            {% else %}
+                                                <td class="text-muted">&mdash;</td>
+                                                <td class="text-muted">&mdash;</td>
+                                            {% endif %}
                                         </tr>
                                     {% endfor %}
                                 {% endwith %}