mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-18 21:16:27 -06:00
Closes #9832: Add mounting_depth field to rack model
This commit is contained in:
parent
dbe66596f9
commit
d773f4e62a
@ -65,6 +65,10 @@ The height of the rack, measured in units.
|
|||||||
|
|
||||||
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 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
|
||||||
|
|
||||||
|
The maximum depth of a mounted device that the rack can accommodate, in millimeters. For four-post frames or cabinets, this is the horizontal distance between the front and rear vertical rails. (Note that this measurement does _not_ include space between the rails and the cabinet doors.)
|
||||||
|
|
||||||
### Weight
|
### Weight
|
||||||
|
|
||||||
The numeric weight of the rack, including a unit designation (e.g. 10 kilograms or 20 pounds).
|
The numeric weight of the rack, including a unit designation (e.g. 10 kilograms or 20 pounds).
|
||||||
|
@ -28,6 +28,7 @@ A new `PluginMenu` class has been introduced, which enables a plugin to inject a
|
|||||||
* [#9478](https://github.com/netbox-community/netbox/issues/9478) - Add `link_peers` field to GraphQL types for cabled objects
|
* [#9478](https://github.com/netbox-community/netbox/issues/9478) - Add `link_peers` field to GraphQL types for cabled objects
|
||||||
* [#9654](https://github.com/netbox-community/netbox/issues/9654) - Add `weight` field to racks, device types, and module types
|
* [#9654](https://github.com/netbox-community/netbox/issues/9654) - Add `weight` field to racks, device types, and module types
|
||||||
* [#9817](https://github.com/netbox-community/netbox/issues/9817) - Add `assigned_object` field to GraphQL type for IP addresses and L2VPN terminations
|
* [#9817](https://github.com/netbox-community/netbox/issues/9817) - Add `assigned_object` field to GraphQL type for IP addresses and L2VPN terminations
|
||||||
|
* [#9832](https://github.com/netbox-community/netbox/issues/9832) - Add `mounting_depth` field to rack model
|
||||||
* [#9892](https://github.com/netbox-community/netbox/issues/9892) - Add optional `name` field for FHRP groups
|
* [#9892](https://github.com/netbox-community/netbox/issues/9892) - Add optional `name` field for FHRP groups
|
||||||
* [#10348](https://github.com/netbox-community/netbox/issues/10348) - Add decimal custom field type
|
* [#10348](https://github.com/netbox-community/netbox/issues/10348) - Add decimal custom field type
|
||||||
* [#10556](https://github.com/netbox-community/netbox/issues/10556) - Include a `display` field in all GraphQL object types
|
* [#10556](https://github.com/netbox-community/netbox/issues/10556) - Include a `display` field in all GraphQL object types
|
||||||
@ -81,6 +82,8 @@ A new `PluginMenu` class has been introduced, which enables a plugin to inject a
|
|||||||
* Add `component` field
|
* Add `component` field
|
||||||
* dcim.InventoryItemTemplate
|
* dcim.InventoryItemTemplate
|
||||||
* Add `component` field
|
* Add `component` field
|
||||||
|
* dcim.Rack
|
||||||
|
* Add `mounting_depth` field
|
||||||
* ipam.FHRPGroupAssignment
|
* ipam.FHRPGroupAssignment
|
||||||
* Add `interface` field
|
* Add `interface` field
|
||||||
* ipam.IPAddress
|
* ipam.IPAddress
|
||||||
|
@ -210,8 +210,8 @@ class RackSerializer(NetBoxModelSerializer):
|
|||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status', 'role', 'serial',
|
'id', 'url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status', 'role', 'serial',
|
||||||
'asset_tag', 'type', 'width', 'u_height', 'weight', 'weight_unit', 'desc_units', 'outer_width',
|
'asset_tag', 'type', 'width', 'u_height', 'weight', 'weight_unit', 'desc_units', 'outer_width',
|
||||||
'outer_depth', 'outer_unit', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count',
|
'outer_depth', 'outer_unit', 'mounting_depth', 'comments', 'tags', 'custom_fields', 'created',
|
||||||
'powerfeed_count',
|
'last_updated', 'device_count', 'powerfeed_count',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
|||||||
model = Rack
|
model = Rack
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'name', 'facility_id', 'asset_tag', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
'id', 'name', 'facility_id', 'asset_tag', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
||||||
'outer_unit', 'weight', 'weight_unit'
|
'outer_unit', 'mounting_depth', 'weight', 'weight_unit'
|
||||||
]
|
]
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
|
@ -281,6 +281,10 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
required=False,
|
required=False,
|
||||||
widget=StaticSelect()
|
widget=StaticSelect()
|
||||||
)
|
)
|
||||||
|
mounting_depth = forms.IntegerField(
|
||||||
|
required=False,
|
||||||
|
min_value=1
|
||||||
|
)
|
||||||
comments = CommentField(
|
comments = CommentField(
|
||||||
widget=SmallTextarea,
|
widget=SmallTextarea,
|
||||||
label='Comments'
|
label='Comments'
|
||||||
@ -300,11 +304,14 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Rack', ('status', 'role', 'tenant', 'serial', 'asset_tag')),
|
('Rack', ('status', 'role', 'tenant', 'serial', 'asset_tag')),
|
||||||
('Location', ('region', 'site_group', 'site', 'location')),
|
('Location', ('region', 'site_group', 'site', 'location')),
|
||||||
('Hardware', ('type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit')),
|
('Hardware', (
|
||||||
|
'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth',
|
||||||
|
)),
|
||||||
('Weight', ('weight', 'weight_unit')),
|
('Weight', ('weight', 'weight_unit')),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments', 'weight', 'weight_unit'
|
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments',
|
||||||
|
'weight', 'weight_unit'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ class RackCSVForm(NetBoxModelCSVForm):
|
|||||||
model = Rack
|
model = Rack
|
||||||
fields = (
|
fields = (
|
||||||
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'type', 'serial', 'asset_tag',
|
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'type', 'serial', 'asset_tag',
|
||||||
'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'comments',
|
'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'comments',
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, data=None, *args, **kwargs):
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
|
@ -278,7 +278,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'region', 'site_group', 'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status',
|
'region', 'site_group', 'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status',
|
||||||
'role', 'serial', 'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
'role', 'serial', 'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
||||||
'outer_unit', 'weight', 'weight_unit', 'comments', 'tags',
|
'outer_unit', 'mounting_depth', 'weight', 'weight_unit', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
help_texts = {
|
||||||
'site': "The site at which the rack exists",
|
'site': "The site at which the rack exists",
|
||||||
|
18
netbox/dcim/migrations/0164_rack_mounting_depth.py
Normal file
18
netbox/dcim/migrations/0164_rack_mounting_depth.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.1 on 2022-10-27 14:01
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('dcim', '0163_rack_devicetype_moduletype_weights'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='rack',
|
||||||
|
name='mounting_depth',
|
||||||
|
field=models.PositiveSmallIntegerField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -167,6 +167,14 @@ class Rack(NetBoxModel, WeightMixin):
|
|||||||
choices=RackDimensionUnitChoices,
|
choices=RackDimensionUnitChoices,
|
||||||
blank=True,
|
blank=True,
|
||||||
)
|
)
|
||||||
|
mounting_depth = models.PositiveSmallIntegerField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
help_text=(
|
||||||
|
'Maximum depth of a mounted device, in millimeters. For four-post racks, this is the '
|
||||||
|
'distance between the front and rear rails.'
|
||||||
|
)
|
||||||
|
)
|
||||||
comments = models.TextField(
|
comments = models.TextField(
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
@ -187,7 +195,7 @@ class Rack(NetBoxModel, WeightMixin):
|
|||||||
|
|
||||||
clone_fields = (
|
clone_fields = (
|
||||||
'site', 'location', 'tenant', 'status', 'role', 'type', 'width', 'u_height', 'desc_units', 'outer_width',
|
'site', 'location', 'tenant', 'status', 'role', 'type', 'width', 'u_height', 'desc_units', 'outer_width',
|
||||||
'outer_depth', 'outer_unit', 'weight', 'weight_unit',
|
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'weight_unit',
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -89,8 +89,9 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
|||||||
model = Rack
|
model = Rack
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'serial',
|
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'serial',
|
||||||
'asset_tag', 'type', 'width', 'outer_width', 'outer_depth', 'u_height', 'weight', 'comments',
|
'asset_tag', 'type', 'u_height', 'width', 'outer_width', 'outer_depth', 'mounting_depth', 'weight',
|
||||||
'device_count', 'get_utilization', 'get_power_utilization', 'contacts', 'tags', 'created', 'last_updated',
|
'comments', 'device_count', 'get_utilization', 'get_power_utilization', 'contacts', 'tags', 'created',
|
||||||
|
'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',
|
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
<th scope="row">Outer Width</th>
|
<th scope="row">Outer Width</th>
|
||||||
<td>
|
<td>
|
||||||
{% if object.outer_width %}
|
{% if object.outer_width %}
|
||||||
<span>{{ object.outer_width }} {{ object.get_outer_unit_display }}</span>
|
{{ object.outer_width }} {{ object.get_outer_unit_display }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ ''|placeholder }}
|
{{ ''|placeholder }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -139,7 +139,17 @@
|
|||||||
<th scope="row">Outer Depth</th>
|
<th scope="row">Outer Depth</th>
|
||||||
<td>
|
<td>
|
||||||
{% if object.outer_depth %}
|
{% if object.outer_depth %}
|
||||||
<span>{{ object.outer_depth }} {{ object.get_outer_unit_display }}</span>
|
{{ object.outer_depth }} {{ object.get_outer_unit_display }}
|
||||||
|
{% else %}
|
||||||
|
{{ ''|placeholder }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Mounting Depth</th>
|
||||||
|
<td>
|
||||||
|
{% if object.mounting_depth %}
|
||||||
|
{{ object.mounting_depth }} Millimeters
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ ''|placeholder }}
|
{{ ''|placeholder }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<div class="form-text">Unit</div>
|
<div class="form-text">Unit</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% render_field form.mounting_depth %}
|
||||||
{% render_field form.desc_units %}
|
{% render_field form.desc_units %}
|
||||||
</div>
|
</div>
|
||||||
<div class="field-group my-5">
|
<div class="field-group my-5">
|
||||||
|
Loading…
Reference in New Issue
Block a user