|
@@ -22,6 +22,11 @@ __all__ = (
|
|
|
'RackElevationSVG',
|
|
'RackElevationSVG',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+GRADIENT_RESERVED = '#b0b0ff'
|
|
|
|
|
+GRADIENT_OCCUPIED = '#d7d7d7'
|
|
|
|
|
+GRADIENT_BLOCKED = '#ffc0c0'
|
|
|
|
|
+STROKE_RESERVED = '#4d4dff'
|
|
|
|
|
+
|
|
|
|
|
|
|
|
def get_device_name(device):
|
|
def get_device_name(device):
|
|
|
if device.virtual_chassis:
|
|
if device.virtual_chassis:
|
|
@@ -132,9 +137,9 @@ class RackElevationSVG:
|
|
|
drawing.defs.add(drawing.style(css_file.read()))
|
|
drawing.defs.add(drawing.style(css_file.read()))
|
|
|
|
|
|
|
|
# Add gradients
|
|
# 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
|
|
return drawing
|
|
|
|
|
|
|
@@ -246,13 +251,13 @@ class RackElevationSVG:
|
|
|
coords = self._get_device_coords(segment[0], u_height)
|
|
coords = self._get_device_coords(segment[0], u_height)
|
|
|
coords = (coords[0] + self.unit_width + RACK_ELEVATION_BORDER_WIDTH * 2, coords[1])
|
|
coords = (coords[0] + self.unit_width + RACK_ELEVATION_BORDER_WIDTH * 2, coords[1])
|
|
|
size = (
|
|
size = (
|
|
|
- self.margin_width,
|
|
|
|
|
|
|
+ self.margin_width - 3,
|
|
|
u_height * self.unit_height
|
|
u_height * self.unit_height
|
|
|
)
|
|
)
|
|
|
link = Hyperlink(href=f'{self.base_url}{reservation.get_absolute_url()}', target='_parent')
|
|
link = Hyperlink(href=f'{self.base_url}{reservation.get_absolute_url()}', target='_parent')
|
|
|
link.set_desc(f'Reservation #{reservation.pk}: {reservation.description}')
|
|
link.set_desc(f'Reservation #{reservation.pk}: {reservation.description}')
|
|
|
link.add(
|
|
link.add(
|
|
|
- Rect(coords, size, class_='reservation')
|
|
|
|
|
|
|
+ Rect(coords, size, class_='reservation', stroke=STROKE_RESERVED, stroke_width=2)
|
|
|
)
|
|
)
|
|
|
self.drawing.add(link)
|
|
self.drawing.add(link)
|
|
|
|
|
|