Commit Graph
75 Commits
Author SHA1 Message Date
MrBlakeandClaude Opus 5.5 95fd28f2a4 feat: MSA import reads disk group exports and loosely named columns
The disk group export of an HPE MSA sets RAID level and pool on the RAID
groups of the selected devices. Column names are matched case- and
punctuation-insensitively with common aliases, positions are accepted as
1.4, 1:4, 1/4 or "Enclosure 1, Slot 4" or as separate enclosure and slot
columns, and both export kinds are detected in the regular disk import.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 15:02:46 +02:00
MrBlakeandClaude Opus 5.5 2b40fbfae0 fix: MSA import wizard posted back to the disk CSV import
When the CSV import handed an MSA export to the wizard, its forms had no
action and submitted to /disks/import/, which failed with KeyError 'format'.
All wizard forms now post to the MSA import URL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 14:16:26 +02:00
MrBlakeandClaude Opus 5.5 2a6abc396d feat: hand HPE MSA exports from the disk CSV import to the MSA wizard
An MSA disk export pasted or uploaded in Disks > Import failed with
"Unknown header: Location". The import now recognises the MSA columns and
opens the shelf assignment step of the MSA import instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 14:13:10 +02:00
MrBlakeandClaude Opus 5.5 7754e823cb fix: disk CSV import crashed with "Disk.bay must be a DiskBayLayout instance"
The bay and raid_group cleaners returned the plain name, which reached the
model instance as a string whenever clean() stopped early on another error.
They now keep the name aside and leave None behind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 14:10:24 +02:00
MrBlakeandClaude Opus 5.5 a7801ec297 feat: import the disk CSV export of an HPE MSA
A three-step wizard reads the MSA disk export, maps each enclosure (shelf)
to a device and previews new, updated, replaced, skipped and conflicting
disks. Devices without slot areas get one created during the import,
pre-filled from the device type template or the export. Disk groups can
become RAID groups and the install date can be estimated from the power
on hours.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 14:06:22 +02:00
MrBlakeandClaude Opus 5.5 d45afa5e54 feat: several slot areas per device, e.g. front bays and a PCIe card
Disks that are not in the front bays, such as NVMe SSDs on a PCIe card or
M.2 SSDs on a boot card, can now be documented in their own slot area.

- A device can have several areas, each with name, order, slot count,
  rows, first slot, numbering and form factor; the tab shows one grid per
  area with its own fill, select and edit actions.
- Add area, edit area and delete empty areas on the Disks tab.
- Slot numbers are unique per area; drag and drop also moves or swaps
  disks between areas.
- Device type templates store all areas; Apply template creates the
  missing ones.
- Disks get a bay field in forms, CSV import (bay column, optional when
  the device has one area), REST API, GraphQL, filters and tables.
- Migration 0010 turns every existing layout into the area "Front" and
  assigns the existing disks to it.
- The grouped disk overview shows the area in its own column and centres
  the slot number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 14:46:48 +02:00
MrBlakeandClaude Opus 5.5 14cb5d5829 feat: own Disks main menu and disk list grouped by device
The disk entries move from the Plugins menu into a top-level Disks menu with
Disks, RAID groups and Disk templates. The Disks entry opens a new page that
groups all disks by device in collapsible sections with per-device summary,
search, warning and removed-disk switches and expand/collapse all. The flat
table with filters, export and bulk actions remains available.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 14:14:58 +02:00
MrBlakeandClaude Opus 5.5 e6be0ed294 fix: RAID group list crashed because format_html() was called without arguments
Django 6 raises a TypeError when format_html() gets no arguments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:51:44 +02:00
MrBlakeandClaude Opus 5.5 3ac6a53fa8 docs: use English UI names in the disks README section
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:51:10 +02:00
MrBlake 8b804cb8ce Merge branch 'feat/disks'
# Conflicts:
#	netbox_utilities/__init__.py
#	pyproject.toml
2026-10-19 12:35:52 +02:00
MrBlakeandClaude Opus 5.5 2980500f53 docs: describe drag and drop of disks in README
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:32:09 +02:00
MrBlakeandClaude Opus 5.5 595d6a2b71 feat: drag and drop disks between slots; fix RAID group form on NetBox 4.7
Disks on the slot grid can be dragged onto a free slot to move them or onto
an occupied slot to swap both disks. Moves are saved immediately with
changelog entries and require netbox_utilities.change_disk.

