mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-26 10:49:07 +02:00
feat(dcim): Add enabled field to Module and Device bays
Add an `enabled` boolean field to ModuleBay, ModuleBayTemplate, DeviceBay, and DeviceBayTemplate models. Disabled bays prevent component installation and display accordingly in the UI. Update serializers, filters, forms, and tables to support the new field. Fixes #20152
This commit is contained in:
@@ -1245,6 +1245,11 @@ class ModuleBayTemplateBulkEditForm(ComponentTemplateBulkEditForm):
|
||||
label=_('Description'),
|
||||
required=False
|
||||
)
|
||||
enabled = forms.NullBooleanField(
|
||||
label=_('Enabled'),
|
||||
required=False,
|
||||
widget=BulkEditNullBooleanSelect,
|
||||
)
|
||||
|
||||
nullable_fields = ('label', 'position', 'description')
|
||||
|
||||
@@ -1263,6 +1268,11 @@ class DeviceBayTemplateBulkEditForm(ComponentTemplateBulkEditForm):
|
||||
label=_('Description'),
|
||||
required=False
|
||||
)
|
||||
enabled = forms.NullBooleanField(
|
||||
label=_('Enabled'),
|
||||
required=False,
|
||||
widget=BulkEditNullBooleanSelect,
|
||||
)
|
||||
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
@@ -1687,23 +1697,23 @@ class RearPortBulkEditForm(
|
||||
|
||||
|
||||
class ModuleBayBulkEditForm(
|
||||
form_from_model(ModuleBay, ['label', 'position', 'description']),
|
||||
form_from_model(ModuleBay, ['label', 'position', 'enabled', 'description']),
|
||||
NetBoxModelBulkEditForm
|
||||
):
|
||||
model = ModuleBay
|
||||
fieldsets = (
|
||||
FieldSet('label', 'position', 'description'),
|
||||
FieldSet('label', 'position', 'enabled', 'description'),
|
||||
)
|
||||
nullable_fields = ('label', 'position', 'description')
|
||||
|
||||
|
||||
class DeviceBayBulkEditForm(
|
||||
form_from_model(DeviceBay, ['label', 'description']),
|
||||
form_from_model(DeviceBay, ['label', 'enabled', 'description']),
|
||||
NetBoxModelBulkEditForm
|
||||
):
|
||||
model = DeviceBay
|
||||
fieldsets = (
|
||||
FieldSet('label', 'description'),
|
||||
FieldSet('label', 'enabled', 'description'),
|
||||
)
|
||||
nullable_fields = ('label', 'description')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user