Commit Graph
8 Commits
Author SHA1 Message Date
MrBlakeandClaude Opus 5.5 6ffe6348a6 Fix partial-width integration with Netbox-Utilities
The default mapping pointed to netbox_utilities.RackDevicePosition / width_fraction, which never existed, so partial widths were silently ignored: copying a rack lost them and deploying a concept with devices sharing a rack unit failed with "already occupied".

Use netbox_utilities.DeviceRackPlacement (width, horizontal_position), convert between 0-based concept positions and the 1-based positions of netbox_utilities, and stage the width on the device before full_clean() so the Utilities collision check sees it. Configurations with the old model name are migrated automatically.

Verified on NetBox 4.7.2: copying a rack with two half-width devices in one U and deploying it twice recreates both side by side. Bump version to 0.2.6.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:25:24 +02:00
MrBlakeandClaude Opus 5.5 9736a216be Add migration for ConceptPortMapping BigAutoField
Migration 0002 created the id column as AutoField while the model uses BigAutoField. Verified with NetBox 4.7.2. Bump version to 0.2.5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:13:33 +02:00
MrBlakeandClaude Sonnet 5 96ce1ef713 v0.2.4: verify and declare NetBox 4.7.1 compatibility
Went through NetBox 4.7's release notes for breaking/plugin-relevant
changes and checked each one that could plausibly affect this plugin
against the actual v4.7.1 source rather than assuming:

- Rack.form_factor/width/airflow/outer_* are deprecated (removal
  planned for v5.0) but still present and behave the same - the
  plugin's GEOMETRY_FIELDS copying is unaffected.
- ChoiceSet's CHOICES now accepts a new Choice object, but the
  metaclass explicitly still supports the legacy (value, label, color)
  tuple format this plugin's own choices.py uses - confirmed by
  reading utilities/choices.py's updated register() logic directly.
- register_model_view, ViewTab, get_model_urls, PluginConfig's
  relative resource-path resolution, PortTemplateMapping/
  PortMappingBase (patch panel front/rear sync),
  Cable/CableTermination/CabledObjectModel (rack-import cable copy),
  NetBoxModel/NetBoxModelForm/NetBoxModelFilterSet/NetBoxModelViewSet,
  PluginMenu*, ColorField, DynamicModelChoiceField, TagFilterField,
  CSVChoiceField/CSVModelChoiceField: all unchanged or only gained
  additive mixins.
- django-tables2 v3's removed RelatedLinkColumn and the removed
  querystring tag aren't used anywhere in this plugin. The MPTT->ltree
  migration doesn't touch any model this plugin manipulates directly.

No source changes were required. Raised max_version from 4.6.99 to
4.7.99 to reflect the verified range; left it there rather than
guessing forward to an unreleased 4.8.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 09:04:58 +02:00
MrBlakeandClaude Sonnet 5 1793bf13e2 v0.2.3: visible cross-panel drag ghost, front-image fallback, shorter hint
- Fix invisible device while dragging from front to rear: the block
  being dragged stayed structurally inside its own source <svg>, so it
  rendered underneath the other panel once it visually overlapped it.
  Replaced the in-SVG transform with a free-floating HTML ghost fixed
  to <body> that tracks the pointer, unaffected by either SVG's own
  stacking - the original block just dims in place during the drag, as
  before.
- Fix rear elevation showing nothing for a device type with no
  rear_image: only full-depth devices (which have a genuinely
  different back) are restricted to their own rear image now; a
  shallow device (e.g. a PDU) falls back to its front image on the
  rear view, since that's usually the only picture that exists and is
  still recognisable either way.
- Shorten the drag-hint badge text; the German translation of the
  previous, longer wording didn't fit well next to the other controls
  above the elevation.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 14:01:42 +02:00
MrBlakeandClaude Sonnet 5 41141ec318 v0.2.2: support dragging a device between front and rear elevations
Front and rear panels already share one coordinate system (same
UNIT_HEIGHT, RACK_X, ...), just placed side by side on screen, so the
existing delta-based drag math is equally valid for a drop on the
other panel - only needed to detect which face the pointer ended up
over (elementFromPoint at drop time) and include it as `face` in the
submitted move; the reorder endpoint already supported changing it.

Also fixed a bug this surfaced: without pointer-events: none on the
dragged block during the drag, elementFromPoint() at drop time always
hit the dragged block itself (it's what's rendered under the cursor),
never the panel actually underneath - cross-face drops would never
have been detected. Pointer capture keeps delivering move/up events to
the block regardless of its own pointer-events value, so this is safe.

Added overflow: visible on the elevation SVGs so a device being
dragged toward the other panel doesn't just vanish at its own SVG's
edge mid-drag.

Updated the German translation for the changed drag-hint string.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 13:50:57 +02:00
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 <[email protected]>
2026-09-16 12:53:42 +02:00
MrBlakeandClaude Sonnet 5 3420d84803 v0.2.0: fix leaked multi-line {# #} comments, add German translation
- Fix template comments rendering as literal text: Django's {# #} tag
  regex (tag_re in django/template/base.py) has no re.DOTALL, so a
  comment spanning multiple lines is never recognized as a tag at all
  and leaks into the rendered output verbatim - exactly what showed up
  under "Elevation". Collapsed all three offending comments to single
  lines. This was also almost certainly the real cause of the "PNG
  could not be generated" report: two of the leaked comments sat
  inside the shared SVG partial, corrupting the exported SVG enough
  that the browser's image decoder rejected it (my own onerror handler
  then showed a misleading CORS-sounding message - the actual bug was
  malformed markup, not cross-origin images).
- Add a German translation (locale/de/), built from every _() and
  {% trans %}/{% blocktrans %} string in the plugin (269 entries,
  cross-checked against the source for completeness). English needs no
  catalog of its own since it's the literal source text; both were
  already listed in NetBox's own language selector.
- Add CHANGELOG.md and bump the version to 0.2.0, covering this and
  every unreleased change so far; will keep bumping per change from
  here on.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 12:45:01 +02:00
MrBlakeandClaude Sonnet 5 17cf94ac0d Add netbox_rack_concept plugin: rack blueprint planning
Introduces a NetBox 4.6 plugin for planning rack layouts (RackConcept,
ConceptDevice) without creating real dcim.Rack/dcim.Device objects, so
blueprints never appear in rack/device lists, utilization reports, or
IPAM.

Features:
- Copy paths: real rack -> concept, concept -> concept (clone), and
  concept -> one or more real racks (deploy, with name patterning and
  dry-run support)
- Manual concept creation via a dedicated "Rack Concepts" nav menu
- Tenant and tenant group assignment on concepts and planned devices
- Partial-width device placement (1/1-1/4) with slot-based collision
  detection, matching netbox_utilities' partial-width feature
- Custom drag-and-drop elevation (netbox-reorder-rack operates on real
  Device querysets, which concepts don't have) with server-side
  validation of every move
- Full REST API, filtering, CSV import, bulk edit, search integration
- Optional, config-driven interop with netbox_utilities (partial-width
  field mapping) and netbox-reorder-rack, degrading gracefully when
  either plugin is absent

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 09:00:26 +02:00