NetBoxModelForm.clean() returns None on NetBox 4.7, which broke creating
RAID groups with an AttributeError. The disk forms now read
self.cleaned_data instead of the return value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:31:56 +02:00
MrBlakeandClaude Opus 5.5 a296c57536 fix: drop unsupported user argument from disk tables and show disk count in tab badge
NetBox 4.7 tables no longer accept a user keyword argument, which broke the
Datenträger tab with a TypeError. The tab badge now shows the number of
installed disks instead of used/total slots or "neu".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:09:29 +02:00
MrBlakeandClaude Opus 5.5 adbd697c0a feat: add disk management tab for servers, NAS, SAN and MSA devices
Devices whose role is one of disk_device_roles (default Server, NAS, SAN,
MSA) get a "Datenträger" tab with slot layout, disks, RAID groups,
warranty and age warnings, replacement history, CSV import, REST API and
GraphQL.

- First-visit wizard for slot count, rows, first slot number, numbering
  and form factor; layouts can be saved as device type templates and
  applied with one click.
- Slot grid drawn like the device front, coloured by status, with
  warning icons; free slots open a pre-filled disk form.
- Bulk fill of selected slots with shared attributes and one serial per
  line (barcode scanner friendly), with live count and duplicate checks.
- Sizes in vendor notation (960 GB, 4 TB, 1,92 TB, 2 TiB); the tenant is
  always taken from the device and follows tenant changes.
- RAID groups (RAID 0/1/5/6/10/50/60, RAID-Z1/Z2/Z3, JBOD) with hot
  spares, usable capacity, tolerated failures and degraded state.
- "Ersetzen" marks a disk as removed and opens the successor form;
  removed disks stay as per-slot history.
- Warnings for failed disks, expired or expiring warranties and disks
  older than disk_age_warning_years.
- Global disk list with filters, export, global search by serial,
  optional device list column, CSV import, REST API and GraphQL.
- New settings: disks_enabled, disk_device_roles,
  disk_age_warning_years, disk_warranty_warning_days.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:01:56 +02:00
MrBlakeandClaude Opus 5.5 2aab3d14ee Enable NetBox-Export integration for 0.3.12-0.3.14 and fix stale tests
The rack width integration only accepted NetBox-Export 0.3.11 and 0.3.14, but the published version was 0.3.13, so the patches were silently skipped. Accept 0.3.12 to 0.3.14; the patcher still checks that all hooked functions exist before patching. Verified on NetBox 4.7.2 that the patch is applied.

Update four outdated tests: compare asset versions against __version__ instead of 0.10.4, allow the read-only tenant group lookup in the connection scope test, and check the prefix column in NetBox's table column registry, where register_table_column() stores it.

