base.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. {% extends 'generic/object.html' %}
  2. {% load buttons %}
  3. {% load static %}
  4. {% load helpers %}
  5. {% load custom_links %}
  6. {% load plugins %}
  7. {% block breadcrumbs %}
  8. <li><a href="{% url 'dcim:device_list' %}">Devices</a></li>
  9. <li><a href="{% url 'dcim:device_list' %}?site={{ object.site.slug }}">{{ object.site }}</a></li>
  10. {% if object.parent_bay %}
  11. <li><a href="{% url 'dcim:device' pk=object.parent_bay.device.pk %}">{{ object.parent_bay.device }}</a></li>
  12. <li>{{ object.parent_bay }}</li>
  13. {% endif %}
  14. <li>{{ object }}</li>
  15. {% endblock %}
  16. {% block buttons %}
  17. {% if perms.dcim.change_device %}
  18. <div class="btn-group">
  19. <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  20. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Components <span class="caret"></span>
  21. </button>
  22. <ul class="dropdown-menu">
  23. {% if perms.dcim.add_consoleport %}
  24. <li><a href="{% url 'dcim:consoleport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}">Console Ports</a></li>
  25. {% endif %}
  26. {% if perms.dcim.add_consoleserverport %}
  27. <li><a href="{% url 'dcim:consoleserverport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}">Console Server Ports</a></li>
  28. {% endif %}
  29. {% if perms.dcim.add_powerport %}
  30. <li><a href="{% url 'dcim:powerport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}">Power Ports</a></li>
  31. {% endif %}
  32. {% if perms.dcim.add_poweroutlet %}
  33. <li><a href="{% url 'dcim:poweroutlet_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}">Power Outlets</a></li>
  34. {% endif %}
  35. {% if perms.dcim.add_interface %}
  36. <li><a href="{% url 'dcim:interface_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_interfaces' pk=object.pk %}">Interfaces</a></li>
  37. {% endif %}
  38. {% if perms.dcim.add_frontport %}
  39. <li><a href="{% url 'dcim:frontport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}">Front Ports</a></li>
  40. {% endif %}
  41. {% if perms.dcim.add_rearport %}
  42. <li><a href="{% url 'dcim:rearport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}">Rear Ports</a></li>
  43. {% endif %}
  44. {% if perms.dcim.add_devicebay %}
  45. <li><a href="{% url 'dcim:devicebay_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_devicebays' pk=object.pk %}">Device Bays</a></li>
  46. {% endif %}
  47. {% if perms.dcim.add_inventoryitem %}
  48. <li><a href="{% url 'dcim:inventoryitem_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_inventory' pk=object.pk %}">Inventory Items</a></li>
  49. {% endif %}
  50. </ul>
  51. </div>
  52. {% endif %}
  53. {% if perms.dcim.add_device %}
  54. {% clone_button object %}
  55. {% endif %}
  56. {% if perms.dcim.change_device %}
  57. {% edit_button object %}
  58. {% endif %}
  59. {% if perms.dcim.delete_device %}
  60. {% delete_button object %}
  61. {% endif %}
  62. {% endblock %}
  63. {% block tabs %}
  64. <ul class="nav nav-tabs">
  65. <li role="presentation" {% if active_tab == 'device' %} class="active"{% endif %}>
  66. <a href="{% url 'dcim:device' pk=object.pk %}">Device</a>
  67. </li>
  68. {% with interface_count=object.vc_interfaces.count %}
  69. {% if interface_count %}
  70. <li role="presentation" {% if active_tab == 'interfaces' %} class="active"{% endif %}>
  71. <a href="{% url 'dcim:device_interfaces' pk=object.pk %}">Interfaces {% badge interface_count %}</a>
  72. </li>
  73. {% endif %}
  74. {% endwith %}
  75. {% with frontport_count=object.frontports.count %}
  76. {% if frontport_count %}
  77. <li role="presentation" {% if active_tab == 'front-ports' %} class="active"{% endif %}>
  78. <a href="{% url 'dcim:device_frontports' pk=object.pk %}">Front Ports {% badge frontport_count %}</a>
  79. </li>
  80. {% endif %}
  81. {% endwith %}
  82. {% with rearport_count=object.rearports.count %}
  83. {% if rearport_count %}
  84. <li role="presentation" {% if active_tab == 'rear-ports' %} class="active"{% endif %}>
  85. <a href="{% url 'dcim:device_rearports' pk=object.pk %}">Rear Ports {% badge rearport_count %}</a>
  86. </li>
  87. {% endif %}
  88. {% endwith %}
  89. {% with consoleport_count=object.consoleports.count %}
  90. {% if consoleport_count %}
  91. <li role="presentation" {% if active_tab == 'console-ports' %} class="active"{% endif %}>
  92. <a href="{% url 'dcim:device_consoleports' pk=object.pk %}">Console Ports {% badge consoleport_count %}</a>
  93. </li>
  94. {% endif %}
  95. {% endwith %}
  96. {% with consoleserverport_count=object.consoleserverports.count %}
  97. {% if consoleserverport_count %}
  98. <li role="presentation" {% if active_tab == 'console-server-ports' %} class="active"{% endif %}>
  99. <a href="{% url 'dcim:device_consoleserverports' pk=object.pk %}">Console Server Ports {% badge consoleserverport_count %}</a>
  100. </li>
  101. {% endif %}
  102. {% endwith %}
  103. {% with powerport_count=object.powerports.count %}
  104. {% if powerport_count %}
  105. <li role="presentation" {% if active_tab == 'power-ports' %} class="active"{% endif %}>
  106. <a href="{% url 'dcim:device_powerports' pk=object.pk %}">Power Ports {% badge powerport_count %}</a>
  107. </li>
  108. {% endif %}
  109. {% endwith %}
  110. {% with poweroutlet_count=object.poweroutlets.count %}
  111. {% if poweroutlet_count %}
  112. <li role="presentation" {% if active_tab == 'power-outlets' %} class="active"{% endif %}>
  113. <a href="{% url 'dcim:device_poweroutlets' pk=object.pk %}">Power Outlets {% badge poweroutlet_count %}</a>
  114. </li>
  115. {% endif %}
  116. {% endwith %}
  117. {% with devicebay_count=object.devicebays.count %}
  118. {% if devicebay_count %}
  119. <li role="presentation" {% if active_tab == 'device-bays' %} class="active"{% endif %}>
  120. <a href="{% url 'dcim:device_devicebays' pk=object.pk %}">Device Bays {% badge devicebay_count %}</a>
  121. </li>
  122. {% endif %}
  123. {% endwith %}
  124. {% with inventoryitem_count=object.inventoryitems.count %}
  125. {% if inventoryitem_count %}
  126. <li role="presentation" {% if active_tab == 'inventory' %} class="active"{% endif %}>
  127. <a href="{% url 'dcim:device_inventory' pk=object.pk %}">Inventory {% badge inventoryitem_count %}</a>
  128. </li>
  129. {% endif %}
  130. {% endwith %}
  131. {% if perms.dcim.napalm_read_device %}
  132. {% if object.status != 'active' %}
  133. {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %}
  134. {% elif not object.platform %}
  135. {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %}
  136. {% elif not object.platform.napalm_driver %}
  137. {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %}
  138. {% else %}
  139. {% include 'dcim/inc/device_napalm_tabs.html' %}
  140. {% endif %}
  141. {% endif %}
  142. {% if perms.extras.view_configcontext %}
  143. <li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}>
  144. <a href="{% url 'dcim:device_configcontext' pk=object.pk %}">Config Context</a>
  145. </li>
  146. {% endif %}
  147. {% if perms.extras.view_journalentry %}
  148. <li role="presentation"{% if active_tab == 'journal' %} class="active"{% endif %}>
  149. <a href="{% url 'dcim:device_journal' pk=object.pk %}">Journal</a>
  150. </li>
  151. {% endif %}
  152. {% if perms.extras.view_objectchange %}
  153. <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
  154. <a href="{% url 'dcim:device_changelog' pk=object.pk %}">Change Log</a>
  155. </li>
  156. {% endif %}
  157. </ul>
  158. {% endblock %}