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

Filtering device components per device role fails #16536

Closed
Alef-Burzmali opened this issue Jun 12, 2024 · 2 comments · Fixed by #16553
Closed

Filtering device components per device role fails #16536

Alef-Burzmali opened this issue Jun 12, 2024 · 2 comments · Fixed by #16553
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@Alef-Burzmali
Copy link
Contributor

Deployment Type

Self-hosted

NetBox Version

v4.0.5

Python Version

3.10

Steps to Reproduce

  1. Create a device role "role_1" and "role_2"
  2. Create a device "device_1" with role "role_1" and a device "device_2" with "role_2"
  3. Create an interface on device_1 and another on device_2
  4. In the Interface list, use the Filters tab to filter on device role role_1

Expected Behavior

Only interfaces of devices with role_1 are displayed.

Observed Behavior

All the interfaces are displayed, the list is not filtered.

@Alef-Burzmali Alef-Burzmali added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Jun 12, 2024
@Alef-Burzmali
Copy link
Contributor Author

Alef-Burzmali commented Jun 12, 2024

The cause seems to be that DeviceComponentFilterForm still uses field device_role_id while DeviceComponentFilterSet has been updated by #15099 to expect role_id parameter. If the URL query parameter is changed to role_id , then the list is filtered as expected.

device_role_id = DynamicModelMultipleChoiceField(
queryset=DeviceRole.objects.all(),
required=False,
label=_('Device role')
)

I can submit a PR, if assigned.

@jeremystretch jeremystretch removed their assignment Jun 13, 2024
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Jun 13, 2024
@jeremystretch
Copy link
Member

Thanks @Alef-Burzmali, I've assigned this to you.

Alef-Burzmali added a commit to Alef-Burzmali/netbox that referenced this issue Jun 13, 2024
…role

* Rename device_role_id field to role_id in DeviceComponentFilterForm

* Add device_role_id field in InventoryItemFilterForm and InventoryItemFilterSet
  to avoid collision with InventoryItemRole's role field
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants