-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Expose Inventory Items Parent/Child hierarchy in UI #1692
Comments
Poked at this a bit, but the list of potential parent InventoryItems doesn't make sense without proper hierarchical ordering. To achieve this we need to convert |
Blocked by #1846 |
I don't think that MPTT (#1846) is necessary, or even desirable, in this case. I think that Processing0wise:
In the API, when changing the device_id and/or parent_id of an inventory item, you'd validate that the updated device_id is the same as the device_id of the updated parent_id (again: cheap and non-recursive) and reject if not. If the device_id has changed, you would also find any other inventory items whose parent_id is this inventory item, and set it to null. That's the cheap option anyway. A slightly more expensive approach is to recursively find all descendents of this inventory item, and set all their device_ids to the new device. "Recursively find" is pretty cheap though; you simply find all inventory items on the old device_id, and then filter them to only descendants of this inventory item. And remember this is only done in the very rare circumstance when you move an inventory item from one device to another. Finally, if you want to allow moving of an inventory item from one device to another in the GUI as well (#2233), you would have logic similar to that I just described for the API. Firstly, in the GUI you would offer a drop-down or set of drop-downs to select the new enclosing device (e.g. site + rack + device drill-down). If the user modifies the enclosing device, then:
|
Issue type
[X] Feature request
[ ] Bug report
[ ] Documentation
Environment
Description
groups thread
The
dcim_inventoryitem
table has a "parent_id" field which is self-referential:and there is some support for rendering such items hierarchically:
But there is currently no way to set the inventory item parent/child relationship in the GUI.
Implementing this could be as simple as a 'set parent' drop-down list (restricted to inventory items on the current device); or it could change the data model to MPTT, like Region.
The text was updated successfully, but these errors were encountered: