18417 add rack outer height

This commit is contained in:
Arthur 2025-03-18 08:31:40 -07:00
parent 2283f6fdf6
commit 604ef7b8e4
7 changed files with 54 additions and 24 deletions

View File

@ -40,7 +40,7 @@ The number of the numerically lowest unit in the rack. This value defaults to on
### Outer Dimensions ### Outer Dimensions
The external width and depth of the rack can be tracked to aid in floorplan calculations. These measurements must be designated in either millimeters or inches. The external width, height and depth of the rack can be tracked to aid in floorplan calculations. These measurements must be designated in either millimeters or inches.
### Mounting Depth ### Mounting Depth

View File

@ -70,8 +70,8 @@ class RackTypeSerializer(RackBaseSerializer):
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_height', 'outer_depth',
'max_weight', 'weight_unit', 'mounting_depth', 'description', 'comments', 'tags', 'outer_unit', 'weight', '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')
@ -129,9 +129,9 @@ class RackSerializer(RackBaseSerializer):
fields = [ fields = [
'id', 'url', 'display_url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status', 'id', 'url', 'display_url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status',
'role', 'serial', 'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'weight', 'role', 'serial', 'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'weight',
'max_weight', 'weight_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'max_weight', 'weight_unit', 'desc_units', 'outer_width', 'outer_height', 'outer_depth', 'outer_unit',
'airflow', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', 'mounting_depth', 'airflow', 'description', 'comments', 'tags', 'custom_fields',
'powerfeed_count', 'created', 'last_updated', 'device_count', 'powerfeed_count',
] ]
brief_fields = ('id', 'url', 'display', 'name', 'description', 'device_count') brief_fields = ('id', 'url', 'display', 'name', 'description', 'device_count')

View File

@ -257,6 +257,11 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
min_value=1 min_value=1
) )
outer_height = forms.IntegerField(
label=_('Outer height'),
required=False,
min_value=1
)
outer_depth = forms.IntegerField( outer_depth = forms.IntegerField(
label=_('Outer depth'), label=_('Outer depth'),
required=False, required=False,
@ -299,7 +304,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
fieldsets = ( fieldsets = (
FieldSet('manufacturer', 'description', 'form_factor', 'width', 'u_height', 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_height', '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', 'mounting_depth',
name=_('Dimensions') name=_('Dimensions')
@ -307,7 +312,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
FieldSet('starting_unit', 'desc_units', name=_('Numbering')), FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
) )
nullable_fields = ( nullable_fields = (
'outer_width', 'outer_depth', 'outer_unit', 'weight', 'outer_width', 'outer_height', 'outer_depth', 'outer_unit', 'weight',
'max_weight', 'weight_unit', 'description', 'comments', 'max_weight', 'weight_unit', 'description', 'comments',
) )
@ -401,6 +406,11 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
required=False, required=False,
min_value=1 min_value=1
) )
outer_height = forms.IntegerField(
label=_('Outer height'),
required=False,
min_value=1
)
outer_depth = forms.IntegerField( outer_depth = forms.IntegerField(
label=_('Outer depth'), label=_('Outer depth'),
required=False, required=False,
@ -449,14 +459,14 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'rack_type', 'description', name=_('Rack')), FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'rack_type', 'description', name=_('Rack')),
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')), FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
FieldSet( FieldSet(
'form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'outer_width', 'outer_depth', 'outer_unit', 'form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'outer_width', 'outer_height', 'outer_depth',
'mounting_depth', name=_('Hardware') 'outer_unit', 'mounting_depth', name=_('Hardware')
), ),
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
) )
nullable_fields = ( nullable_fields = (
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'weight', 'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_height', 'outer_depth',
'max_weight', 'weight_unit', 'description', 'comments', 'outer_unit', 'weight', 'max_weight', 'weight_unit', 'description', 'comments',
) )

View File

@ -219,7 +219,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', 'weight', 'max_weight', 'outer_width', 'outer_height', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight',
'weight_unit', 'description', 'comments', 'tags', 'weight_unit', 'description', 'comments', 'tags',
) )
@ -304,7 +304,7 @@ class RackImportForm(NetBoxModelImportForm):
model = Rack model = Rack
fields = ( fields = (
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'rack_type', 'form_factor', 'serial', 'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'rack_type', 'form_factor', 'serial',
'asset_tag', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'asset_tag', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_height', 'outer_depth', 'outer_unit',
'mounting_depth', 'airflow', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags',
) )

View File

