Skip to content

Commit d11031c

Browse files
committed
Closes #9099: Enable display of installed module serial & asset tag in module bays list
1 parent 916e976 commit d11031c

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

docs/release-notes/version-3.2.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
* [#5479](https://github.com/netbox-community/netbox/issues/5479) - Allow custom job timeouts for scripts & reports
88
* [#8973](https://github.com/netbox-community/netbox/issues/8973) - Display VLAN group count under site view
9+
* [#9099](https://github.com/netbox-community/netbox/issues/9099) - Enable display of installed module serial & asset tag in module bays list
910

1011
### Bug Fixes
1112

netbox/dcim/tables/devices.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,22 @@ class ModuleBayTable(DeviceComponentTable):
739739
linkify=True,
740740
verbose_name='Installed module'
741741
)
742+
module_serial = tables.Column(
743+
accessor=tables.A('installed_module__serial')
744+
)
745+
module_asset_tag = tables.Column(
746+
accessor=tables.A('installed_module__asset_tag')
747+
)
742748
tags = columns.TagColumn(
743749
url_name='dcim:modulebay_list'
744750
)
745751

746752
class Meta(DeviceComponentTable.Meta):
747753
model = ModuleBay
748-
fields = ('pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'description', 'tags')
754+
fields = (
755+
'pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'module_serial', 'module_asset_tag',
756+
'description', 'tags',
757+
)
749758
default_columns = ('pk', 'name', 'device', 'label', 'installed_module', 'description')
750759

751760

@@ -756,7 +765,10 @@ class DeviceModuleBayTable(ModuleBayTable):
756765

757766
class Meta(DeviceComponentTable.Meta):
758767
model = ModuleBay
759-
fields = ('pk', 'id', 'name', 'label', 'position', 'installed_module', 'description', 'tags', 'actions')
768+
fields = (
769+
'pk', 'id', 'name', 'label', 'position', 'installed_module', 'module_serial', 'module_asset_tag',
770+
'description', 'tags', 'actions',
771+
)
760772
default_columns = ('pk', 'name', 'label', 'installed_module', 'description')
761773

762774

netbox/templates/dcim/modulebay.html

+12
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ <h5 class="card-header">Installed Module</h5>
5252
{% if object.installed_module %}
5353
{% with module=object.installed_module %}
5454
<table class="table table-hover attr-table">
55+
<tr>
56+
<th scope="row">Module</th>
57+
<td>{{ module|linkify }}</td>
58+
</tr>
5559
<tr>
5660
<th scope="row">Manufacturer</th>
5761
<td>{{ module.module_type.manufacturer|linkify }}</td>
@@ -60,6 +64,14 @@ <h5 class="card-header">Installed Module</h5>
6064
<th scope="row">Module Type</th>
6165
<td>{{ module.module_type|linkify }}</td>
6266
</tr>
67+
<tr>
68+
<th scope="row">Serial Number</th>
69+
<td class="font-monospace">{{ module.serial|placeholder }}</td>
70+
</tr>
71+
<tr>
72+
<th scope="row">Asset Tag</th>
73+
<td class="font-monospace">{{ module.asset_tag|placeholder }}</td>
74+
</tr>
6375
</table>
6476
{% endwith %}
6577
{% else %}

0 commit comments

Comments
 (0)