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

Add location to rack clone fields #16786

Open
alehaa opened this issue Jul 2, 2024 · 4 comments · May be fixed by #17508
Open

Add location to rack clone fields #16786

alehaa opened this issue Jul 2, 2024 · 4 comments · May be fixed by #17508
Assignees
Labels
complexity: low Requires minimal effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@alehaa
Copy link
Contributor

alehaa commented Jul 2, 2024

NetBox version

v4.0.6

Feature type

Change to existing functionality

Proposed functionality

When creating or editing a device, all racks in a location are selectable, including racks in child locations. If you select a rack in a child location, saving the device is rejected with this error message:

Rack RACK01 does not belong to location PARENT.

Therefore, I suggest that all racks of a location (including child locations) can be selected in the form. When saving, the location of the device will be replaced by the location of the rack, thus automatically correcting it if needed.

Steps to reproduce:

  • Create location PARENT
  • Create child location CHILD
  • Create rack RACK01 in CHILD
  • Create new device. Select location PARENT and RACK01 as rack.
  • Save

Use case

The structure of the locations is entirely up to the NetBox user. A typical scenario could be to have parent locations for the room and child locations for the rack rows named "R1", "R2", ... in each room. Searching for the room is quite easy because it is unique. Finding the right rack row is not as easy, as there are several with the same name.

Also, it seems a bit odd that the racks are selectable in the UI and the backend does not accept the user's choice.

Database changes

None

External dependencies

None

@alehaa alehaa added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Jul 2, 2024
@DanSheps DanSheps changed the title Copy device location from rack Add location to rack clone fields Jul 8, 2024
@DanSheps DanSheps added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation complexity: low Requires minimal effort to implement and removed status: needs triage This issue is awaiting triage by a maintainer labels Jul 8, 2024
@DanSheps DanSheps removed their assignment Jul 8, 2024
@alehaa
Copy link
Contributor Author

alehaa commented Sep 13, 2024

I volunteer to work on a PR for this feature.

@jeremystretch jeremystretch added 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 Sep 16, 2024
@jeremystretch
Copy link
Member

Thanks @alehaa, I've assigned this to you.

@alehaa alehaa linked a pull request Sep 16, 2024 that will close this issue
@jeremystretch
Copy link
Member

jeremystretch commented Sep 19, 2024

Searching for the room is quite easy because it is unique. Finding the right rack row is not as easy, as there are several with the same name.

@alehaa It sounds like what you're after is a mechanism to easily filter for objects assigned to a location or any of its child locations. Is that accurate?

@alehaa
Copy link
Contributor Author

alehaa commented Sep 21, 2024

No, the (device) objects are pretty easy for us to find. However, creating / editing them sometimes has pitfalls.

Real life problem on our site:

  1. Employee creates new device.
  2. Employee assigns device to location Data Center Room 01, rack Rack 17.
  3. Operator saves the device.
  4. NetBox displays error because Rack 17 is not in Datacenter Room 01, but in Datacenter Room 01 > Row A.

This problem occurs because the Device edit form displays all racks in a location, including child locations. There are (at least) two possible solutions:

  1. Limit the racks in the device edit form to those of the location, NOT including child locations. This would reflect the implementation of dcim.models.Device.check().
  2. Change the implementation of Device.check() / Device.save() so that the location (and perhaps the site) is copied from the rack. Since the rack has a defined location / site, its clear where the device should be located.

However, my inquiry was that solution 1 could make the workflow a bit difficult for employees: While it is clear to search for the location Data Center Room 01, searching for Row A might result in multiple items from different locations named the same. The device edit form doesn't display additional information about a location's parent locations. Also, a technician might not even know what row a rack is in, only the room (parent location). Typing the room into the location field of the device edit form wouldn't show the child locations, so you might be able to select them if you only know the parent location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants