mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added device count to clusters table
This commit is contained in:
@ -64,11 +64,12 @@ class ClusterGroupTable(BaseTable):
|
||||
class ClusterTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
name = tables.LinkColumn()
|
||||
device_count = tables.Column(verbose_name='Devices')
|
||||
vm_count = tables.Column(verbose_name='VMs')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = Cluster
|
||||
fields = ('pk', 'name', 'type', 'group', 'vm_count')
|
||||
fields = ('pk', 'name', 'type', 'group', 'device_count', 'vm_count')
|
||||
|
||||
|
||||
#
|
||||
|
@ -87,7 +87,10 @@ class ClusterGroupBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
|
||||
#
|
||||
|
||||
class ClusterListView(ObjectListView):
|
||||
queryset = Cluster.objects.annotate(vm_count=Count('virtual_machines'))
|
||||
queryset = Cluster.objects.annotate(
|
||||
device_count=Count('devices', distinct=True),
|
||||
vm_count=Count('virtual_machines', distinct=True)
|
||||
)
|
||||
table = tables.ClusterTable
|
||||
filter = filters.ClusterFilter
|
||||
filter_form = forms.ClusterFilterForm
|
||||
|
Reference in New Issue
Block a user