Jelajahi Sumber

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>
Arthur Hanson 1 tahun lalu
induk
melakukan
829bef041d

+ 0 - 5
docs/models/dcim/racktype.md

@@ -59,8 +59,3 @@ The maximum total weight capacity for all installed devices, inclusive of the ra
 ### 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.)
-
-### Airflow
-
-The direction in which air circulates through the rack for cooling.
-

+ 1 - 6
netbox/dcim/api/serializers_/racks.py

@@ -64,18 +64,13 @@ class RackTypeSerializer(RackBaseSerializer):
     manufacturer = ManufacturerSerializer(
         nested=True
     )
-    airflow = ChoiceField(
-        choices=RackAirflowChoices,
-        allow_blank=True,
-        required=False
-    )
 
     class Meta:
         model = RackType
         fields = [
             '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',
-            'max_weight', 'weight_unit', 'mounting_depth', 'airflow', 'description', 'comments', 'tags',
+            'max_weight', 'weight_unit', 'mounting_depth', 'description', 'comments', 'tags',
             'custom_fields', 'created', 'last_updated',
         ]
         brief_fields = ('id', 'url', 'display', 'manufacturer', 'model', 'slug', 'description')

+ 1 - 1
netbox/dcim/filtersets.py

@@ -312,7 +312,7 @@ class RackTypeFilterSet(NetBoxModelFilterSet):
         model = RackType
         fields = (
             '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):

+ 1 - 6
netbox/dcim/forms/bulk_edit.py

@@ -268,11 +268,6 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
         required=False,
         min_value=1
     )
-    airflow = forms.ChoiceField(
-        label=_('Airflow'),
-        choices=add_blank_choice(RackAirflowChoices),
-        required=False
-    )
     weight = forms.DecimalField(
         label=_('Weight'),
         min_value=0,
@@ -298,7 +293,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
 
     model = RackType
     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(
             InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
             InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),

+ 1 - 7
netbox/dcim/forms/bulk_import.py

@@ -206,12 +206,6 @@ class RackTypeImportForm(NetBoxModelImportForm):
         required=False,
         help_text=_('Unit for outer dimensions')
     )
-    airflow = CSVChoiceField(
-        label=_('Airflow'),
-        choices=RackAirflowChoices,
-        required=False,
-        help_text=_('Airflow direction')
-    )
     weight_unit = CSVChoiceField(
         label=_('Weight unit'),
         choices=WeightUnitChoices,
@@ -223,7 +217,7 @@ class RackTypeImportForm(NetBoxModelImportForm):
         model = RackType
         fields = (
             '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',
         )
 

+ 1 - 1
netbox/dcim/forms/filtersets.py

@@ -302,7 +302,7 @@ class RackTypeFilterForm(RackBaseFilterForm):
     model = RackType
     fieldsets = (
         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('weight', 'max_weight', 'weight_unit', name=_('Weight')),
     )

+ 4 - 4
netbox/dcim/forms/model_forms.py

@@ -214,7 +214,7 @@ class RackTypeForm(NetBoxModelForm):
     )
 
     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(
             'width', 'u_height',
             InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
@@ -229,7 +229,7 @@ class RackTypeForm(NetBoxModelForm):
         fields = [
             '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',
-            'airflow', 'description', 'comments', 'tags',
+            'description', 'comments', 'tags',
         ]
 
 
@@ -261,7 +261,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
     comments = CommentField()
 
     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('tenant_group', 'tenant', name=_('Tenancy')),
     )
@@ -293,7 +293,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
             self.fieldsets = (
                 *self.fieldsets,
                 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('weight', 'max_weight', 'weight_unit', label=_('Weight')),
                     'mounting_depth', 'desc_units', name=_('Dimensions')

+ 0 - 7
netbox/dcim/migrations/0189_moduletype_airflow_rack_airflow_racktype_airflow.py → netbox/dcim/migrations/0189_moduletype_rack_airflow.py

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

+ 1 - 1
netbox/dcim/migrations/0190_nested_modules.py

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

+ 8 - 8
netbox/dcim/models/racks.py

@@ -53,12 +53,6 @@ class RackBase(WeightMixin, PrimaryModel):
         verbose_name=_('width'),
         help_text=_('Rail-to-rail width')
     )
-    airflow = models.CharField(
-        verbose_name=_('airflow'),
-        max_length=50,
-        choices=RackAirflowChoices,
-        blank=True
-    )
 
     # Numbering
     u_height = models.PositiveSmallIntegerField(
@@ -147,7 +141,7 @@ class RackType(RackBase):
     )
 
     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',
     )
     prerequisite_models = (
@@ -248,7 +242,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
     """
     # Fields which cannot be set locally if a RackType is assigned
     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',
     )
 
@@ -321,6 +315,12 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
         verbose_name=_('asset tag'),
         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
     vlan_groups = GenericRelation(

+ 0 - 6
netbox/dcim/tests/test_filtersets.py

@@ -501,7 +501,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
                 max_weight=1000,
                 weight_unit=WeightUnitChoices.UNIT_POUND,
                 description='foobar1',
-                airflow=RackAirflowChoices.FRONT_TO_REAR
             ),
             RackType(
                 manufacturer=manufacturers[1],
@@ -520,7 +519,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
                 max_weight=2000,
                 weight_unit=WeightUnitChoices.UNIT_POUND,
                 description='foobar2',
-                airflow=RackAirflowChoices.REAR_TO_FRONT
             ),
             RackType(
                 manufacturer=manufacturers[2],
@@ -617,10 +615,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
         params = {'weight_unit': WeightUnitChoices.UNIT_POUND}
         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):
     queryset = Rack.objects.all()