limits vlans on interface tables (#17662)

* limits vlans on interface tables

* limits vlans on interface tables

* limits vlans on interface tables

* limits vlans on interface tables
This commit is contained in:
Thor Selmer Dreier-Hansen 2024-10-07 14:45:53 +02:00 committed by GitHub
parent 4b6e8a9e75
commit 364826d2d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -588,6 +588,9 @@ class BaseInterfaceTable(NetBoxTable):
def value_ip_addresses(self, value):
return ",".join([str(obj.address) for obj in value.all()])
def value_tagged_vlans(self, value):
return ",".join([str(obj) for obj in value.all()])
class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpointTable):
device = tables.Column(

View File

@ -56,9 +56,13 @@ INTERFACE_FHRPGROUPS = """
INTERFACE_TAGGED_VLANS = """
{% if record.mode == 'tagged' %}
{% if value.count > 3 %}
<a href="{% url 'ipam:vlan_list' %}?{{ record|meta:"model_name" }}_id={{ record.pk }}">{{ value.count }} VLANs</a>
{% else %}
{% for vlan in value.all %}
<a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br />
{% endfor %}
{% endif %}
{% elif record.mode == 'tagged-all' %}
All
{% endif %}