power_utilization.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {% extends "ui/panels/_base.html" %}
  2. {% load helpers i18n %}
  3. {% block panel_content %}
  4. <table class="table table-hover">
  5. <thead>
  6. <tr>
  7. <th>{% trans "Input" %}</th>
  8. <th>{% trans "Outlets" %}</th>
  9. <th>{% trans "Allocated" %}</th>
  10. <th>{% trans "Available" %}</th>
  11. <th>{% trans "Utilization" %}</th>
  12. </tr>
  13. </thead>
  14. {% for powerport in object.powerports.all %}
  15. {% with utilization=powerport.get_power_draw powerfeed=powerport.connected_endpoints.0 %}
  16. <tr>
  17. <td>{{ powerport }}</td>
  18. <td>{{ utilization.outlet_count }}</td>
  19. <td>{{ utilization.allocated }}{% trans "VA" %}</td>
  20. {% if powerfeed.available_power %}
  21. <td>{{ powerfeed.available_power }}{% trans "VA" %}</td>
  22. <td>{% utilization_graph utilization.allocated|percentage:powerfeed.available_power %}</td>
  23. {% else %}
  24. <td class="text-muted">&mdash;</td>
  25. <td class="text-muted">&mdash;</td>
  26. {% endif %}
  27. </tr>
  28. {% for leg in utilization.legs %}
  29. <tr>
  30. <td style="padding-left: 20px">
  31. {% trans "Leg" context "Leg of a power feed" %} {{ leg.name }}
  32. </td>
  33. <td>{{ leg.outlet_count }}</td>
  34. <td>{{ leg.allocated }}</td>
  35. {% if powerfeed.available_power %}
  36. {% with phase_available=powerfeed.available_power|divide:3 %}
  37. <td>{{ phase_available }}{% trans "VA" %}</td>
  38. <td>{% utilization_graph leg.allocated|percentage:phase_available %}</td>
  39. {% endwith %}
  40. {% else %}
  41. <td class="text-muted">&mdash;</td>
  42. <td class="text-muted">&mdash;</td>
  43. {% endif %}
  44. </tr>
  45. {% endfor %}
  46. {% endwith %}
  47. {% endfor %}
  48. </table>
  49. {% endblock panel_content %}