Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limits vlans on interface tables #17662

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions netbox/dcim/tables/template_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@

INTERFACE_TAGGED_VLANS = """
{% if record.mode == 'tagged' %}
{% if value.count > 3 %}
<a href="{{ record.get_absolute_url }}#vlans">{{ value.count }}</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the interface view, let's link to the VLAN list with a filter for the current interface. This will be consistent with the way we currently handle assigned IP addresses (see INTERFACE_IPADDRESSES).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was also my initial plan, but VLANs doesn't seem to have interface filter like IP-address do.
So ipam/vlans/?(vm)interface_id=XXX needs to be implemented first for this to work.
That's why I implemented it with "vlan" anchor on interface page instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right. I've just opened FR #17669 to add filters for this. I'll see if I can knock that out real quick today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the pull request to support #17669

{% else %}
{% for vlan in value.all %}
<a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br />
{% endfor %}
{% endif %}
{% elif record.mode == 'tagged-all' %}
All
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/dcim/interface.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ <h2 class="card-header">
</div>
</div>
<div class="row mb-3">
<div class="col col-md-12">
<div class="col col-md-12" id="vlans">
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/virtualization/vminterface.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2 class="card-header">
</div>
</div>
<div class="row mb-3">
<div class="col col-md-12">
<div class="col col-md-12" id="vlans">
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
</div>
</div>
Expand Down