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

Position field missing for Module Bay bulk creation #9194

Closed
sleepinggenius2 opened this issue Apr 21, 2022 · 3 comments
Closed

Position field missing for Module Bay bulk creation #9194

sleepinggenius2 opened this issue Apr 21, 2022 · 3 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@sleepinggenius2
Copy link
Contributor

NetBox version

v3.2.1

Python version

3.8

Steps to Reproduce

  1. Select one of more devices from the Devices list
  2. Click on Add Components > Module Bays
  3. Observe there is no Position field

Expected Behavior

The bulk creation form for Module Bays should have a Position field just like the singular add form.

Observed Behavior

The Position field does not exist on the bulk creation form.

@sleepinggenius2 sleepinggenius2 added the type: bug A confirmed report of unexpected behavior in the application label Apr 21, 2022
@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Apr 22, 2022
@jeremystretch jeremystretch self-assigned this Apr 25, 2022
@sleepinggenius2
Copy link
Contributor Author

I've checked this in v3.2.2 and v3.2.3 and it doesn't actually seem to be working. The field shows up in the form and the module bays are created, but the position fields are empty.

@sleepinggenius2
Copy link
Contributor Author

@jeremystretch, can we reopen this issue or do you need me to open a new one? I finally tracked down what I believe to be the source of this bug and I'm not 100% on how to fix it, but I'm willing to give it a shot.

The DeviceBulkAddModuleBayView class in netbox/dcim/views.py inherits from generic.BulkComponentCreateView, but in that class (within netbox/netbox/views/generic/bulk_views.py), the post function is hard-coded for name_pattern and label_pattern.

The ModuleBayCreateView class in netbox/dcim/views.py inherits from generic.ComponentCreateView and sets patterned_fields = ('name', 'label', 'position'), then in that class (within netbox/netbox/views/generic/object_views.py), the post function uses the patterned_fields variable to set the appropriate values.

This would explain why the position field is being properly set for the single component creation, but not the bulk.

@sleepinggenius2
Copy link
Contributor Author

I believe that I have a working solution, if you would like me to submit a PR.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants