mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
dcim: fix #3982 by readding reserved tooltip
This commit is contained in:
@ -414,7 +414,7 @@ class RackElevationHelperMixin:
|
|||||||
drawing.add(drawing.text(str(device), insert=text))
|
drawing.add(drawing.text(str(device), insert=text))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_):
|
def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_, reservation):
|
||||||
link = drawing.add(
|
link = drawing.add(
|
||||||
drawing.a(
|
drawing.a(
|
||||||
href='{}?{}'.format(
|
href='{}?{}'.format(
|
||||||
@ -424,6 +424,10 @@ class RackElevationHelperMixin:
|
|||||||
target='_top'
|
target='_top'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if reservation:
|
||||||
|
link.set_desc('{} — {} · {}'.format(
|
||||||
|
reservation.description, reservation.user, reservation.created
|
||||||
|
))
|
||||||
link.add(drawing.rect(start, end, class_=class_))
|
link.add(drawing.rect(start, end, class_=class_))
|
||||||
link.add(drawing.text("add device", insert=text, class_='add-device'))
|
link.add(drawing.text("add device", insert=text, class_='add-device'))
|
||||||
|
|
||||||
@ -453,12 +457,13 @@ class RackElevationHelperMixin:
|
|||||||
else:
|
else:
|
||||||
# Draw shallow devices, reservations, or empty units
|
# Draw shallow devices, reservations, or empty units
|
||||||
class_ = 'slot'
|
class_ = 'slot'
|
||||||
|
reservation = reserved_units.get(unit["id"])
|
||||||
if device:
|
if device:
|
||||||
class_ += ' occupied'
|
class_ += ' occupied'
|
||||||
if unit["id"] in reserved_units:
|
if reservation:
|
||||||
class_ += ' reserved'
|
class_ += ' reserved'
|
||||||
self._draw_empty(
|
self._draw_empty(
|
||||||
drawing, self, start_cordinates, end_cordinates, text_cordinates, unit["id"], face, class_
|
drawing, self, start_cordinates, end_cordinates, text_cordinates, unit["id"], face, class_, reservation
|
||||||
)
|
)
|
||||||
|
|
||||||
unit_cursor += height
|
unit_cursor += height
|
||||||
@ -493,7 +498,7 @@ class RackElevationHelperMixin:
|
|||||||
height of the elevation
|
height of the elevation
|
||||||
"""
|
"""
|
||||||
elevation = self.merge_elevations(face)
|
elevation = self.merge_elevations(face)
|
||||||
reserved_units = self.get_reserved_units().keys()
|
reserved_units = self.get_reserved_units()
|
||||||
|
|
||||||
return self._draw_elevations(elevation, reserved_units, face, unit_width, unit_height)
|
return self._draw_elevations(elevation, reserved_units, face, unit_width, unit_height)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user