diff --git a/netbox/dcim/api/serializers_/devices.py b/netbox/dcim/api/serializers_/devices.py index 842c7e02b..f4e72f082 100644 --- a/netbox/dcim/api/serializers_/devices.py +++ b/netbox/dcim/api/serializers_/devices.py @@ -149,7 +149,7 @@ class ModuleSerializer(NetBoxModelSerializer): class Meta: model = Module fields = [ - 'id', 'url', 'display_url', 'display', 'device', 'module_bay', 'module_type', 'status', - 'serial', 'asset_tag', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'id', 'url', 'display_url', 'display', 'device', 'module_bay', 'module_type', 'status', 'serial', + 'asset_tag', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', ] brief_fields = ('id', 'url', 'display', 'device', 'module_bay', 'module_type', 'description') diff --git a/netbox/dcim/api/serializers_/devicetypes.py b/netbox/dcim/api/serializers_/devicetypes.py index 23c27e664..cda738862 100644 --- a/netbox/dcim/api/serializers_/devicetypes.py +++ b/netbox/dcim/api/serializers_/devicetypes.py @@ -62,9 +62,21 @@ class DeviceTypeSerializer(NetBoxModelSerializer): class ModuleTypeSerializer(NetBoxModelSerializer): - manufacturer = ManufacturerSerializer(nested=True) - weight_unit = ChoiceField(choices=WeightUnitChoices, allow_blank=True, required=False, allow_null=True) - airflow = ChoiceField(choices=ModuleAirflowChoices, allow_blank=True, required=False, allow_null=True) + manufacturer = ManufacturerSerializer( + nested=True + ) + weight_unit = ChoiceField( + choices=WeightUnitChoices, + allow_blank=True, + required=False, + allow_null=True + ) + airflow = ChoiceField( + choices=ModuleAirflowChoices, + allow_blank=True, + required=False, + allow_null=True + ) class Meta: model = ModuleType diff --git a/netbox/dcim/api/serializers_/racks.py b/netbox/dcim/api/serializers_/racks.py index 6b9fdd684..17c1c174e 100644 --- a/netbox/dcim/api/serializers_/racks.py +++ b/netbox/dcim/api/serializers_/racks.py @@ -75,8 +75,8 @@ class RackTypeSerializer(RackBaseSerializer): fields = [ 'id', 'url', 'display_url', 'display', 'manufacturer', 'name', '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', 'custom_fields', - 'created', 'last_updated', + 'max_weight', 'weight_unit', 'mounting_depth', 'airflow', 'description', 'comments', 'tags', + 'custom_fields', 'created', 'last_updated', ] brief_fields = ('id', 'url', 'display', 'manufacturer', 'name', 'slug', 'description') diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 05ab80f2d..bc0f0bd71 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -298,12 +298,10 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm): model = RackType fieldsets = ( - FieldSet('manufacturer', 'description', 'form_factor', name=_('Rack Type')), + FieldSet('manufacturer', 'description', 'form_factor', 'width', 'u_height', 'airflow', name=_('Rack Type')), FieldSet( - 'width', - 'u_height', InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), - InlineFields('airflow', 'weight', 'max_weight', 'weight_unit', label=_('Chassis')), + InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), 'mounting_depth', name=_('Dimensions') ), @@ -447,10 +445,10 @@ class RackBulkEditForm(NetBoxModelBulkEditForm): FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'description', name=_('Rack')), FieldSet('region', 'site_group', 'site', 'location', name=_('Location')), FieldSet( - 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', + 'form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', name=_('Hardware') ), - FieldSet('airflow', 'weight', 'max_weight', 'weight_unit', name=_('Chassis')), + FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), ) nullable_fields = ( 'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'weight', @@ -599,7 +597,11 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm): model = ModuleType fieldsets = ( FieldSet('manufacturer', 'part_number', 'description', name=_('Module Type')), - FieldSet('airflow', 'weight', 'weight_unit', name=_('Chassis')), + FieldSet( + 'airflow', + InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), + name=_('Chassis') + ), ) nullable_fields = ('part_number', 'weight', 'weight_unit', 'description', 'comments') diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 8eeba9fc8..30c1cf3b9 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -211,11 +211,11 @@ class RackTypeForm(NetBoxModelForm): slug = SlugField() fieldsets = ( - FieldSet('manufacturer', 'name', 'slug', 'description', 'form_factor', 'tags', name=_('Rack Type')), + FieldSet('manufacturer', 'name', 'slug', 'description', 'form_factor', 'airflow', 'tags', name=_('Rack Type')), FieldSet( 'width', 'u_height', InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), - InlineFields('airflow', 'weight', 'max_weight', 'weight_unit', label=_('Chassis')), + InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), 'mounting_depth', name=_('Dimensions') ), FieldSet('starting_unit', 'desc_units', name=_('Numbering')), @@ -290,9 +290,9 @@ class RackForm(TenancyForm, NetBoxModelForm): self.fieldsets = ( *self.fieldsets, FieldSet( - 'form_factor', 'width', 'starting_unit', 'u_height', + 'form_factor', 'width', 'starting_unit', 'u_height', 'airflow', InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), - InlineFields('airflow', 'weight', 'max_weight', 'weight_unit', label=_('Chassis')), + InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), 'mounting_depth', 'desc_units', name=_('Dimensions') ), ) diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index 4f01b9490..cfa8f28be 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -53,6 +53,12 @@ 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( @@ -116,14 +122,6 @@ class RackBase(WeightMixin, PrimaryModel): null=True ) - # Airflow - airflow = models.CharField( - verbose_name=_('airflow'), - max_length=50, - choices=RackAirflowChoices, - blank=True - ) - class Meta: abstract = True @@ -240,10 +238,10 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): Each Rack is assigned to a Site and (optionally) a Location. """ # Fields which cannot be set locally if a RackType is assigned - RACKTYPE_FIELDS = [ - 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', - 'mounting_depth', 'weight', 'weight_unit', 'max_weight', 'airflow' - ] + RACKTYPE_FIELDS = ( + 'form_factor', 'width', 'airflow', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', + 'outer_unit', 'mounting_depth', 'weight', 'weight_unit', 'max_weight', + ) rack_type = models.ForeignKey( to='dcim.RackType', @@ -324,8 +322,8 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): ) clone_fields = ( - 'site', 'location', 'tenant', 'status', 'role', 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', - 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'airflow', + 'site', 'location', 'tenant', 'status', 'role', 'form_factor', 'width', 'airflow', 'u_height', 'desc_units', + 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', ) prerequisite_models = ( 'dcim.Site', diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html index b51c65b58..f69abe77a 100644 --- a/netbox/templates/dcim/rack.html +++ b/netbox/templates/dcim/rack.html @@ -61,6 +61,10 @@ {% trans "Asset Tag" %} {{ object.asset_tag|placeholder }} + + {% trans "Airflow" %} + {{ object.get_airflow_display|placeholder }} + {% trans "Space Utilization" %} {% utilization_graph object.get_utilization %} @@ -69,12 +73,6 @@ {% trans "Power Utilization" %} {% utilization_graph object.get_power_utilization %} - - {% trans "Airflow" %} - - {{ object.get_airflow_display|placeholder }} - - {% include 'dcim/inc/panels/racktype_dimensions.html' %} diff --git a/netbox/templates/dcim/racktype.html b/netbox/templates/dcim/racktype.html index c9af740fc..c4e445146 100644 --- a/netbox/templates/dcim/racktype.html +++ b/netbox/templates/dcim/racktype.html @@ -25,10 +25,8 @@ {{ object.description|placeholder }} - {% trans "Airflow" %} - - {{ object.get_airflow_display|placeholder }} - + {% trans "Airflow" %} + {{ object.get_airflow_display|placeholder }}