@ -222,7 +222,7 @@ class RackTypeForm(NetBoxModelForm):
FieldSet('manufacturer', 'model', 'slug', 'description', 'form_factor', '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_height', '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', name=_('Dimensions') 'mounting_depth', name=_('Dimensions')
), ),
@ -233,8 +233,8 @@ class RackTypeForm(NetBoxModelForm):
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', 'weight', 'max_weight', 'weight_unit', 'outer_width', 'outer_height', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight',
'description', 'comments', 'tags', 'weight_unit', 'description', 'comments', 'tags',
] ]
@ -279,8 +279,8 @@ class RackForm(TenancyForm, NetBoxModelForm):
fields = [ fields = [
'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status', 'role', 'serial', 'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status', 'role', 'serial',
'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
'outer_depth', 'outer_unit', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'weight_unit', 'outer_height', 'outer_depth', 'outer_unit', 'mounting_depth', 'airflow', 'weight', 'max_weight',
'description', 'comments', 'tags', 'weight_unit', 'description', 'comments', 'tags',
] ]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -302,7 +302,8 @@ class RackForm(TenancyForm, NetBoxModelForm):
*self.fieldsets, *self.fieldsets,
FieldSet( FieldSet(
'form_factor', 'width', 'starting_unit', 'u_height', 'form_factor', 'width', 'starting_unit', 'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), InlineFields('outer_width', 'outer_height', '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

@ -66,6 +66,10 @@ class RackTypeTable(NetBoxTable):
template_code="{{ record.outer_width }} {{ record.outer_unit }}", template_code="{{ record.outer_width }} {{ record.outer_unit }}",
verbose_name=_('Outer Width') verbose_name=_('Outer Width')
) )
outer_height = tables.TemplateColumn(
template_code="{{ record.outer_height }} {{ record.outer_unit }}",
verbose_name=_('Outer Height')
)
outer_depth = tables.TemplateColumn( outer_depth = tables.TemplateColumn(
template_code="{{ record.outer_depth }} {{ record.outer_unit }}", template_code="{{ record.outer_depth }} {{ record.outer_unit }}",
verbose_name=_('Outer Depth') verbose_name=_('Outer Depth')
@ -96,8 +100,8 @@ class RackTypeTable(NetBoxTable):
model = RackType model = RackType
fields = ( fields = (
'pk', 'id', 'model', 'manufacturer', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width', 'pk', 'id', 'model', 'manufacturer', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width',
'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'description', 'comments', 'outer_height', 'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'description',
'instance_count', 'tags', 'created', 'last_updated', 'comments', 'instance_count', 'tags', 'created', 'last_updated',
) )
default_columns = ( default_columns = (
'pk', 'model', 'manufacturer', 'type', 'u_height', 'description', 'instance_count', 'pk', 'model', 'manufacturer', 'type', 'u_height', 'description', 'instance_count',
@ -163,6 +167,10 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
template_code="{{ record.outer_width }} {{ record.outer_unit }}", template_code="{{ record.outer_width }} {{ record.outer_unit }}",
verbose_name=_('Outer Width') verbose_name=_('Outer Width')
) )
outer_height = tables.TemplateColumn(
template_code="{{ record.outer_height }} {{ record.outer_unit }}",
verbose_name=_('Outer Height')
)
outer_depth = tables.TemplateColumn( outer_depth = tables.TemplateColumn(
template_code="{{ record.outer_depth }} {{ record.outer_unit }}", template_code="{{ record.outer_depth }} {{ record.outer_unit }}",
verbose_name=_('Outer Depth') verbose_name=_('Outer Depth')
@ -183,8 +191,9 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
fields = ( fields = (
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role',
'rack_type', 'serial', 'asset_tag', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width', 'rack_type', 'serial', 'asset_tag', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width',
'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'comments', 'device_count', 'outer_height', 'outer_depth', 'mounting_depth', 'airflow', 'weight', 'max_weight', 'comments',
'get_utilization', 'get_power_utilization', 'description', 'contacts', 'tags', 'created', 'last_updated', 'device_count', 'get_utilization', 'get_power_utilization', 'description', 'contacts',
'tags', 'created', 'last_updated',
) )
default_columns = ( default_columns = (
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'rack_type', 'u_height', 'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'rack_type', 'u_height',

View File

@ -24,6 +24,16 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
<tr>
<th scope="row">{% trans "Outer Height" %}</th>
<td>
{% if object.outer_height %}
{{ object.outer_height }} {{ object.get_outer_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr> <tr>
<th scope="row">{% trans "Outer Depth" %}</th> <th scope="row">{% trans "Outer Depth" %}</th>
<td> <td>