site.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 class="position-relative">
  87. {% if object.physical_address %}
  88. {% if config.MAPS_URL %}
  89. <div class="position-absolute top-50 end-0 translate-middle-y noprint">
  90. <a href="{{ config.MAPS_URL }}{{ object.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-sm">
  91. <i class="mdi mdi-map-marker"></i> Map
  92. </a>
  93. </div>
  94. {% endif %}
  95. <span>{{ object.physical_address|linebreaksbr }}</span>
  96. {% else %}
  97. {{ ''|placeholder }}
  98. {% endif %}
  99. </td>
  100. </tr>
  101. <tr>
  102. <th scope="row">Shipping Address</th>
  103. <td>{{ object.shipping_address|linebreaksbr|placeholder }}</td>
  104. </tr>
  105. <tr>
  106. <th scope="row">GPS Coordinates</th>
  107. <td class="position-relative">
  108. {% if object.latitude and object.longitude %}
  109. {% if config.MAPS_URL %}
  110. <div class="position-absolute top-50 end-0 translate-middle-y noprint">
  111. <a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary btn-sm">
  112. <i class="mdi mdi-map-marker"></i> Map It
  113. </a>
  114. </div>
  115. {% endif %}
  116. <span>{{ object.latitude }}, {{ object.longitude }}</span>
  117. {% else %}
  118. {{ ''|placeholder }}
  119. {% endif %}
  120. </td>
  121. </tr>
  122. </table>
  123. </div>
  124. </div>
  125. {% include 'inc/panels/custom_fields.html' %}
  126. {% include 'inc/panels/tags.html' %}
  127. {% include 'inc/panels/comments.html' %}
  128. {% plugin_left_page object %}
  129. </div>
  130. <div class="col col-md-6">
  131. {% include 'inc/panels/related_objects.html' with filter_name='site_id' %}
  132. <div class="card">
  133. <h5 class="card-header">Locations</h5>
  134. <div class='card-body'>
  135. {% if locations %}
  136. <table class="table table-hover">
  137. <tr>
  138. <th>Location</th>
  139. <th>Racks</th>
  140. <th>Devices</th>
  141. <th></th>
  142. </tr>
  143. {% for location in locations %}
  144. <tr>
  145. <td>
  146. {% for i in location.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
  147. {{ location|linkify }}
  148. </td>
  149. <td>
  150. <a href="{% url 'dcim:rack_list' %}?location_id={{ location.pk }}">{{ location.rack_count }}</a>
  151. </td>
  152. <td>
  153. <a href="{% url 'dcim:device_list' %}?location_id={{ location.pk }}">{{ location.device_count }}</a>
  154. </td>
  155. <td class="text-end noprint">
  156. <a href="{% url 'dcim:rack_elevation_list' %}?location_id={{ location.pk }}" class="btn btn-sm btn-primary" title="View Elevations">
  157. <i class="mdi mdi-server"></i>
  158. </a>
  159. </td>
  160. </tr>
  161. {% endfor %}
  162. </table>
  163. {% else %}
  164. <span class="text-muted">None</span>
  165. {% endif %}
  166. </div>
  167. {% if perms.dcim.add_location %}
  168. <div class="card-footer text-end noprint">
  169. <a href="{% url 'dcim:location_add' %}?site={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-sm">
  170. <i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add a location
  171. </a>
  172. </div>
  173. {% endif %}
  174. </div>
  175. {% include 'inc/panels/image_attachments.html' %}
  176. {% plugin_right_page object %}
  177. </div>
  178. </div>
  179. <div class="row">
  180. <div class="col col-md-12">
  181. {% include 'dcim/inc/nonracked_devices.html' %}
  182. {% plugin_full_width_page object %}
  183. </div>
  184. </div>
  185. {% endblock %}