|
@@ -5,11 +5,8 @@ from dcim.models import (
|
|
|
ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem,
|
|
ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem,
|
|
|
InventoryItemRole, ModuleBay, Platform, PowerOutlet, PowerPort, RearPort, VirtualChassis,
|
|
InventoryItemRole, ModuleBay, Platform, PowerOutlet, PowerPort, RearPort, VirtualChassis,
|
|
|
)
|
|
)
|
|
|
|
|
+from netbox.tables import NetBoxTable, columns
|
|
|
from tenancy.tables import TenantColumn
|
|
from tenancy.tables import TenantColumn
|
|
|
-from utilities.tables import (
|
|
|
|
|
- BaseTable, BooleanColumn, ButtonsColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn,
|
|
|
|
|
- MarkdownColumn, TagColumn, TemplateColumn, ToggleColumn,
|
|
|
|
|
-)
|
|
|
|
|
from .template_code import *
|
|
from .template_code import *
|
|
|
|
|
|
|
|
__all__ = (
|
|
__all__ = (
|
|
@@ -74,69 +71,65 @@ def get_interface_state_attribute(record):
|
|
|
# Device roles
|
|
# Device roles
|
|
|
#
|
|
#
|
|
|
|
|
|
|
|
-class DeviceRoleTable(BaseTable):
|
|
|
|
|
- pk = ToggleColumn()
|
|
|
|
|
|
|
+class DeviceRoleTable(NetBoxTable):
|
|
|
name = tables.Column(
|
|
name = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- device_count = LinkedCountColumn(
|
|
|
|
|
|
|
+ device_count = columns.LinkedCountColumn(
|
|
|
viewname='dcim:device_list',
|
|
viewname='dcim:device_list',
|
|
|
url_params={'role_id': 'pk'},
|
|
url_params={'role_id': 'pk'},
|
|
|
verbose_name='Devices'
|
|
verbose_name='Devices'
|
|
|
)
|
|
)
|
|
|
- vm_count = LinkedCountColumn(
|
|
|
|
|
|
|
+ vm_count = columns.LinkedCountColumn(
|
|
|
viewname='virtualization:virtualmachine_list',
|
|
viewname='virtualization:virtualmachine_list',
|
|
|
url_params={'role_id': 'pk'},
|
|
url_params={'role_id': 'pk'},
|
|
|
verbose_name='VMs'
|
|
verbose_name='VMs'
|
|
|
)
|
|
)
|
|
|
- color = ColorColumn()
|
|
|
|
|
- vm_role = BooleanColumn()
|
|
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ color = columns.ColorColumn()
|
|
|
|
|
+ vm_role = columns.BooleanColumn()
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:devicerole_list'
|
|
url_name='dcim:devicerole_list'
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(DeviceRole)
|
|
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = DeviceRole
|
|
model = DeviceRole
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description', 'slug', 'tags',
|
|
'pk', 'id', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description', 'slug', 'tags',
|
|
|
- 'actions',
|
|
|
|
|
|
|
+ 'actions', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
- default_columns = ('pk', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description', 'actions')
|
|
|
|
|
|
|
+ default_columns = ('pk', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
#
|
|
|
# Platforms
|
|
# Platforms
|
|
|
#
|
|
#
|
|
|
|
|
|
|
|
-class PlatformTable(BaseTable):
|
|
|
|
|
- pk = ToggleColumn()
|
|
|
|
|
|
|
+class PlatformTable(NetBoxTable):
|
|
|
name = tables.Column(
|
|
name = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- device_count = LinkedCountColumn(
|
|
|
|
|
|
|
+ device_count = columns.LinkedCountColumn(
|
|
|
viewname='dcim:device_list',
|
|
viewname='dcim:device_list',
|
|
|
url_params={'platform_id': 'pk'},
|
|
url_params={'platform_id': 'pk'},
|
|
|
verbose_name='Devices'
|
|
verbose_name='Devices'
|
|
|
)
|
|
)
|
|
|
- vm_count = LinkedCountColumn(
|
|
|
|
|
|
|
+ vm_count = columns.LinkedCountColumn(
|
|
|
viewname='virtualization:virtualmachine_list',
|
|
viewname='virtualization:virtualmachine_list',
|
|
|
url_params={'platform_id': 'pk'},
|
|
url_params={'platform_id': 'pk'},
|
|
|
verbose_name='VMs'
|
|
verbose_name='VMs'
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:platform_list'
|
|
url_name='dcim:platform_list'
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(Platform)
|
|
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = Platform
|
|
model = Platform
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'manufacturer', 'device_count', 'vm_count', 'slug', 'napalm_driver', 'napalm_args',
|
|
'pk', 'id', 'name', 'manufacturer', 'device_count', 'vm_count', 'slug', 'napalm_driver', 'napalm_args',
|
|
|
- 'description', 'tags', 'actions',
|
|
|
|
|
|
|
+ 'description', 'tags', 'actions', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
- 'pk', 'name', 'manufacturer', 'device_count', 'vm_count', 'napalm_driver', 'description', 'actions',
|
|
|
|
|
|
|
+ 'pk', 'name', 'manufacturer', 'device_count', 'vm_count', 'napalm_driver', 'description',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -144,13 +137,12 @@ class PlatformTable(BaseTable):
|
|
|
# Devices
|
|
# Devices
|
|
|
#
|
|
#
|
|
|
|
|
|
|
|
-class DeviceTable(BaseTable):
|
|
|
|
|
- pk = ToggleColumn()
|
|
|
|
|
|
|
+class DeviceTable(NetBoxTable):
|
|
|
name = tables.TemplateColumn(
|
|
name = tables.TemplateColumn(
|
|
|
order_by=('_name',),
|
|
order_by=('_name',),
|
|
|
template_code=DEVICE_LINK
|
|
template_code=DEVICE_LINK
|
|
|
)
|
|
)
|
|
|
- status = ChoiceFieldColumn()
|
|
|
|
|
|
|
+ status = columns.ChoiceFieldColumn()
|
|
|
tenant = TenantColumn()
|
|
tenant = TenantColumn()
|
|
|
site = tables.Column(
|
|
site = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
@@ -161,7 +153,7 @@ class DeviceTable(BaseTable):
|
|
|
rack = tables.Column(
|
|
rack = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- device_role = ColoredLabelColumn(
|
|
|
|
|
|
|
+ device_role = columns.ColoredLabelColumn(
|
|
|
verbose_name='Role'
|
|
verbose_name='Role'
|
|
|
)
|
|
)
|
|
|
manufacturer = tables.Column(
|
|
manufacturer = tables.Column(
|
|
@@ -197,17 +189,18 @@ class DeviceTable(BaseTable):
|
|
|
vc_priority = tables.Column(
|
|
vc_priority = tables.Column(
|
|
|
verbose_name='VC Priority'
|
|
verbose_name='VC Priority'
|
|
|
)
|
|
)
|
|
|
- comments = MarkdownColumn()
|
|
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ comments = columns.MarkdownColumn()
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:device_list'
|
|
url_name='dcim:device_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = Device
|
|
model = Device
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'status', 'tenant', 'device_role', 'manufacturer', 'device_type', 'platform', 'serial',
|
|
'pk', 'id', 'name', 'status', 'tenant', 'device_role', 'manufacturer', 'device_type', 'platform', 'serial',
|
|
|
'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'primary_ip', 'airflow', 'primary_ip4',
|
|
'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'primary_ip', 'airflow', 'primary_ip4',
|
|
|
- 'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'tags',
|
|
|
|
|
|
|
+ 'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'tags', 'created',
|
|
|
|
|
+ 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
'pk', 'name', 'status', 'tenant', 'site', 'location', 'rack', 'device_role', 'manufacturer', 'device_type',
|
|
'pk', 'name', 'status', 'tenant', 'site', 'location', 'rack', 'device_role', 'manufacturer', 'device_type',
|
|
@@ -215,11 +208,11 @@ class DeviceTable(BaseTable):
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class DeviceImportTable(BaseTable):
|
|
|
|
|
|
|
+class DeviceImportTable(NetBoxTable):
|
|
|
name = tables.TemplateColumn(
|
|
name = tables.TemplateColumn(
|
|
|
template_code=DEVICE_LINK
|
|
template_code=DEVICE_LINK
|
|
|
)
|
|
)
|
|
|
- status = ChoiceFieldColumn()
|
|
|
|
|
|
|
+ status = columns.ChoiceFieldColumn()
|
|
|
tenant = TenantColumn()
|
|
tenant = TenantColumn()
|
|
|
site = tables.Column(
|
|
site = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
@@ -234,7 +227,7 @@ class DeviceImportTable(BaseTable):
|
|
|
verbose_name='Type'
|
|
verbose_name='Type'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = Device
|
|
model = Device
|
|
|
fields = ('id', 'name', 'status', 'tenant', 'site', 'rack', 'position', 'device_role', 'device_type')
|
|
fields = ('id', 'name', 'status', 'tenant', 'site', 'rack', 'position', 'device_role', 'device_type')
|
|
|
empty_text = False
|
|
empty_text = False
|
|
@@ -244,8 +237,7 @@ class DeviceImportTable(BaseTable):
|
|
|
# Device components
|
|
# Device components
|
|
|
#
|
|
#
|
|
|
|
|
|
|
|
-class DeviceComponentTable(BaseTable):
|
|
|
|
|
- pk = ToggleColumn()
|
|
|
|
|
|
|
+class DeviceComponentTable(NetBoxTable):
|
|
|
device = tables.Column(
|
|
device = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
@@ -254,7 +246,7 @@ class DeviceComponentTable(BaseTable):
|
|
|
order_by=('_name',)
|
|
order_by=('_name',)
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
order_by = ('device', 'name')
|
|
order_by = ('device', 'name')
|
|
|
|
|
|
|
|
|
|
|
|
@@ -271,26 +263,26 @@ class ModularDeviceComponentTable(DeviceComponentTable):
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class CableTerminationTable(BaseTable):
|
|
|
|
|
|
|
+class CableTerminationTable(NetBoxTable):
|
|
|
cable = tables.Column(
|
|
cable = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- cable_color = ColorColumn(
|
|
|
|
|
|
|
+ cable_color = columns.ColorColumn(
|
|
|
accessor='cable.color',
|
|
accessor='cable.color',
|
|
|
orderable=False,
|
|
orderable=False,
|
|
|
verbose_name='Cable Color'
|
|
verbose_name='Cable Color'
|
|
|
)
|
|
)
|
|
|
- link_peer = TemplateColumn(
|
|
|
|
|
|
|
+ link_peer = columns.TemplateColumn(
|
|
|
accessor='_link_peer',
|
|
accessor='_link_peer',
|
|
|
template_code=LINKTERMINATION,
|
|
template_code=LINKTERMINATION,
|
|
|
orderable=False,
|
|
orderable=False,
|
|
|
verbose_name='Link Peer'
|
|
verbose_name='Link Peer'
|
|
|
)
|
|
)
|
|
|
- mark_connected = BooleanColumn()
|
|
|
|
|
|
|
+ mark_connected = columns.BooleanColumn()
|
|
|
|
|
|
|
|
|
|
|
|
|
class PathEndpointTable(CableTerminationTable):
|
|
class PathEndpointTable(CableTerminationTable):
|
|
|
- connection = TemplateColumn(
|
|
|
|
|
|
|
+ connection = columns.TemplateColumn(
|
|
|
accessor='_path.last_node',
|
|
accessor='_path.last_node',
|
|
|
template_code=LINKTERMINATION,
|
|
template_code=LINKTERMINATION,
|
|
|
verbose_name='Connection',
|
|
verbose_name='Connection',
|
|
@@ -305,7 +297,7 @@ class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
'args': [Accessor('device_id')],
|
|
'args': [Accessor('device_id')],
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:consoleport_list'
|
|
url_name='dcim:consoleport_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -313,7 +305,7 @@ class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
model = ConsolePort
|
|
model = ConsolePort
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'speed', 'description',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'speed', 'description',
|
|
|
- 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags',
|
|
|
|
|
|
|
+ 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description')
|
|
|
|
|
|
|
@@ -324,10 +316,8 @@ class DeviceConsolePortTable(ConsolePortTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=ConsolePort,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=CONSOLEPORT_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=CONSOLEPORT_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -336,7 +326,7 @@ class DeviceConsolePortTable(ConsolePortTable):
|
|
|
'pk', 'id', 'name', 'module_bay', 'module', 'label', 'type', 'speed', 'description', 'mark_connected',
|
|
'pk', 'id', 'name', 'module_bay', 'module', 'label', 'type', 'speed', 'description', 'mark_connected',
|
|
|
'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'actions'
|
|
'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'actions'
|
|
|
)
|
|
)
|
|
|
- default_columns = ('pk', 'name', 'label', 'type', 'speed', 'description', 'cable', 'connection', 'actions')
|
|
|
|
|
|
|
+ default_columns = ('pk', 'name', 'label', 'type', 'speed', 'description', 'cable', 'connection')
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_cabletermination_row_class
|
|
'class': get_cabletermination_row_class
|
|
|
}
|
|
}
|
|
@@ -349,7 +339,7 @@ class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
'args': [Accessor('device_id')],
|
|
'args': [Accessor('device_id')],
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:consoleserverport_list'
|
|
url_name='dcim:consoleserverport_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -357,7 +347,7 @@ class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
model = ConsoleServerPort
|
|
model = ConsoleServerPort
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'speed', 'description',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'speed', 'description',
|
|
|
- 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags',
|
|
|
|
|
|
|
+ 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description')
|
|
|
|
|
|
|
@@ -369,10 +359,8 @@ class DeviceConsoleServerPortTable(ConsoleServerPortTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=ConsoleServerPort,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=CONSOLESERVERPORT_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=CONSOLESERVERPORT_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -381,7 +369,7 @@ class DeviceConsoleServerPortTable(ConsoleServerPortTable):
|
|
|
'pk', 'id', 'name', 'module_bay', 'module', 'label', 'type', 'speed', 'description', 'mark_connected',
|
|
'pk', 'id', 'name', 'module_bay', 'module', 'label', 'type', 'speed', 'description', 'mark_connected',
|
|
|
'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'actions',
|
|
'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'actions',
|
|
|
)
|
|
)
|
|
|
- default_columns = ('pk', 'name', 'label', 'type', 'speed', 'description', 'cable', 'connection', 'actions')
|
|
|
|
|
|
|
+ default_columns = ('pk', 'name', 'label', 'type', 'speed', 'description', 'cable', 'connection')
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_cabletermination_row_class
|
|
'class': get_cabletermination_row_class
|
|
|
}
|
|
}
|
|
@@ -394,7 +382,7 @@ class PowerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
'args': [Accessor('device_id')],
|
|
'args': [Accessor('device_id')],
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:powerport_list'
|
|
url_name='dcim:powerport_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -402,7 +390,8 @@ class PowerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
model = PowerPort
|
|
model = PowerPort
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'description', 'mark_connected',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'description', 'mark_connected',
|
|
|
- 'maximum_draw', 'allocated_draw', 'cable', 'cable_color', 'link_peer', 'connection', 'tags',
|
|
|
|
|
|
|
+ 'maximum_draw', 'allocated_draw', 'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'created',
|
|
|
|
|
+ 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description')
|
|
|
|
|
|
|
@@ -414,10 +403,8 @@ class DevicePowerPortTable(PowerPortTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=PowerPort,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=POWERPORT_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=POWERPORT_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -428,7 +415,6 @@ class DevicePowerPortTable(PowerPortTable):
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
'pk', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description', 'cable', 'connection',
|
|
'pk', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description', 'cable', 'connection',
|
|
|
- 'actions',
|
|
|
|
|
)
|
|
)
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_cabletermination_row_class
|
|
'class': get_cabletermination_row_class
|
|
@@ -445,7 +431,7 @@ class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
power_port = tables.Column(
|
|
power_port = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:poweroutlet_list'
|
|
url_name='dcim:poweroutlet_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -453,7 +439,8 @@ class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
|
|
|
model = PowerOutlet
|
|
model = PowerOutlet
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'description', 'power_port',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'description', 'power_port',
|
|
|
- 'feed_leg', 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags',
|
|
|
|
|
|
|
+ 'feed_leg', 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'created',
|
|
|
|
|
+ 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'power_port', 'feed_leg', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'power_port', 'feed_leg', 'description')
|
|
|
|
|
|
|
@@ -464,10 +451,8 @@ class DevicePowerOutletTable(PowerOutletTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=PowerOutlet,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=POWEROUTLET_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=POWEROUTLET_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -477,15 +462,15 @@ class DevicePowerOutletTable(PowerOutletTable):
|
|
|
'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'actions',
|
|
'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'tags', 'actions',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
- 'pk', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description', 'cable', 'connection', 'actions',
|
|
|
|
|
|
|
+ 'pk', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description', 'cable', 'connection',
|
|
|
)
|
|
)
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_cabletermination_row_class
|
|
'class': get_cabletermination_row_class
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-class BaseInterfaceTable(BaseTable):
|
|
|
|
|
- enabled = BooleanColumn()
|
|
|
|
|
|
|
+class BaseInterfaceTable(NetBoxTable):
|
|
|
|
|
+ enabled = columns.BooleanColumn()
|
|
|
ip_addresses = tables.TemplateColumn(
|
|
ip_addresses = tables.TemplateColumn(
|
|
|
template_code=INTERFACE_IPADDRESSES,
|
|
template_code=INTERFACE_IPADDRESSES,
|
|
|
orderable=False,
|
|
orderable=False,
|
|
@@ -498,7 +483,7 @@ class BaseInterfaceTable(BaseTable):
|
|
|
verbose_name='FHRP Groups'
|
|
verbose_name='FHRP Groups'
|
|
|
)
|
|
)
|
|
|
untagged_vlan = tables.Column(linkify=True)
|
|
untagged_vlan = tables.Column(linkify=True)
|
|
|
- tagged_vlans = TemplateColumn(
|
|
|
|
|
|
|
+ tagged_vlans = columns.TemplateColumn(
|
|
|
template_code=INTERFACE_TAGGED_VLANS,
|
|
template_code=INTERFACE_TAGGED_VLANS,
|
|
|
orderable=False,
|
|
orderable=False,
|
|
|
verbose_name='Tagged VLANs'
|
|
verbose_name='Tagged VLANs'
|
|
@@ -512,16 +497,19 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi
|
|
|
'args': [Accessor('device_id')],
|
|
'args': [Accessor('device_id')],
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- mgmt_only = BooleanColumn()
|
|
|
|
|
|
|
+ mgmt_only = columns.BooleanColumn()
|
|
|
wireless_link = tables.Column(
|
|
wireless_link = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- wireless_lans = TemplateColumn(
|
|
|
|
|
|
|
+ wireless_lans = columns.TemplateColumn(
|
|
|
template_code=INTERFACE_WIRELESS_LANS,
|
|
template_code=INTERFACE_WIRELESS_LANS,
|
|
|
orderable=False,
|
|
orderable=False,
|
|
|
verbose_name='Wireless LANs'
|
|
verbose_name='Wireless LANs'
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ vrf = tables.Column(
|
|
|
|
|
+ linkify=True
|
|
|
|
|
+ )
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:interface_list'
|
|
url_name='dcim:interface_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -529,9 +517,10 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi
|
|
|
model = Interface
|
|
model = Interface
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'enabled', 'type', 'mgmt_only', 'mtu',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'enabled', 'type', 'mgmt_only', 'mtu',
|
|
|
- 'mode', 'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width',
|
|
|
|
|
- 'tx_power', 'description', 'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans',
|
|
|
|
|
- 'link_peer', 'connection', 'tags', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans',
|
|
|
|
|
|
|
+ 'speed', 'duplex', 'mode', 'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_frequency',
|
|
|
|
|
+ 'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', 'cable_color', 'wireless_link',
|
|
|
|
|
+ 'wireless_lans', 'link_peer', 'connection', 'tags', 'vrf', 'ip_addresses', 'fhrp_groups', 'untagged_vlan',
|
|
|
|
|
+ 'tagged_vlans', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description')
|
|
|
|
|
|
|
@@ -554,10 +543,8 @@ class DeviceInterfaceTable(InterfaceTable):
|
|
|
linkify=True,
|
|
linkify=True,
|
|
|
verbose_name='LAG'
|
|
verbose_name='LAG'
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=Interface,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=INTERFACE_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=INTERFACE_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -572,7 +559,7 @@ class DeviceInterfaceTable(InterfaceTable):
|
|
|
order_by = ('name',)
|
|
order_by = ('name',)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
'pk', 'name', 'label', 'enabled', 'type', 'parent', 'lag', 'mtu', 'mode', 'description', 'ip_addresses',
|
|
'pk', 'name', 'label', 'enabled', 'type', 'parent', 'lag', 'mtu', 'mode', 'description', 'ip_addresses',
|
|
|
- 'cable', 'connection', 'actions',
|
|
|
|
|
|
|
+ 'cable', 'connection',
|
|
|
)
|
|
)
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_interface_row_class,
|
|
'class': get_interface_row_class,
|
|
@@ -588,14 +575,14 @@ class FrontPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
|
|
'args': [Accessor('device_id')],
|
|
'args': [Accessor('device_id')],
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- color = ColorColumn()
|
|
|
|
|
|
|
+ color = columns.ColorColumn()
|
|
|
rear_port_position = tables.Column(
|
|
rear_port_position = tables.Column(
|
|
|
verbose_name='Position'
|
|
verbose_name='Position'
|
|
|
)
|
|
)
|
|
|
rear_port = tables.Column(
|
|
rear_port = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:frontport_list'
|
|
url_name='dcim:frontport_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -604,6 +591,7 @@ class FrontPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'color', 'rear_port',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'color', 'rear_port',
|
|
|
'rear_port_position', 'description', 'mark_connected', 'cable', 'cable_color', 'link_peer', 'tags',
|
|
'rear_port_position', 'description', 'mark_connected', 'cable', 'cable_color', 'link_peer', 'tags',
|
|
|
|
|
+ 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
'pk', 'name', 'device', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'description',
|
|
'pk', 'name', 'device', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'description',
|
|
@@ -617,10 +605,8 @@ class DeviceFrontPortTable(FrontPortTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=FrontPort,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=FRONTPORT_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=FRONTPORT_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -631,7 +617,6 @@ class DeviceFrontPortTable(FrontPortTable):
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
'pk', 'name', 'label', 'type', 'rear_port', 'rear_port_position', 'description', 'cable', 'link_peer',
|
|
'pk', 'name', 'label', 'type', 'rear_port', 'rear_port_position', 'description', 'cable', 'link_peer',
|
|
|
- 'actions',
|
|
|
|
|
)
|
|
)
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_cabletermination_row_class
|
|
'class': get_cabletermination_row_class
|
|
@@ -645,8 +630,8 @@ class RearPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
|
|
'args': [Accessor('device_id')],
|
|
'args': [Accessor('device_id')],
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- color = ColorColumn()
|
|
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ color = columns.ColorColumn()
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:rearport_list'
|
|
url_name='dcim:rearport_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -654,7 +639,7 @@ class RearPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
|
|
model = RearPort
|
|
model = RearPort
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'color', 'positions', 'description',
|
|
'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'color', 'positions', 'description',
|
|
|
- 'mark_connected', 'cable', 'cable_color', 'link_peer', 'tags',
|
|
|
|
|
|
|
+ 'mark_connected', 'cable', 'cable_color', 'link_peer', 'tags', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'color', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'type', 'color', 'description')
|
|
|
|
|
|
|
@@ -666,10 +651,8 @@ class DeviceRearPortTable(RearPortTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=RearPort,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=REARPORT_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=REARPORT_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -679,7 +662,7 @@ class DeviceRearPortTable(RearPortTable):
|
|
|
'cable', 'cable_color', 'link_peer', 'tags', 'actions',
|
|
'cable', 'cable_color', 'link_peer', 'tags', 'actions',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
- 'pk', 'name', 'label', 'type', 'positions', 'description', 'cable', 'link_peer', 'actions',
|
|
|
|
|
|
|
+ 'pk', 'name', 'label', 'type', 'positions', 'description', 'cable', 'link_peer',
|
|
|
)
|
|
)
|
|
|
row_attrs = {
|
|
row_attrs = {
|
|
|
'class': get_cabletermination_row_class
|
|
'class': get_cabletermination_row_class
|
|
@@ -700,13 +683,17 @@ class DeviceBayTable(DeviceComponentTable):
|
|
|
installed_device = tables.Column(
|
|
installed_device = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:devicebay_list'
|
|
url_name='dcim:devicebay_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
|
model = DeviceBay
|
|
model = DeviceBay
|
|
|
- fields = ('pk', 'id', 'name', 'device', 'label', 'status', 'installed_device', 'description', 'tags')
|
|
|
|
|
|
|
+ fields = (
|
|
|
|
|
+ 'pk', 'id', 'name', 'device', 'label', 'status', 'installed_device', 'description', 'tags',
|
|
|
|
|
+ 'created', 'last_updated',
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
default_columns = ('pk', 'name', 'device', 'label', 'status', 'installed_device', 'description')
|
|
default_columns = ('pk', 'name', 'device', 'label', 'status', 'installed_device', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
@@ -717,10 +704,8 @@ class DeviceDeviceBayTable(DeviceBayTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=DeviceBay,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=DEVICEBAY_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=DEVICEBAY_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
@@ -728,9 +713,7 @@ class DeviceDeviceBayTable(DeviceBayTable):
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'label', 'status', 'installed_device', 'description', 'tags', 'actions',
|
|
'pk', 'id', 'name', 'label', 'status', 'installed_device', 'description', 'tags', 'actions',
|
|
|
)
|
|
)
|
|
|
- default_columns = (
|
|
|
|
|
- 'pk', 'name', 'label', 'status', 'installed_device', 'description', 'actions',
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ default_columns = ('pk', 'name', 'label', 'status', 'installed_device', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModuleBayTable(DeviceComponentTable):
|
|
class ModuleBayTable(DeviceComponentTable):
|
|
@@ -744,7 +727,7 @@ class ModuleBayTable(DeviceComponentTable):
|
|
|
linkify=True,
|
|
linkify=True,
|
|
|
verbose_name='Installed module'
|
|
verbose_name='Installed module'
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:modulebay_list'
|
|
url_name='dcim:modulebay_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -755,16 +738,14 @@ class ModuleBayTable(DeviceComponentTable):
|
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceModuleBayTable(ModuleBayTable):
|
|
class DeviceModuleBayTable(ModuleBayTable):
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=DeviceBay,
|
|
|
|
|
- buttons=('edit', 'delete'),
|
|
|
|
|
- prepend_template=MODULEBAY_BUTTONS
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn(
|
|
|
|
|
+ extra_buttons=MODULEBAY_BUTTONS
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta(DeviceComponentTable.Meta):
|
|
class Meta(DeviceComponentTable.Meta):
|
|
|
model = ModuleBay
|
|
model = ModuleBay
|
|
|
fields = ('pk', 'id', 'name', 'label', 'description', 'installed_module', 'tags', 'actions')
|
|
fields = ('pk', 'id', 'name', 'label', 'description', 'installed_module', 'tags', 'actions')
|
|
|
- default_columns = ('pk', 'name', 'label', 'description', 'installed_module', 'actions')
|
|
|
|
|
|
|
+ default_columns = ('pk', 'name', 'label', 'description', 'installed_module')
|
|
|
|
|
|
|
|
|
|
|
|
|
class InventoryItemTable(DeviceComponentTable):
|
|
class InventoryItemTable(DeviceComponentTable):
|
|
@@ -785,17 +766,17 @@ class InventoryItemTable(DeviceComponentTable):
|
|
|
orderable=False,
|
|
orderable=False,
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- discovered = BooleanColumn()
|
|
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ discovered = columns.BooleanColumn()
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:inventoryitem_list'
|
|
url_name='dcim:inventoryitem_list'
|
|
|
)
|
|
)
|
|
|
cable = None # Override DeviceComponentTable
|
|
cable = None # Override DeviceComponentTable
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = InventoryItem
|
|
model = InventoryItem
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'device', 'component', 'label', 'role', 'manufacturer', 'part_id', 'serial',
|
|
'pk', 'id', 'name', 'device', 'component', 'label', 'role', 'manufacturer', 'part_id', 'serial',
|
|
|
- 'asset_tag', 'description', 'discovered', 'tags',
|
|
|
|
|
|
|
+ 'asset_tag', 'description', 'discovered', 'tags', 'created', 'last_updated',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
'pk', 'name', 'device', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag',
|
|
'pk', 'name', 'device', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag',
|
|
@@ -809,68 +790,62 @@ class DeviceInventoryItemTable(InventoryItemTable):
|
|
|
order_by=Accessor('_name'),
|
|
order_by=Accessor('_name'),
|
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
attrs={'td': {'class': 'text-nowrap'}}
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(
|
|
|
|
|
- model=InventoryItem,
|
|
|
|
|
- buttons=('edit', 'delete')
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ actions = columns.ActionsColumn()
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = InventoryItem
|
|
model = InventoryItem
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'component',
|
|
'pk', 'id', 'name', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'component',
|
|
|
'description', 'discovered', 'tags', 'actions',
|
|
'description', 'discovered', 'tags', 'actions',
|
|
|
)
|
|
)
|
|
|
default_columns = (
|
|
default_columns = (
|
|
|
- 'pk', 'name', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'component', 'actions',
|
|
|
|
|
|
|
+ 'pk', 'name', 'label', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'component',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class InventoryItemRoleTable(BaseTable):
|
|
|
|
|
- pk = ToggleColumn()
|
|
|
|
|
|
|
+class InventoryItemRoleTable(NetBoxTable):
|
|
|
name = tables.Column(
|
|
name = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- inventoryitem_count = LinkedCountColumn(
|
|
|
|
|
|
|
+ inventoryitem_count = columns.LinkedCountColumn(
|
|
|
viewname='dcim:inventoryitem_list',
|
|
viewname='dcim:inventoryitem_list',
|
|
|
url_params={'role_id': 'pk'},
|
|
url_params={'role_id': 'pk'},
|
|
|
verbose_name='Items'
|
|
verbose_name='Items'
|
|
|
)
|
|
)
|
|
|
- color = ColorColumn()
|
|
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ color = columns.ColorColumn()
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:inventoryitemrole_list'
|
|
url_name='dcim:inventoryitemrole_list'
|
|
|
)
|
|
)
|
|
|
- actions = ButtonsColumn(InventoryItemRole)
|
|
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = InventoryItemRole
|
|
model = InventoryItemRole
|
|
|
fields = (
|
|
fields = (
|
|
|
'pk', 'id', 'name', 'inventoryitem_count', 'color', 'description', 'slug', 'tags', 'actions',
|
|
'pk', 'id', 'name', 'inventoryitem_count', 'color', 'description', 'slug', 'tags', 'actions',
|
|
|
)
|
|
)
|
|
|
- default_columns = ('pk', 'name', 'inventoryitem_count', 'color', 'description', 'actions')
|
|
|
|
|
|
|
+ default_columns = ('pk', 'name', 'inventoryitem_count', 'color', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
#
|
|
|
# Virtual chassis
|
|
# Virtual chassis
|
|
|
#
|
|
#
|
|
|
|
|
|
|
|
-class VirtualChassisTable(BaseTable):
|
|
|
|
|
- pk = ToggleColumn()
|
|
|
|
|
|
|
+class VirtualChassisTable(NetBoxTable):
|
|
|
name = tables.Column(
|
|
name = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
master = tables.Column(
|
|
master = tables.Column(
|
|
|
linkify=True
|
|
linkify=True
|
|
|
)
|
|
)
|
|
|
- member_count = LinkedCountColumn(
|
|
|
|
|
|
|
+ member_count = columns.LinkedCountColumn(
|
|
|
viewname='dcim:device_list',
|
|
viewname='dcim:device_list',
|
|
|
url_params={'virtual_chassis_id': 'pk'},
|
|
url_params={'virtual_chassis_id': 'pk'},
|
|
|
verbose_name='Members'
|
|
verbose_name='Members'
|
|
|
)
|
|
)
|
|
|
- tags = TagColumn(
|
|
|
|
|
|
|
+ tags = columns.TagColumn(
|
|
|
url_name='dcim:virtualchassis_list'
|
|
url_name='dcim:virtualchassis_list'
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- class Meta(BaseTable.Meta):
|
|
|
|
|
|
|
+ class Meta(NetBoxTable.Meta):
|
|
|
model = VirtualChassis
|
|
model = VirtualChassis
|
|
|
- fields = ('pk', 'id', 'name', 'domain', 'master', 'member_count', 'tags')
|
|
|
|
|
|
|
+ fields = ('pk', 'id', 'name', 'domain', 'master', 'member_count', 'tags', 'created', 'last_updated',)
|
|
|
default_columns = ('pk', 'name', 'domain', 'master', 'member_count')
|
|
default_columns = ('pk', 'name', 'domain', 'master', 'member_count')
|