mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix up missing table columns
This commit is contained in:
@ -11,9 +11,9 @@ from utilities.tables import (
|
|||||||
TagColumn, ToggleColumn,
|
TagColumn, ToggleColumn,
|
||||||
)
|
)
|
||||||
from .template_code import (
|
from .template_code import (
|
||||||
CABLETERMINATION, CONSOLEPORT_BUTTONS, CONSOLESERVERPORT_BUTTONS, DEVICE_LINK, DEVICEBAY_BUTTONS, FRONTPORT_BUTTONS,
|
CABLETERMINATION, CONSOLEPORT_BUTTONS, CONSOLESERVERPORT_BUTTONS, DEVICE_LINK, DEVICEBAY_BUTTONS, DEVICEBAY_STATUS,
|
||||||
INTERFACE_BUTTONS, INTERFACE_IPADDRESSES, INTERFACE_TAGGED_VLANS, POWEROUTLET_BUTTONS, POWERPORT_BUTTONS,
|
FRONTPORT_BUTTONS, INTERFACE_BUTTONS, INTERFACE_IPADDRESSES, INTERFACE_TAGGED_VLANS, POWEROUTLET_BUTTONS,
|
||||||
REARPORT_BUTTONS,
|
POWERPORT_BUTTONS, REARPORT_BUTTONS,
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -343,6 +343,9 @@ class DevicePowerPortTable(PowerPortTable):
|
|||||||
|
|
||||||
|
|
||||||
class PowerOutletTable(DeviceComponentTable, PathEndpointTable):
|
class PowerOutletTable(DeviceComponentTable, PathEndpointTable):
|
||||||
|
power_port = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
tags = TagColumn(
|
tags = TagColumn(
|
||||||
url_name='dcim:poweroutlet_list'
|
url_name='dcim:poweroutlet_list'
|
||||||
)
|
)
|
||||||
@ -415,6 +418,10 @@ class DeviceInterfaceTable(InterfaceTable):
|
|||||||
'{% elif iface.is_virtual %}circle{% elif iface.is_wireless %}wifi{% else %}exchange'
|
'{% elif iface.is_virtual %}circle{% elif iface.is_wireless %}wifi{% else %}exchange'
|
||||||
'{% endif %}"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>'
|
'{% endif %}"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>'
|
||||||
)
|
)
|
||||||
|
lag = tables.Column(
|
||||||
|
linkify=True,
|
||||||
|
verbose_name='LAG'
|
||||||
|
)
|
||||||
actions = ButtonsColumn(
|
actions = ButtonsColumn(
|
||||||
model=Interface,
|
model=Interface,
|
||||||
buttons=('edit', 'delete'),
|
buttons=('edit', 'delete'),
|
||||||
@ -424,11 +431,11 @@ class DeviceInterfaceTable(InterfaceTable):
|
|||||||
class Meta(DeviceComponentTable.Meta):
|
class Meta(DeviceComponentTable.Meta):
|
||||||
model = Interface
|
model = Interface
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'name', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'description', 'cable',
|
'pk', 'name', 'label', 'enabled', 'lag', 'type', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'description',
|
||||||
'cable_peer', 'connection', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
|
'cable', 'cable_peer', 'connection', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'label', 'type', 'enabled', 'description', 'cable', 'cable_peer', 'actions',
|
'pk', 'name', 'label', 'enabled', 'lag', 'type', 'description', 'cable', 'cable_peer', 'actions',
|
||||||
)
|
)
|
||||||
row_attrs = {
|
row_attrs = {
|
||||||
'class': lambda record: record.cable.get_status_class() if record.cable else ''
|
'class': lambda record: record.cable.get_status_class() if record.cable else ''
|
||||||
@ -439,6 +446,9 @@ class FrontPortTable(DeviceComponentTable, CableTerminationTable):
|
|||||||
rear_port_position = tables.Column(
|
rear_port_position = tables.Column(
|
||||||
verbose_name='Position'
|
verbose_name='Position'
|
||||||
)
|
)
|
||||||
|
rear_port = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
tags = TagColumn(
|
tags = TagColumn(
|
||||||
url_name='dcim:frontport_list'
|
url_name='dcim:frontport_list'
|
||||||
)
|
)
|
||||||
@ -514,6 +524,9 @@ class DeviceRearPortTable(RearPortTable):
|
|||||||
|
|
||||||
|
|
||||||
class DeviceBayTable(DeviceComponentTable):
|
class DeviceBayTable(DeviceComponentTable):
|
||||||
|
status = tables.TemplateColumn(
|
||||||
|
template_code=DEVICEBAY_STATUS
|
||||||
|
)
|
||||||
installed_device = tables.Column(
|
installed_device = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -523,8 +536,8 @@ class DeviceBayTable(DeviceComponentTable):
|
|||||||
|
|
||||||
class Meta(DeviceComponentTable.Meta):
|
class Meta(DeviceComponentTable.Meta):
|
||||||
model = DeviceBay
|
model = DeviceBay
|
||||||
fields = ('pk', 'device', 'name', 'label', 'installed_device', 'description', 'tags')
|
fields = ('pk', 'device', 'name', 'label', 'status', 'installed_device', 'description', 'tags')
|
||||||
default_columns = ('pk', 'device', 'name', 'label', 'installed_device', 'description')
|
default_columns = ('pk', 'device', 'name', 'label', 'status', 'installed_device', 'description')
|
||||||
|
|
||||||
|
|
||||||
class DeviceDeviceBayTable(DeviceBayTable):
|
class DeviceDeviceBayTable(DeviceBayTable):
|
||||||
@ -541,10 +554,10 @@ class DeviceDeviceBayTable(DeviceBayTable):
|
|||||||
class Meta(DeviceComponentTable.Meta):
|
class Meta(DeviceComponentTable.Meta):
|
||||||
model = DeviceBay
|
model = DeviceBay
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'name', 'label', 'installed_device', 'description', 'tags', 'actions',
|
'pk', 'name', 'label', 'status', 'installed_device', 'description', 'tags', 'actions',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'label', 'installed_device', 'description', 'actions',
|
'pk', 'name', 'label', 'status', 'installed_device', 'description', 'actions',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -580,7 +593,8 @@ class DeviceInventoryItemTable(DeviceBayTable):
|
|||||||
class Meta(DeviceComponentTable.Meta):
|
class Meta(DeviceComponentTable.Meta):
|
||||||
model = InventoryItem
|
model = InventoryItem
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'tags', 'actions',
|
'pk', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'discovered',
|
||||||
|
'tags', 'actions',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'actions',
|
'pk', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'actions',
|
||||||
|
@ -28,6 +28,16 @@ DEVICE_LINK = """
|
|||||||
</a>
|
</a>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
DEVICEBAY_STATUS = """
|
||||||
|
{% if record.installed_device_id %}
|
||||||
|
<span class="label label-{{ record.installed_device.get_status_class }}">
|
||||||
|
{{ record.installed_device.get_status_display }}
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="label label-default">Vacant</span>
|
||||||
|
{% endif %}
|
||||||
|
"""
|
||||||
|
|
||||||
INTERFACE_IPADDRESSES = """
|
INTERFACE_IPADDRESSES = """
|
||||||
{% for ip in record.ip_addresses.unrestricted %}
|
{% for ip in record.ip_addresses.unrestricted %}
|
||||||
<a href="{{ ip.get_absolute_url }}">{{ ip }}</a><br />
|
<a href="{{ ip.get_absolute_url }}">{{ ip }}</a><br />
|
||||||
|
Reference in New Issue
Block a user