-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application
Description
NetBox version
v3.5.7
Feature type
Change to existing functionality
Proposed functionality
I propose to add fields device_id and virtual_machine_id to the ServiceFilterForm class. Currently there's no way to filter a service by the associated device or virtual machine in the web form. The search method also does not include these fields.
The API does support filtering by device and virtual machine.
This feature request can be accomplished by updating the filtersets.py from:
class ServiceFilterForm(ServiceTemplateFilterForm):
model = Service
tag = TagFilterField(model)
to:
class ServiceFilterForm(ServiceTemplateFilterForm):
model = Service
fieldsets = (
(None, ('q', 'filter_id', 'tag')),
(_('Attributes'), ('protocol', 'port')),
(_('Device/VM'), ('device_id', 'virtual_machine_id')),
)
device_id = DynamicModelMultipleChoiceField(
queryset=Device.objects.all(),
required=False,
label=_('Assigned Device'),
)
virtual_machine_id = DynamicModelMultipleChoiceField(
queryset=VirtualMachine.objects.all(),
required=False,
label=_('Assigned VM'),
)
I could handle this PR if desired and if this request is approved.
Use case
Adding these fields would improve the user experience, align the services model filterset with the IP address model filterset, and provide functionality available in the API to the web filter forms.
Database changes
None
External dependencies
None
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application



