From d11031c694898f18b43c17dc1acfaa24c0f61dfe Mon Sep 17 00:00:00 2001 From: jeremystretch <jstretch@ns1.com> Date: Tue, 12 Apr 2022 09:00:19 -0400 Subject: [PATCH] Closes #9099: Enable display of installed module serial & asset tag in module bays list --- docs/release-notes/version-3.2.md | 1 + netbox/dcim/tables/devices.py | 16 ++++++++++++++-- netbox/templates/dcim/modulebay.html | 12 ++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.2.md b/docs/release-notes/version-3.2.md index 8fcfd6136..faa87c6d2 100644 --- a/docs/release-notes/version-3.2.md +++ b/docs/release-notes/version-3.2.md @@ -6,6 +6,7 @@ * [#5479](https://github.com/netbox-community/netbox/issues/5479) - Allow custom job timeouts for scripts & reports * [#8973](https://github.com/netbox-community/netbox/issues/8973) - Display VLAN group count under site view +* [#9099](https://github.com/netbox-community/netbox/issues/9099) - Enable display of installed module serial & asset tag in module bays list ### Bug Fixes diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index f3e1d39e0..25ad1415d 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -739,13 +739,22 @@ class ModuleBayTable(DeviceComponentTable): linkify=True, verbose_name='Installed module' ) + module_serial = tables.Column( + accessor=tables.A('installed_module__serial') + ) + module_asset_tag = tables.Column( + accessor=tables.A('installed_module__asset_tag') + ) tags = columns.TagColumn( url_name='dcim:modulebay_list' ) class Meta(DeviceComponentTable.Meta): model = ModuleBay - fields = ('pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'description', 'tags') + fields = ( + 'pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'module_serial', 'module_asset_tag', + 'description', 'tags', + ) default_columns = ('pk', 'name', 'device', 'label', 'installed_module', 'description') @@ -756,7 +765,10 @@ class DeviceModuleBayTable(ModuleBayTable): class Meta(DeviceComponentTable.Meta): model = ModuleBay - fields = ('pk', 'id', 'name', 'label', 'position', 'installed_module', 'description', 'tags', 'actions') + fields = ( + 'pk', 'id', 'name', 'label', 'position', 'installed_module', 'module_serial', 'module_asset_tag', + 'description', 'tags', 'actions', + ) default_columns = ('pk', 'name', 'label', 'installed_module', 'description') diff --git a/netbox/templates/dcim/modulebay.html b/netbox/templates/dcim/modulebay.html index a12e020e9..3ef539156 100644 --- a/netbox/templates/dcim/modulebay.html +++ b/netbox/templates/dcim/modulebay.html @@ -52,6 +52,10 @@ {% if object.installed_module %} {% with module=object.installed_module %} <table class="table table-hover attr-table"> + <tr> + <th scope="row">Module</th> + <td>{{ module|linkify }}</td> + </tr> <tr> <th scope="row">Manufacturer</th> <td>{{ module.module_type.manufacturer|linkify }}</td> @@ -60,6 +64,14 @@ <th scope="row">Module Type</th> <td>{{ module.module_type|linkify }}</td> </tr> + <tr> + <th scope="row">Serial Number</th> + <td class="font-monospace">{{ module.serial|placeholder }}</td> + </tr> + <tr> + <th scope="row">Asset Tag</th> + <td class="font-monospace">{{ module.asset_tag|placeholder }}</td> + </tr> </table> {% endwith %} {% else %}