interface.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <tr{% if iface.connection and not iface.connection.connection_status %} class="info"{% endif %}>
  2. {% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %}
  3. <td class="pk">
  4. <input name="pk" type="checkbox" value="{{ iface.pk }}" />
  5. </td>
  6. {% endif %}
  7. <td>
  8. <i class="fa fa-fw fa-{{ icon|default:"exchange" }}"></i> <span title="{{ iface.get_form_factor_display }}">{{ iface.name }}</span>
  9. {% if iface.lag %}
  10. <span class="label label-primary">{{ iface.lag.name }}</span>
  11. {% endif %}
  12. {% if iface.description %}
  13. <i class="fa fa-fw fa-comment-o" title="{{ iface.description }}"></i>
  14. {% endif %}
  15. {% if iface.is_lag %}
  16. <br /><small class="text-muted">{{ iface.member_interfaces.all|join:", "|default:"No members" }}</small>
  17. {% endif %}
  18. </td>
  19. <td>
  20. <small>{{ iface.mac_address|default:'' }}</small>
  21. </td>
  22. {% if iface.is_virtual %}
  23. <td colspan="2" class="text-muted">Virtual interface</td>
  24. {% elif iface.connection %}
  25. {% with iface.connected_interface as connected_iface %}
  26. <td>
  27. <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
  28. </td>
  29. <td>
  30. <span title="{{ connected_iface.get_form_factor_display }}">{{ connected_iface }}</span>
  31. </td>
  32. {% endwith %}
  33. {% elif iface.circuit_termination %}
  34. {% with iface.circuit_termination.get_peer_termination as peer_termination %}
  35. <td colspan="2">
  36. <i class="fa fa-fw fa-globe" title="Circuit"></i>
  37. {% if peer_termination %}
  38. <a href="{% url 'dcim:site' slug=peer_termination.site.slug %}">{{ peer_termination.site }}</a> via
  39. {% endif %}
  40. <a href="{% url 'circuits:circuit' pk=iface.circuit_termination.circuit_id %}">{{ iface.circuit_termination.circuit }}</a>
  41. </td>
  42. {% endwith %}
  43. {% else %}
  44. <td colspan="2">
  45. <span class="text-muted">Not connected</span>
  46. </td>
  47. {% endif %}
  48. <td class="text-right">
  49. {% if show_graphs %}
  50. {% if iface.circuit_termination or iface.connection %}
  51. <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#graphs_modal" data-obj="{{ device.name }} - {{ iface.name }}" data-url="{% url 'dcim-api:interface-graphs' pk=iface.pk %}" title="Show graphs">
  52. <i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
  53. </button>
  54. {% endif %}
  55. {% endif %}
  56. {% if perms.dcim.change_interface %}
  57. {% if not iface.is_virtual %}
  58. {% if iface.connection %}
  59. {% if iface.connection.connection_status %}
  60. <a href="#" class="btn btn-warning btn-xs interface-toggle connected" data="{{ iface.connection.pk }}" title="Mark planned">
  61. <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
  62. </a>
  63. {% else %}
  64. <a href="#" class="btn btn-success btn-xs interface-toggle" data="{{ iface.connection.pk }}" title="Mark connected">
  65. <i class="fa fa-plug" aria-hidden="true"></i>
  66. </a>
  67. {% endif %}
  68. <a href="{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?device={{ device.pk }}" class="btn btn-danger btn-xs" title="Delete connection">
  69. <i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
  70. </a>
  71. {% elif iface.circuit_termination and perms.circuits.change_circuittermination %}
  72. <button class="btn btn-warning btn-xs interface-toggle connected" disabled="disabled" title="Circuits cannot be marked as planned or connected">
  73. <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
  74. </button>
  75. <a href="{% url 'circuits:circuittermination_edit' pk=iface.circuit_termination.pk %}" class="btn btn-danger btn-xs" title="Edit circuit termination">
  76. <i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
  77. </a>
  78. {% else %}
  79. <a href="{% url 'dcim:interfaceconnection_add' pk=device.pk %}?interface_a={{ iface.pk }}" class="btn btn-success btn-xs" title="Connect">
  80. <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
  81. </a>
  82. {% endif %}
  83. {% endif %}
  84. <a href="{% url 'dcim:interface_edit' pk=iface.pk %}" class="btn btn-info btn-xs" title="Edit interface">
  85. <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
  86. </a>
  87. {% endif %}
  88. {% if perms.dcim.delete_interface %}
  89. {% if iface.connection or iface.circuit_termination %}
  90. <button class="btn btn-danger btn-xs" disabled="disabled">
  91. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  92. </button>
  93. {% else %}
  94. <a href="{% url 'dcim:interface_delete' pk=iface.pk %}" class="btn btn-danger btn-xs" title="Delete interface">
  95. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  96. </a>
  97. {% endif %}
  98. {% endif %}
  99. </td>
  100. </tr>