Cleaned up IP addresses list under device/VM interfaces

This commit is contained in:
Jeremy Stretch 2018-07-03 17:05:04 -04:00
parent 49ecf5aa8a
commit 9eb9715e05
3 changed files with 80 additions and 50 deletions

View File

@ -366,6 +366,10 @@ table.component-list td.subtable td {
padding-bottom: 6px; padding-bottom: 6px;
padding-top: 6px; padding-top: 6px;
} }
table.interface-ips th {
font-size: 80%;
font-weight: normal;
}
/* Reports */ /* Reports */
table.reports td.method { table.reports td.method {

View File

@ -762,9 +762,9 @@ $(".interface-toggle").click(function() {
$('button.toggle-ips').click(function() { $('button.toggle-ips').click(function() {
var selected = $(this).attr('selected'); var selected = $(this).attr('selected');
if (selected) { if (selected) {
$('#interfaces_table tr.ipaddress').hide(); $('#interfaces_table tr.ipaddresses').hide();
} else { } else {
$('#interfaces_table tr.ipaddress').show(); $('#interfaces_table tr.ipaddresses').show();
} }
$(this).attr('selected', !selected); $(this).attr('selected', !selected);
$(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked'); $(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked');

View File

@ -131,20 +131,36 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% for ip in iface.ip_addresses.all %}
<tr class="ipaddress">
{% with ipaddresses=iface.ip_addresses.all %}
{% if ipaddresses %}
<tr class="ipaddresses">
{# Placeholder #} {# Placeholder #}
{% if perms.dcim.change_interface or perms.dcim.delete_interface %} {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
<td></td> <td></td>
{% endif %} {% endif %}
{# IP addresses table #}
<td colspan="8" style="padding: 0">
<table class="table table-condensed interface-ips">
<thead>
<tr class="text-muted">
<th class="col-md-3">IP Address</th>
<th class="col-md-2">Status/Role</th>
<th class="col-md-3">VRF</th>
<th class="col-md-3">Description</th>
<th class="col-md-1"></th>
</tr>
</thead>
{% for ip in iface.ip_addresses.all %}
<tr>
{# IP address #} {# IP address #}
<td colspan="2"> <td>
<a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a> <a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a>
</td> </td>
{# Primary, status, role #} {# Primary/status/role #}
<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>
@ -156,7 +172,7 @@
</td> </td>
{# VRF #} {# VRF #}
<td colspan="2"> <td>
{% if ip.vrf %} {% if ip.vrf %}
<a href="{% url 'ipam:vrf' pk=ip.vrf.pk %}" title="{{ ip.vrf.rd }}">{{ ip.vrf.name }}</a> <a href="{% url 'ipam:vrf' pk=ip.vrf.pk %}" title="{{ ip.vrf.rd }}">{{ ip.vrf.name }}</a>
{% else %} {% else %}
@ -165,8 +181,12 @@
</td> </td>
{# Description #} {# Description #}
<td colspan="2"> <td>
{% if ip.description %}
{{ ip.description }} {{ ip.description }}
{% else %}
<span class="text-muted">&mdash;</span>
{% endif %}
</td> </td>
{# Buttons #} {# Buttons #}
@ -182,5 +202,11 @@
</a> </a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table>
</td>
</tr>
{% endif %}
{% endwith %}