Misc cleanup

This commit is contained in:
Jeremy Stretch 2024-10-30 16:25:27 -04:00
parent a7fbb986bb
commit 1275c55e1b
6 changed files with 88 additions and 84 deletions

View File

@ -2579,6 +2579,8 @@ class InterfaceView(generic.ObjectView):
data=vlans,
orderable=False
)
# Get VLAN translation rules
vlan_translation_table = None
if instance.vlan_translation_policy:
vlan_translation_table = VLANTranslationRuleTable(

View File

@ -284,6 +284,9 @@ class VLANTranslationRuleTable(NetBoxTable):
remote_vid = tables.Column(
verbose_name=_('Remote VID'),
)
description = tables.Column(
verbose_name=_('Description'),
)
tags = columns.TagColumn(
url_name='ipam:vlantranslationrule_list'
)
@ -291,6 +294,6 @@ class VLANTranslationRuleTable(NetBoxTable):
class Meta(NetBoxTable.Meta):
model = VLANTranslationRule
fields = (
'pk', 'id', 'name', 'policy', 'local_vid', 'remote_vid', 'tags', 'created', 'last_updated',
'pk', 'id', 'name', 'policy', 'local_vid', 'remote_vid', 'description', 'tags', 'created', 'last_updated',
)
default_columns = ('pk', 'id', 'local_vid', 'remote_vid', 'policy')
default_columns = ('pk', 'policy', 'local_vid', 'remote_vid', 'description')

View File

@ -1975,9 +1975,6 @@ class VLANTranslationRuleTestCase(TestCase, ChangeLoggedFilterSetTests):
policies = VLANTranslationPolicy.objects.all()[:2]
params = {'policy_id': [policies[0].pk]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_policy(self):
policies = VLANTranslationPolicy.objects.all()[:2]
params = {'policy': [policies[0].name]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)

View File

@ -11,7 +11,7 @@
<h2 class="card-header">{% trans "VLAN Translation Policy" %}</h2>
<table class="table table-hover attr-table">
<tr>
<th scope="row">{% trans "DNS Name" %}</th>
<th scope="row">{% trans "Name" %}</th>
<td>{{ object.name|placeholder }}</td>
</tr>
<tr>

View File

@ -515,6 +515,8 @@ class VMInterfaceView(generic.ObjectView):
exclude=('virtual_machine',),
orderable=False
)
# Get VLAN translation rules
vlan_translation_table = None
if instance.vlan_translation_policy:
vlan_translation_table = VLANTranslationRuleTable(