diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 495e3f5de..eba5a918e 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -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( diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index 2bcf99d52..1a06bb700 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -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') diff --git a/netbox/ipam/tests/test_filtersets.py b/netbox/ipam/tests/test_filtersets.py index 4f873d045..b402a8426 100644 --- a/netbox/ipam/tests/test_filtersets.py +++ b/netbox/ipam/tests/test_filtersets.py @@ -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) diff --git a/netbox/templates/ipam/vlantranslationpolicy.html b/netbox/templates/ipam/vlantranslationpolicy.html index 0b44ad67e..5217db913 100644 --- a/netbox/templates/ipam/vlantranslationpolicy.html +++ b/netbox/templates/ipam/vlantranslationpolicy.html @@ -5,51 +5,51 @@ {% load i18n %} {% block content %} -
-
-
-

{% trans "VLAN Translation Policy" %}

- - - - - - - - - -
{% trans "DNS Name" %}{{ object.name|placeholder }}
{% trans "Description" %}{{ object.description|placeholder }}
+
+
+
+

{% trans "VLAN Translation Policy" %}

+ + + + + + + + + +
{% trans "Name" %}{{ object.name|placeholder }}
{% trans "Description" %}{{ object.description|placeholder }}
+
+ {% plugin_left_page object %} +
+
+ {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/custom_fields.html' %} + {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %} +
+
+
+
+
+

+ {% trans "VLAN Translation Rules" %} + {% if perms.ipam.add_vlantranslationrule %} + - {% plugin_left_page object %} -

-
- {% include 'inc/panels/tags.html' %} - {% include 'inc/panels/custom_fields.html' %} - {% include 'inc/panels/comments.html' %} - {% plugin_right_page object %} -
+ {% endif %} + + {% htmx_table 'ipam:vlantranslationrule_list' policy_id=object.pk %} +
-
-
-
-

- {% trans "VLAN Translation Rules" %} - {% if perms.ipam.add_vlantranslationrule %} - - {% endif %} -

- {% htmx_table 'ipam:vlantranslationrule_list' policy_id=object.pk %} -
-
-
-
-
- {% plugin_full_width_page object %} -
+
+
+
+ {% plugin_full_width_page object %}
+
{% endblock %} diff --git a/netbox/templates/ipam/vlantranslationrule.html b/netbox/templates/ipam/vlantranslationrule.html index b63992073..7f3aad2ad 100644 --- a/netbox/templates/ipam/vlantranslationrule.html +++ b/netbox/templates/ipam/vlantranslationrule.html @@ -5,41 +5,41 @@ {% load i18n %} {% block content %} -
-
-
-

{% trans "VLAN Translation Rule" %}

- - - - - - - - - - - - - - - - - -
{% trans "Policy" %}{{ object.policy|linkify }}
{% trans "Local VID" %}{{ object.local_vid }}
{% trans "Remote VID" %}{{ object.remote_vid }}
{% trans "Description" %}{{ object.description }}
-
- {% plugin_left_page object %} -
-
- {% include 'inc/panels/tags.html' %} - {% include 'inc/panels/custom_fields.html' %} - {% include 'inc/panels/comments.html' %} - {% plugin_right_page object %} -
+
+
+
+

{% trans "VLAN Translation Rule" %}

+ + + + + + + + + + + + + + + + + +
{% trans "Policy" %}{{ object.policy|linkify }}
{% trans "Local VID" %}{{ object.local_vid }}
{% trans "Remote VID" %}{{ object.remote_vid }}
{% trans "Description" %}{{ object.description }}
+
+ {% plugin_left_page object %}
-
-
- {% plugin_full_width_page object %} -
+
+ {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/custom_fields.html' %} + {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %}
+
+
+
+ {% plugin_full_width_page object %} +
+
{% endblock %} diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 30b59b2af..f9e842d0b 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -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(