mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-30 04:16:24 -06:00
Misc cleanup
This commit is contained in:
parent
a7fbb986bb
commit
1275c55e1b
@ -2579,6 +2579,8 @@ class InterfaceView(generic.ObjectView):
|
|||||||
data=vlans,
|
data=vlans,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Get VLAN translation rules
|
||||||
vlan_translation_table = None
|
vlan_translation_table = None
|
||||||
if instance.vlan_translation_policy:
|
if instance.vlan_translation_policy:
|
||||||
vlan_translation_table = VLANTranslationRuleTable(
|
vlan_translation_table = VLANTranslationRuleTable(
|
||||||
|
@ -284,6 +284,9 @@ class VLANTranslationRuleTable(NetBoxTable):
|
|||||||
remote_vid = tables.Column(
|
remote_vid = tables.Column(
|
||||||
verbose_name=_('Remote VID'),
|
verbose_name=_('Remote VID'),
|
||||||
)
|
)
|
||||||
|
description = tables.Column(
|
||||||
|
verbose_name=_('Description'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:vlantranslationrule_list'
|
url_name='ipam:vlantranslationrule_list'
|
||||||
)
|
)
|
||||||
@ -291,6 +294,6 @@ class VLANTranslationRuleTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = VLANTranslationRule
|
model = VLANTranslationRule
|
||||||
fields = (
|
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')
|
||||||
|
@ -1975,9 +1975,6 @@ class VLANTranslationRuleTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|||||||
policies = VLANTranslationPolicy.objects.all()[:2]
|
policies = VLANTranslationPolicy.objects.all()[:2]
|
||||||
params = {'policy_id': [policies[0].pk]}
|
params = {'policy_id': [policies[0].pk]}
|
||||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||||
|
|
||||||
def test_policy(self):
|
|
||||||
policies = VLANTranslationPolicy.objects.all()[:2]
|
|
||||||
params = {'policy': [policies[0].name]}
|
params = {'policy': [policies[0].name]}
|
||||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||||
|
|
||||||
|
@ -5,51 +5,51 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-4">
|
<div class="col col-md-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h2 class="card-header">{% trans "VLAN Translation Policy" %}</h2>
|
<h2 class="card-header">{% trans "VLAN Translation Policy" %}</h2>
|
||||||
<table class="table table-hover attr-table">
|
<table class="table table-hover attr-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "DNS Name" %}</th>
|
<th scope="row">{% trans "Name" %}</th>
|
||||||
<td>{{ object.name|placeholder }}</td>
|
<td>{{ object.name|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Description" %}</th>
|
<th scope="row">{% trans "Description" %}</th>
|
||||||
<td>{{ object.description|placeholder }}</td>
|
<td>{{ object.description|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
{% plugin_left_page object %}
|
||||||
|
</div>
|
||||||
|
<div class="col col-md-8">
|
||||||
|
{% include 'inc/panels/tags.html' %}
|
||||||
|
{% include 'inc/panels/custom_fields.html' %}
|
||||||
|
{% include 'inc/panels/comments.html' %}
|
||||||
|
{% plugin_right_page object %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col col-md-12">
|
||||||
|
<div class="card">
|
||||||
|
<h2 class="card-header">
|
||||||
|
{% trans "VLAN Translation Rules" %}
|
||||||
|
{% if perms.ipam.add_vlantranslationrule %}
|
||||||
|
<div class="card-actions">
|
||||||
|
<a href="{% url 'ipam:vlantranslationrule_add' %}?device={{ object.device.pk }}&policy={{ object.pk }}&return_url={{ object.get_absolute_url }}"
|
||||||
|
class="btn btn-ghost-primary btn-sm">
|
||||||
|
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Add Rule" %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% plugin_left_page object %}
|
{% endif %}
|
||||||
</div>
|
</h2>
|
||||||
<div class="col col-md-8">
|
{% htmx_table 'ipam:vlantranslationrule_list' policy_id=object.pk %}
|
||||||
{% include 'inc/panels/tags.html' %}
|
</div>
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
|
||||||
{% include 'inc/panels/comments.html' %}
|
|
||||||
{% plugin_right_page object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
</div>
|
||||||
<div class="col col-md-12">
|
<div class="row">
|
||||||
<div class="card">
|
<div class="col col-md-12">
|
||||||
<h2 class="card-header">
|
{% plugin_full_width_page object %}
|
||||||
{% trans "VLAN Translation Rules" %}
|
|
||||||
{% if perms.ipam.add_vlantranslationrule %}
|
|
||||||
<div class="card-actions">
|
|
||||||
<a href="{% url 'ipam:vlantranslationrule_add' %}?device={{ object.device.pk }}&policy={{ object.pk }}&return_url={{ object.get_absolute_url }}"
|
|
||||||
class="btn btn-ghost-primary btn-sm">
|
|
||||||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Add Rule" %}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</h2>
|
|
||||||
{% htmx_table 'ipam:vlantranslationrule_list' policy_id=object.pk %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col col-md-12">
|
|
||||||
{% plugin_full_width_page object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -5,41 +5,41 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-4">
|
<div class="col col-md-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h2 class="card-header">{% trans "VLAN Translation Rule" %}</h2>
|
<h2 class="card-header">{% trans "VLAN Translation Rule" %}</h2>
|
||||||
<table class="table table-hover attr-table">
|
<table class="table table-hover attr-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Policy" %}</th>
|
<th scope="row">{% trans "Policy" %}</th>
|
||||||
<td>{{ object.policy|linkify }}</td>
|
<td>{{ object.policy|linkify }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Local VID" %}</th>
|
<th scope="row">{% trans "Local VID" %}</th>
|
||||||
<td>{{ object.local_vid }}</td>
|
<td>{{ object.local_vid }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Remote VID" %}</th>
|
<th scope="row">{% trans "Remote VID" %}</th>
|
||||||
<td>{{ object.remote_vid }}</td>
|
<td>{{ object.remote_vid }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Description" %}</th>
|
<th scope="row">{% trans "Description" %}</th>
|
||||||
<td>{{ object.description }}</td>
|
<td>{{ object.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% plugin_left_page object %}
|
{% plugin_left_page object %}
|
||||||
</div>
|
|
||||||
<div class="col col-md-8">
|
|
||||||
{% include 'inc/panels/tags.html' %}
|
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
|
||||||
{% include 'inc/panels/comments.html' %}
|
|
||||||
{% plugin_right_page object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col col-md-8">
|
||||||
<div class="col col-md-12">
|
{% include 'inc/panels/tags.html' %}
|
||||||
{% plugin_full_width_page object %}
|
{% include 'inc/panels/custom_fields.html' %}
|
||||||
</div>
|
{% include 'inc/panels/comments.html' %}
|
||||||
|
{% plugin_right_page object %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col col-md-12">
|
||||||
|
{% plugin_full_width_page object %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -515,6 +515,8 @@ class VMInterfaceView(generic.ObjectView):
|
|||||||
exclude=('virtual_machine',),
|
exclude=('virtual_machine',),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Get VLAN translation rules
|
||||||
vlan_translation_table = None
|
vlan_translation_table = None
|
||||||
if instance.vlan_translation_policy:
|
if instance.vlan_translation_policy:
|
||||||
vlan_translation_table = VLANTranslationRuleTable(
|
vlan_translation_table = VLANTranslationRuleTable(
|
||||||
|
Loading…
Reference in New Issue
Block a user