Cleaned up device interfaces/IPs table

This commit is contained in:
Jeremy Stretch 2017-09-20 14:44:51 -04:00
parent e31d2c9857
commit 4f9379a5e2
2 changed files with 58 additions and 43 deletions

View File

@ -329,13 +329,14 @@ li.occupied + li.available {
} }
/* Devices */ /* Devices */
table.component-list tr.ipaddress td { table.component-list td.subtable {
background-color: #eeffff; padding: 0;
padding-bottom: 4px; padding-left: 16px;
padding-top: 4px;
} }
table.component-list tr.ipaddress:hover td { table.component-list td.subtable td {
background-color: #e6f7f7; border: none;
padding-bottom: 6px;
padding-top: 6px;
} }
/* AJAX loader */ /* AJAX loader */

View File

@ -1,4 +1,4 @@
<tr class="interface{% if not iface.enabled %} danger{% elif iface.connection and iface.connection.connection_status %} success{% elif iface.connection and not iface.connection.connection_status %} info{% endif %}"> <tr class="interface{% if not iface.enabled %} danger{% elif iface.connection and iface.connection.connection_status or iface.circuit_termination %} success{% elif iface.connection and not iface.connection.connection_status %} info{% elif iface.is_virtual %} warning{% endif %}">
{% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %} {% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %}
<td class="pk"> <td class="pk">
<input name="pk" type="checkbox" value="{{ iface.pk }}" /> <input name="pk" type="checkbox" value="{{ iface.pk }}" />
@ -113,25 +113,34 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% for ip in iface.ip_addresses.all %} {% with iface.ip_addresses.all as ipaddresses %}
{% if ipaddresses %}
<tr class="ipaddress"> <tr class="ipaddress">
{% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %} {% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %}
<td></td> <td></td>
<td colspan="6" class="subtable">
{% else %}
<td colspan="7" class="subtable">
{% endif %} {% endif %}
<td colspan="3"> <table class="table table-hover">
{% for ip in ipaddresses %}
<tr>
<td>
<a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a> <a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a>
{% if ip.description %} {% if ip.description %}
<i class="fa fa-fw fa-comment-o" title="{{ ip.description }}"></i> <i class="fa fa-fw fa-comment-o" title="{{ ip.description }}"></i>
{% endif %} {% endif %}
</td>
<td>
{% if device.primary_ip4 == ip or device.primary_ip6 == ip %} {% if device.primary_ip4 == ip or device.primary_ip6 == ip %}
<span class="label label-success">Primary</span> <span class="label label-success">Primary</span>
{% endif %} {% endif %}
</td> </td>
<td class="text-right"> <td>
{% if ip.vrf %} {% if ip.vrf %}
<a href="{% url 'ipam:vrf' pk=ip.vrf.pk %}">{{ ip.vrf }}</a> <a href="{% url 'ipam:vrf' pk=ip.vrf.pk %}">{{ ip.vrf }}</a>
{% else %} {% else %}
<span class="text-muted">Global</span> <span class="text-muted">Global table</span>
{% endif %} {% endif %}
</td> </td>
<td> <td>
@ -150,4 +159,9 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table>
</td>
</tr>
{% endif %}
{% endwith %}