-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Allow filtering by Parent device in Interfaces view #4100
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
Comments
Fairly simple. This is somewhat similar to #3122. If there are no objections, I'd like to work on this (I've missed adding Edit: or just diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py
index 34f18f6d..e9169523 100644
--- a/netbox/dcim/forms.py
+++ b/netbox/dcim/forms.py
@@ -84,7 +84,18 @@ class DeviceComponentFilterForm(BootstrapMixin, forms.Form):
to_field_name='slug',
widget=APISelectMultiple(
api_url="/api/dcim/sites/",
- value_field="slug"
+ value_field="slug",
+ filter_for={
+ 'device_id': 'site',
+ }
+ )
+ )
+ device_id = FilterChoiceField(
+ queryset=Device.objects.all(),
+ required=False,
+ label='Device',
+ widget=APISelectMultiple(
+ api_url='/api/dcim/devices/',
)
)
@@ -3642,6 +3653,7 @@ class CableFilterForm(BootstrapMixin, forms.Form):
value_field="slug",
filter_for={
'rack_id': 'site',
+ 'device_id': 'site',
}
)
)
@@ -3663,6 +3675,9 @@ class CableFilterForm(BootstrapMixin, forms.Form):
widget=APISelectMultiple(
api_url="/api/dcim/racks/",
null_option=True,
+ filter_for={
+ 'device_id': 'rack_id',
+ }
)
)
type = forms.MultipleChoiceField(
@@ -3816,6 +3831,9 @@ class ConsoleConnectionFilterForm(BootstrapMixin, forms.Form):
widget=APISelectMultiple(
api_url="/api/dcim/sites/",
value_field="slug",
+ filter_for={
+ 'device_id': 'site',
+ }
)
)
device_id = FilterChoiceField(
@@ -3835,6 +3853,9 @@ class PowerConnectionFilterForm(BootstrapMixin, forms.Form):
widget=APISelectMultiple(
api_url="/api/dcim/sites/",
value_field="slug",
+ filter_for={
+ 'device_id': 'site',
+ }
)
)
device_id = FilterChoiceField(
@@ -3854,6 +3875,9 @@ class InterfaceConnectionFilterForm(BootstrapMixin, forms.Form):
widget=APISelectMultiple(
api_url="/api/dcim/sites/",
value_field="slug",
+ filter_for={
+ 'device_id': 'site',
+ }
)
)
device_id = FilterChoiceField( In addition, it might be worth creating |
Done
Not sure @jeremystretch view on this, but I would probably want this as a separate Issue/PR |
Fixes #4100: Added device field to device components filter forms
Environment
Proposed Functionality
Allow interfaces to be filtered also by Parent device. Field should allow to select multiple devices.
Use Case
We're using tags to mark free/reserved/special interfaces to be able later select them and count/review. Now Netbox displaying all interfaces from all devices that matching criteria such as Name/Region/Site/Tags. Ability to filter by Parent device will help alot to find interfaces with selected tags on one/multiple devices.
The text was updated successfully, but these errors were encountered: