1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merge pull request #8482 from 991jo/feature-asn-ui-improvement

Fixes #8476: Bring the ASN Web UI up to the standard set by other obj…
This commit is contained in:
Jeremy Stretch
2022-01-28 09:37:54 -05:00
committed by GitHub
4 changed files with 14 additions and 3 deletions

View File

@ -8,6 +8,7 @@
* [#8367](https://github.com/netbox-community/netbox/issues/8367) - Add ASNs to global search function
* [#8368](https://github.com/netbox-community/netbox/issues/8368) - Enable controlling the order of custom script form fields with `field_order`
* [#8381](https://github.com/netbox-community/netbox/issues/8381) - Add contacts to global search function
* [#8476](https://github.com/netbox-community/netbox/issues/8476) - Bring the ASN Web UI up to the standard set by other objects
### Bug Fixes

View File

@ -119,15 +119,20 @@ class ASNTable(BaseTable):
url_params={'asn_id': 'pk'},
verbose_name='Sites'
)
tenant = TenantColumn()
tags = TagColumn(
url_name='ipam:asn_list'
)
actions = ButtonsColumn(ASN)
class Meta(BaseTable.Meta):
model = ASN
fields = (
'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'tenant', 'description', 'actions', 'created',
'last_updated',
'last_updated', 'tags',
)
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'tenant', 'actions')
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'description', 'tenant', 'actions')
#

View File

@ -71,6 +71,10 @@
<h2><a href="{% url 'ipam:aggregate_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.aggregate_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.aggregate_count }}</a></h2>
<p>Aggregates</p>
</div>
<div class="col col-md-4 text-center">
<h2><a href="{% url 'ipam:asn_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.asn_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.asn_count }}</a></h2>
<p>ASNs</p>
</div>
<div class="col col-md-4 text-center">
<h2><a href="{% url 'ipam:prefix_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.prefix_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2>
<p>Prefixes</p>

View File

@ -4,7 +4,7 @@ from django.shortcuts import get_object_or_404
from circuits.models import Circuit
from dcim.models import Site, Rack, Device, RackReservation, Cable
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF, ASN
from netbox.views import generic
from utilities.tables import paginate_table
from utilities.utils import count_related
@ -113,6 +113,7 @@ class TenantView(generic.ObjectView):
'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'cable_count': Cable.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
'asn_count': ASN.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
}
return {