11969 remove airflow from racktype (#17324)

* 11969 remove airflow from racktype

* 11969 remove airflow from racktype

* 11969 update docs

* 11969 fix rack edit

* Rename migration

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Arthur Hanson 2024-08-30 10:30:51 -07:00 committed by GitHub
parent b797fcc03d
commit 829bef041d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 18 additions and 52 deletions

View File

@ -59,8 +59,3 @@ The maximum total weight capacity for all installed devices, inclusive of the ra
### Descending Units ### Descending Units
If selected, the rack's elevation will display unit 1 at the top of the rack. (Most racks use ascending numbering, with unit 1 assigned to the bottommost position.) If selected, the rack's elevation will display unit 1 at the top of the rack. (Most racks use ascending numbering, with unit 1 assigned to the bottommost position.)
### Airflow
The direction in which air circulates through the rack for cooling.

View File

@ -64,18 +64,13 @@ class RackTypeSerializer(RackBaseSerializer):
manufacturer = ManufacturerSerializer( manufacturer = ManufacturerSerializer(
nested=True nested=True
) )
airflow = ChoiceField(
choices=RackAirflowChoices,
allow_blank=True,
required=False
)
class Meta: class Meta:
model = RackType model = RackType
fields = [ fields = [
'id', 'url', 'display_url', 'display', 'manufacturer', 'model', 'slug', 'description', 'form_factor', 'id', 'url', 'display_url', 'display', 'manufacturer', 'model', 'slug', 'description', 'form_factor',
'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'weight', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'weight',
'max_weight', 'weight_unit', 'mounting_depth', 'airflow', 'description', 'comments', 'tags', 'max_weight', 'weight_unit', 'mounting_depth', 'description', 'comments', 'tags',
'custom_fields', 'created', 'last_updated', 'custom_fields', 'created', 'last_updated',
] ]
brief_fields = ('id', 'url', 'display', 'manufacturer', 'model', 'slug', 'description') brief_fields = ('id', 'url', 'display', 'manufacturer', 'model', 'slug', 'description')

View File

@ -312,7 +312,7 @@ class RackTypeFilterSet(NetBoxModelFilterSet):
model = RackType model = RackType
fields = ( fields = (
'id', 'model', 'slug', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'id', 'model', 'slug', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
'mounting_depth', 'airflow', 'weight', 'max_weight', 'weight_unit', 'description', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
) )
def search(self, queryset, name, value): def search(self, queryset, name, value):

View File

@ -268,11 +268,6 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
min_value=1 min_value=1
) )
airflow = forms.ChoiceField(
label=_('Airflow'),
choices=add_blank_choice(RackAirflowChoices),
required=False
)
weight = forms.DecimalField( weight = forms.DecimalField(
label=_('Weight'), label=_('Weight'),
min_value=0, min_value=0,
@ -298,7 +293,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
model = RackType model = RackType
fieldsets = ( fieldsets = (
FieldSet('manufacturer', 'description', 'form_factor', 'width', 'u_height', 'airflow', name=_('Rack Type')), FieldSet('manufacturer', 'description', 'form_factor', 'width', 'u_height', name=_('Rack Type')),
FieldSet( FieldSet(
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),

View File

@ -206,12 +206,6 @@ class RackTypeImportForm(NetBoxModelImportForm):
required=False, required=False,
help_text=_('Unit for outer dimensions') help_text=_('Unit for outer dimensions')
) )
airflow = CSVChoiceField(
label=_('Airflow'),
choices=RackAirflowChoices,
required=False,
help_text=_('Airflow direction')
)
weight_unit = CSVChoiceField( weight_unit = CSVChoiceField(
label=_('Weight unit'), label=_('Weight unit'),
choices=WeightUnitChoices, choices=WeightUnitChoices,
@ -223,7 +217,7 @@ class RackTypeImportForm(NetBoxModelImportForm):
model = RackType model = RackType
fields = ( fields = (
'manufacturer', 'model', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'manufacturer', 'model', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight',
'weight_unit', 'description', 'comments', 'tags', 'weight_unit', 'description', 'comments', 'tags',
) )

View File

@ -302,7 +302,7 @@ class RackTypeFilterForm(RackBaseFilterForm):
model = RackType model = RackType
fieldsets = ( fieldsets = (
FieldSet('q', 'filter_id', 'tag'), FieldSet('q', 'filter_id', 'tag'),
FieldSet('form_factor', 'width', 'u_height', 'airflow', name=_('Rack Type')), FieldSet('form_factor', 'width', 'u_height', name=_('Rack Type')),
FieldSet('starting_unit', 'desc_units', name=_('Numbering')), FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
) )

View File

@ -214,7 +214,7 @@ class RackTypeForm(NetBoxModelForm):
) )
fieldsets = ( fieldsets = (
FieldSet('manufacturer', 'model', 'slug', 'description', 'form_factor', 'airflow', 'tags', name=_('Rack Type')), FieldSet('manufacturer', 'model', 'slug', 'description', 'form_factor', 'tags', name=_('Rack Type')),
FieldSet( FieldSet(
'width', 'u_height', 'width', 'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
@ -229,7 +229,7 @@ class RackTypeForm(NetBoxModelForm):
fields = [ fields = [
'manufacturer', 'model', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'manufacturer', 'model', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
'airflow', 'description', 'comments', 'tags', 'description', 'comments', 'tags',
] ]
@ -261,7 +261,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
comments = CommentField() comments = CommentField()
fieldsets = ( fieldsets = (
FieldSet('site', 'location', 'name', 'status', 'role', 'rack_type', 'description', 'tags', name=_('Rack')), FieldSet('site', 'location', 'name', 'status', 'role', 'rack_type', 'description', 'airflow', 'tags', name=_('Rack')),
FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')), FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')),
FieldSet('tenant_group', 'tenant', name=_('Tenancy')), FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
) )
@ -293,7 +293,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
self.fieldsets = ( self.fieldsets = (
*self.fieldsets, *self.fieldsets,
FieldSet( FieldSet(
'form_factor', 'width', 'starting_unit', 'u_height', 'airflow', 'form_factor', 'width', 'starting_unit', 'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),
'mounting_depth', 'desc_units', name=_('Dimensions') 'mounting_depth', 'desc_units', name=_('Dimensions')

View File

@ -1,5 +1,3 @@
# Generated by Django 5.0.7 on 2024-07-25 07:00
from django.db import migrations, models from django.db import migrations, models
@ -20,9 +18,4 @@ class Migration(migrations.Migration):
name='airflow', name='airflow',
field=models.CharField(blank=True, max_length=50), field=models.CharField(blank=True, max_length=50),
), ),
migrations.AddField(
model_name='racktype',
name='airflow',
field=models.CharField(blank=True, max_length=50),
),
] ]

View File

@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('dcim', '0189_moduletype_airflow_rack_airflow_racktype_airflow'), ('dcim', '0189_moduletype_rack_airflow'),
('extras', '0121_customfield_related_object_filter'), ('extras', '0121_customfield_related_object_filter'),
] ]

View File

@ -53,12 +53,6 @@ class RackBase(WeightMixin, PrimaryModel):
verbose_name=_('width'), verbose_name=_('width'),
help_text=_('Rail-to-rail width') help_text=_('Rail-to-rail width')
) )
airflow = models.CharField(
verbose_name=_('airflow'),
max_length=50,
choices=RackAirflowChoices,
blank=True
)
# Numbering # Numbering
u_height = models.PositiveSmallIntegerField( u_height = models.PositiveSmallIntegerField(
@ -147,7 +141,7 @@ class RackType(RackBase):
) )
clone_fields = ( clone_fields = (
'manufacturer', 'form_factor', 'width', 'u_height', 'airflow', 'desc_units', 'outer_width', 'outer_depth', 'manufacturer', 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
) )
prerequisite_models = ( prerequisite_models = (
@ -248,7 +242,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
""" """
# Fields which cannot be set locally if a RackType is assigned # Fields which cannot be set locally if a RackType is assigned
RACKTYPE_FIELDS = ( RACKTYPE_FIELDS = (
'form_factor', 'width', 'airflow', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth',
'outer_unit', 'mounting_depth', 'weight', 'weight_unit', 'max_weight', 'outer_unit', 'mounting_depth', 'weight', 'weight_unit', 'max_weight',
) )
@ -321,6 +315,12 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
verbose_name=_('asset tag'), verbose_name=_('asset tag'),
help_text=_('A unique tag used to identify this rack') help_text=_('A unique tag used to identify this rack')
) )
airflow = models.CharField(
verbose_name=_('airflow'),
max_length=50,
choices=RackAirflowChoices,
blank=True
)
# Generic relations # Generic relations
vlan_groups = GenericRelation( vlan_groups = GenericRelation(

View File

@ -501,7 +501,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
max_weight=1000, max_weight=1000,
weight_unit=WeightUnitChoices.UNIT_POUND, weight_unit=WeightUnitChoices.UNIT_POUND,
description='foobar1', description='foobar1',
airflow=RackAirflowChoices.FRONT_TO_REAR
), ),
RackType( RackType(
manufacturer=manufacturers[1], manufacturer=manufacturers[1],
@ -520,7 +519,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
max_weight=2000, max_weight=2000,
weight_unit=WeightUnitChoices.UNIT_POUND, weight_unit=WeightUnitChoices.UNIT_POUND,
description='foobar2', description='foobar2',
airflow=RackAirflowChoices.REAR_TO_FRONT
), ),
RackType( RackType(
manufacturer=manufacturers[2], manufacturer=manufacturers[2],
@ -617,10 +615,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
params = {'weight_unit': WeightUnitChoices.UNIT_POUND} params = {'weight_unit': WeightUnitChoices.UNIT_POUND}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_airflow(self):
params = {'airflow': RackAirflowChoices.REAR_TO_FRONT}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
class RackTestCase(TestCase, ChangeLoggedFilterSetTests): class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
queryset = Rack.objects.all() queryset = Rack.objects.all()