Skip to content

Commit 57156f0

Browse files
Adds stroke to the reservation (#12506)
* adds stroke to the reservation #11900 * fixed right side border * Tweak reserved stroke style & add constants for colors --------- Co-authored-by: jeremystretch <[email protected]>
1 parent 4e49f4a commit 57156f0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

netbox/dcim/svg/racks.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
'RackElevationSVG',
2323
)
2424

25+
GRADIENT_RESERVED = '#b0b0ff'
26+
GRADIENT_OCCUPIED = '#d7d7d7'
27+
GRADIENT_BLOCKED = '#ffc0c0'
28+
STROKE_RESERVED = '#4d4dff'
29+
2530

2631
def get_device_name(device):
2732
if device.virtual_chassis:
@@ -132,9 +137,9 @@ def _setup_drawing(self):
132137
drawing.defs.add(drawing.style(css_file.read()))
133138

134139
# Add gradients
135-
RackElevationSVG._add_gradient(drawing, 'reserved', '#b0b0ff')
136-
RackElevationSVG._add_gradient(drawing, 'occupied', '#d7d7d7')
137-
RackElevationSVG._add_gradient(drawing, 'blocked', '#ffc0c0')
140+
RackElevationSVG._add_gradient(drawing, 'reserved', GRADIENT_RESERVED)
141+
RackElevationSVG._add_gradient(drawing, 'occupied', GRADIENT_OCCUPIED)
142+
RackElevationSVG._add_gradient(drawing, 'blocked', GRADIENT_BLOCKED)
138143

139144
return drawing
140145

@@ -246,13 +251,13 @@ def draw_margin(self):
246251
coords = self._get_device_coords(segment[0], u_height)
247252
coords = (coords[0] + self.unit_width + RACK_ELEVATION_BORDER_WIDTH * 2, coords[1])
248253
size = (
249-
self.margin_width,
254+
self.margin_width - 3,
250255
u_height * self.unit_height
251256
)
252257
link = Hyperlink(href=f'{self.base_url}{reservation.get_absolute_url()}', target='_parent')
253258
link.set_desc(f'Reservation #{reservation.pk}: {reservation.description}')
254259
link.add(
255-
Rect(coords, size, class_='reservation')
260+
Rect(coords, size, class_='reservation', stroke=STROKE_RESERVED, stroke_width=2)
256261
)
257262
self.drawing.add(link)
258263

0 commit comments

Comments
 (0)