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>
47 lines
2.6 KiB
Markdown
47 lines
2.6 KiB
Markdown
# Changelog
|
|
|
|
## 0.2.1
|
|
|
|
- Rework PNG export: instead of rasterizing the SVG export via `<img>`/`<canvas>`
|
|
(fragile - any malformed SVG or cross-origin image reference could fail the whole
|
|
export with an opaque error), draw the elevation directly onto a `<canvas>` from
|
|
plain pixel geometry (`export/data/`), the same approach netbox-topology-views uses.
|
|
Device type images are fetched individually as same-origin blobs; a single image
|
|
failing to load only drops that picture instead of aborting the export. Added a
|
|
combined front+rear PNG option to the Export menu.
|
|
|
|
## 0.2.0
|
|
|
|
- Fix: several multi-line `{# ... #}` template comments rendered as literal text on
|
|
the page instead of being stripped, because Django's comment-tag regex doesn't match
|
|
across newlines. All comments are now single-line. (This was also the most likely
|
|
cause of a reported "PNG export failed" error: the leaked text made the exported SVG
|
|
invalid, so the browser couldn't decode it as an image.)
|
|
- Add German translation (`locale/de/`). English remains the source language and needs
|
|
no catalog; both are already listed in NetBox's own language selector.
|
|
- Center the "+ Add device" hint on empty rack units instead of right-aligning it.
|
|
- Add SVG/PNG/draw.io export for rack concepts.
|
|
- Fix drag-and-drop reorder: NetBox sets `CSRF_COOKIE_HTTPONLY`, so the reorder POST's
|
|
CSRF token now comes from a rendered `{% csrf_token %}` input instead of the
|
|
(JS-invisible) cookie.
|
|
- Add per-type component tabs (Interfaces, Front/Rear Ports, Console (Server) Ports,
|
|
Power Ports/Outlets) on the concept device page, mirroring real `dcim.Device` pages.
|
|
- Copying a real rack (or merging two real racks) into a concept now also copies
|
|
internal cabling as ConceptCables.
|
|
- Show the peer device/port in component connection columns.
|
|
- Fix `IntegrityError` when merging two real racks: `airflow`/`face` can be `NULL` on
|
|
a real `Rack`/`Device` but not on the corresponding concept fields.
|
|
- Add rack cabling: `ConceptComponent`, `ConceptCable`, device-type component sync,
|
|
patch panel front/rear pass-through mapping.
|
|
- Add click-to-add on empty rack units, dropping the separate "Add planned device"
|
|
button.
|
|
- Add images/labels view toggle and clean up device label styling on the elevation.
|
|
- Fix rack elevation overlap; add device images to elevation blocks.
|
|
- Add rack/concept merge (2 racks or 2 concepts → 1), and a size override when copying
|
|
a real rack into a concept.
|
|
|
|
## 0.1.0
|
|
|
|
Initial release: rack concept planning, copy/clone/merge/deploy flows, drag-and-drop
|
|
elevation, partial-width devices, REST API.
|