mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
#3648: Add missing mark_connected form fields
This commit is contained in:
parent
8de20fcd1f
commit
a17018a875
@ -2370,6 +2370,10 @@ class ConsolePortBulkEditForm(
|
|||||||
queryset=ConsolePort.objects.all(),
|
queryset=ConsolePort.objects.all(),
|
||||||
widget=forms.MultipleHiddenInput()
|
widget=forms.MultipleHiddenInput()
|
||||||
)
|
)
|
||||||
|
mark_connected = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['label', 'description']
|
nullable_fields = ['label', 'description']
|
||||||
@ -2427,7 +2431,7 @@ class ConsoleServerPortForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = ConsoleServerPort
|
model = ConsoleServerPort
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'name', 'label', 'type', 'speed', 'description', 'tags',
|
'device', 'name', 'label', 'type', 'speed', 'mark_connected', 'description', 'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
@ -2446,11 +2450,11 @@ class ConsoleServerPortCreateForm(ComponentCreateForm):
|
|||||||
required=False,
|
required=False,
|
||||||
widget=StaticSelect2()
|
widget=StaticSelect2()
|
||||||
)
|
)
|
||||||
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'speed', 'description', 'tags')
|
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'speed', 'mark_connected', 'description', 'tags')
|
||||||
|
|
||||||
|
|
||||||
class ConsoleServerPortBulkCreateForm(
|
class ConsoleServerPortBulkCreateForm(
|
||||||
form_from_model(ConsoleServerPort, ['type', 'speed']),
|
form_from_model(ConsoleServerPort, ['type', 'speed', 'mark_connected']),
|
||||||
DeviceBulkAddComponentForm
|
DeviceBulkAddComponentForm
|
||||||
):
|
):
|
||||||
model = ConsoleServerPort
|
model = ConsoleServerPort
|
||||||
@ -2458,7 +2462,7 @@ class ConsoleServerPortBulkCreateForm(
|
|||||||
|
|
||||||
|
|
||||||
class ConsoleServerPortBulkEditForm(
|
class ConsoleServerPortBulkEditForm(
|
||||||
form_from_model(ConsoleServerPort, ['label', 'type', 'speed', 'description']),
|
form_from_model(ConsoleServerPort, ['label', 'type', 'speed', 'mark_connected', 'description']),
|
||||||
BootstrapMixin,
|
BootstrapMixin,
|
||||||
AddRemoveTagsForm,
|
AddRemoveTagsForm,
|
||||||
CustomFieldBulkEditForm
|
CustomFieldBulkEditForm
|
||||||
@ -2467,6 +2471,10 @@ class ConsoleServerPortBulkEditForm(
|
|||||||
queryset=ConsoleServerPort.objects.all(),
|
queryset=ConsoleServerPort.objects.all(),
|
||||||
widget=forms.MultipleHiddenInput()
|
widget=forms.MultipleHiddenInput()
|
||||||
)
|
)
|
||||||
|
mark_connected = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['label', 'description']
|
nullable_fields = ['label', 'description']
|
||||||
@ -2519,7 +2527,8 @@ class PowerPortForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = PowerPort
|
model = PowerPort
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description', 'tags',
|
'device', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected', 'description',
|
||||||
|
'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
@ -2544,12 +2553,13 @@ class PowerPortCreateForm(ComponentCreateForm):
|
|||||||
help_text="Allocated draw in watts"
|
help_text="Allocated draw in watts"
|
||||||
)
|
)
|
||||||
field_order = (
|
field_order = (
|
||||||
'device', 'name_pattern', 'label_pattern', 'type', 'maximum_draw', 'allocated_draw', 'description', 'tags',
|
'device', 'name_pattern', 'label_pattern', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected',
|
||||||
|
'description', 'tags',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PowerPortBulkCreateForm(
|
class PowerPortBulkCreateForm(
|
||||||
form_from_model(PowerPort, ['type', 'maximum_draw', 'allocated_draw']),
|
form_from_model(PowerPort, ['type', 'maximum_draw', 'allocated_draw', 'mark_connected']),
|
||||||
DeviceBulkAddComponentForm
|
DeviceBulkAddComponentForm
|
||||||
):
|
):
|
||||||
model = PowerPort
|
model = PowerPort
|
||||||
@ -2557,7 +2567,7 @@ class PowerPortBulkCreateForm(
|
|||||||
|
|
||||||
|
|
||||||
class PowerPortBulkEditForm(
|
class PowerPortBulkEditForm(
|
||||||
form_from_model(PowerPort, ['label', 'type', 'maximum_draw', 'allocated_draw', 'description']),
|
form_from_model(PowerPort, ['label', 'type', 'maximum_draw', 'allocated_draw', 'mark_connected', 'description']),
|
||||||
BootstrapMixin,
|
BootstrapMixin,
|
||||||
AddRemoveTagsForm,
|
AddRemoveTagsForm,
|
||||||
CustomFieldBulkEditForm
|
CustomFieldBulkEditForm
|
||||||
@ -2566,6 +2576,10 @@ class PowerPortBulkEditForm(
|
|||||||
queryset=PowerPort.objects.all(),
|
queryset=PowerPort.objects.all(),
|
||||||
widget=forms.MultipleHiddenInput()
|
widget=forms.MultipleHiddenInput()
|
||||||
)
|
)
|
||||||
|
mark_connected = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['label', 'description']
|
nullable_fields = ['label', 'description']
|
||||||
@ -2615,7 +2629,7 @@ class PowerOutletForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description', 'tags',
|
'device', 'name', 'label', 'type', 'power_port', 'feed_leg', 'mark_connected', 'description', 'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
@ -2646,7 +2660,10 @@ class PowerOutletCreateForm(ComponentCreateForm):
|
|||||||
choices=add_blank_choice(PowerOutletFeedLegChoices),
|
choices=add_blank_choice(PowerOutletFeedLegChoices),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'power_port', 'feed_leg', 'description', 'tags')
|
field_order = (
|
||||||
|
'device', 'name_pattern', 'label_pattern', 'type', 'power_port', 'feed_leg', 'mark_connected', 'description',
|
||||||
|
'tags',
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@ -2659,7 +2676,7 @@ class PowerOutletCreateForm(ComponentCreateForm):
|
|||||||
|
|
||||||
|
|
||||||
class PowerOutletBulkCreateForm(
|
class PowerOutletBulkCreateForm(
|
||||||
form_from_model(PowerOutlet, ['type', 'feed_leg']),
|
form_from_model(PowerOutlet, ['type', 'feed_leg', 'mark_connected']),
|
||||||
DeviceBulkAddComponentForm
|
DeviceBulkAddComponentForm
|
||||||
):
|
):
|
||||||
model = PowerOutlet
|
model = PowerOutlet
|
||||||
@ -2667,7 +2684,7 @@ class PowerOutletBulkCreateForm(
|
|||||||
|
|
||||||
|
|
||||||
class PowerOutletBulkEditForm(
|
class PowerOutletBulkEditForm(
|
||||||
form_from_model(PowerOutlet, ['label', 'type', 'feed_leg', 'power_port', 'description']),
|
form_from_model(PowerOutlet, ['label', 'type', 'feed_leg', 'power_port', 'mark_connected', 'description']),
|
||||||
BootstrapMixin,
|
BootstrapMixin,
|
||||||
AddRemoveTagsForm,
|
AddRemoveTagsForm,
|
||||||
CustomFieldBulkEditForm
|
CustomFieldBulkEditForm
|
||||||
@ -2682,6 +2699,10 @@ class PowerOutletBulkEditForm(
|
|||||||
disabled=True,
|
disabled=True,
|
||||||
widget=forms.HiddenInput()
|
widget=forms.HiddenInput()
|
||||||
)
|
)
|
||||||
|
mark_connected = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['label', 'type', 'feed_leg', 'power_port', 'description']
|
nullable_fields = ['label', 'type', 'feed_leg', 'power_port', 'description']
|
||||||
@ -2901,7 +2922,7 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
|
|||||||
)
|
)
|
||||||
field_order = (
|
field_order = (
|
||||||
'device', 'name_pattern', 'label_pattern', 'type', 'enabled', 'lag', 'mtu', 'mac_address', 'description',
|
'device', 'name_pattern', 'label_pattern', 'type', 'enabled', 'lag', 'mtu', 'mac_address', 'description',
|
||||||
'mgmt_only', 'mode', 'untagged_vlan', 'tagged_vlans', 'tags'
|
'mgmt_only', 'mark_connected', 'mode', 'untagged_vlan', 'tagged_vlans', 'tags'
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -2922,16 +2943,18 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
|
|||||||
|
|
||||||
|
|
||||||
class InterfaceBulkCreateForm(
|
class InterfaceBulkCreateForm(
|
||||||
form_from_model(Interface, ['type', 'enabled', 'mtu', 'mgmt_only']),
|
form_from_model(Interface, ['type', 'enabled', 'mtu', 'mgmt_only', 'mark_connected']),
|
||||||
DeviceBulkAddComponentForm
|
DeviceBulkAddComponentForm
|
||||||
):
|
):
|
||||||
model = Interface
|
model = Interface
|
||||||
field_order = ('name_pattern', 'label_pattern', 'type', 'enabled', 'mtu', 'mgmt_only', 'description', 'tags')
|
field_order = (
|
||||||
|
'name_pattern', 'label_pattern', 'type', 'enabled', 'mtu', 'mgmt_only', 'mark_connected', 'description', 'tags',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class InterfaceBulkEditForm(
|
class InterfaceBulkEditForm(
|
||||||
form_from_model(Interface, [
|
form_from_model(Interface, [
|
||||||
'label', 'type', 'lag', 'mac_address', 'mtu', 'description', 'mode'
|
'label', 'type', 'lag', 'mac_address', 'mtu', 'mgmt_only', 'mark_connected', 'description', 'mode'
|
||||||
]),
|
]),
|
||||||
BootstrapMixin,
|
BootstrapMixin,
|
||||||
AddRemoveTagsForm,
|
AddRemoveTagsForm,
|
||||||
@ -2956,6 +2979,10 @@ class InterfaceBulkEditForm(
|
|||||||
widget=BulkEditNullBooleanSelect,
|
widget=BulkEditNullBooleanSelect,
|
||||||
label='Management only'
|
label='Management only'
|
||||||
)
|
)
|
||||||
|
mark_connected = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect
|
||||||
|
)
|
||||||
untagged_vlan = DynamicModelChoiceField(
|
untagged_vlan = DynamicModelChoiceField(
|
||||||
queryset=VLAN.objects.all(),
|
queryset=VLAN.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
@ -3109,7 +3136,8 @@ class FrontPortForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = FrontPort
|
model = FrontPort
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'name', 'label', 'type', 'rear_port', 'rear_port_position', 'description', 'tags',
|
'device', 'name', 'label', 'type', 'rear_port', 'rear_port_position', 'mark_connected', 'description',
|
||||||
|
'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
@ -3139,7 +3167,9 @@ class FrontPortCreateForm(ComponentCreateForm):
|
|||||||
label='Rear ports',
|
label='Rear ports',
|
||||||
help_text='Select one rear port assignment for each front port being created.',
|
help_text='Select one rear port assignment for each front port being created.',
|
||||||
)
|
)
|
||||||
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'rear_port_set', 'description', 'tags')
|
field_order = (
|
||||||
|
'device', 'name_pattern', 'label_pattern', 'type', 'rear_port_set', 'mark_connected', 'description', 'tags',
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@ -3197,7 +3227,7 @@ class FrontPortCreateForm(ComponentCreateForm):
|
|||||||
|
|
||||||
|
|
||||||
class FrontPortBulkEditForm(
|
class FrontPortBulkEditForm(
|
||||||
form_from_model(FrontPort, ['label', 'type', 'description']),
|
form_from_model(FrontPort, ['label', 'type', 'mark_connected', 'description']),
|
||||||
BootstrapMixin,
|
BootstrapMixin,
|
||||||
AddRemoveTagsForm,
|
AddRemoveTagsForm,
|
||||||
CustomFieldBulkEditForm
|
CustomFieldBulkEditForm
|
||||||
@ -3279,7 +3309,7 @@ class RearPortForm(BootstrapMixin, CustomFieldModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = RearPort
|
model = RearPort
|
||||||
fields = [
|
fields = [
|
||||||
'device', 'name', 'label', 'type', 'positions', 'description', 'tags',
|
'device', 'name', 'label', 'type', 'positions', 'mark_connected', 'description', 'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'device': forms.HiddenInput(),
|
'device': forms.HiddenInput(),
|
||||||
@ -3299,19 +3329,21 @@ class RearPortCreateForm(ComponentCreateForm):
|
|||||||
initial=1,
|
initial=1,
|
||||||
help_text='The number of front ports which may be mapped to each rear port'
|
help_text='The number of front ports which may be mapped to each rear port'
|
||||||
)
|
)
|
||||||
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'positions', 'description', 'tags')
|
field_order = (
|
||||||
|
'device', 'name_pattern', 'label_pattern', 'type', 'positions', 'mark_connected', 'description', 'tags',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RearPortBulkCreateForm(
|
class RearPortBulkCreateForm(
|
||||||
form_from_model(RearPort, ['type', 'positions']),
|
form_from_model(RearPort, ['type', 'positions', 'mark_connected']),
|
||||||
DeviceBulkAddComponentForm
|
DeviceBulkAddComponentForm
|
||||||
):
|
):
|
||||||
model = RearPort
|
model = RearPort
|
||||||
field_order = ('name_pattern', 'label_pattern', 'type', 'positions', 'description', 'tags')
|
field_order = ('name_pattern', 'label_pattern', 'type', 'positions', 'mark_connected', 'description', 'tags')
|
||||||
|
|
||||||
|
|
||||||
class RearPortBulkEditForm(
|
class RearPortBulkEditForm(
|
||||||
form_from_model(RearPort, ['label', 'type', 'description']),
|
form_from_model(RearPort, ['label', 'type', 'mark_connected', 'description']),
|
||||||
BootstrapMixin,
|
BootstrapMixin,
|
||||||
AddRemoveTagsForm,
|
AddRemoveTagsForm,
|
||||||
CustomFieldBulkEditForm
|
CustomFieldBulkEditForm
|
||||||
@ -4705,6 +4737,10 @@ class PowerFeedBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEd
|
|||||||
max_utilization = forms.IntegerField(
|
max_utilization = forms.IntegerField(
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
mark_connected = forms.NullBooleanField(
|
||||||
|
required=False,
|
||||||
|
widget=BulkEditNullBooleanSelect
|
||||||
|
)
|
||||||
comments = CommentField(
|
comments = CommentField(
|
||||||
widget=SmallTextarea,
|
widget=SmallTextarea,
|
||||||
label='Comments'
|
label='Comments'
|
||||||
|
Loading…
Reference in New Issue
Block a user