Selaa lähdekoodia

Closes #5592: Add IP addresses count to VRF view

Jeremy Stretch 5 vuotta sitten
vanhempi
commit
16a3d1339a
3 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  1. 1 0
      docs/release-notes/version-2.10.md
  2. 2 0
      netbox/ipam/views.py
  3. 6 0
      netbox/templates/ipam/vrf.html

+ 1 - 0
docs/release-notes/version-2.10.md

@@ -4,6 +4,7 @@
 
 ### Enhancements
 
+* [#5592](https://github.com/netbox-community/netbox/issues/5592) - Add IP addresses count to VRF view
 * [#5630](https://github.com/netbox-community/netbox/issues/5630) - Add QSFP+ (64GFC) FibreChannel Interface option
 * [#5884](https://github.com/netbox-community/netbox/issues/5884) - Enable custom links for device components
 

+ 2 - 0
netbox/ipam/views.py

@@ -30,6 +30,7 @@ class VRFView(generic.ObjectView):
 
     def get_extra_context(self, request, instance):
         prefix_count = Prefix.objects.restrict(request.user, 'view').filter(vrf=instance).count()
+        ipaddress_count = IPAddress.objects.restrict(request.user, 'view').filter(vrf=instance).count()
 
         import_targets_table = tables.RouteTargetTable(
             instance.import_targets.prefetch_related('tenant'),
@@ -42,6 +43,7 @@ class VRFView(generic.ObjectView):
 
         return {
             'prefix_count': prefix_count,
+            'ipaddress_count': ipaddress_count,
             'import_targets_table': import_targets_table,
             'export_targets_table': export_targets_table,
         }

+ 6 - 0
netbox/templates/ipam/vrf.html

@@ -95,6 +95,12 @@
                     <td>
                         <a href="{% url 'ipam:prefix_list' %}?vrf_id={{ object.pk }}">{{ prefix_count }}</a>
                     </td>
+                </tr>
+                <tr>
+                    <td>IP Addresses</td>
+                    <td>
+                        <a href="{% url 'ipam:ipaddress_list' %}?vrf_id={{ object.pk }}">{{ ipaddress_count }}</a>
+                    </td>
                 </tr>
 		    </table>
         </div>