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

Merge pull request #3673 from ananace/cable-color-display

3457 Display cable colors in device interface list
Jeremy Stretch 6 лет назад
Родитель
Сommit
053f49c76a
2 измененных файлов с 11 добавлено и 0 удалено
  1. 8 0
      netbox/project-static/css/base.css
  2. 3 0
      netbox/templates/dcim/inc/interface.html

+ 8 - 0
netbox/project-static/css/base.css

@@ -457,6 +457,14 @@ table.report th a {
     width: 80px;
     border: 1px solid grey;
 }
+.inline-color-block {
+    display: inline-block;
+    width: 1.5em;
+    height: 1.5em;
+    border: 1px solid grey;
+    border-radius: .25em;
+    vertical-align: middle;
+}
 .text-nowrap {
     white-space: nowrap;
 }

+ 3 - 0
netbox/templates/dcim/inc/interface.html

@@ -48,6 +48,9 @@
     <td class="text-nowrap">
         {% if iface.cable %}
             <a href="{{ iface.cable.get_absolute_url }}">{{ iface.cable }}</a>
+            {% if iface.cable.color %}
+            <span class="inline-color-block" style="background-color: #{{ iface.cable.color }}">&nbsp;</span>
+            {% endif %}
             <a href="{% url 'dcim:interface_trace' pk=iface.pk %}" class="btn btn-primary btn-xs" title="Trace">
                 <i class="fa fa-share-alt" aria-hidden="true"></i>
             </a>