revert: defer rack images to NetBox
This commit is contained in:
@@ -36,7 +36,7 @@ Release-Tag oder ein bestimmter Commit verwendet werden:
|
||||
|
||||
```bash
|
||||
/opt/netbox/venv/bin/pip install --upgrade --force-reinstall \
|
||||
"git+https://git.mrblake.cc/MrBlake/Netbox-Utilities.git@v0.8.7"
|
||||
"git+https://git.mrblake.cc/MrBlake/Netbox-Utilities.git@v0.8.8"
|
||||
```
|
||||
|
||||
Alternativ kann hinter dem `@` die vollständige Commit-ID stehen.
|
||||
@@ -152,9 +152,6 @@ unterstützt.
|
||||
|
||||
Nach einer Änderung der Rackbreite wird die **Breitenposition** unmittelbar
|
||||
aktualisiert; ein Zwischenspeichern oder Neuladen ist nicht erforderlich.
|
||||
Hinterlegte Vorder- und Rückseitenbilder des Gerätetyps werden bei
|
||||
Teilbreitengeräten proportional in die verfügbare Breite eingepasst, ohne das
|
||||
Bild seitlich abzuschneiden.
|
||||
|
||||
Ohne Breitenangabe belegt ein Gerät wie bisher die volle Rackbreite. Das gilt
|
||||
automatisch für sämtliche vorhandenen Geräte; es findet keine Änderung oder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from netbox.plugins import PluginConfig, get_plugin_config
|
||||
|
||||
__version__ = "0.8.7"
|
||||
__version__ = "0.8.8"
|
||||
|
||||
|
||||
class NetBoxUtilitiesConfig(PluginConfig):
|
||||
|
||||
@@ -465,7 +465,6 @@ def _install_rack_svg():
|
||||
elevation.draw_device_front(device, coords, size)
|
||||
else:
|
||||
elevation.draw_device_rear(device, coords, size)
|
||||
_fit_latest_elevation_image(elevation.drawing)
|
||||
else:
|
||||
from svgwrite.shapes import Rect
|
||||
|
||||
@@ -497,19 +496,6 @@ def _partial_width_elevation_devices(rack, face):
|
||||
)
|
||||
|
||||
|
||||
def _fit_latest_elevation_image(drawing):
|
||||
"""Fit the latest device image into a partial-width slot without cropping it."""
|
||||
from svgwrite.image import Image
|
||||
|
||||
if not getattr(drawing, "elements", None):
|
||||
return
|
||||
container = drawing.elements[-1]
|
||||
for element in reversed(getattr(container, "elements", ())):
|
||||
if isinstance(element, Image):
|
||||
element.fit(scale="meet")
|
||||
return
|
||||
|
||||
|
||||
def _validate_before_save(sender, instance, raw=False, **kwargs):
|
||||
if not raw:
|
||||
using = kwargs.get("using")
|
||||
|
||||
@@ -13,7 +13,6 @@ from django.urls import resolve, reverse
|
||||
|
||||
from netbox_utilities.rack_width import (
|
||||
_cleanup_unracked_placement,
|
||||
_fit_latest_elevation_image,
|
||||
_partial_width_elevation_devices,
|
||||
available_units_for_device,
|
||||
horizontal_interval,
|
||||
@@ -33,22 +32,6 @@ class RackWidthTest(SimpleTestCase):
|
||||
self.assertIn("positionField.disabled = width === 1", script)
|
||||
self.assertIn("positionField.tomselect.sync()", script)
|
||||
|
||||
def test_partial_width_device_image_is_fitted_without_cropping(self):
|
||||
from svgwrite import Drawing
|
||||
from svgwrite.container import Hyperlink
|
||||
from svgwrite.image import Image
|
||||
|
||||
drawing = Drawing()
|
||||
link = Hyperlink("/dcim/devices/1/")
|
||||
device_image = Image("/media/device.png", size=(100, 20))
|
||||
device_image.fit(scale="slice")
|
||||
link.add(device_image)
|
||||
drawing.add(link)
|
||||
|
||||
_fit_latest_elevation_image(drawing)
|
||||
|
||||
self.assertEqual(device_image.attribs["preserveAspectRatio"], "xMidYMid meet")
|
||||
|
||||
def test_partial_width_svg_devices_include_core_device_bay_annotation(self):
|
||||
from dcim.choices import DeviceFaceChoices
|
||||
from dcim.models import Rack
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "netbox-utilities"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
description = "Navigation, tenant utilities, partial-width rack devices, bulk uploads, and rack reordering for NetBox 4.6"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
Reference in New Issue
Block a user