_interface.html 3.8 KB

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