All 174 tests pass on NetBox 4.7.2. Bump version to 0.14.4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:08:43 +02:00
MrBlakeandClaude Opus 5.5 1ed16c542a Fix fresh-install migrations on PostgreSQL
Reading the runtime settings while other migrations run failed because the settings table did not exist yet. The error was caught, but it aborted the surrounding migration transaction on PostgreSQL. Run the query inside a savepoint. Verified with NetBox 4.7.2. Bump version to 0.14.3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:13:18 +02:00
MrBlakeandClaude Opus 5.5 cbb8128385 fix: downscale oversized bulk uploads so NetBox can render thumbnails
NetBox renders image attachment thumbnails under its global 25 MP Pillow
limit, so 50 MP photos uploaded via the bulk form showed no preview.
Scale images above that limit down (applying EXIF orientation) before
saving. Also resolve leftover merge conflict markers in the README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-02 10:19:19 +02:00
MrBlake f7c9ce995f Merge branch 'main' of https://git.mrblake.cc/MrBlake/Netbox-Utilities 2026-10-02 10:14:54 +02:00
MrBlakeandClaude Opus 5.5 a9fd36f31c fix: allow 50 MP smartphone photos in bulk image upload
NetBox sets Pillow's MAX_IMAGE_PIXELS to 25 MP, so Pillow rejects images
above 50 MP as decompression bombs. Raise the limit to 100 MP while the
bulk upload is processed and surface the underlying Pillow error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-02 10:14:13 +02:00
MrBlakeandClaude Opus 5.5 a85e4d6375 docs: rewrite README in English with standard structure
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 13:36:57 +02:00
MrBlakeandClaude Opus 5.5 c7b65f123b feat: make site prefix column sortable
Clicking the Prefix column header sorts device and rack lists by site
name, which starts with the prefix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-25 11:10:29 +02:00
MrBlakeandClaude Opus 5.5 337cd28c23 feat: filter device and rack lists by site prefix
Adds a site_prefix filter to the device and rack filtersets and filter
forms. It matches the first word of the site name case-insensitively
and accepts several comma-separated prefixes. Bumps version to 0.14.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-25 11:07:03 +02:00
MrBlakeandClaude Opus 5.5 ae4b05d539 feat: integrate site prefix column from Netbox-Prefixes
Device and rack tables show the first word of the site name as the
first data column. Replaces the separate netbox_site_prefix plugin and
can be disabled with site_prefix_column_enabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-24 15:38:47 +02:00
MrBlakeandClaude Opus 5 ad4085a2db feat: prefilter the B side of a cable by tenant group, tenant and site
Add three optional filter fields above the B-side termination selection.
They are never saved on the cable and can be cleared, so cabling across
tenant or site boundaries stays possible. Defaults come from the A side
or the global tenant filter.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-23 11:27:03 +02:00
MrBlakeandClaude Sonnet 5 ca1e38a1da ui: place offline SVG button directly beside "SVG herunterladen"
NetBox renders the native download link inside each per-face
elevation card, not through a plugin buttons() extension point, so
there's no server-side hook to inject a matching link next to it. The
right_page() extension now emits only a script (no separate sidebar
panel) that finds every a[href*="render=svg"] link, reads its face=
param, and inserts a matching "SVG offline" button right after it. The
button's href stays in sync with the rack-view select the same way
the previous panel's links did.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 16:13:40 +02:00
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 <[email protected]>
2026-09-17 15:54:53 +02:00
MrBlakeandClaude Sonnet 5 bfc4382403 feat: honor images-only/labels-only rack view mode in offline SVG export
The rack elevation page's "Bilder und Beschriftungen" dropdown only
toggles CSS visibility client-side after the browser already has the
SVG, so a freshly server-rendered export had no way to know which mode
was selected and always exported everything.

apply_rack_view_mode() replicates that filtering server-side by
removing the .label text elements (images-only) or the .device-image /
.device-image-label elements (labels-only) from the parsed SVG.
RackElevationOfflineSVGView now accepts a ?view= query param, and the
rack detail page panel syncs its download links to the page's own
"select.rack-view" dropdown so the exported file matches what's
currently shown.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 15:30:38 +02:00
MrBlakeandClaude Sonnet 5 20ec9453c2 feat: support netbox-export 0.3.14 and netbox-reorder-rack 1.1.5
Verified against the actually installed versions that the patched
hook signatures (serialize_object, is_exportable_model,
_defer_device_placement, _device_placement_conflicts,
_apply_device_placements, SaveViewSet.update, ReorderView.get) are
still compatible with our wrappers, then added both versions to the
supported sets so the width-aware patches stop being silently
skipped.

netbox-reorder-rack 1.1.5 changed ReorderView.get from
(self, request, pk) to (self, request, **kwargs). Our fallback path
called the original view with a positional pk, which would now raise
TypeError; width_aware_reorder_get now accepts pk as a keyword with
**kwargs passthrough so both the patched and native code paths work
regardless of which signature is installed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 15:27:34 +02:00
MrBlakeandClaude Sonnet 5 ead171d546 fix: inline device images as data URIs in offline SVG export
strip_svg_hyperlinks() removed every href, including on <image>
elements that reference device-type photos, leaving devices with
images blank in the exported file. Non-anchor hrefs (currently only
<image>) are now resolved through an optional image_loader callback
and embedded as base64 data URIs instead of being stripped; anchor
unwrapping is unchanged. RackElevationOfflineSVGView wires this up to
NetBox's MEDIA storage.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 15:20:43 +02:00
MrBlakeandClaude Sonnet 5 23acebcf17 fix: handle plain HttpResponse from elevation SVG endpoint, unracked devices
- RackElevationOfflineSVGView called .render() unconditionally on the
  RackViewSet elevation action's response, but that action returns a
  plain HttpResponse (not a DRF Response) when render=svg is
  requested, causing AttributeError on every click.
