cable_trace.html 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {% extends 'base/layout.html' %}
  2. {% load helpers %}
  3. {% block title %}Cable Trace for {{ object|meta:"verbose_name"|bettertitle }} {{ object }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col col-md-5">
  7. <object data="{{ svg_url }}" class="rack_elevation"></object>
  8. <div class="text-center mt-3">
  9. <a class="btn btn-outline-primary btn-sm" href="{{ svg_url }}">
  10. <i class="mdi mdi-file-download"></i> Download SVG
  11. </a>
  12. </div>
  13. <div class="cable-trace">
  14. {% with traced_path=path.origin.trace %}
  15. {% if path.is_split %}
  16. <div class="trace-end">
  17. <h3 class="text-danger">Path split!</h3>
  18. <p>Select a node below to continue:</p>
  19. <ul class="text-start">
  20. {% for next_node in path.get_split_nodes %}
  21. {% if next_node.cable %}
  22. <li>
  23. <a href="{% url 'dcim:frontport_trace' pk=next_node.pk %}">{{ next_node }}</a>
  24. (Cable <a href="{{ next_node.cable.get_absolute_url }}">{{ next_node.cable }}</a>)
  25. </li>
  26. {% else %}
  27. <li class="text-muted">{{ next_node }}</li>
  28. {% endif %}
  29. {% endfor %}
  30. </ul>
  31. </div>
  32. {% else %}
  33. <div class="trace-end">
  34. <h3 class="text-success">Trace Completed</h3>
  35. <h5>Total Segments: {{ traced_path|length }}</h5>
  36. <h5>Total Length:
  37. {% if total_length %}
  38. {{ total_length|floatformat:"-2" }}{% if not is_definitive %}+{% endif %} Meters /
  39. {{ total_length|meters_to_feet|floatformat:"-2" }} Feet
  40. {% else %}
  41. <span class="text-muted">N/A</span>
  42. {% endif %}
  43. </h5>
  44. </div>
  45. {% endif %}
  46. {% endwith %}
  47. </div>
  48. </div>
  49. <div class="col col-md-7">
  50. <div class="card">
  51. <h5 class="card-header">
  52. Related Paths
  53. </h5>
  54. <div class="card-body">
  55. <table class="table table-hover">
  56. <thead>
  57. <tr>
  58. <th>Origin</th>
  59. <th>Destination</th>
  60. <th>Segments</th>
  61. </tr>
  62. </thead>
  63. <tbody>
  64. {% for cablepath in related_paths %}
  65. <tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
  66. <td>
  67. <a href="?cablepath_id={{ cablepath.pk }}">
  68. {{ cablepath.origin.parent_object }} / {{ cablepath.origin }}
  69. </a>
  70. </td>
  71. <td>
  72. {% if cablepath.destination %}
  73. {{ cablepath.destination }} ({{ cablepath.destination.parent_object }})
  74. {% else %}
  75. <span class="text-muted">Incomplete</span>
  76. {% endif %}
  77. </td>
  78. <td class="text-end">
  79. {{ cablepath.segment_count }}
  80. </td>
  81. </tr>
  82. {% empty %}
  83. <td colspan="3" class="text-muted">
  84. None found
  85. </td>
  86. {% endfor %}
  87. </tbody>
  88. </table>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. {% endblock %}