mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 12:06:53 -06:00
Add missing table columns
This commit is contained in:
parent
52692d49b6
commit
047d717532
@ -84,6 +84,11 @@ class RackTypeTable(NetBoxTable):
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
instance_count = columns.LinkedCountColumn(
|
||||
viewname='dcim:rack_list',
|
||||
url_params={'rack_type_id': 'pk'},
|
||||
verbose_name=_('Instances')
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='dcim:rack_list'
|
||||
)
|
||||
@ -92,11 +97,11 @@ class RackTypeTable(NetBoxTable):
|
||||
model = RackType
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'manufacturer', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width',
|
||||
'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'description', 'comments', 'tags',
|
||||
'created', 'last_updated',
|
||||
'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'description', 'comments',
|
||||
'instance_count', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = (
|
||||
'pk', 'name', 'manufacturer', 'type', 'u_height', 'description',
|
||||
'pk', 'name', 'manufacturer', 'type', 'u_height', 'description', 'instance_count',
|
||||
)
|
||||
|
||||
|
||||
@ -124,6 +129,15 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||
role = columns.ColoredLabelColumn(
|
||||
verbose_name=_('Role'),
|
||||
)
|
||||
manufacturer = tables.Column(
|
||||
verbose_name=_('Manufacturer'),
|
||||
accessor=Accessor('rack_type__manufacturer'),
|
||||
linkify=True
|
||||
)
|
||||
rack_type = tables.Column(
|
||||
linkify=True,
|
||||
verbose_name=_('Type')
|
||||
)
|
||||
u_height = tables.TemplateColumn(
|
||||
template_code="{{ value }}U",
|
||||
verbose_name=_('Height')
|
||||
@ -169,14 +183,14 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Rack
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'serial',
|
||||
'asset_tag', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width', 'outer_depth',
|
||||
'mounting_depth', 'airflow', 'weight', 'max_weight', 'comments', 'device_count', 'get_utilization',
|
||||
'get_power_utilization', 'description', 'contacts', 'tags', 'created', 'last_updated',
|
||||
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role',
|
||||
'rack_type', 'serial', 'asset_tag', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width',
|
||||
'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'comments', 'device_count',
|
||||
'get_utilization', 'get_power_utilization', 'description', 'contacts', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = (
|
||||
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',
|
||||
'get_utilization',
|
||||
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'rack_type', 'u_height',
|
||||
'device_count', 'get_utilization',
|
||||
)
|
||||
|
||||
|
||||
|
@ -584,7 +584,9 @@ class RackRoleBulkDeleteView(generic.BulkDeleteView):
|
||||
#
|
||||
|
||||
class RackTypeListView(generic.ObjectListView):
|
||||
queryset = RackType.objects.all()
|
||||
queryset = RackType.objects.annotate(
|
||||
instance_count=count_related(Rack, 'rack_type')
|
||||
)
|
||||
filterset = filtersets.RackTypeFilterSet
|
||||
filterset_form = forms.RackTypeFilterForm
|
||||
table = tables.RackTypeTable
|
||||
|
Loading…
Reference in New Issue
Block a user