_interface.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <tr{% if iface.connection and not iface.connection.connection_status %} class="info"{% endif %}>
  2. {% if selectable and 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.description %}
  10. <i class="fa fa-fw fa-comment-o" title="{{ iface.description }}"></i>
  11. {% endif %}
  12. </td>
  13. <td>
  14. <small>{{ iface.mac_address|default:'' }}</small>
  15. </td>
  16. {% if not iface.is_physical %}
  17. <td colspan="2">Virtual</td>
  18. {% elif iface.connection %}
  19. {% with iface.get_connected_interface as connected_iface %}
  20. <td>
  21. <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
  22. </td>
  23. <td>
  24. <span title="{{ connected_iface.get_form_factor_display }}">{{ connected_iface }}</span>
  25. </td>
  26. {% endwith %}
  27. {% elif iface.circuit %}
  28. <td colspan="2">
  29. <a href="{% url 'circuits:circuit' pk=iface.circuit.pk %}">{{ iface.circuit }}</a>
  30. </td>
  31. {% else %}
  32. <td colspan="2">
  33. <span class="text-muted">Not connected</span>
  34. </td>
  35. {% endif %}
  36. <td class="text-right">
  37. {% if show_graphs %}
  38. {% if iface.circuit or iface.connection %}
  39. <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">
  40. <i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
  41. </button>
  42. {% endif %}
  43. {% endif %}
  44. {% if perms.dcim.change_interface %}
  45. {% if iface.is_physical %}
  46. {% if iface.connection %}
  47. {% if iface.connection.connection_status %}
  48. <a href="#" class="btn btn-warning btn-xs interface-toggle connected" data="{{ iface.connection.pk }}" title="Mark planned">
  49. <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
  50. </a>
  51. {% else %}
  52. <a href="#" class="btn btn-success btn-xs interface-toggle" data="{{ iface.connection.pk }}" title="Mark connected">
  53. <i class="fa fa-plug" aria-hidden="true"></i>
  54. </a>
  55. {% endif %}
  56. <a href="{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?device={{ device.pk }}" class="btn btn-danger btn-xs" title="Delete connection">
  57. <i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
  58. </a>
  59. {% else %}
  60. <a href="{% url 'dcim:interfaceconnection_add' pk=device.pk %}?interface={{ iface.pk }}" class="btn btn-success btn-xs" title="Connect">
  61. <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
  62. </a>
  63. {% endif %}
  64. {% endif %}
  65. <a href="{% url 'dcim:interface_edit' pk=iface.pk %}" class="btn btn-info btn-xs" title="Edit interface">
  66. <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
  67. </a>
  68. {% endif %}
  69. {% if perms.dcim.delete_interface %}
  70. {% if iface.connection or iface.circuit %}
  71. <button class="btn btn-danger btn-xs" disabled="disabled">
  72. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  73. </button>
  74. {% else %}
  75. <a href="{% url 'dcim:interface_delete' pk=iface.pk %}" class="btn btn-danger btn-xs" title="Delete interface">
  76. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  77. </a>
  78. {% endif %}
  79. {% endif %}
  80. </td>
  81. </tr>