feat: optional disk install date in disks export
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a796b92056
commit
3cf26c8ded
6 files changed
+21
-8
No files matched your search
@@ -290,7 +290,7 @@ The **license key** only appears with the "Export secrets" option (requires
|
|||||||
If [Netbox-Utilities](https://git.mrblake.cc/MrBlake/Netbox-Utilities) with disk management is installed, the
|
If [Netbox-Utilities](https://git.mrblake.cc/MrBlake/Netbox-Utilities) with disk management is installed, the
|
||||||
**Disks & RAID** section (off by default) lists for each device in scope: occupied slots, raw capacity, hot spares and
|
**Disks & RAID** section (off by default) lists for each device in scope: occupied slots, raw capacity, hot spares and
|
||||||
failed disks, the RAID groups (level, count, usable capacity, fault tolerance) and a table of all installed disks with
|
failed disks, the RAID groups (level, count, usable capacity, fault tolerance) and a table of all installed disks with
|
||||||
slot, status, type, model, size, serial number, firmware, RAID group, warranty and warnings (failed, warranty
|
slot, status, type, model, size, serial number, firmware, RAID group, optionally the install date, warranty and warnings (failed, warranty
|
||||||
expired/expiring soon, too old – thresholds from the Utilities configuration). Removed disks (history) are not shown.
|
expired/expiring soon, too old – thresholds from the Utilities configuration). Removed disks (history) are not shown.
|
||||||
Without the plugin the section stays empty.
|
Without the plugin the section stays empty.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class CustomerExportConfig(PluginConfig):
|
|||||||
name = "netbox_customer_export"
|
name = "netbox_customer_export"
|
||||||
verbose_name = "Kunden-Export"
|
verbose_name = "Kunden-Export"
|
||||||
description = "Kundendokumentation als PDF oder Word exportieren"
|
description = "Kundendokumentation als PDF oder Word exportieren"
|
||||||
version = "0.10.0"
|
version = "0.11.0"
|
||||||
author = "Claude"
|
author = "Claude"
|
||||||
base_url = "customer-export"
|
base_url = "customer-export"
|
||||||
min_version = "4.6.8"
|
min_version = "4.6.8"
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ def disk_blocks(scope, opts):
|
|||||||
for disk in disks:
|
for disk in disks:
|
||||||
by_device.setdefault(disk.device, []).append(disk)
|
by_device.setdefault(disk.device, []).append(disk)
|
||||||
|
|
||||||
headers = ["Steckplatz", "Status", "Typ", "Hersteller / Modell", "Größe", "Seriennummer", "Firmware", "RAID", "Garantie bis", "Hinweise"]
|
show_installed = bool(opts.get("disk_install_date"))
|
||||||
|
headers = ["Steckplatz", "Status", "Typ", "Hersteller / Modell", "Größe", "Seriennummer", "Firmware", "RAID"]
|
||||||
|
headers += ["Eingebaut"] * show_installed + ["Garantie bis", "Hinweise"]
|
||||||
blocks = []
|
blocks = []
|
||||||
for device, items in by_device.items():
|
for device, items in by_device.items():
|
||||||
slots = sum(b.slot_count for b in DiskBayLayout.objects.filter(device=device))
|
slots = sum(b.slot_count for b in DiskBayLayout.objects.filter(device=device))
|
||||||
@@ -84,7 +86,7 @@ def disk_blocks(scope, opts):
|
|||||||
rows = []
|
rows = []
|
||||||
for d in items:
|
for d in items:
|
||||||
hints = "\n".join(text for _lvl, text in helpers.disk_warnings(d, **warn_cfg))
|
hints = "\n".join(text for _lvl, text in helpers.disk_warnings(d, **warn_cfg))
|
||||||
rows.append([
|
row = [
|
||||||
_slot(d),
|
_slot(d),
|
||||||
d.get_status_display(),
|
d.get_status_display(),
|
||||||
" / ".join(x for x in (d.get_disk_type_display(), d.get_interface_display()) if x),
|
" / ".join(x for x in (d.get_disk_type_display(), d.get_interface_display()) if x),
|
||||||
@@ -93,8 +95,9 @@ def disk_blocks(scope, opts):
|
|||||||
d.serial,
|
d.serial,
|
||||||
d.firmware,
|
d.firmware,
|
||||||
d.raid_group,
|
d.raid_group,
|
||||||
_date(d.warranty_end),
|
]
|
||||||
hints,
|
if show_installed:
|
||||||
])
|
row.append(_date(getattr(d, "install_date", None)))
|
||||||
|
rows.append(row + [_date(d.warranty_end), hints])
|
||||||
blocks.append(T(headers, rows))
|
blocks.append(T(headers, rows))
|
||||||
return blocks
|
return blocks
|
||||||
@@ -53,6 +53,8 @@ class ExportForm(forms.Form):
|
|||||||
)
|
)
|
||||||
group_by_site = forms.BooleanField(required=False, initial=True, label="Geräte nach Standort gruppieren")
|
group_by_site = forms.BooleanField(required=False, initial=True, label="Geräte nach Standort gruppieren")
|
||||||
|
|
||||||
|
disk_install_date = forms.BooleanField(required=False, initial=False, label="Einbaudatum der Datenträger anzeigen")
|
||||||
|
|
||||||
rack_svg = forms.BooleanField(required=False, initial=True, label="Rack-Ansichten (SVG) einbetten")
|
rack_svg = forms.BooleanField(required=False, initial=True, label="Rack-Ansichten (SVG) einbetten")
|
||||||
rack_images = forms.BooleanField(required=False, initial=False, label="Gerätebilder anzeigen (wie in NetBox)")
|
rack_images = forms.BooleanField(required=False, initial=False, label="Gerätebilder anzeigen (wie in NetBox)")
|
||||||
rack_faces = forms.MultipleChoiceField(
|
rack_faces = forms.MultipleChoiceField(
|
||||||
|
|||||||
@@ -122,6 +122,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="card ce-card h-100" data-ce-depends="disks">
|
||||||
|
<h2 class="card-header"><i class="mdi mdi-harddisk"></i> Datenträger</h2>
|
||||||
|
<div class="card-body">
|
||||||
|
<label class="ce-switch">{{ form.disk_install_date }} {{ form.disk_install_date.label }}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card ce-card mt-3" data-ce-depends="topology">
|
<div class="card ce-card mt-3" data-ce-depends="topology">
|
||||||
<h2 class="card-header d-flex justify-content-between align-items-center">
|
<h2 class="card-header d-flex justify-content-between align-items-center">
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "netbox-customer-export"
|
name = "netbox-customer-export"
|
||||||
version = "0.10.0"
|
version = "0.11.0"
|
||||||
description = "NetBox-Plugin: Kundendokumentation (PDF/Word) für Standorte, Lokationen, Mandanten und Mandantengruppen"
|
description = "NetBox-Plugin: Kundendokumentation (PDF/Word) für Standorte, Lokationen, Mandanten und Mandantengruppen"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
Reference in new issue
Block a user