site.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. {% extends 'generic/object.html' %}
  2. {% load helpers %}
  3. {% load plugins %}
  4. {% load tz %}
  5. {% block breadcrumbs %}
  6. {{ block.super }}
  7. {% if object.region %}
  8. {% for region in object.region.get_ancestors %}
  9. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?region_id={{ region.pk }}">{{ region }}</a></li>
  10. {% endfor %}
  11. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?region_id={{ object.region.pk }}">{{ object.region }}</a></li>
  12. {% elif object.group %}
  13. {% for group in object.group.get_ancestors %}
  14. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?group_id={{ group.pk }}">{{ group }}</a></li>
  15. {% endfor %}
  16. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?group_id={{ object.group.pk }}">{{ object.group }}</a></li>
  17. {% endif %}
  18. {% endblock %}
  19. {% block content %}
  20. <div class="row">
  21. <div class="col col-md-6">
  22. <div class="card">
  23. <h5 class="card-header">Site</h5>
  24. <div class="card-body">
  25. <table class="table table-hover attr-table">
  26. <tr>
  27. <th scope="row">Region</th>
  28. <td>
  29. {% if object.region %}
  30. {% for region in object.region.get_ancestors %}
  31. {{ region|linkify }} /
  32. {% endfor %}
  33. {{ object.region|linkify }}
  34. {% else %}
  35. {{ ''|placeholder }}
  36. {% endif %}
  37. </td>
  38. </tr>
  39. <tr>
  40. <th scope="row">Group</th>
  41. <td>
  42. {% if object.group %}
  43. {% for group in object.group.get_ancestors %}
  44. {{ group|linkify }} /
  45. {% endfor %}
  46. {{ object.group|linkify }}
  47. {% else %}
  48. {{ ''|placeholder }}
  49. {% endif %}
  50. </td>
  51. </tr>
  52. <tr>
  53. <th scope="row">Status</th>
  54. <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
  55. </tr>
  56. <tr>
  57. <th scope="row">Tenant</th>
  58. <td>
  59. {% if object.tenant.group %}
  60. {{ object.tenant.group|linkify }} /
  61. {% endif %}
  62. {{ object.tenant|linkify|placeholder }}
  63. </td>
  64. </tr>
  65. <tr>
  66. <th scope="row">Facility</th>
  67. <td>{{ object.facility|placeholder }}</td>
  68. </tr>
  69. <tr>
  70. <th scope="row">Description</th>
  71. <td>{{ object.description|placeholder }}</td>
  72. </tr>
  73. <tr>
  74. <th scope="row">Time Zone</th>
  75. <td>
  76. {% if object.time_zone %}
  77. {{ object.time_zone }} (UTC {{ object.time_zone|tzoffset }})<br />
  78. <small class="text-muted">Site time: {% timezone object.time_zone %}{% annotated_now %}{% endtimezone %}</small>
  79. {% else %}
  80. {{ ''|placeholder }}
  81. {% endif %}
  82. </td>
  83. </tr>
  84. <tr>
  85. <th scope="row">Physical Address</th>
  86. <td>
  87. {% if object.physical_address %}
  88. <div class="float-end noprint">
  89. <a href="{{ config.MAPS_URL }}{{ object.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-sm">
  90. <i class="mdi mdi-map-marker"></i> Map It
  91. </a>
  92. </div>
  93. <span>{{ object.physical_address|linebreaksbr }}</span>
  94. {% else %}
  95. {{ ''|placeholder }}
  96. {% endif %}
  97. </td>
  98. </tr>
  99. <tr>
  100. <th scope="row">Shipping Address</th>
  101. <td>{{ object.shipping_address|linebreaksbr|placeholder }}</td>
  102. </tr>
  103. <tr>
  104. <th scope="row">GPS Coordinates</th>
  105. <td>
  106. {% if object.latitude and object.longitude %}
  107. <div class="float-end noprint">
  108. <a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary btn-sm">
  109. <i class="mdi mdi-map-marker"></i> Map It
  110. </a>
  111. </div>
  112. <span>{{ object.latitude }}, {{ object.longitude }}</span>
  113. {% else %}
  114. {{ ''|placeholder }}
  115. {% endif %}
  116. </td>
  117. </tr>
  118. </table>
  119. </div>
  120. </div>
  121. {% include 'inc/panels/custom_fields.html' %}
  122. {% include 'inc/panels/tags.html' %}
  123. {% include 'inc/panels/comments.html' %}
  124. {% plugin_left_page object %}
  125. </div>
  126. <div class="col col-md-6">
  127. <div class="card">
  128. <h5 class="card-header">Related Objects</h5>
  129. <div class="card-body">
  130. <table class="table table-hover attr-table">
  131. <tr>
  132. <th scope="row">Locations</th>
  133. <td class="text-end">
  134. {% if stats.location_count %}
  135. <a href="{% url 'dcim:location_list' %}?site_id={{ object.pk }}">{{ stats.location_count }}</a>
  136. {% else %}
  137. {{ ''|placeholder }}
  138. {% endif %}
  139. </td>
  140. </tr>
  141. <tr>
  142. <th scope="row">Racks</th>
  143. <td class="text-end">
  144. {% if stats.rack_count %}
  145. <div class="dropdown">
  146. <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
  147. {{ stats.rack_count }}
  148. </button>
  149. <ul class="dropdown-menu">
  150. <li><a class="dropdown-item" href="{% url 'dcim:rack_list' %}?site_id={{ object.pk }}">View Racks</a></li>
  151. <li><a class="dropdown-item" href="{% url 'dcim:rack_elevation_list' %}?site_id={{ object.pk }}">View Elevations</a></li>
  152. </ul>
  153. </div>
  154. {% else %}
  155. {{ ''|placeholder }}
  156. {% endif %}
  157. </td>
  158. </tr>
  159. <tr>
  160. <th scope="row">Devices</th>
  161. <td class="text-end">
  162. {% if stats.device_count %}
  163. <a href="{% url 'dcim:device_list' %}?site_id={{ object.pk }}">{{ stats.device_count }}</a>
  164. {% else %}
  165. {{ ''|placeholder }}
  166. {% endif %}
  167. </td>
  168. </tr>
  169. <tr>
  170. <th scope="row">Virtual Machines</th>
  171. <td class="text-end">
  172. {% if stats.vm_count %}
  173. <a href="{% url 'virtualization:virtualmachine_list' %}?site_id={{ object.pk }}">{{ stats.vm_count }}</a>
  174. {% else %}
  175. {{ ''|placeholder }}
  176. {% endif %}
  177. </td>
  178. </tr>
  179. <tr>
  180. <th scope="row">Prefixes</th>
  181. <td class="text-end">
  182. {% if stats.prefix_count %}
  183. <a href="{% url 'ipam:prefix_list' %}?site_id={{ object.pk }}">{{ stats.prefix_count }}</a>
  184. {% else %}
  185. {{ ''|placeholder }}
  186. {% endif %}
  187. </td>
  188. </tr>
  189. <tr>
  190. <th scope="row">VLAN Groups</th>
  191. <td class="text-end">
  192. {% if stats.vlangroup_count %}
  193. <a href="{% url 'ipam:vlangroup_list' %}?site={{ object.pk }}">{{ stats.vlangroup_count }}</a>
  194. {% else %}
  195. {{ ''|placeholder }}
  196. {% endif %}
  197. </td>
  198. </tr>
  199. <tr>
  200. <th scope="row">VLANs</th>
  201. <td class="text-end">
  202. {% if stats.vlan_count %}
  203. <a href="{% url 'ipam:vlan_list' %}?site_id={{ object.pk }}">{{ stats.vlan_count }}</a>
  204. {% else %}
  205. {{ ''|placeholder }}
  206. {% endif %}
  207. </td>
  208. </tr>
  209. <tr>
  210. <th scope="row">ASNs</th>
  211. <td class="text-end">
  212. {% if stats.asn_count %}
  213. <a href="{% url 'ipam:asn_list' %}?site_id={{ object.pk }}">{{ stats.asn_count }}</a>
  214. {% else %}
  215. {{ ''|placeholder }}
  216. {% endif %}
  217. </td>
  218. </tr>
  219. <tr>
  220. <th scope="row">Circuits</th>
  221. <td class="text-end">
  222. {% if stats.circuit_count %}
  223. <a href="{% url 'circuits:circuit_list' %}?site_id={{ object.pk }}">{{ stats.circuit_count }}</a>
  224. {% else %}
  225. {{ ''|placeholder }}
  226. {% endif %}
  227. </td>
  228. </tr>
  229. </table>
  230. </div>
  231. </div>
  232. {% include 'dcim/inc/nonracked_devices.html' %}
  233. {% include 'inc/panels/contacts.html' %}
  234. <div class="card">
  235. <h5 class="card-header">Locations</h5>
  236. <div class='card-body'>
  237. {% if locations %}
  238. <table class="table table-hover">
  239. <tr>
  240. <th>Location</th>
  241. <th>Racks</th>
  242. <th>Devices</th>
  243. <th></th>
  244. </tr>
  245. {% for location in locations %}
  246. <tr>
  247. <td>
  248. {% for i in location.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
  249. {{ location|linkify }}
  250. </td>
  251. <td>
  252. <a href="{% url 'dcim:rack_list' %}?location_id={{ location.pk }}">{{ location.rack_count }}</a>
  253. </td>
  254. <td>
  255. <a href="{% url 'dcim:device_list' %}?location_id={{ location.pk }}">{{ location.device_count }}</a>
  256. </td>
  257. <td class="text-end noprint">
  258. <a href="{% url 'dcim:rack_elevation_list' %}?location_id={{ location.pk }}" class="btn btn-sm btn-primary" title="View Elevations">
  259. <i class="mdi mdi-server"></i>
  260. </a>
  261. </td>
  262. </tr>
  263. {% endfor %}
  264. </table>
  265. {% else %}
  266. <span class="text-muted">None</span>
  267. {% endif %}
  268. </div>
  269. {% if perms.dcim.add_location %}
  270. <div class="card-footer text-end noprint">
  271. <a href="{% url 'dcim:location_add' %}?site={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-sm">
  272. <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add a location
  273. </a>
  274. </div>
  275. {% endif %}
  276. </div>
  277. <div class="card">
  278. <h5 class="card-header">ASNs</h5>
  279. <div class='card-body'>
  280. {% if asns %}
  281. <table class="table table-hover">
  282. <tr>
  283. <th>ASN</th>
  284. <th>Description</th>
  285. </tr>
  286. {% for asn in asns %}
  287. <tr>
  288. <td>{{ asn|linkify }}</td>
  289. <td>{{ asn.description|placeholder }}</td>
  290. </tr>
  291. {% endfor %}
  292. </table>
  293. {% else %}
  294. <span class="text-muted">None</span>
  295. {% endif %}
  296. </div>
  297. {% if perms.ipam.add_asn %}
  298. <div class="card-footer text-end noprint">
  299. <a href="{% url 'ipam:asn_add' %}?sites={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-sm">
  300. <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add an ASN
  301. </a>
  302. </div>
  303. {% endif %}
  304. </div>
  305. {% include 'inc/panels/image_attachments.html' %}
  306. {% plugin_right_page object %}
  307. </div>
  308. </div>
  309. <div class="row">
  310. <div class="col col-md-12">
  311. {% plugin_full_width_page object %}
  312. </div>
  313. </div>
  314. {% endblock %}