poweroutlet.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. {% load helpers %}
  2. <tr class="poweroutlet{% if po.cable %} {{ po.cable.get_status_class }}{% endif %}">
  3. {# Checkbox #}
  4. {% if perms.dcim.change_poweroutlet or perms.dcim.delete_poweroutlet %}
  5. <td class="pk">
  6. <input name="pk" type="checkbox" value="{{ po.pk }}" />
  7. </td>
  8. {% endif %}
  9. {# Name #}
  10. <td>
  11. <i class="fa fa-fw fa-bolt"></i>
  12. <a href="{{ po.get_absolute_url }}">{{ po }}</a>
  13. </td>
  14. {# Type #}
  15. <td>
  16. {{ po.get_type_display }}
  17. </td>
  18. {# Input/leg #}
  19. <td>
  20. {% if po.power_port %}
  21. {{ po.power_port }}{% if po.feed_leg %} / {{ po.get_feed_leg_display }}{% endif %}
  22. {% elif po.feed_leg %}
  23. {{ po.get_feed_leg_display }}
  24. {% else %}
  25. <span class="text-warning">None</span>
  26. {% endif %}
  27. </td>
  28. {# Description #}
  29. <td>
  30. {{ po.description|placeholder }}
  31. </td>
  32. {# Cable #}
  33. <td class="text-nowrap">
  34. {% if po.cable %}
  35. <a href="{{ po.cable.get_absolute_url }}">{{ po.cable }}</a>
  36. <a href="{% url 'dcim:poweroutlet_trace' pk=po.pk %}" class="btn btn-primary btn-xs" title="Trace">
  37. <i class="fa fa-share-alt" aria-hidden="true"></i>
  38. </a>
  39. {% else %}
  40. <span class="text-muted">&mdash;</span>
  41. {% endif %}
  42. </td>
  43. {# Connection #}
  44. {% if po.connected_endpoint %}
  45. {% with pp=po.connected_endpoint %}
  46. <td>
  47. <a href="{% url 'dcim:device' pk=pp.device.pk %}">{{ pp.device }}</a>
  48. </td>
  49. <td>
  50. {{ pp }}
  51. </td>
  52. <td>
  53. {% if pp.allocated_draw %}
  54. {{ pp.allocated_draw }}W{% if pp.maximum_draw %} ({{ pp.maximum_draw }}W max){% endif %}
  55. {% elif pp.maximum_draw %}
  56. {{ pp.maximum_draw }}W
  57. {% endif %}
  58. </td>
  59. {% endwith %}
  60. {% else %}
  61. <td colspan="3">
  62. <span class="text-muted">Not connected</span>
  63. </td>
  64. {% endif %}
  65. {# Actions #}
  66. <td class="text-right noprint">
  67. {% if po.cable %}
  68. {% include 'dcim/inc/cable_toggle_buttons.html' with cable=po.cable %}
  69. {% elif perms.dcim.add_cable %}
  70. <a href="{% url 'dcim:poweroutlet_connect' termination_a_id=po.pk termination_b_type='power-port' %}?return_url={{ device.get_absolute_url }}" title="Connect" class="btn btn-success btn-xs">
  71. <i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
  72. </a>
  73. {% endif %}
  74. {% if perms.dcim.change_poweroutlet %}
  75. <a href="{% url 'dcim:poweroutlet_edit' pk=po.pk %}" title="Edit outlet" class="btn btn-info btn-xs">
  76. <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
  77. </a>
  78. {% endif %}
  79. {% if perms.dcim.delete_poweroutlet %}
  80. {% if po.connected_endpoint %}
  81. <button class="btn btn-danger btn-xs" disabled="disabled">
  82. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  83. </button>
  84. {% else %}
  85. <a href="{% url 'dcim:poweroutlet_delete' pk=po.pk %}?return_url={{ device.get_absolute_url }}" title="Delete outlet" class="btn btn-danger btn-xs">
  86. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  87. </a>
  88. {% endif %}
  89. {% endif %}
  90. </td>
  91. </tr>