role.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {% extends 'generic/object.html' %}
  2. {% load helpers %}
  3. {% load plugins %}
  4. {% load render_table from django_tables2 %}
  5. {% block extra_controls %}
  6. {% if perms.ipam.add_prefix %}
  7. <a href="{% url 'ipam:prefix_add' %}?role={{ object.pk }}" class="btn btn-sm btn-primary">
  8. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Prefix
  9. </a>
  10. {% endif %}
  11. {% endblock extra_controls %}
  12. {% block content %}
  13. <div class="row mb-3">
  14. <div class="col col-md-6">
  15. <div class="card">
  16. <h5 class="card-header">
  17. Role
  18. </h5>
  19. <div class="card-body">
  20. <table class="table table-hover attr-table">
  21. <tr>
  22. <th scope="row">Name</th>
  23. <td>{{ object.name }}</td>
  24. </tr>
  25. <tr>
  26. <th scope="row">Description</th>
  27. <td>{{ object.description|placeholder }}</td>
  28. </tr>
  29. <tr>
  30. <th scope="row">Weight</th>
  31. <td>{{ object.weight }}</td>
  32. </tr>
  33. <tr>
  34. <th scope="row">Prefixes</th>
  35. <td>
  36. <a href="{% url 'ipam:prefix_list' %}?role_id={{ object.pk }}">{{ prefixes_table.rows|length }}</a>
  37. </td>
  38. </tr>
  39. <tr>
  40. <th scope="row">IP Ranges</th>
  41. <td>
  42. {% with ipranges_count=object.ip_ranges.count %}
  43. {% if ipranges_count %}
  44. <a href="{% url 'ipam:iprange_list' %}?role_id={{ object.pk }}">{{ ipranges_count }}</a>
  45. {% else %}
  46. {{ ''|placeholder }}
  47. {% endif %}
  48. {% endwith %}
  49. </td>
  50. </tr>
  51. <tr>
  52. <th scope="row">VLANs</th>
  53. <td>
  54. {% with vlans_count=object.vlans.count %}
  55. {% if vlans_count %}
  56. <a href="{% url 'ipam:vlan_list' %}?role_id={{ object.pk }}">{{ vlans_count }}</a>
  57. {% else %}
  58. {{ ''|placeholder }}
  59. {% endif %}
  60. {% endwith %}
  61. </td>
  62. </tr>
  63. </table>
  64. </div>
  65. </div>
  66. {% include 'inc/panels/tags.html' %}
  67. {% plugin_left_page object %}
  68. </div>
  69. <div class="col col-md-6">
  70. {% include 'inc/panels/custom_fields.html' %}
  71. {% plugin_right_page object %}
  72. </div>
  73. </div>
  74. <div class="row mb-3">
  75. <div class="col col-md-12">
  76. <div class="card">
  77. <h5 class="card-header">Prefixes</h5>
  78. <div class="card-body table-responsive">
  79. {% render_table prefixes_table 'inc/table.html' %}
  80. {% include 'inc/paginator.html' with paginator=prefixes_table.paginator page=prefixes_table.page %}
  81. </div>
  82. </div>
  83. {% plugin_full_width_page object %}
  84. </div>
  85. </div>
  86. {% endblock %}