- effective_width_positions() crashed with decimal.InvalidOperation
  when a device had no rack position set (e.g. surfaced via NetBox
  Topology Views, which includes unracked devices). Such devices now
  get the default full-width result instead of entering the Decimal
  conversion.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 15:16:09 +02:00
MrBlakeandClaude Sonnet 5 c722abe497 fix: move offline SVG export from buttons() to right_page()
The buttons() plugin-template-extension hook was registered for
dcim.rack and rendered without error, but the button HTML never
appeared on the rendered rack detail page in production — NetBox's
Rack detail template apparently doesn't wire the buttons() slot into
its controls row. right_page() is confirmed working for this plugin
already (the device rack-width panel uses it), so the export links
now render there as a small card instead.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 15:10:33 +02:00
MrBlakeandClaude Sonnet 5 3768417be6 feat: add offline SVG export for rack elevations
Adds a "SVG offline" download button on the rack detail page. It
reuses NetBox's own rack-elevation REST endpoint to render the SVG,
then strips embedded <a>/xlink:href links (which point at internal,
relative NetBox URLs and are useless once the file is saved) so the
result renders identically when opened standalone in any SVG viewer.

Gated by the new offline_svg_export_enabled plugin setting (on by
default).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 14:22:04 +02:00
MrBlakeandClaude Sonnet 5 35ca661ed0 compat: raise max_version to support NetBox 4.7
Extends the declared version range (min_version stays 4.6.5) and
updates the plugin description to reflect 4.7 support. The plugin's
internal-API monkeypatches (rack elevation SVG, DeviceEditView form)
should be regression-tested against a live NetBox 4.7.1 install, as
those are the areas most likely to break across minor releases.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-17 09:21:42 +02:00
MrBlake ff8dacc68c fix: pair LC patchpanel ports by number 2026-08-31 11:22:53 +02:00
MrBlake f3d658b52b feat: filter connection VLANs by group 2026-08-25 12:11:18 +02:00
MrBlake d245ae0f79 ui: place connection VLANs below cable B side 2026-08-25 12:03:45 +02:00
MrBlake 4421000409 fix: ignore reverse relations during tenant autofill 2026-08-19 12:40:17 +02:00
MrBlake bd748ef985 feat: assign VLANs to network connections 2026-08-19 12:24:40 +02:00
MrBlake 1c6708216c fix: preserve shared rack units during import 2026-08-19 10:53:44 +02:00
MrBlake 7216dad2b4 fix: separate rack width import locks 2026-08-19 10:43:33 +02:00
MrBlake 639dc958a5 feat: preserve rack widths in netbox export 2026-08-19 10:33:17 +02:00
MrBlake 839b076d94 fix: preserve reorder drag width and images 2026-08-13 16:10:47 +02:00
MrBlake 79a071597c fix: restore visible rack integration widgets 2026-08-13 11:21:48 +02:00
MrBlake e42580d651 fix: bind rack integrations to rendered devices 2026-08-13 10:51:59 +02:00
MrBlake 270d821219 fix: render rack integrations server-side 2026-08-13 10:15:13 +02:00
MrBlake 33490d40c4 fix: preserve native reorder rack devices 2026-08-13 09:58:34 +02:00
MrBlake a5f8cb62c7 fix: restore populated rack and reorder views 2026-08-13 09:37:59 +02:00
MrBlake bc2024ac13 fix: render all devices sharing rack units 2026-08-13 09:09:55 +02:00
MrBlake a0358136b2 fix: restore rack and reorder width views 2026-08-13 08:35:21 +02:00
MrBlake 70825c4040 feat: integrate rack widths across plugins 2026-08-12 17:12:19 +02:00