poweroutlet.html 3.4 KB

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