Merge branch 'develop' into 3950-not-retain-device-type

This commit is contained in:
Jeremy Stretch 2020-01-24 13:49:30 -05:00 committed by GitHub
commit 0ec091ffe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -4,10 +4,12 @@
* [#3310](https://github.com/netbox-community/netbox/issues/3310) - Pre-select site/rack for B side when creating a new cable
* [#3509](https://github.com/netbox-community/netbox/issues/3509) - Add IP address variables for custom scripts
* [#4005](https://github.com/netbox-community/netbox/issues/4005) - Include timezone context in webhook timestamps
## Bug Fixes
* [#3950](https://github.com/netbox-community/netbox/issues/3950) - Fix "Create and Add Another" not keep Manufacturer and Device Type after device creation
* [#3950](https://github.com/netbox-community/netbox/issues/3950) - Automatically select parent manufacturer when specifying initial device type during device creation
* [#3982](https://github.com/netbox-community/netbox/issues/3982) - Restore tooltip for reservations on rack elevations
* [#3983](https://github.com/netbox-community/netbox/issues/3983) - Permit the creation of multiple unnamed devices
* [#3989](https://github.com/netbox-community/netbox/issues/3989) - Correct HTTP content type assignment for webhooks
* [#3999](https://github.com/netbox-community/netbox/issues/3999) - Do not filter child results by null if non-required parent fields are blank

View File

@ -414,7 +414,7 @@ class RackElevationHelperMixin:
drawing.add(drawing.text(str(device), insert=text))
@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(
drawing.a(
href='{}?{}'.format(
@ -424,6 +424,10 @@ class RackElevationHelperMixin:
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.text("add device", insert=text, class_='add-device'))
@ -453,12 +457,13 @@ class RackElevationHelperMixin:
else:
# Draw shallow devices, reservations, or empty units
class_ = 'slot'
reservation = reserved_units.get(unit["id"])
if device:
class_ += ' occupied'
if unit["id"] in reserved_units:
if reservation:
class_ += ' reserved'
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
@ -493,7 +498,7 @@ class RackElevationHelperMixin:
height of the elevation
"""
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)

View File

@ -3,6 +3,7 @@ import hashlib
import hmac
from django.contrib.contenttypes.models import ContentType
from django.utils import timezone
from extras.models import Webhook
from utilities.api import get_serializer_for_model
@ -62,7 +63,7 @@ def enqueue_webhooks(instance, user, request_id, action):
serializer.data,
instance._meta.model_name,
action,
str(datetime.datetime.now()),
str(timezone.now()),
user.username,
request_id
)