mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #8471: Add status field to Cluster
This commit is contained in:
@@ -58,6 +58,12 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
|
||||
queryset=ClusterGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(ClusterStatusChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect()
|
||||
)
|
||||
tenant = DynamicModelChoiceField(
|
||||
queryset=Tenant.objects.all(),
|
||||
required=False
|
||||
@@ -85,7 +91,7 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = Cluster
|
||||
fieldsets = (
|
||||
(None, ('type', 'group', 'tenant',)),
|
||||
(None, ('type', 'group', 'status', 'tenant',)),
|
||||
('Site', ('region', 'site_group', 'site',)),
|
||||
)
|
||||
nullable_fields = (
|
||||
|
@@ -44,6 +44,10 @@ class ClusterCSVForm(NetBoxModelCSVForm):
|
||||
required=False,
|
||||
help_text='Assigned cluster group'
|
||||
)
|
||||
status = CSVChoiceField(
|
||||
choices=ClusterStatusChoices,
|
||||
help_text='Operational status'
|
||||
)
|
||||
site = CSVModelChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
to_field_name='name',
|
||||
@@ -59,7 +63,7 @@ class ClusterCSVForm(NetBoxModelCSVForm):
|
||||
|
||||
class Meta:
|
||||
model = Cluster
|
||||
fields = ('name', 'type', 'group', 'site', 'comments')
|
||||
fields = ('name', 'type', 'group', 'status', 'site', 'comments')
|
||||
|
||||
|
||||
class VirtualMachineCSVForm(NetBoxModelCSVForm):
|
||||
|
@@ -35,7 +35,7 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
|
||||
model = Cluster
|
||||
fieldsets = (
|
||||
(None, ('q', 'tag')),
|
||||
('Attributes', ('group_id', 'type_id')),
|
||||
('Attributes', ('group_id', 'type_id', 'status')),
|
||||
('Location', ('region_id', 'site_group_id', 'site_id')),
|
||||
('Tenant', ('tenant_group_id', 'tenant_id')),
|
||||
('Contacts', ('contact', 'contact_role')),
|
||||
@@ -50,6 +50,10 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
|
||||
required=False,
|
||||
label=_('Region')
|
||||
)
|
||||
status = MultipleChoiceField(
|
||||
choices=ClusterStatusChoices,
|
||||
required=False
|
||||
)
|
||||
site_group_id = DynamicModelMultipleChoiceField(
|
||||
queryset=SiteGroup.objects.all(),
|
||||
required=False,
|
||||
|
@@ -79,15 +79,19 @@ class ClusterForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
('Cluster', ('name', 'type', 'group', 'region', 'site_group', 'site', 'tags')),
|
||||
('Cluster', ('name', 'type', 'group', 'status', 'tags')),
|
||||
('Site', ('region', 'site_group', 'site')),
|
||||
('Tenancy', ('tenant_group', 'tenant')),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Cluster
|
||||
fields = (
|
||||
'name', 'type', 'group', 'tenant', 'region', 'site_group', 'site', 'comments', 'tags',
|
||||
'name', 'type', 'group', 'status', 'tenant', 'region', 'site_group', 'site', 'comments', 'tags',
|
||||
)
|
||||
widgets = {
|
||||
'status': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
|
||||
|
Reference in New Issue
Block a user