Skip to content

Commit 64dd46c

Browse files
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…
2 parents 69eb6b1 + 8df382d commit 64dd46c

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

docs/release-notes/version-3.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [#8367](https://github.com/netbox-community/netbox/issues/8367) - Add ASNs to global search function
99
* [#8368](https://github.com/netbox-community/netbox/issues/8368) - Enable controlling the order of custom script form fields with `field_order`
1010
* [#8381](https://github.com/netbox-community/netbox/issues/8381) - Add contacts to global search function
11+
* [#8476](https://github.com/netbox-community/netbox/issues/8476) - Bring the ASN Web UI up to the standard set by other objects
1112

1213
### Bug Fixes
1314

netbox/ipam/tables/ip.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,20 @@ class ASNTable(BaseTable):
119119
url_params={'asn_id': 'pk'},
120120
verbose_name='Sites'
121121
)
122+
tenant = TenantColumn()
123+
tags = TagColumn(
124+
url_name='ipam:asn_list'
125+
)
126+
122127
actions = ButtonsColumn(ASN)
123128

124129
class Meta(BaseTable.Meta):
125130
model = ASN
126131
fields = (
127132
'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'tenant', 'description', 'actions', 'created',
128-
'last_updated',
133+
'last_updated', 'tags',
129134
)
130-
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'tenant', 'actions')
135+
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'description', 'tenant', 'actions')
131136

132137

133138
#

netbox/templates/tenancy/tenant.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ <h2><a href="{% url 'ipam:vrf_list' %}?tenant_id={{ object.pk }}" class="stat-bt
7171
<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>
7272
<p>Aggregates</p>
7373
</div>
74+
<div class="col col-md-4 text-center">
75+
<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>
76+
<p>ASNs</p>
77+
</div>
7478
<div class="col col-md-4 text-center">
7579
<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>
7680
<p>Prefixes</p>

netbox/tenancy/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from circuits.models import Circuit
66
from dcim.models import Site, Rack, Device, RackReservation, Cable
7-
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
7+
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF, ASN
88
from netbox.views import generic
99
from utilities.tables import paginate_table
1010
from utilities.utils import count_related
@@ -113,6 +113,7 @@ def get_extra_context(self, request, instance):
113113
'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
114114
'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
115115
'cable_count': Cable.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
116+
'asn_count': ASN.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
116117
}
117118

118119
return {

0 commit comments

Comments
 (0)