mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
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 <jstretch@netboxlabs.com>
This commit is contained in:
parent
4e49f4a434
commit
57156f0e94
@ -22,6 +22,11 @@ __all__ = (
|
||||
'RackElevationSVG',
|
||||
)
|
||||
|
||||
GRADIENT_RESERVED = '#b0b0ff'
|
||||
GRADIENT_OCCUPIED = '#d7d7d7'
|
||||
GRADIENT_BLOCKED = '#ffc0c0'
|
||||
STROKE_RESERVED = '#4d4dff'
|
||||
|
||||
|
||||
def get_device_name(device):
|
||||
if device.virtual_chassis:
|
||||
@ -132,9 +137,9 @@ class RackElevationSVG:
|
||||
drawing.defs.add(drawing.style(css_file.read()))
|
||||
|
||||
# Add gradients
|
||||
RackElevationSVG._add_gradient(drawing, 'reserved', '#b0b0ff')
|
||||
RackElevationSVG._add_gradient(drawing, 'occupied', '#d7d7d7')
|
||||
RackElevationSVG._add_gradient(drawing, 'blocked', '#ffc0c0')
|
||||
RackElevationSVG._add_gradient(drawing, 'reserved', GRADIENT_RESERVED)
|
||||
RackElevationSVG._add_gradient(drawing, 'occupied', GRADIENT_OCCUPIED)
|
||||
RackElevationSVG._add_gradient(drawing, 'blocked', GRADIENT_BLOCKED)
|
||||
|
||||
return drawing
|
||||
|
||||
@ -246,13 +251,13 @@ class RackElevationSVG:
|
||||
coords = self._get_device_coords(segment[0], u_height)
|
||||
coords = (coords[0] + self.unit_width + RACK_ELEVATION_BORDER_WIDTH * 2, coords[1])
|
||||
size = (
|
||||
self.margin_width,
|
||||
self.margin_width - 3,
|
||||
u_height * self.unit_height
|
||||
)
|
||||
link = Hyperlink(href=f'{self.base_url}{reservation.get_absolute_url()}', target='_parent')
|
||||
link.set_desc(f'Reservation #{reservation.pk}: {reservation.description}')
|
||||
link.add(
|
||||
Rect(coords, size, class_='reservation')
|
||||
Rect(coords, size, class_='reservation', stroke=STROKE_RESERVED, stroke_width=2)
|
||||
)
|
||||
self.drawing.add(link)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user