powerport.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <tr class="powerport{% if pp.cable %} {{ pp.cable.get_status_class }}{% endif %}">
  2. {# Checkbox #}
  3. {% if perms.dcim.change_powerport or perms.dcim.delete_powerport %}
  4. <td class="pk">
  5. <input name="pk" type="checkbox" value="{{ pp.pk }}" />
  6. </td>
  7. {% endif %}
  8. {# Name #}
  9. <td>
  10. <i class="fa fa-fw fa-bolt"></i>
  11. <a href="{{ pp.get_absolute_url }}">{{ pp }}</a>
  12. </td>
  13. {# Type #}
  14. <td>
  15. {{ pp.get_type_display }}
  16. </td>
  17. {# Current draw #}
  18. <td>
  19. {% if pp.allocated_draw %}
  20. {{ pp.allocated_draw }}W{% if pp.maximum_draw %} ({{ pp.maximum_draw }}W max){% endif %}
  21. {% elif pp.maximum_draw %}
  22. {{ pp.maximum_draw }}W
  23. {% endif %}
  24. </td>
  25. {# Description #}
  26. <td>
  27. {{ pp.description }}
  28. </td>
  29. {# Cable #}
  30. {% if pp.cable %}
  31. <td>
  32. <a href="{{ pp.cable.get_absolute_url }}">{{ pp.cable }}</a>
  33. <a href="{% url 'dcim:powerport_trace' pk=pp.pk %}" class="btn btn-primary btn-xs" title="Trace">
  34. <i class="fa fa-share-alt" aria-hidden="true"></i>
  35. </a>
  36. </td>
  37. {% else %}
  38. <td><span class="text-muted">Not connected</span></td>
  39. {% endif %}
  40. {# Connection #}
  41. {% include 'dcim/inc/endpoint_connection.html' with path=pp.path %}
  42. {# Actions #}
  43. <td class="text-right noprint">
  44. {% if pp.cable %}
  45. {% include 'dcim/inc/cable_toggle_buttons.html' with cable=pp.cable %}
  46. {% elif perms.dcim.add_cable %}
  47. <span class="dropdown">
  48. <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  49. <span class="glyphicon glyphicon-resize-small" aria-hidden="true"></span>
  50. </button>
  51. <ul class="dropdown-menu dropdown-menu-right">
  52. <li><a href="{% url 'dcim:powerport_connect' termination_a_id=pp.pk termination_b_type='power-outlet' %}?return_url={{ device.get_absolute_url }}">Power Outlet</a></li>
  53. <li><a href="{% url 'dcim:powerport_connect' termination_a_id=pp.pk termination_b_type='power-feed' %}?return_url={{ device.get_absolute_url }}">Power Feed</a></li>
  54. </ul>
  55. </span>
  56. {% endif %}
  57. {% if perms.dcim.change_powerport %}
  58. <a href="{% url 'dcim:powerport_edit' pk=pp.pk %}?return_url={{ device.get_absolute_url }}" title="Edit port" class="btn btn-info btn-xs">
  59. <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
  60. </a>
  61. {% endif %}
  62. {% if perms.dcim.delete_powerport %}
  63. {% if pp.connected_endpoint %}
  64. <button class="btn btn-danger btn-xs" disabled="disabled">
  65. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  66. </button>
  67. {% else %}
  68. <a href="{% url 'dcim:powerport_delete' pk=pp.pk %}?return_url={{ device.get_absolute_url }}" title="Delete port" class="btn btn-danger btn-xs">
  69. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  70. </a>
  71. {% endif %}
  72. {% endif %}
  73. </td>
  74. </tr>