mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
12175 rack with starting unit > 1 (#12778)
* 12175 add rack starting unit * 12175 rack starting unit to svg * verify devices can still fit if change rack starting_unit * 12175 fix migration * 12175 fix typo and test * 12175 fix test * 12175 fix max height calc display * Misc cleanup & fixes --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -150,9 +150,9 @@ class RackElevationSVG:
|
||||
x = self.legend_width + RACK_ELEVATION_BORDER_WIDTH
|
||||
y = RACK_ELEVATION_BORDER_WIDTH
|
||||
if self.rack.desc_units:
|
||||
y += int((position - 1) * self.unit_height)
|
||||
y += int((position - self.rack.starting_unit) * self.unit_height)
|
||||
else:
|
||||
y += int((self.rack.u_height - position + 1) * self.unit_height) - int(height * self.unit_height)
|
||||
y += int((self.rack.u_height - position + self.rack.starting_unit) * self.unit_height) - int(height * self.unit_height)
|
||||
|
||||
return x, y
|
||||
|
||||
@@ -237,6 +237,7 @@ class RackElevationSVG:
|
||||
start_y = ru * self.unit_height + RACK_ELEVATION_BORDER_WIDTH
|
||||
position_coordinates = (self.legend_width / 2, start_y + self.unit_height / 2 + RACK_ELEVATION_BORDER_WIDTH)
|
||||
unit = ru + 1 if self.rack.desc_units else self.rack.u_height - ru
|
||||
unit = unit + self.rack.starting_unit - 1
|
||||
self.drawing.add(
|
||||
Text(str(unit), position_coordinates, class_='unit')
|
||||
)
|
||||
@@ -278,6 +279,7 @@ class RackElevationSVG:
|
||||
|
||||
for ru in range(0, self.rack.u_height):
|
||||
unit = ru + 1 if self.rack.desc_units else self.rack.u_height - ru
|
||||
unit = unit + self.rack.starting_unit - 1
|
||||
y_offset = RACK_ELEVATION_BORDER_WIDTH + ru * self.unit_height
|
||||
text_coords = (
|
||||
x_offset + self.unit_width / 2,
|
||||
|
Reference in New Issue
Block a user