Skip to content

Commit

Permalink
limits ip addresses on interface tables #14645
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 committed Jan 19, 2024
1 parent ebf6ce1 commit 510c082
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions netbox/dcim/tables/template_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@

INTERFACE_IPADDRESSES = """
<div class="table-badge-group">
{% for ip in value.all %}
{% if ip.status != 'active' %}
<a href="{{ ip.get_absolute_url }}" class="table-badge badge bg-{{ ip.get_status_color }}" data-bs-toggle="tooltip" data-bs-placement="left" title="{{ ip.get_status_display }}">{{ ip }}</a>
{% else %}
<a href="{{ ip.get_absolute_url }}" class="table-badge">{{ ip }}</a>
{% endif %}
{% endfor %}
{% if value.count >= 3 %}
<a href="{% url 'ipam:ipaddress_list' %}?interface_id={{ record.pk }}">{{ value.count }}</a>
{% else %}
{% for ip in value.all %}
{% if ip.status != 'active' %}
<a href="{{ ip.get_absolute_url }}" class="table-badge badge bg-{{ ip.get_status_color }}" data-bs-toggle="tooltip" data-bs-placement="left" title="{{ ip.get_status_display }}">{{ ip }}</a>
{% else %}
<a href="{{ ip.get_absolute_url }}" class="table-badge">{{ ip }}</a>
{% endif %}
{% endfor %}
{% endif %}
</div>
"""

Expand Down

0 comments on commit 510c082

Please sign in to comment.