mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Closes #1536: Improved formatting of aggregate prefix statistics
This commit is contained in:
parent
ce9f1eb201
commit
a328e12642
@ -286,11 +286,12 @@ class AggregateListView(ObjectListView):
|
|||||||
ipv4_total = 0
|
ipv4_total = 0
|
||||||
ipv6_total = 0
|
ipv6_total = 0
|
||||||
|
|
||||||
for a in self.queryset:
|
for aggregate in self.queryset:
|
||||||
if a.prefix.version == 4:
|
if aggregate.prefix.version == 6:
|
||||||
ipv4_total += a.prefix.size
|
# Report equivalent /64s for IPv6 to keep things sane
|
||||||
elif a.prefix.version == 6:
|
ipv6_total += int(aggregate.prefix.size / 2 ** 64)
|
||||||
ipv6_total += a.prefix.size / 2 ** 64
|
else:
|
||||||
|
ipv4_total += aggregate.prefix.size
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'ipv4_total': ipv4_total,
|
'ipv4_total': ipv4_total,
|
||||||
|
@ -20,11 +20,18 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:aggregate_bulk_edit' bulk_delete_url='ipam:aggregate_bulk_delete' %}
|
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:aggregate_bulk_edit' bulk_delete_url='ipam:aggregate_bulk_delete' %}
|
||||||
<p class="text-right">IPv4 total: <strong>{{ ipv4_total|intcomma }} /32s</strong></p>
|
|
||||||
<p class="text-right">IPv6 total: <strong>{{ ipv6_total|intcomma }} /64s</strong></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{% include 'inc/search_panel.html' %}
|
{% include 'inc/search_panel.html' %}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<strong><i class="fa fa-bar-chart"></i> Statistics</strong>
|
||||||
|
</div>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item">Total IPv4 IPs <span class="badge">{{ ipv4_total|intcomma }}</span></li>
|
||||||
|
<li class="list-group-item">Total IPv6 /64s <span class="badge">{{ ipv6_total|intcomma }}</span></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user