Просмотр исходного кода

Closes #2807: Include device site/rack assignment in cable trace view

Jeremy Stretch 7 лет назад
Родитель
Сommit
d53249060d

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ v2.5.4 (FUTURE)
 * [#2753](https://github.com/digitalocean/netbox/issues/2753) - Implemented Select2 to replace most all instances of select fields in forms
 * [#2766](https://github.com/digitalocean/netbox/issues/2766) - Extend users admin table to include superuser and active fields
 * [#2782](https://github.com/digitalocean/netbox/issues/2782) - Add `is_pool` field for prefix filtering
+* [#2807](https://github.com/digitalocean/netbox/issues/2807) - Include device site/rack assignment in cable trace view
 
 ## Bug Fixes
 

+ 2 - 2
netbox/templates/dcim/cable_trace.html

@@ -29,8 +29,8 @@
                             {% if cable.label %}<code>{{ cable.label }}</code>{% else %}Cable #{{ cable.pk }}{% endif %}
                         </a>
                     </h4>
-                    {{ cable.get_status_display }}<br />
-                    {{ cable.get_type_display|default:"" }}
+                    <p><span class="label label-{% if cable.status %}success{% else %}info{% endif %}">{{ cable.get_status_display }}</span></p>
+                    <p>{{ cable.get_type_display|default:"" }}</p>
                     {% if cable.length %}- {{ cable.length }}{{ cable.get_length_unit_display }}{% endif %}
                     <span class="label color-block center-block" style="background-color: #{{ cable.color }}">&nbsp;</span>
                 {% else %}

+ 7 - 1
netbox/templates/dcim/inc/cable_trace_end.html

@@ -3,7 +3,13 @@
 <div class="panel panel-default">
     <div class="panel-heading text-center">
         {% if end.device %}
-            <strong><a href="{{ end.device.get_absolute_url }}">{{ end.device }}</a></strong>
+            <strong><a href="{{ end.device.get_absolute_url }}">{{ end.device }}</a></strong><br/>
+            <small>
+                <a href="{{ end.device.site.get_absolute_url }}">{{ end.device.site }}</a>
+                {% if end.device.rack %}
+                    / <a href="{{ end.device.rack.get_absolute_url }}">{{ end.device.rack }}</a>
+                {% endif %}
+            </small>
         {% else %}
             <strong><a href="{{ end.circuit.provider.get_absolute_url }}">{{ end.circuit.provider }}</a></strong>
         {% endif %}