poweroutlet.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <tr class="poweroutlet{% if po.connected_endpoint %} {% if po.connected_endpoint.connection_status %}success{% else %}info{% endif %}{% endif %}">
  2. {# Checkbox #}
  3. {% if perms.dcim.change_poweroutlet or perms.dcim.delete_poweroutlet %}
  4. <td class="pk">
  5. <input name="pk" type="checkbox" value="{{ po.pk }}" />
  6. </td>
  7. {% endif %}
  8. {# Name #}
  9. <td>
  10. <i class="fa fa-fw fa-bolt"></i> {{ po }}
  11. </td>
  12. {# Cable #}
  13. <td>
  14. {% with cable=po.get_connected_cable %}
  15. {% if cable %}
  16. <a href="{{ cable.get_absolute_url }}">{{ cable }}</a>
  17. {% if cable.far_end != po.connected_endpoint %}
  18. to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> {{ cable.far_end }}
  19. {% endif %}
  20. {% endif %}
  21. {% endwith %}
  22. </td>
  23. {# Connection #}
  24. {% if po.connected_endpoint %}
  25. <td>
  26. <a href="{% url 'dcim:device' pk=po.connected_endpoint.device.pk %}">{{ po.connected_endpoint.device }}</a>
  27. </td>
  28. <td>
  29. {{ po.connected_endpoint }}
  30. </td>
  31. {% else %}
  32. <td colspan="2">
  33. <span class="text-muted">Not connected</span>
  34. </td>
  35. {% endif %}
  36. {# Actions #}
  37. <td class="text-right">
  38. {% if perms.dcim.change_poweroutlet %}
  39. {% if po.connected_endpoint %}
  40. {% if po.connected_endpoint.connection_status %}
  41. <a href="#" class="btn btn-warning btn-xs powerport-toggle connected" title="Mark planned" data="{{ po.connected_endpoint.pk }}">
  42. <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
  43. </a>
  44. {% else %}
  45. <a href="#" class="btn btn-success btn-xs powerport-toggle" title="Mark installed" data="{{ po.connected_endpoint.pk }}">
  46. <i class="fa fa-plug" aria-hidden="true"></i>
  47. </a>
  48. {% endif %}
  49. <a href="{% url 'dcim:poweroutlet_disconnect' pk=po.pk %}" title="Delete connection" class="btn btn-danger btn-xs">
  50. <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
  51. </a>
  52. {% else %}
  53. <a href="{% url 'dcim:poweroutlet_connect' termination_a_id=po.pk %}" title="Connect" class="btn btn-success btn-xs">
  54. <i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
  55. </a>
  56. {% endif %}
  57. <a href="{% url 'dcim:poweroutlet_edit' pk=po.pk %}" title="Edit outlet" class="btn btn-info btn-xs">
  58. <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
  59. </a>
  60. {% endif %}
  61. {% if perms.dcim.delete_poweroutlet %}
  62. {% if po.connected_endpoint %}
  63. <button class="btn btn-danger btn-xs" disabled="disabled">
  64. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  65. </button>
  66. {% else %}
  67. <a href="{% url 'dcim:poweroutlet_delete' pk=po.pk %}?return_url={{ device.get_absolute_url }}" title="Delete outlet" class="btn btn-danger btn-xs">
  68. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  69. </a>
  70. {% endif %}
  71. {% endif %}
  72. </td>
  73. </tr>