Files
Netbox-Utilities/netbox_utilities/__init__.py
T
MrBlakeandClaude Sonnet 5 3cff66ad33 fix: target the correct classes for images-only/labels-only export
Decompiled NetBox core's own bundled JS (netbox.js) to find the real
toggle logic: its "images-only"/"labels-only" control only ever
hides image.device-image and text.device-image-label - it never
touches the plain text.label, relying on an opaque device image to
visually cover it. A device without a photo therefore still shows its
name live, even in "images-only".

apply_rack_view_mode() previously removed .label for images-only and
.device-image/.device-image-label for labels-only, which not only
targeted the wrong element for images-only but also left device-
image-label (the name overlaid on the image) around in labels-only.

For a static, non-interactive export there's no image left to cover
stray text, so per explicit request this deliberately does not mirror
NetBox's live fallback: images-only now always removes every label
(.label and .device-image-label) for a pure image view, and
labels-only removes the image layer (.device-image and
.device-image-label) to reproduce NetBox's own box-with-text view.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17 15:54:53 +02:00

54 lines
1.9 KiB
Python

from netbox.plugins import PluginConfig, get_plugin_config
__version__ = "0.12.1"
class NetBoxUtilitiesConfig(PluginConfig):
name = "netbox_utilities"
verbose_name = "NetBox Utilities"
description = "Navigation, tenant utilities, connection VLANs, partial-width racks, and bulk operations"
version = __version__
author = "LKE"
base_url = "utilities"
min_version = "4.6.5"
max_version = "4.7.99"
default_settings = {
"navigation_customization_enabled": True,
"connection_vlans_enabled": True,
"reorder_rack_bulk_save_enabled": True,
"topology_views_rack_width_enabled": True,
"tenant_filter_enabled": True,
"tenant_required": True,
"offline_svg_export_enabled": True,
}
middleware = [
"netbox_utilities.middleware.GlobalTenantFilterMiddleware",
]
def ready(self):
super().ready()
from .patchpanel import install_patchpanel_automation
from .rack_width import install_rack_width_support
from .tenant_scope import install_search_filter
from .tenant_validation import install_tenant_validation
install_search_filter()
install_tenant_validation()
install_patchpanel_automation()
install_rack_width_support()
if get_plugin_config("netbox_utilities", "connection_vlans_enabled"):
from .connection_vlans import install_connection_vlan_support
install_connection_vlan_support()
if self.apps.is_installed("netbox_export"):
from .netbox_export import install_netbox_export_rack_width_support
install_netbox_export_rack_width_support()
if get_plugin_config("netbox_utilities", "reorder_rack_bulk_save_enabled"):
from .reorder_rack import install_reorder_rack_bulk_save
install_reorder_rack_bulk_save()
config = NetBoxUtilitiesConfig