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 Brian Tiemann
parent ddf236dd50
commit 4a42da1e76
2 changed files with 7 additions and 0 deletions

View File

@ -589,6 +589,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 %}