device.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. {% extends 'dcim/device/base.html' %}
  2. {% load render_table from django_tables2 %}
  3. {% load buttons %}
  4. {% load static %}
  5. {% load helpers %}
  6. {% load plugins %}
  7. {% load i18n %}
  8. {% load mptt %}
  9. {% block content %}
  10. <div class="row">
  11. <div class="col col-12 col-xl-6">
  12. <div class="card">
  13. <h5 class="card-header">{% trans "Device" %}</h5>
  14. <table class="table table-hover attr-table">
  15. <tr>
  16. <th scope="row">{% trans "Region" %}</th>
  17. <td>{% nested_tree object.site.region %}</td>
  18. </tr>
  19. <tr>
  20. <th scope="row">{% trans "Site" %}</th>
  21. <td>{{ object.site|linkify }}</td>
  22. </tr>
  23. <tr>
  24. <th scope="row">{% trans "Location" %}</th>
  25. <td>{% nested_tree object.location %}</td>
  26. </tr>
  27. <tr>
  28. <th scope="row">{% trans "Rack" %}</th>
  29. <td class="position-relative">
  30. {% if object.rack %}
  31. {{ object.rack|linkify }}
  32. <div class="position-absolute top-50 end-0 translate-middle-y d-print-none">
  33. <a href="{{ object.rack.get_absolute_url }}?device={{ object.pk }}" class="btn btn-primary" title="{% trans "Highlight device" %}">
  34. <i class="mdi mdi-view-day-outline"></i>
  35. </a>
  36. </div>
  37. {% else %}
  38. {{ ''|placeholder }}
  39. {% endif %}
  40. </td>
  41. </tr>
  42. <tr>
  43. <th scope="row">{% trans "Position" %}</th>
  44. <td>
  45. {% if object.parent_bay %}
  46. {% with object.parent_bay.device as parent %}
  47. {{ parent|linkify }} / {{ object.parent_bay }}
  48. {% if parent.position %}
  49. (U{{ parent.position|floatformat }} / {{ parent.get_face_display }})
  50. {% endif %}
  51. {% endwith %}
  52. {% elif object.rack and object.position %}
  53. <span>U{{ object.position|floatformat }} / {{ object.get_face_display }}</span>
  54. {% elif object.rack and object.device_type.u_height %}
  55. <span class="badge text-bg-warning">{% trans "Not racked" %}</span>
  56. {% else %}
  57. {{ ''|placeholder }}
  58. {% endif %}
  59. </td>
  60. </tr>
  61. <tr>
  62. <th scope="row">{% trans "GPS Coordinates" %}</th>
  63. <td class="position-relative">
  64. {% if object.latitude and object.longitude %}
  65. {% if config.MAPS_URL %}
  66. <div class="position-absolute top-50 end-0 translate-middle-y d-print-none">
  67. <a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary">
  68. <i class="mdi mdi-map-marker"></i> {% trans "Map It" %}
  69. </a>
  70. </div>
  71. {% endif %}
  72. <span>{{ object.latitude }}, {{ object.longitude }}</span>
  73. {% else %}
  74. {{ ''|placeholder }}
  75. {% endif %}
  76. </td>
  77. </tr>
  78. <tr>
  79. <th scope="row">{% trans "Tenant" %}</th>
  80. <td>
  81. {% if object.tenant.group %}
  82. {{ object.tenant.group|linkify }} /
  83. {% endif %}
  84. {{ object.tenant|linkify|placeholder }}
  85. </td>
  86. </tr>
  87. <tr>
  88. <th scope="row">{% trans "Device Type" %}</th>
  89. <td>
  90. {{ object.device_type|linkify:"get_full_name" }} ({{ object.device_type.u_height|floatformat }}U)
  91. </td>
  92. </tr>
  93. <tr>
  94. <th scope="row">{% trans "Description" %}</th>
  95. <td>{{ object.description|placeholder }}</td>
  96. </tr>
  97. <tr>
  98. <th scope="row">{% trans "Airflow" %}</th>
  99. <td>
  100. {{ object.get_airflow_display|placeholder }}
  101. </td>
  102. </tr>
  103. <tr>
  104. <th scope="row">{% trans "Serial Number" %}</th>
  105. <td class="font-monospace">{{ object.serial|placeholder }}</td>
  106. </tr>
  107. <tr>
  108. <th scope="row">{% trans "Asset Tag" %}</th>
  109. <td class="font-monospace">{{ object.asset_tag|placeholder }}</td>
  110. </tr>
  111. <tr>
  112. <th scope="row">{% trans "Config Template" %}</th>
  113. <td>{{ object.config_template|linkify|placeholder }}</td>
  114. </tr>
  115. </table>
  116. </div>
  117. {% if vc_members %}
  118. <div class="card">
  119. <h5 class="card-header">{% trans "Virtual Chassis" %}</h5>
  120. <table class="table table-hover attr-table">
  121. <tr>
  122. <th>{% trans "Device" %}</th>
  123. <th>{% trans "Position" %}</th>
  124. <th>{% trans "Master" %}</th>
  125. <th>{% trans "Priority" %}</th>
  126. </tr>
  127. {% for vc_member in vc_members %}
  128. <tr{% if vc_member == object %} class="info"{% endif %}>
  129. <td>
  130. {{ vc_member|linkify }}
  131. </td>
  132. <td>
  133. {% badge vc_member.vc_position show_empty=True %}
  134. </td>
  135. <td>
  136. {% if object.virtual_chassis.master == vc_member %}<i class="mdi mdi-check-bold"></i>{% endif %}
  137. </td>
  138. <td>
  139. {{ vc_member.vc_priority|placeholder }}
  140. </td>
  141. </tr>
  142. {% endfor %}
  143. </table>
  144. <div class="card-footer text-end d-print-none">
  145. <a href="{{ object.virtual_chassis.get_absolute_url }}" class="btn btn-primary">
  146. <span class="mdi mdi-arrow-right-bold" aria-hidden="true"></span> {% trans "View Virtual Chassis" %}
  147. </a>
  148. </div>
  149. </div>
  150. {% endif %}
  151. {% include 'inc/panels/custom_fields.html' %}
  152. {% include 'inc/panels/tags.html' %}
  153. {% include 'inc/panels/comments.html' %}
  154. <div class="card">
  155. <h5 class="card-header">{% trans "Virtual Device Contexts" %}</h5>
  156. {% htmx_table 'dcim:virtualdevicecontext_list' device_id=object.pk %}
  157. {% if perms.dcim.add_virtualdevicecontext %}
  158. <div class="card-footer text-end d-print-none">
  159. <a href="{% url 'dcim:virtualdevicecontext_add' %}?device={{ object.pk }}" class="btn btn-primary">
  160. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Create VDC" %}
  161. </a>
  162. </div>
  163. {% endif %}
  164. </div>
  165. {% plugin_left_page object %}
  166. </div>
  167. <div class="col col-12 col-xl-6">
  168. <div class="card">
  169. <h5 class="card-header">{% trans "Management" %}</h5>
  170. <table class="table table-hover attr-table">
  171. <tr>
  172. <th scope="row">{% trans "Status" %}</th>
  173. <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
  174. </tr>
  175. <tr>
  176. <th scope="row">{% trans "Role" %}</th>
  177. <td>{{ object.role|linkify }}</td>
  178. </tr>
  179. <tr>
  180. <th scope="row">{% trans "Platform" %}</th>
  181. <td>{{ object.platform|linkify|placeholder }}</td>
  182. </tr>
  183. <tr>
  184. <th scope="row">{% trans "Primary IPv4" %}</th>
  185. <td>
  186. {% if object.primary_ip4 %}
  187. <a href="{{ object.primary_ip4.get_absolute_url }}" id="primary_ip4">{{ object.primary_ip4.address.ip }}</a>
  188. {% if object.primary_ip4.nat_inside %}
  189. ({% trans "NAT for" %} <a href="{{ object.primary_ip4.nat_inside.get_absolute_url }}">{{ object.primary_ip4.nat_inside.address.ip }}</a>)
  190. {% elif object.primary_ip4.nat_outside.exists %}
  191. ({% trans "NAT" %}: {% for nat in object.primary_ip4.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %})
  192. {% endif %}
  193. {% copy_content "primary_ip4" %}
  194. {% else %}
  195. {{ ''|placeholder }}
  196. {% endif %}
  197. </td>
  198. </tr>
  199. <tr>
  200. <th scope="row">{% trans "Primary IPv6" %}</th>
  201. <td>
  202. {% if object.primary_ip6 %}
  203. <a href="{{ object.primary_ip6.get_absolute_url }}" id="primary_ip6">{{ object.primary_ip6.address.ip }}</a>
  204. {% if object.primary_ip6.nat_inside %}
  205. ({% trans "NAT for" %} <a href="{{ object.primary_ip6.nat_inside.get_absolute_url }}">{{ object.primary_ip6.nat_inside.address.ip }}</a>)
  206. {% elif object.primary_ip6.nat_outside.exists %}
  207. ({% trans "NAT" %}: {% for nat in object.primary_ip6.nat_outside.all %}<a href="{{ nat.get_absolute_url }}">{{ nat.address.ip }}</a>{% if not forloop.last %}, {% endif %}{% endfor %})
  208. {% endif %}
  209. {% copy_content "primary_ip6" %}
  210. {% else %}
  211. {{ ''|placeholder }}
  212. {% endif %}
  213. </td>
  214. </tr>
  215. <tr>
  216. <th scope="row">Out-of-band IP</th>
  217. <td>
  218. {% if object.oob_ip %}
  219. <a href="{{ object.oob_ip.get_absolute_url }}" id="oob_ip">{{ object.oob_ip.address.ip }}</a>
  220. {% copy_content "oob_ip" %}
  221. {% else %}
  222. {{ ''|placeholder }}
  223. {% endif %}
  224. </td>
  225. </tr>
  226. {% if object.cluster %}
  227. <tr>
  228. <th>{% trans "Cluster" %}</th>
  229. <td>
  230. {% if object.cluster.group %}
  231. {{ object.cluster.group|linkify }} /
  232. {% endif %}
  233. {{ object.cluster|linkify }}
  234. </td>
  235. </tr>
  236. {% endif %}
  237. </table>
  238. </div>
  239. {% if object.powerports.exists and object.poweroutlets.exists %}
  240. <div class="card">
  241. <h5 class="card-header">{% trans "Power Utilization" %}</h5>
  242. <table class="table table-hover">
  243. <thead>
  244. <tr>
  245. <th>{% trans "Input" %}</th>
  246. <th>{% trans "Outlets" %}</th>
  247. <th>{% trans "Allocated" %}</th>
  248. <th>{% trans "Available" %}</th>
  249. <th>{% trans "Utilization" %}</th>
  250. </tr>
  251. </thead>
  252. {% for powerport in object.powerports.all %}
  253. {% with utilization=powerport.get_power_draw powerfeed=powerport.connected_endpoints.0 %}
  254. <tr>
  255. <td>{{ powerport }}</td>
  256. <td>{{ utilization.outlet_count }}</td>
  257. <td>{{ utilization.allocated }}{% trans "VA" %}</td>
  258. {% if powerfeed.available_power %}
  259. <td>{{ powerfeed.available_power }}{% trans "VA" %}</td>
  260. <td>{% utilization_graph utilization.allocated|percentage:powerfeed.available_power %}</td>
  261. {% else %}
  262. <td class="text-muted">&mdash;</td>
  263. <td class="text-muted">&mdash;</td>
  264. {% endif %}
  265. </tr>
  266. {% for leg in utilization.legs %}
  267. <tr>
  268. <td style="padding-left: 20px">
  269. {% trans "Leg" context "Leg of a power feed" %} {{ leg.name }}
  270. </td>
  271. <td>{{ leg.outlet_count }}</td>
  272. <td>{{ leg.allocated }}</td>
  273. {% if powerfeed.available_power %}
  274. {% with phase_available=powerfeed.available_power|divide:3 %}
  275. <td>{{ phase_available }}{% trans "VA" %}</td>
  276. <td>{% utilization_graph leg.allocated|percentage:phase_available %}</td>
  277. {% endwith %}
  278. {% else %}
  279. <td class="text-muted">&mdash;</td>
  280. <td class="text-muted">&mdash;</td>
  281. {% endif %}
  282. </tr>
  283. {% endfor %}
  284. {% endwith %}
  285. {% endfor %}
  286. </table>
  287. </div>
  288. {% endif %}
  289. <div class="card">
  290. <h5 class="card-header">{% trans "Services" %}</h5>
  291. {% htmx_table 'ipam:service_list' device_id=object.pk %}
  292. {% if perms.ipam.add_service %}
  293. <div class="card-footer text-end d-print-none">
  294. <a href="{% url 'ipam:service_add' %}?device={{ object.pk }}" class="btn btn-primary">
  295. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Add a service" %}
  296. </a>
  297. </div>
  298. {% endif %}
  299. </div>
  300. {% include 'inc/panels/image_attachments.html' %}
  301. <div class="card">
  302. <h5 class="card-header">{% trans "Dimensions" %}</h5>
  303. <table class="table table-hover attr-table">
  304. <tr>
  305. <th scope="row">{% trans "Height" %}</th>
  306. <td>
  307. {{ object.device_type.u_height }}U
  308. </td>
  309. </tr>
  310. <tr>
  311. <th scope="row">{% trans "Weight" %}</th>
  312. <td>
  313. {% if object.total_weight %}
  314. {{ object.total_weight|floatformat }} {% trans "Kilograms" %}
  315. {% else %}
  316. {{ ''|placeholder }}
  317. {% endif %}
  318. </td>
  319. </tr>
  320. </table>
  321. </div>
  322. {% if object.rack and object.position %}
  323. <div class="row" style="margin-bottom: 20px">
  324. <div class="col col-md-6 col-sm-6 col-xs-12 text-center">
  325. <div style="margin-left: 30px">
  326. <h4>{% trans "Front" %}</h4>
  327. {% include 'dcim/inc/rack_elevation.html' with object=object.rack face='front' extra_params=svg_extra %}
  328. </div>
  329. </div>
  330. <div class="col col-md-6 col-sm-6 col-xs-12 text-center">
  331. <div style="margin-left: 30px">
  332. <h4>{% trans "Rear" %}</h4>
  333. {% include 'dcim/inc/rack_elevation.html' with object=object.rack face='rear' extra_params=svg_extra %}
  334. </div>
  335. </div>
  336. </div>
  337. {% endif %}
  338. {% plugin_right_page object %}
  339. </div>
  340. </div>
  341. <div class="row">
  342. <div class="col col-md-12">
  343. {% plugin_full_width_page object %}
  344. </div>
  345. </div>
  346. {% endblock %}