2
0

site.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {% extends 'generic/object.html' %}
  2. {% load helpers %}
  3. {% load plugins %}
  4. {% load tz %}
  5. {% load i18n %}
  6. {% load l10n %}
  7. {% load mptt %}
  8. {% block breadcrumbs %}
  9. {{ block.super }}
  10. {% if object.region %}
  11. {% for region in object.region.get_ancestors %}
  12. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?region_id={{ region.pk }}">{{ region }}</a></li>
  13. {% endfor %}
  14. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?region_id={{ object.region.pk }}">{{ object.region }}</a></li>
  15. {% elif object.group %}
  16. {% for group in object.group.get_ancestors %}
  17. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?group_id={{ group.pk }}">{{ group }}</a></li>
  18. {% endfor %}
  19. <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?group_id={{ object.group.pk }}">{{ object.group }}</a></li>
  20. {% endif %}
  21. {% endblock %}
  22. {% block content %}
  23. <div class="row">
  24. <div class="col col-12 col-md-6">
  25. <div class="card">
  26. <h2 class="card-header">{% trans "Site" %}</h2>
  27. <table class="table table-hover attr-table">
  28. <tr>
  29. <th scope="row">{% trans "Region" %}</th>
  30. <td>
  31. {% nested_tree object.region %}
  32. </td>
  33. </tr>
  34. <tr>
  35. <th scope="row">{% trans "Group" %}</th>
  36. <td>
  37. {% nested_tree object.group %}
  38. </td>
  39. </tr>
  40. <tr>
  41. <th scope="row">{% trans "Status" %}</th>
  42. <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
  43. </tr>
  44. <tr>
  45. <th scope="row">{% trans "Tenant" %}</th>
  46. <td>
  47. {% if object.tenant.group %}
  48. {{ object.tenant.group|linkify }} /
  49. {% endif %}
  50. {{ object.tenant|linkify|placeholder }}
  51. </td>
  52. </tr>
  53. <tr>
  54. <th scope="row">{% trans "Facility" %}</th>
  55. <td>{{ object.facility|placeholder }}</td>
  56. </tr>
  57. <tr>
  58. <th scope="row">{% trans "Description" %}</th>
  59. <td>{{ object.description|placeholder }}</td>
  60. </tr>
  61. <tr>
  62. <th scope="row">{% trans "Time Zone" %}</th>
  63. <td>
  64. {% if object.time_zone %}
  65. {{ object.time_zone }} ({% trans "UTC" %} {{ object.time_zone|tzoffset }})<br />
  66. <small class="text-muted">{% trans "Site time" %}: {% timezone object.time_zone %}{% now 'Y-m-d H:i' %}{% endtimezone %}</small>
  67. {% else %}
  68. {{ ''|placeholder }}
  69. {% endif %}
  70. </td>
  71. </tr>
  72. <tr>
  73. <th scope="row">{% trans "Physical Address" %}</th>
  74. <td class="d-flex justify-content-between align-items-start">
  75. {% if object.physical_address %}
  76. <span>{{ object.physical_address|linebreaksbr }}</span>
  77. {% if config.MAPS_URL %}
  78. <a href="{{ config.MAPS_URL }}{{ object.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-sm d-print-none">
  79. <i class="mdi mdi-map-marker"></i> {% trans "Map" %}
  80. </a>
  81. {% endif %}
  82. {% else %}
  83. {{ ''|placeholder }}
  84. {% endif %}
  85. </td>
  86. </tr>
  87. <tr>
  88. <th scope="row">{% trans "Shipping Address" %}</th>
  89. <td>{{ object.shipping_address|linebreaksbr|placeholder }}</td>
  90. </tr>
  91. <tr>
  92. <th scope="row">{% trans "GPS Coordinates" %}</th>
  93. <td class="position-relative">
  94. {% if object.latitude and object.longitude %}
  95. {% if config.MAPS_URL %}
  96. <div class="position-absolute top-50 end-0 me-2 translate-middle-y d-print-none">
  97. <a href="{{ config.MAPS_URL }}{{ object.latitude|unlocalize }},{{ object.longitude|unlocalize }}" target="_blank" class="btn btn-primary btn-sm">
  98. <i class="mdi mdi-map-marker"></i> {% trans "Map" %}
  99. </a>
  100. </div>
  101. {% endif %}
  102. <span>{{ object.latitude }}, {{ object.longitude }}</span>
  103. {% else %}
  104. {{ ''|placeholder }}
  105. {% endif %}
  106. </td>
  107. </tr>
  108. </table>
  109. </div>
  110. {% include 'inc/panels/custom_fields.html' %}
  111. {% include 'inc/panels/tags.html' %}
  112. {% include 'inc/panels/comments.html' %}
  113. {% plugin_left_page object %}
  114. </div>
  115. <div class="col col-12 col-md-6">
  116. {% include 'inc/panels/related_objects.html' with filter_name='site_id' %}
  117. {% include 'inc/panels/image_attachments.html' %}
  118. {% plugin_right_page object %}
  119. </div>
  120. </div>
  121. <div class="row">
  122. <div class="col col-md-12">
  123. <div class="card">
  124. <h2 class="card-header">
  125. {% trans "Locations" %}
  126. {% if perms.dcim.add_location %}
  127. <div class="card-actions">
  128. <a href="{% url 'dcim:location_add' %}?site={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
  129. <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Location" %}
  130. </a>
  131. </div>
  132. {% endif %}
  133. </h2>
  134. {% htmx_table 'dcim:location_list' site_id=object.pk %}
  135. </div>
  136. <div class="card">
  137. <h2 class="card-header">
  138. {% trans "Non-Racked Devices" %}
  139. {% if perms.dcim.add_device %}
  140. <div class="card-actions">
  141. <a href="{% url 'dcim:device_add' %}?site={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
  142. <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Device" %}
  143. </a>
  144. </div>
  145. {% endif %}
  146. </h2>
  147. {% htmx_table 'dcim:device_list' site_id=object.pk rack_id='null' parent_bay_id='null' %}
  148. </div>
  149. {% plugin_full_width_page object %}
  150. </div>
  151. </div>
  152. {% endblock %}