powerport.html 3.4 KB

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