Files
NetBox-Concept/pyproject.toml
T
MrBlakeandClaude Sonnet 5 67d999e234 v0.2.1: rework PNG export to draw directly on canvas, like netbox-topology-views
Investigated how MrBlake/mrb-netbox-topology-views does its PNG export:
it renders its topology natively onto a canvas (vis-network draws
there directly) and just calls canvas.toDataURL() - no SVG round-trip
at all. Applied the same principle here.

Previous approach loaded the standalone SVG export via <img src="blob:...">
and rasterized that onto a canvas - fragile, because the whole export
failed if that SVG document wasn't strictly valid XML (as our leaked
{# #} comment bug demonstrated) or if a single device type image
reference inside it couldn't be resolved.

New approach: a dedicated export/data/ endpoint returns the elevation's
plain pixel geometry as JSON (positions, sizes, colors, labels, image
URLs - the same numbers the SVG is built from), and export.js draws
that directly onto a <canvas> with native 2D primitives (fillRect,
strokeRect, fillText/strokeText, drawImage). Device type images are
fetched individually as same-origin blobs before drawing; one image
failing to load only drops that picture; the rest of the export still
succeeds. Added a combined front+rear PNG option.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 12:53:42 +02:00

34 lines
968 B
TOML

[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "netbox-rack-concept"
version = "0.2.1"
description = "Rack blueprints for NetBox: plan racks and their equipment without creating real racks or devices"
readme = "README.md"
requires-python = ">=3.12"
license = { text = "MIT" }
authors = [{ name = "Louis" }]
keywords = ["netbox", "netbox-plugin", "dcim", "planning"]
classifiers = [
"Framework :: Django",
"Programming Language :: Python :: 3.12",
"Intended Audience :: System Administrators",
]
[project.urls]
Homepage = "https://github.com/example/netbox-rack-concept"
[tool.setuptools.packages.find]
include = ["netbox_rack_concept*"]
[tool.setuptools.package-data]
netbox_rack_concept = [
"templates/netbox_rack_concept/*.html",
"templates/netbox_rack_concept/inc/*.html",
"static/netbox_rack_concept/*",
"locale/*/LC_MESSAGES/*.po",
"locale/*/LC_MESSAGES/*.mo",
]