netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.11k stars 2.58k forks source link

Rack face not clear when site is cleared #17695

Open Theyouth1 opened 3 weeks ago

Theyouth1 commented 3 weeks ago

Deployment Type

Self-hosted

NetBox Version

v4.1.3 Community

Python Version

3.12

Steps to Reproduce

  1. Create a device.
  2. Assign it to a site
  3. Assign it to a location
  4. Assign it to a rack
  5. Set rack face
  6. Set Position
  7. Save
  8. Edit device again
  9. Press x next to Site (Note: all fields clear bar rack face)
  10. press save
  11. Error prompt "Race face: Cannot select a rack face without assigning a rack"
  12. Press x for Rack face.
  13. Press save as a work around

Expected Behavior

All fields associated with Location should auto clear when parent item is removed. Aka when Site is clear rack face should also auto clear.

Observed Behavior

When clearing the Site field with the x. Rack Face doesn't clear.

arthanson commented 3 weeks ago

This is a bit more involved as rack and location are DynamicModelChoice fields which auto-clear based on query_params being linked to $site. face, however is a char field and we don't currently have a mechanism for auto-clearing fields based on another field.