mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Adds module status to module bay table (#12455)
* adds module status to module bay table #11652 * removed the extra line * updated field name
This commit is contained in:
parent
25142e037a
commit
ea8a0135ad
@ -39,6 +39,10 @@ __all__ = (
|
|||||||
'VirtualDeviceContextTable'
|
'VirtualDeviceContextTable'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
MODULEBAY_STATUS = """
|
||||||
|
{% badge record.installed_module.get_status_display bg_color=record.installed_module.get_status_color %}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def get_cabletermination_row_class(record):
|
def get_cabletermination_row_class(record):
|
||||||
if record.mark_connected:
|
if record.mark_connected:
|
||||||
@ -781,14 +785,17 @@ class ModuleBayTable(DeviceComponentTable):
|
|||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:modulebay_list'
|
url_name='dcim:modulebay_list'
|
||||||
)
|
)
|
||||||
|
module_status = columns.TemplateColumn(
|
||||||
|
template_code=MODULEBAY_STATUS
|
||||||
|
)
|
||||||
|
|
||||||
class Meta(DeviceComponentTable.Meta):
|
class Meta(DeviceComponentTable.Meta):
|
||||||
model = models.ModuleBay
|
model = models.ModuleBay
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'module_serial', 'module_asset_tag',
|
'pk', 'id', 'name', 'device', 'label', 'position', 'installed_module', 'module_status', 'module_serial',
|
||||||
'description', 'tags',
|
'module_asset_tag', 'description', 'tags',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'name', 'device', 'label', 'installed_module', 'description')
|
default_columns = ('pk', 'name', 'device', 'label', 'installed_module', 'module_status', 'description')
|
||||||
|
|
||||||
|
|
||||||
class DeviceModuleBayTable(ModuleBayTable):
|
class DeviceModuleBayTable(ModuleBayTable):
|
||||||
@ -799,10 +806,10 @@ class DeviceModuleBayTable(ModuleBayTable):
|
|||||||
class Meta(DeviceComponentTable.Meta):
|
class Meta(DeviceComponentTable.Meta):
|
||||||
model = models.ModuleBay
|
model = models.ModuleBay
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'label', 'position', 'installed_module', 'module_serial', 'module_asset_tag',
|
'pk', 'id', 'name', 'label', 'position', 'installed_module', 'module_status', 'module_serial', 'module_asset_tag',
|
||||||
'description', 'tags', 'actions',
|
'description', 'tags', 'actions',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'name', 'label', 'installed_module', 'description')
|
default_columns = ('pk', 'name', 'label', 'installed_module', 'module_status', 'description')
|
||||||
|
|
||||||
|
|
||||||
class InventoryItemTable(DeviceComponentTable):
|
class InventoryItemTable(DeviceComponentTable):
|
||||||
|
Loading…
Reference in New Issue
Block a user