#12175: Misc cleanup

This commit is contained in:
Jeremy Stretch 2023-08-02 10:47:16 -04:00
parent bf20611668
commit 1937c1fad6
6 changed files with 19 additions and 9 deletions

View File

@ -61,6 +61,10 @@ The canonical distance between the two vertical rails on a face. (This is typica
The height of the rack, measured in units. The height of the rack, measured in units.
### Starting Unit
The number of the numerically lowest unit in the rack. This value defaults to one, but may be higher in certain situations. For example, you may want to model only a select range of units within a shared physical rack (e.g. U13 through U24).
### 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 and depth of the rack can be tracked to aid in floorplan calculations. These measurements must be designated in either millimeters or inches.

View File

@ -214,9 +214,9 @@ class RackSerializer(NetBoxModelSerializer):
model = Rack model = Rack
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', 'max_weight', 'weight_unit', 'desc_units', 'asset_tag', 'type', 'width', 'u_height', 'starting_unit', 'weight', 'max_weight', 'weight_unit',
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'description', 'comments', 'tags', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'description', 'comments',
'custom_fields', 'created', 'last_updated', 'device_count', 'powerfeed_count', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', 'powerfeed_count',
] ]

View File

@ -323,8 +323,8 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
class Meta: class Meta:
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', 'starting_unit', 'desc_units', 'outer_width',
'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit' 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit'
] ]
def search(self, queryset, name, value): def search(self, queryset, name, value):

View File

@ -114,9 +114,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', 'u_height', 'width', 'outer_width', 'outer_depth', 'mounting_depth', 'weight', 'asset_tag', 'type', 'u_height', 'starting_unit', 'width', 'outer_width', 'outer_depth', 'mounting_depth',
'max_weight', 'comments', 'device_count', 'get_utilization', 'get_power_utilization', 'description', 'weight', 'max_weight', 'comments', 'device_count', 'get_utilization', 'get_power_utilization',
'contacts', 'tags', 'created', 'last_updated', 'description', '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',

View File

@ -459,6 +459,12 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
params = {'u_height': [42, 43]} params = {'u_height': [42, 43]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_starting_unit(self):
params = {'starting_unit': [1]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 3)
params = {'starting_unit': [2]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 0)
def test_desc_units(self): def test_desc_units(self):
params = {'desc_units': 'true'} params = {'desc_units': 'true'}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)

View File

@ -39,6 +39,7 @@
</div> </div>
{% render_field form.type %} {% render_field form.type %}
{% render_field form.width %} {% render_field form.width %}
{% render_field form.starting_unit %}
{% render_field form.u_height %} {% render_field form.u_height %}
<div class="row mb-3"> <div class="row mb-3">
<label class="col col-md-3 col-form-label text-lg-end">{% trans "Outer Dimensions" %}</label> <label class="col col-md-3 col-form-label text-lg-end">{% trans "Outer Dimensions" %}</label>
@ -72,7 +73,6 @@
</div> </div>
{% render_field form.mounting_depth %} {% render_field form.mounting_depth %}
{% render_field form.desc_units %} {% render_field form.desc_units %}
{% render_field form.starting_unit %}
</div> </div>
{% if form.custom_fields %} {% if form.custom_fields %}