Skip to content

Conversation

pheus
Copy link
Contributor

@pheus pheus commented Oct 15, 2025

Fixes: #19751

Implements the occupied‑bay UI behavior without adding a private _occupied field to the API.

Update the module_bay form field to use context with disabled_indicator: 'installed_module' so occupied bays are disabled in dropdowns

Notes

  • Backward compatible; no database or migration changes
  • Keeps the REST surface clean while providing the needed UI parity

@jnovinger jnovinger requested review from a team and arthanson and removed request for a team October 15, 2025 17:52
Copy link
Collaborator

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is showing up in the regular REST API (see screenshot) which with an underscore seems like it is an internal / private parameter?
Monosnap Image 2025-10-17 14-25-32

@pheus
Copy link
Contributor Author

pheus commented Oct 18, 2025

Thanks for the thoughtful review!

You’re right! The leading underscore makes it look internal. I initially mirrored CabledObjectSerializer (which exposes _occupied), but I agree it’s not ideal here and a brief‑only approach would still require listing it in Meta.fields.

I’ve reworked this to keep the API surface clean:

  • Drop _occupied entirely
  • Use installed_module as the occupancy signal (included in brief)
  • Update the form field context to disable options via installed_module

This preserves the UI behavior without adding a private‑looking field. If you’d prefer an explicit boolean, I can expose a read‑only occupied derived from installed_module. Happy to adjust. Thanks again!

Extend the context of the `module_bay` field to support a `disabled`
parameter. This facilitates the handling of installed modules and adds
flexibility to form field rendering.

Fixes netbox-community#19751
@pheus pheus force-pushed the 19751-add-occupied-to-modulebay-serializer branch from dea7f3f to aab8ee6 Compare October 18, 2025 14:11
@pheus pheus changed the title Closes #19751: Add _occupied to ModuleBay serializer Closes #19751: Disable occupied Module Bays in form dropdowns Oct 18, 2025
@pheus pheus requested a review from arthanson October 18, 2025 14:27
@pheus pheus closed this Oct 18, 2025
@pheus pheus deleted the 19751-add-occupied-to-modulebay-serializer branch October 18, 2025 14:29
@pheus pheus restored the 19751-add-occupied-to-modulebay-serializer branch October 18, 2025 14:29
@pheus pheus reopened this Oct 18, 2025
@pheus
Copy link
Contributor Author

pheus commented Oct 18, 2025

Apologies for the noise! I tried to rename the feature branch in GitHub’s UI to better reflect the updated scope, and that inadvertently auto‑closed this PR. I’ve restored the branch and reopened the PR—no code changes were introduced as part of this. Sorry for the disruption!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide feature parity in module bay dropdown

2 participants