mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-09 10:53:50 +02:00
fix(tables): Correct sortable column definitions across tables
Fix broken sorting metadata caused by incorrect accessors, field references, and naming mismatches in several table definitions. Update accessor paths for provider_account and device order_by; add order_by mapping for the is_active property column; correct field name typos such as termination_count to terminations_count; rename the ssl_validation column to ssl_verification to match the model field; and mark computed columns as orderable=False where sorting is not supported. Fixes #21825
This commit is contained in:
committed by
Jeremy Stretch
parent
f2d8ae29c2
commit
57556e3fdb
@@ -95,6 +95,7 @@ class VirtualCircuitTerminationTable(NetBoxTable):
|
||||
verbose_name=_('Provider network')
|
||||
)
|
||||
provider_account = tables.Column(
|
||||
accessor=tables.A('virtual_circuit__provider_account'),
|
||||
linkify=True,
|
||||
verbose_name=_('Account')
|
||||
)
|
||||
@@ -112,7 +113,7 @@ class VirtualCircuitTerminationTable(NetBoxTable):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VirtualCircuitTermination
|
||||
fields = (
|
||||
'pk', 'id', 'virtual_circuit', 'provider', 'provider_network', 'provider_account', 'role', 'interfaces',
|
||||
'pk', 'id', 'virtual_circuit', 'provider', 'provider_network', 'provider_account', 'role', 'interface',
|
||||
'description', 'created', 'last_updated', 'actions',
|
||||
)
|
||||
default_columns = (
|
||||
|
||||
@@ -19,6 +19,7 @@ REVISION_BUTTONS = """
|
||||
class ConfigRevisionTable(NetBoxTable):
|
||||
is_active = columns.BooleanColumn(
|
||||
verbose_name=_('Is Active'),
|
||||
accessor='active',
|
||||
false_mark=None
|
||||
)
|
||||
actions = columns.ActionsColumn(
|
||||
|
||||
@@ -1149,7 +1149,7 @@ class VirtualDeviceContextTable(TenancyColumnsMixin, PrimaryModelTable):
|
||||
)
|
||||
device = tables.Column(
|
||||
verbose_name=_('Device'),
|
||||
order_by=('device___name',),
|
||||
order_by=('device__name',),
|
||||
linkify=True
|
||||
)
|
||||
status = columns.ChoiceFieldColumn(
|
||||
|
||||
@@ -56,7 +56,9 @@ class ModuleTypeTable(PrimaryModelTable):
|
||||
template_code=WEIGHT,
|
||||
order_by=('_abs_weight', 'weight_unit')
|
||||
)
|
||||
attributes = columns.DictColumn()
|
||||
attributes = columns.DictColumn(
|
||||
orderable=False,
|
||||
)
|
||||
module_count = columns.LinkedCountColumn(
|
||||
viewname='dcim:module_list',
|
||||
url_params={'module_type_id': 'pk'},
|
||||
|
||||
@@ -417,6 +417,7 @@ class NotificationTable(NetBoxTable):
|
||||
icon = columns.TemplateColumn(
|
||||
template_code=NOTIFICATION_ICON,
|
||||
accessor=tables.A('event'),
|
||||
orderable=False,
|
||||
attrs={
|
||||
'td': {'class': 'w-1'},
|
||||
'th': {'class': 'w-1'},
|
||||
@@ -479,8 +480,8 @@ class WebhookTable(NetBoxTable):
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
)
|
||||
ssl_validation = columns.BooleanColumn(
|
||||
verbose_name=_('SSL Validation')
|
||||
ssl_verification = columns.BooleanColumn(
|
||||
verbose_name=_('SSL Verification'),
|
||||
)
|
||||
owner = tables.Column(
|
||||
linkify=True,
|
||||
|
||||
@@ -247,6 +247,6 @@ class VLANTranslationRuleTable(NetBoxTable):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VLANTranslationRule
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'policy', 'local_vid', 'remote_vid', 'description', 'tags', 'created', 'last_updated',
|
||||
'pk', 'id', 'policy', 'local_vid', 'remote_vid', 'description', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = ('pk', 'policy', 'local_vid', 'remote_vid', 'description')
|
||||
|
||||
@@ -66,7 +66,7 @@ class TunnelTable(TenancyColumnsMixin, ContactsColumnMixin, PrimaryModelTable):
|
||||
model = Tunnel
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'group', 'status', 'encapsulation', 'ipsec_profile', 'tenant', 'tenant_group',
|
||||
'tunnel_id', 'termination_count', 'description', 'contacts', 'comments', 'tags', 'created',
|
||||
'tunnel_id', 'terminations_count', 'description', 'contacts', 'comments', 'tags', 'created',
|
||||
'last_updated',
|
||||
)
|
||||
default_columns = ('pk', 'name', 'group', 'status', 'encapsulation', 'tenant', 'terminations_count')
|
||||
|
||||
Reference in New Issue
Block a user