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

Fixes #3589: Interface VLAN filtering #3814

Merged
merged 11 commits into from
Jan 6, 2020
Merged

Fixes #3589: Interface VLAN filtering #3814

merged 11 commits into from
Jan 6, 2020

Conversation

hSaria
Copy link
Contributor

@hSaria hSaria commented Jan 1, 2020

Fixes: #3589

  • Perform validation on the tagged VLANs similar to that which is already performed on the untagged VLAN
  • Removes the legacy choices filter that is no longer used because the API-based select widgets override the choices
  • Limit the select filter to only global VLANs or VLANs in the same site as the device

Because there currently isn't a way to specify multiple values for the same parameter, I had to work around it.

netbox/dcim/forms.py Outdated Show resolved Hide resolved
netbox/dcim/forms.py Outdated Show resolved Hide resolved
netbox/dcim/forms.py Outdated Show resolved Hide resolved
netbox/dcim/forms.py Outdated Show resolved Hide resolved
netbox/dcim/forms.py Outdated Show resolved Hide resolved
netbox/dcim/forms.py Outdated Show resolved Hide resolved
netbox/dcim/forms.py Outdated Show resolved Hide resolved
Co-Authored-By: Jeremy Stretch <jeremy.stretch@networktocode.com>
@hSaria
Copy link
Contributor Author

hSaria commented Jan 3, 2020

@jeremystretch FYI, this is currently waiting on your input regarding multiple values for the same field. The current implementation will override the field I've put in the additional_query_params of the widget.

I'm hoping there's a better way, but I can think of only two ways to do it:

  • Key-based: use a different key which will map to the same field once the code in forms.js processes it (what I did, but perhaps in a better way than just prepending 1-)
  • Value-based: Use some character to indicate multiple values in the field (e.g. add_additional_query_param('site_id', 'null,{}'.format(self.parent_obj.site.pk))) and have forms.js split on that character.

@hSaria
Copy link
Contributor Author

hSaria commented Jan 5, 2020

I have removed the select widget filtering changes from this PR as they will be covered in a different PR for #3840.

This PR just adds validation for the tagged VLANs of an interface. It also cleans up the filtering that is no longer needed because of #3812.

@hSaria hSaria requested a review from jeremystretch January 5, 2020 09:13
@jeremystretch jeremystretch merged commit 15545b7 into netbox-community:develop Jan 6, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing error message when Tagged VLAN with incompatible Site is set
2 participants