mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-18 06:47:46 +01:00
Expose additional properties of the device installed in each bay as configurable table columns. - Rename `role` → `installed_role` - Rename `device_type` → `installed_device_type` - Add `installed_description`, `installed_serial`, and `installed_asset_tag` columns to `DeviceBayTable` --------- Co-authored-by: Martin Hauser <mhauser@netboxlabs.com>
This commit is contained in:
@@ -887,24 +887,36 @@ class DeviceBayTable(DeviceComponentTable):
|
||||
'args': [Accessor('device_id')],
|
||||
}
|
||||
)
|
||||
role = columns.ColoredLabelColumn(
|
||||
accessor=Accessor('installed_device__role'),
|
||||
verbose_name=_('Role')
|
||||
)
|
||||
device_type = tables.Column(
|
||||
accessor=Accessor('installed_device__device_type'),
|
||||
linkify=True,
|
||||
verbose_name=_('Type')
|
||||
)
|
||||
status = tables.TemplateColumn(
|
||||
verbose_name=_('Status'),
|
||||
template_code=DEVICEBAY_STATUS,
|
||||
order_by=Accessor('installed_device__status')
|
||||
)
|
||||
installed_device = tables.Column(
|
||||
verbose_name=_('Installed device'),
|
||||
verbose_name=_('Installed Device'),
|
||||
linkify=True
|
||||
)
|
||||
installed_role = columns.ColoredLabelColumn(
|
||||
accessor=Accessor('installed_device__role'),
|
||||
verbose_name=_('Installed Role')
|
||||
)
|
||||
installed_device_type = tables.Column(
|
||||
accessor=Accessor('installed_device__device_type'),
|
||||
linkify=True,
|
||||
verbose_name=_('Installed Type')
|
||||
)
|
||||
installed_description = tables.Column(
|
||||
accessor=Accessor('installed_device__description'),
|
||||
verbose_name=_('Installed Description')
|
||||
)
|
||||
installed_serial = tables.Column(
|
||||
accessor=Accessor('installed_device__serial'),
|
||||
verbose_name=_('Installed Serial')
|
||||
)
|
||||
installed_asset_tag = tables.Column(
|
||||
accessor=Accessor('installed_device__asset_tag'),
|
||||
verbose_name=_('Installed Asset Tag')
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='dcim:devicebay_list'
|
||||
)
|
||||
@@ -912,8 +924,9 @@ class DeviceBayTable(DeviceComponentTable):
|
||||
class Meta(DeviceComponentTable.Meta):
|
||||
model = models.DeviceBay
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'device', 'label', 'status', 'role', 'device_type', 'installed_device', 'description',
|
||||
'tags', 'created', 'last_updated',
|
||||
'pk', 'id', 'name', 'device', 'label', 'status', 'description', 'installed_device', 'installed_role',
|
||||
'installed_device_type', 'installed_description', 'installed_serial', 'installed_asset_tag', 'tags',
|
||||
'created', 'last_updated',
|
||||
)
|
||||
|
||||
default_columns = ('pk', 'name', 'device', 'label', 'status', 'installed_device', 'description')
|
||||
|
||||
Reference in New Issue
Block a user