mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
13150 internationalize dcim tables
This commit is contained in:
parent
d39a99f0e1
commit
a4c7fb8294
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from core.models import *
|
from core.models import *
|
||||||
@ -11,11 +12,18 @@ __all__ = (
|
|||||||
|
|
||||||
class DataSourceTable(NetBoxTable):
|
class DataSourceTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
type = columns.ChoiceFieldColumn()
|
type = columns.ChoiceFieldColumn(
|
||||||
status = columns.ChoiceFieldColumn()
|
verbose_name=_('Type'),
|
||||||
enabled = columns.BooleanColumn()
|
)
|
||||||
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='core:datasource_list'
|
url_name='core:datasource_list'
|
||||||
)
|
)
|
||||||
@ -34,13 +42,18 @@ class DataSourceTable(NetBoxTable):
|
|||||||
|
|
||||||
class DataFileTable(NetBoxTable):
|
class DataFileTable(NetBoxTable):
|
||||||
source = tables.Column(
|
source = tables.Column(
|
||||||
|
verbose_name=_('Source'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
path = tables.Column(
|
path = tables.Column(
|
||||||
|
verbose_name=_('Path'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
last_updated = columns.DateTimeColumn()
|
last_updated = columns.DateTimeColumn(
|
||||||
|
verbose_name=_('Last updated'),
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('delete',)
|
actions=('delete',)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from ..models import Job
|
from ..models import Job
|
||||||
@ -7,24 +7,40 @@ from ..models import Job
|
|||||||
|
|
||||||
class JobTable(NetBoxTable):
|
class JobTable(NetBoxTable):
|
||||||
id = tables.Column(
|
id = tables.Column(
|
||||||
|
verbose_name=_('Id'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
object_type = columns.ContentTypeColumn(
|
object_type = columns.ContentTypeColumn(
|
||||||
verbose_name=_('Type')
|
verbose_name=_('Type')
|
||||||
)
|
)
|
||||||
object = tables.Column(
|
object = tables.Column(
|
||||||
|
verbose_name=_('Object'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
created = columns.DateTimeColumn()
|
verbose_name=_('Status'),
|
||||||
scheduled = columns.DateTimeColumn()
|
)
|
||||||
interval = columns.DurationColumn()
|
created = columns.DateTimeColumn(
|
||||||
started = columns.DateTimeColumn()
|
verbose_name=_('Created'),
|
||||||
completed = columns.DateTimeColumn()
|
)
|
||||||
|
scheduled = columns.DateTimeColumn(
|
||||||
|
verbose_name=_('Scheduled'),
|
||||||
|
)
|
||||||
|
interval = columns.DurationColumn(
|
||||||
|
verbose_name=_('Interval'),
|
||||||
|
)
|
||||||
|
started = columns.DateTimeColumn(
|
||||||
|
verbose_name=_('Started'),
|
||||||
|
)
|
||||||
|
completed = columns.DateTimeColumn(
|
||||||
|
verbose_name=_('Completed'),
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('delete',)
|
actions=('delete',)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
@ -50,60 +51,60 @@ class CableTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
a_terminations = CableTerminationsColumn(
|
a_terminations = CableTerminationsColumn(
|
||||||
cable_end='A',
|
cable_end='A',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Termination A'
|
verbose_name=_('Termination A')
|
||||||
)
|
)
|
||||||
b_terminations = CableTerminationsColumn(
|
b_terminations = CableTerminationsColumn(
|
||||||
cable_end='B',
|
cable_end='B',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Termination B'
|
verbose_name=_('Termination B')
|
||||||
)
|
)
|
||||||
device_a = CableTerminationsColumn(
|
device_a = CableTerminationsColumn(
|
||||||
cable_end='A',
|
cable_end='A',
|
||||||
attr='_device',
|
attr='_device',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Device A'
|
verbose_name=_('Device A')
|
||||||
)
|
)
|
||||||
device_b = CableTerminationsColumn(
|
device_b = CableTerminationsColumn(
|
||||||
cable_end='B',
|
cable_end='B',
|
||||||
attr='_device',
|
attr='_device',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Device B'
|
verbose_name=_('Device B')
|
||||||
)
|
)
|
||||||
location_a = CableTerminationsColumn(
|
location_a = CableTerminationsColumn(
|
||||||
cable_end='A',
|
cable_end='A',
|
||||||
attr='_location',
|
attr='_location',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Location A'
|
verbose_name=_('Location A')
|
||||||
)
|
)
|
||||||
location_b = CableTerminationsColumn(
|
location_b = CableTerminationsColumn(
|
||||||
cable_end='B',
|
cable_end='B',
|
||||||
attr='_location',
|
attr='_location',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Location B'
|
verbose_name=_('Location B')
|
||||||
)
|
)
|
||||||
rack_a = CableTerminationsColumn(
|
rack_a = CableTerminationsColumn(
|
||||||
cable_end='A',
|
cable_end='A',
|
||||||
attr='_rack',
|
attr='_rack',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Rack A'
|
verbose_name=_('Rack A')
|
||||||
)
|
)
|
||||||
rack_b = CableTerminationsColumn(
|
rack_b = CableTerminationsColumn(
|
||||||
cable_end='B',
|
cable_end='B',
|
||||||
attr='_rack',
|
attr='_rack',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Rack B'
|
verbose_name=_('Rack B')
|
||||||
)
|
)
|
||||||
site_a = CableTerminationsColumn(
|
site_a = CableTerminationsColumn(
|
||||||
cable_end='A',
|
cable_end='A',
|
||||||
attr='_site',
|
attr='_site',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Site A'
|
verbose_name=_('Site A')
|
||||||
)
|
)
|
||||||
site_b = CableTerminationsColumn(
|
site_b = CableTerminationsColumn(
|
||||||
cable_end='B',
|
cable_end='B',
|
||||||
attr='_site',
|
attr='_site',
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Site B'
|
verbose_name=_('Site B')
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
length = columns.TemplateColumn(
|
length = columns.TemplateColumn(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
|
|
||||||
@ -18,15 +19,16 @@ __all__ = (
|
|||||||
|
|
||||||
class ConsoleConnectionTable(PathEndpointTable):
|
class ConsoleConnectionTable(PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Console Port'
|
verbose_name=_('Console Port')
|
||||||
)
|
)
|
||||||
reachable = columns.BooleanColumn(
|
reachable = columns.BooleanColumn(
|
||||||
accessor=Accessor('_path__is_active'),
|
accessor=Accessor('_path__is_active'),
|
||||||
verbose_name='Reachable'
|
verbose_name=_('Reachable')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
@ -36,15 +38,16 @@ class ConsoleConnectionTable(PathEndpointTable):
|
|||||||
|
|
||||||
class PowerConnectionTable(PathEndpointTable):
|
class PowerConnectionTable(PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Power Port'
|
verbose_name=_('Power Port')
|
||||||
)
|
)
|
||||||
reachable = columns.BooleanColumn(
|
reachable = columns.BooleanColumn(
|
||||||
accessor=Accessor('_path__is_active'),
|
accessor=Accessor('_path__is_active'),
|
||||||
verbose_name='Reachable'
|
verbose_name=_('Reachable')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
@ -54,16 +57,18 @@ class PowerConnectionTable(PathEndpointTable):
|
|||||||
|
|
||||||
class InterfaceConnectionTable(PathEndpointTable):
|
class InterfaceConnectionTable(PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
accessor=Accessor('device'),
|
accessor=Accessor('device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
interface = tables.Column(
|
interface = tables.Column(
|
||||||
|
verbose_name=_('Interface'),
|
||||||
accessor=Accessor('name'),
|
accessor=Accessor('name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
reachable = columns.BooleanColumn(
|
reachable = columns.BooleanColumn(
|
||||||
accessor=Accessor('_path__is_active'),
|
accessor=Accessor('_path__is_active'),
|
||||||
verbose_name='Reachable'
|
verbose_name=_('Reachable')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from dcim import models
|
from dcim import models
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
@ -76,17 +77,18 @@ def get_interface_state_attribute(record):
|
|||||||
|
|
||||||
class DeviceRoleTable(NetBoxTable):
|
class DeviceRoleTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device_count = columns.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 = columns.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 = columns.ColorColumn()
|
color = columns.ColorColumn()
|
||||||
vm_role = columns.BooleanColumn()
|
vm_role = columns.BooleanColumn()
|
||||||
@ -112,23 +114,26 @@ class DeviceRoleTable(NetBoxTable):
|
|||||||
|
|
||||||
class PlatformTable(NetBoxTable):
|
class PlatformTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
config_template = tables.Column(
|
config_template = tables.Column(
|
||||||
|
verbose_name=_('Config template'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device_count = columns.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 = columns.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 = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:platform_list'
|
url_name='dcim:platform_list'
|
||||||
@ -151,78 +156,90 @@ class PlatformTable(NetBoxTable):
|
|||||||
|
|
||||||
class DeviceTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class DeviceTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
template_code=DEVICE_LINK,
|
template_code=DEVICE_LINK,
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
region = tables.Column(
|
region = tables.Column(
|
||||||
|
verbose_name=_('Region'),
|
||||||
accessor=Accessor('site__region'),
|
accessor=Accessor('site__region'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site_group = tables.Column(
|
site_group = tables.Column(
|
||||||
accessor=Accessor('site__group'),
|
accessor=Accessor('site__group'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Site Group'
|
verbose_name=_('Site Group')
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
location = tables.Column(
|
location = tables.Column(
|
||||||
|
verbose_name=_('Location'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rack = tables.Column(
|
rack = tables.Column(
|
||||||
|
verbose_name=_('Rack'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
position = columns.TemplateColumn(
|
position = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Position'),
|
||||||
template_code='{{ value|floatformat }}'
|
template_code='{{ value|floatformat }}'
|
||||||
)
|
)
|
||||||
device_role = columns.ColoredLabelColumn(
|
device_role = columns.ColoredLabelColumn(
|
||||||
verbose_name='Role'
|
verbose_name=_('Role')
|
||||||
)
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
accessor=Accessor('device_type__manufacturer'),
|
accessor=Accessor('device_type__manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device_type = tables.Column(
|
device_type = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Type'
|
verbose_name=_('Type')
|
||||||
)
|
)
|
||||||
primary_ip = tables.Column(
|
primary_ip = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
order_by=('primary_ip4', 'primary_ip6'),
|
order_by=('primary_ip4', 'primary_ip6'),
|
||||||
verbose_name='IP Address'
|
verbose_name=_('IP Address')
|
||||||
)
|
)
|
||||||
primary_ip4 = tables.Column(
|
primary_ip4 = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IPv4 Address'
|
verbose_name=_('IPv4 Address')
|
||||||
)
|
)
|
||||||
primary_ip6 = tables.Column(
|
primary_ip6 = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IPv6 Address'
|
verbose_name=_('IPv6 Address')
|
||||||
)
|
)
|
||||||
cluster = tables.Column(
|
cluster = tables.Column(
|
||||||
|
verbose_name=_('Cluster'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
virtual_chassis = tables.Column(
|
virtual_chassis = tables.Column(
|
||||||
|
verbose_name=_('Virtual chassis'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
vc_position = tables.Column(
|
vc_position = tables.Column(
|
||||||
verbose_name='VC Position'
|
verbose_name=_('VC Position')
|
||||||
)
|
)
|
||||||
vc_priority = tables.Column(
|
vc_priority = tables.Column(
|
||||||
verbose_name='VC Priority'
|
verbose_name=_('VC Priority')
|
||||||
)
|
)
|
||||||
config_template = tables.Column(
|
config_template = tables.Column(
|
||||||
|
verbose_name=_('Config template'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
parent_device = tables.Column(
|
parent_device = tables.Column(
|
||||||
verbose_name='Parent Device',
|
verbose_name=_('Parent Device'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
accessor='parent_bay__device'
|
accessor='parent_bay__device'
|
||||||
)
|
)
|
||||||
device_bay_position = tables.Column(
|
device_bay_position = tables.Column(
|
||||||
verbose_name='Position (Device Bay)',
|
verbose_name=_('Position (Device Bay)'),
|
||||||
accessor='parent_bay',
|
accessor='parent_bay',
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -248,21 +265,26 @@ class DeviceTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class DeviceImportTable(TenancyColumnsMixin, NetBoxTable):
|
class DeviceImportTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code=DEVICE_LINK,
|
template_code=DEVICE_LINK,
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rack = tables.Column(
|
rack = tables.Column(
|
||||||
|
verbose_name=_('Rack'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device_role = tables.Column(
|
device_role = tables.Column(
|
||||||
verbose_name='Role'
|
verbose_name=_('Role')
|
||||||
)
|
)
|
||||||
device_type = tables.Column(
|
device_type = tables.Column(
|
||||||
verbose_name='Type'
|
verbose_name=_('Type')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -277,9 +299,11 @@ class DeviceImportTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
|
|
||||||
class DeviceComponentTable(NetBoxTable):
|
class DeviceComponentTable(NetBoxTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
order_by=('_name',)
|
order_by=('_name',)
|
||||||
)
|
)
|
||||||
@ -290,6 +314,7 @@ class DeviceComponentTable(NetBoxTable):
|
|||||||
|
|
||||||
class ModularDeviceComponentTable(DeviceComponentTable):
|
class ModularDeviceComponentTable(DeviceComponentTable):
|
||||||
module_bay = tables.Column(
|
module_bay = tables.Column(
|
||||||
|
verbose_name=_('Module bay'),
|
||||||
accessor=Accessor('module__module_bay'),
|
accessor=Accessor('module__module_bay'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_modulebays',
|
'viewname': 'dcim:device_modulebays',
|
||||||
@ -297,39 +322,44 @@ class ModularDeviceComponentTable(DeviceComponentTable):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
module = tables.Column(
|
module = tables.Column(
|
||||||
|
verbose_name=_('Module'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CableTerminationTable(NetBoxTable):
|
class CableTerminationTable(NetBoxTable):
|
||||||
cable = tables.Column(
|
cable = tables.Column(
|
||||||
|
verbose_name=_('Cable'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
cable_color = columns.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 = columns.TemplateColumn(
|
link_peer = columns.TemplateColumn(
|
||||||
accessor='link_peers',
|
accessor='link_peers',
|
||||||
template_code=LINKTERMINATION,
|
template_code=LINKTERMINATION,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Link Peers'
|
verbose_name=_('Link Peers')
|
||||||
|
)
|
||||||
|
mark_connected = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Mark connected'),
|
||||||
)
|
)
|
||||||
mark_connected = columns.BooleanColumn()
|
|
||||||
|
|
||||||
|
|
||||||
class PathEndpointTable(CableTerminationTable):
|
class PathEndpointTable(CableTerminationTable):
|
||||||
connection = columns.TemplateColumn(
|
connection = columns.TemplateColumn(
|
||||||
accessor='_path__destinations',
|
accessor='_path__destinations',
|
||||||
template_code=LINKTERMINATION,
|
template_code=LINKTERMINATION,
|
||||||
verbose_name='Connection',
|
verbose_name=_('Connection'),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable):
|
class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_consoleports',
|
'viewname': 'dcim:device_consoleports',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
@ -350,11 +380,13 @@ class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|||||||
|
|
||||||
class DeviceConsolePortTable(ConsolePortTable):
|
class DeviceConsolePortTable(ConsolePortTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-console"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
template_code='<i class="mdi mdi-console"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=CONSOLEPORT_BUTTONS
|
extra_buttons=CONSOLEPORT_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -372,6 +404,7 @@ class DeviceConsolePortTable(ConsolePortTable):
|
|||||||
|
|
||||||
class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_consoleserverports',
|
'viewname': 'dcim:device_consoleserverports',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
@ -392,12 +425,14 @@ class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|||||||
|
|
||||||
class DeviceConsoleServerPortTable(ConsoleServerPortTable):
|
class DeviceConsoleServerPortTable(ConsoleServerPortTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-console-network-outline"></i> '
|
template_code='<i class="mdi mdi-console-network-outline"></i> '
|
||||||
'<a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
'<a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=CONSOLESERVERPORT_BUTTONS
|
extra_buttons=CONSOLESERVERPORT_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -415,6 +450,7 @@ class DeviceConsoleServerPortTable(ConsoleServerPortTable):
|
|||||||
|
|
||||||
class PowerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
class PowerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_powerports',
|
'viewname': 'dcim:device_powerports',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
@ -436,12 +472,14 @@ class PowerPortTable(ModularDeviceComponentTable, PathEndpointTable):
|
|||||||
|
|
||||||
class DevicePowerPortTable(PowerPortTable):
|
class DevicePowerPortTable(PowerPortTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-power-plug-outline"></i> <a href="{{ record.get_absolute_url }}">'
|
template_code='<i class="mdi mdi-power-plug-outline"></i> <a href="{{ record.get_absolute_url }}">'
|
||||||
'{{ value }}</a>',
|
'{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=POWERPORT_BUTTONS
|
extra_buttons=POWERPORT_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -461,12 +499,14 @@ class DevicePowerPortTable(PowerPortTable):
|
|||||||
|
|
||||||
class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
|
class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_poweroutlets',
|
'viewname': 'dcim:device_poweroutlets',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
power_port = tables.Column(
|
power_port = tables.Column(
|
||||||
|
verbose_name=_('Power port'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -485,11 +525,13 @@ class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
|
|||||||
|
|
||||||
class DevicePowerOutletTable(PowerOutletTable):
|
class DevicePowerOutletTable(PowerOutletTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-power-socket"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
template_code='<i class="mdi mdi-power-socket"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=POWEROUTLET_BUTTONS
|
extra_buttons=POWEROUTLET_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -508,29 +550,34 @@ class DevicePowerOutletTable(PowerOutletTable):
|
|||||||
|
|
||||||
|
|
||||||
class BaseInterfaceTable(NetBoxTable):
|
class BaseInterfaceTable(NetBoxTable):
|
||||||
enabled = columns.BooleanColumn()
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
ip_addresses = tables.TemplateColumn(
|
ip_addresses = tables.TemplateColumn(
|
||||||
template_code=INTERFACE_IPADDRESSES,
|
template_code=INTERFACE_IPADDRESSES,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='IP Addresses'
|
verbose_name=_('IP Addresses')
|
||||||
)
|
)
|
||||||
fhrp_groups = tables.TemplateColumn(
|
fhrp_groups = tables.TemplateColumn(
|
||||||
accessor=Accessor('fhrp_group_assignments'),
|
accessor=Accessor('fhrp_group_assignments'),
|
||||||
template_code=INTERFACE_FHRPGROUPS,
|
template_code=INTERFACE_FHRPGROUPS,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='FHRP Groups'
|
verbose_name=_('FHRP Groups')
|
||||||
)
|
)
|
||||||
l2vpn = tables.Column(
|
l2vpn = tables.Column(
|
||||||
accessor=tables.A('l2vpn_termination__l2vpn'),
|
accessor=tables.A('l2vpn_termination__l2vpn'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='L2VPN'
|
verbose_name=_('L2VPN')
|
||||||
|
)
|
||||||
|
untagged_vlan = tables.Column(
|
||||||
|
verbose_name=_('Untagged VLAN'),
|
||||||
|
linkify=True
|
||||||
)
|
)
|
||||||
untagged_vlan = tables.Column(linkify=True)
|
|
||||||
tagged_vlans = columns.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')
|
||||||
)
|
)
|
||||||
|
|
||||||
def value_ip_addresses(self, value):
|
def value_ip_addresses(self, value):
|
||||||
@ -539,25 +586,30 @@ class BaseInterfaceTable(NetBoxTable):
|
|||||||
|
|
||||||
class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpointTable):
|
class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpointTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_interfaces',
|
'viewname': 'dcim:device_interfaces',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
mgmt_only = columns.BooleanColumn()
|
mgmt_only = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Mgmt only'),
|
||||||
|
)
|
||||||
wireless_link = tables.Column(
|
wireless_link = tables.Column(
|
||||||
|
verbose_name=_('Wireless link'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
wireless_lans = columns.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')
|
||||||
)
|
)
|
||||||
vdcs = columns.ManyToManyColumn(
|
vdcs = columns.ManyToManyColumn(
|
||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
verbose_name='VDCs'
|
verbose_name=_('VDCs')
|
||||||
)
|
)
|
||||||
vrf = tables.Column(
|
vrf = tables.Column(
|
||||||
|
verbose_name=_('VRF'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -578,6 +630,7 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi
|
|||||||
|
|
||||||
class DeviceInterfaceTable(InterfaceTable):
|
class DeviceInterfaceTable(InterfaceTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-{% if record.mgmt_only %}wrench{% elif record.is_lag %}reorder-horizontal'
|
template_code='<i class="mdi mdi-{% if record.mgmt_only %}wrench{% elif record.is_lag %}reorder-horizontal'
|
||||||
'{% elif record.is_virtual %}circle{% elif record.is_wireless %}wifi{% else %}ethernet'
|
'{% elif record.is_virtual %}circle{% elif record.is_wireless %}wifi{% else %}ethernet'
|
||||||
'{% endif %}"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
'{% endif %}"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
@ -585,16 +638,19 @@ class DeviceInterfaceTable(InterfaceTable):
|
|||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
parent = tables.Column(
|
parent = tables.Column(
|
||||||
|
verbose_name=_('Parent'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
bridge = tables.Column(
|
bridge = tables.Column(
|
||||||
|
verbose_name=_('Bridge'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
lag = tables.Column(
|
lag = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='LAG'
|
verbose_name=_('LAG')
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=INTERFACE_BUTTONS
|
extra_buttons=INTERFACE_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -621,16 +677,20 @@ class DeviceInterfaceTable(InterfaceTable):
|
|||||||
|
|
||||||
class FrontPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
class FrontPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_frontports',
|
'viewname': 'dcim:device_frontports',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
color = columns.ColorColumn()
|
color = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
|
)
|
||||||
rear_port_position = tables.Column(
|
rear_port_position = tables.Column(
|
||||||
verbose_name='Position'
|
verbose_name=_('Position')
|
||||||
)
|
)
|
||||||
rear_port = tables.Column(
|
rear_port = tables.Column(
|
||||||
|
verbose_name=_('Rear port'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -651,12 +711,14 @@ class FrontPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
|||||||
|
|
||||||
class DeviceFrontPortTable(FrontPortTable):
|
class DeviceFrontPortTable(FrontPortTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-square-rounded{% if not record.cable %}-outline{% endif %}"></i> '
|
template_code='<i class="mdi mdi-square-rounded{% if not record.cable %}-outline{% endif %}"></i> '
|
||||||
'<a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
'<a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=FRONTPORT_BUTTONS
|
extra_buttons=FRONTPORT_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -676,12 +738,15 @@ class DeviceFrontPortTable(FrontPortTable):
|
|||||||
|
|
||||||
class RearPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
class RearPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_rearports',
|
'viewname': 'dcim:device_rearports',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
color = columns.ColorColumn()
|
color = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:rearport_list'
|
url_name='dcim:rearport_list'
|
||||||
)
|
)
|
||||||
@ -697,12 +762,14 @@ class RearPortTable(ModularDeviceComponentTable, CableTerminationTable):
|
|||||||
|
|
||||||
class DeviceRearPortTable(RearPortTable):
|
class DeviceRearPortTable(RearPortTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-square-rounded{% if not record.cable %}-outline{% endif %}"></i> '
|
template_code='<i class="mdi mdi-square-rounded{% if not record.cable %}-outline{% endif %}"></i> '
|
||||||
'<a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
'<a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=REARPORT_BUTTONS
|
extra_buttons=REARPORT_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -722,6 +789,7 @@ class DeviceRearPortTable(RearPortTable):
|
|||||||
|
|
||||||
class DeviceBayTable(DeviceComponentTable):
|
class DeviceBayTable(DeviceComponentTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_devicebays',
|
'viewname': 'dcim:device_devicebays',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
@ -729,18 +797,20 @@ class DeviceBayTable(DeviceComponentTable):
|
|||||||
)
|
)
|
||||||
device_role = columns.ColoredLabelColumn(
|
device_role = columns.ColoredLabelColumn(
|
||||||
accessor=Accessor('installed_device__device_role'),
|
accessor=Accessor('installed_device__device_role'),
|
||||||
verbose_name='Role'
|
verbose_name=_('Role')
|
||||||
)
|
)
|
||||||
device_type = tables.Column(
|
device_type = tables.Column(
|
||||||
accessor=Accessor('installed_device__device_type'),
|
accessor=Accessor('installed_device__device_type'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Type'
|
verbose_name=_('Type')
|
||||||
)
|
)
|
||||||
status = tables.TemplateColumn(
|
status = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
template_code=DEVICEBAY_STATUS,
|
template_code=DEVICEBAY_STATUS,
|
||||||
order_by=Accessor('installed_device__status')
|
order_by=Accessor('installed_device__status')
|
||||||
)
|
)
|
||||||
installed_device = tables.Column(
|
installed_device = tables.Column(
|
||||||
|
verbose_name=_('Installed device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -759,12 +829,14 @@ class DeviceBayTable(DeviceComponentTable):
|
|||||||
|
|
||||||
class DeviceDeviceBayTable(DeviceBayTable):
|
class DeviceDeviceBayTable(DeviceBayTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<i class="mdi mdi-circle{% if record.installed_device %}slice-8{% else %}outline{% endif %}'
|
template_code='<i class="mdi mdi-circle{% if record.installed_device %}slice-8{% else %}outline{% endif %}'
|
||||||
'"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
'"></i> <a href="{{ record.get_absolute_url }}">{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=DEVICEBAY_BUTTONS
|
extra_buttons=DEVICEBAY_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -778,6 +850,7 @@ class DeviceDeviceBayTable(DeviceBayTable):
|
|||||||
|
|
||||||
class ModuleBayTable(DeviceComponentTable):
|
class ModuleBayTable(DeviceComponentTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_modulebays',
|
'viewname': 'dcim:device_modulebays',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
@ -785,18 +858,21 @@ class ModuleBayTable(DeviceComponentTable):
|
|||||||
)
|
)
|
||||||
installed_module = tables.Column(
|
installed_module = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Installed module'
|
verbose_name=_('Installed module')
|
||||||
)
|
)
|
||||||
module_serial = tables.Column(
|
module_serial = tables.Column(
|
||||||
|
verbose_name=_('Module serial'),
|
||||||
accessor=tables.A('installed_module__serial')
|
accessor=tables.A('installed_module__serial')
|
||||||
)
|
)
|
||||||
module_asset_tag = tables.Column(
|
module_asset_tag = tables.Column(
|
||||||
|
verbose_name=_('Module asset tag'),
|
||||||
accessor=tables.A('installed_module__asset_tag')
|
accessor=tables.A('installed_module__asset_tag')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:modulebay_list'
|
url_name='dcim:modulebay_list'
|
||||||
)
|
)
|
||||||
module_status = columns.TemplateColumn(
|
module_status = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Module status'),
|
||||||
template_code=MODULEBAY_STATUS
|
template_code=MODULEBAY_STATUS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -811,6 +887,7 @@ class ModuleBayTable(DeviceComponentTable):
|
|||||||
|
|
||||||
class DeviceModuleBayTable(ModuleBayTable):
|
class DeviceModuleBayTable(ModuleBayTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=MODULEBAY_BUTTONS
|
extra_buttons=MODULEBAY_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -825,20 +902,27 @@ class DeviceModuleBayTable(ModuleBayTable):
|
|||||||
|
|
||||||
class InventoryItemTable(DeviceComponentTable):
|
class InventoryItemTable(DeviceComponentTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify={
|
linkify={
|
||||||
'viewname': 'dcim:device_inventory',
|
'viewname': 'dcim:device_inventory',
|
||||||
'args': [Accessor('device_id')],
|
'args': [Accessor('device_id')],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
role = columns.ColoredLabelColumn()
|
role = columns.ColoredLabelColumn(
|
||||||
|
verbose_name=_('Role'),
|
||||||
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
component = tables.Column(
|
component = tables.Column(
|
||||||
|
verbose_name=_('Component'),
|
||||||
orderable=False,
|
orderable=False,
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
discovered = columns.BooleanColumn()
|
discovered = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Discovered'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:inventoryitem_list'
|
url_name='dcim:inventoryitem_list'
|
||||||
)
|
)
|
||||||
@ -857,6 +941,7 @@ class InventoryItemTable(DeviceComponentTable):
|
|||||||
|
|
||||||
class DeviceInventoryItemTable(InventoryItemTable):
|
class DeviceInventoryItemTable(InventoryItemTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
template_code='<a href="{{ record.get_absolute_url }}" style="padding-left: {{ record.level }}0px">'
|
template_code='<a href="{{ record.get_absolute_url }}" style="padding-left: {{ record.level }}0px">'
|
||||||
'{{ value }}</a>',
|
'{{ value }}</a>',
|
||||||
order_by=Accessor('_name'),
|
order_by=Accessor('_name'),
|
||||||
@ -876,14 +961,17 @@ class DeviceInventoryItemTable(InventoryItemTable):
|
|||||||
|
|
||||||
class InventoryItemRoleTable(NetBoxTable):
|
class InventoryItemRoleTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
inventoryitem_count = columns.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 = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
)
|
)
|
||||||
color = columns.ColorColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:inventoryitemrole_list'
|
url_name='dcim:inventoryitemrole_list'
|
||||||
)
|
)
|
||||||
@ -902,17 +990,21 @@ class InventoryItemRoleTable(NetBoxTable):
|
|||||||
|
|
||||||
class VirtualChassisTable(NetBoxTable):
|
class VirtualChassisTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
master = tables.Column(
|
master = tables.Column(
|
||||||
|
verbose_name=_('Master'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
member_count = columns.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')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:virtualchassis_list'
|
url_name='dcim:virtualchassis_list'
|
||||||
)
|
)
|
||||||
@ -928,31 +1020,35 @@ class VirtualChassisTable(NetBoxTable):
|
|||||||
|
|
||||||
class VirtualDeviceContextTable(TenancyColumnsMixin, NetBoxTable):
|
class VirtualDeviceContextTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device = tables.TemplateColumn(
|
device = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Device'),
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
template_code=DEVICE_LINK,
|
template_code=DEVICE_LINK,
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
primary_ip = tables.Column(
|
primary_ip = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
order_by=('primary_ip4', 'primary_ip6'),
|
order_by=('primary_ip4', 'primary_ip6'),
|
||||||
verbose_name='IP Address'
|
verbose_name=_('IP Address')
|
||||||
)
|
)
|
||||||
primary_ip4 = tables.Column(
|
primary_ip4 = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IPv4 Address'
|
verbose_name=_('IPv4 Address')
|
||||||
)
|
)
|
||||||
primary_ip6 = tables.Column(
|
primary_ip6 = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IPv6 Address'
|
verbose_name=_('IPv6 Address')
|
||||||
)
|
)
|
||||||
interface_count = columns.LinkedCountColumn(
|
interface_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:interface_list',
|
viewname='dcim:interface_list',
|
||||||
url_params={'vdc_id': 'pk'},
|
url_params={'vdc_id': 'pk'},
|
||||||
verbose_name='Interfaces'
|
verbose_name=_('Interfaces')
|
||||||
)
|
)
|
||||||
|
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from dcim import models
|
from dcim import models
|
||||||
@ -27,27 +28,28 @@ __all__ = (
|
|||||||
|
|
||||||
class ManufacturerTable(ContactsColumnMixin, NetBoxTable):
|
class ManufacturerTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
devicetype_count = columns.LinkedCountColumn(
|
devicetype_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:devicetype_list',
|
viewname='dcim:devicetype_list',
|
||||||
url_params={'manufacturer_id': 'pk'},
|
url_params={'manufacturer_id': 'pk'},
|
||||||
verbose_name='Device Types'
|
verbose_name=_('Device Types')
|
||||||
)
|
)
|
||||||
moduletype_count = columns.LinkedCountColumn(
|
moduletype_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:moduletype_list',
|
viewname='dcim:moduletype_list',
|
||||||
url_params={'manufacturer_id': 'pk'},
|
url_params={'manufacturer_id': 'pk'},
|
||||||
verbose_name='Module Types'
|
verbose_name=_('Module Types')
|
||||||
)
|
)
|
||||||
inventoryitem_count = columns.LinkedCountColumn(
|
inventoryitem_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:inventoryitem_list',
|
viewname='dcim:inventoryitem_list',
|
||||||
url_params={'manufacturer_id': 'pk'},
|
url_params={'manufacturer_id': 'pk'},
|
||||||
verbose_name='Inventory Items'
|
verbose_name=_('Inventory Items')
|
||||||
)
|
)
|
||||||
platform_count = columns.LinkedCountColumn(
|
platform_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:platform_list',
|
viewname='dcim:platform_list',
|
||||||
url_params={'manufacturer_id': 'pk'},
|
url_params={'manufacturer_id': 'pk'},
|
||||||
verbose_name='Platforms'
|
verbose_name=_('Platforms')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:manufacturer_list'
|
url_name='dcim:manufacturer_list'
|
||||||
@ -72,30 +74,36 @@ class ManufacturerTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
class DeviceTypeTable(NetBoxTable):
|
class DeviceTypeTable(NetBoxTable):
|
||||||
model = tables.Column(
|
model = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Device Type'
|
verbose_name=_('Device Type')
|
||||||
)
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
default_platform = tables.Column(
|
default_platform = tables.Column(
|
||||||
|
verbose_name=_('Default platform'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
is_full_depth = columns.BooleanColumn(
|
is_full_depth = columns.BooleanColumn(
|
||||||
verbose_name='Full Depth'
|
verbose_name=_('Full Depth')
|
||||||
)
|
)
|
||||||
instance_count = columns.LinkedCountColumn(
|
instance_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:device_list',
|
viewname='dcim:device_list',
|
||||||
url_params={'device_type_id': 'pk'},
|
url_params={'device_type_id': 'pk'},
|
||||||
verbose_name='Instances'
|
verbose_name=_('Instances')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:devicetype_list'
|
url_name='dcim:devicetype_list'
|
||||||
)
|
)
|
||||||
u_height = columns.TemplateColumn(
|
u_height = columns.TemplateColumn(
|
||||||
|
verbose_name=_('U height'),
|
||||||
template_code='{{ value|floatformat }}'
|
template_code='{{ value|floatformat }}'
|
||||||
)
|
)
|
||||||
weight = columns.TemplateColumn(
|
weight = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Weight'),
|
||||||
template_code=WEIGHT,
|
template_code=WEIGHT,
|
||||||
order_by=('_abs_weight', 'weight_unit')
|
order_by=('_abs_weight', 'weight_unit')
|
||||||
)
|
)
|
||||||
@ -117,7 +125,7 @@ class DeviceTypeTable(NetBoxTable):
|
|||||||
|
|
||||||
class ComponentTemplateTable(NetBoxTable):
|
class ComponentTemplateTable(NetBoxTable):
|
||||||
id = tables.Column(
|
id = tables.Column(
|
||||||
verbose_name='ID'
|
verbose_name=_('ID')
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
order_by=('_name',)
|
order_by=('_name',)
|
||||||
@ -129,6 +137,7 @@ class ComponentTemplateTable(NetBoxTable):
|
|||||||
|
|
||||||
class ConsolePortTemplateTable(ComponentTemplateTable):
|
class ConsolePortTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -141,6 +150,7 @@ class ConsolePortTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class ConsoleServerPortTemplateTable(ComponentTemplateTable):
|
class ConsoleServerPortTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -153,6 +163,7 @@ class ConsoleServerPortTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class PowerPortTemplateTable(ComponentTemplateTable):
|
class PowerPortTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -165,6 +176,7 @@ class PowerPortTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class PowerOutletTemplateTable(ComponentTemplateTable):
|
class PowerOutletTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -176,11 +188,14 @@ class PowerOutletTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
|
|
||||||
class InterfaceTemplateTable(ComponentTemplateTable):
|
class InterfaceTemplateTable(ComponentTemplateTable):
|
||||||
enabled = columns.BooleanColumn()
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
mgmt_only = columns.BooleanColumn(
|
mgmt_only = columns.BooleanColumn(
|
||||||
verbose_name='Management Only'
|
verbose_name=_('Management Only')
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -193,10 +208,13 @@ class InterfaceTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class FrontPortTemplateTable(ComponentTemplateTable):
|
class FrontPortTemplateTable(ComponentTemplateTable):
|
||||||
rear_port_position = tables.Column(
|
rear_port_position = tables.Column(
|
||||||
verbose_name='Position'
|
verbose_name=_('Position')
|
||||||
|
)
|
||||||
|
color = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
)
|
)
|
||||||
color = columns.ColorColumn()
|
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -208,8 +226,11 @@ class FrontPortTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
|
|
||||||
class RearPortTemplateTable(ComponentTemplateTable):
|
class RearPortTemplateTable(ComponentTemplateTable):
|
||||||
color = columns.ColorColumn()
|
color = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
)
|
)
|
||||||
@ -222,6 +243,7 @@ class RearPortTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class ModuleBayTemplateTable(ComponentTemplateTable):
|
class ModuleBayTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete')
|
actions=('edit', 'delete')
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -233,6 +255,7 @@ class ModuleBayTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class DeviceBayTemplateTable(ComponentTemplateTable):
|
class DeviceBayTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete')
|
actions=('edit', 'delete')
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -244,15 +267,19 @@ class DeviceBayTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
class InventoryItemTemplateTable(ComponentTemplateTable):
|
class InventoryItemTemplateTable(ComponentTemplateTable):
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
actions=('edit', 'delete')
|
actions=('edit', 'delete')
|
||||||
)
|
)
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
component = tables.Column(
|
component = tables.Column(
|
||||||
|
verbose_name=_('Component'),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from dcim.models import Module, ModuleType
|
from dcim.models import Module, ModuleType
|
||||||
@ -13,21 +14,25 @@ __all__ = (
|
|||||||
class ModuleTypeTable(NetBoxTable):
|
class ModuleTypeTable(NetBoxTable):
|
||||||
model = tables.Column(
|
model = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Module Type'
|
verbose_name=_('Module Type')
|
||||||
)
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
instance_count = columns.LinkedCountColumn(
|
instance_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:module_list',
|
viewname='dcim:module_list',
|
||||||
url_params={'module_type_id': 'pk'},
|
url_params={'module_type_id': 'pk'},
|
||||||
verbose_name='Instances'
|
verbose_name=_('Instances')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:moduletype_list'
|
url_name='dcim:moduletype_list'
|
||||||
)
|
)
|
||||||
weight = columns.TemplateColumn(
|
weight = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Weight'),
|
||||||
template_code=WEIGHT,
|
template_code=WEIGHT,
|
||||||
order_by=('_abs_weight', 'weight_unit')
|
order_by=('_abs_weight', 'weight_unit')
|
||||||
)
|
)
|
||||||
@ -44,20 +49,28 @@ class ModuleTypeTable(NetBoxTable):
|
|||||||
|
|
||||||
class ModuleTable(NetBoxTable):
|
class ModuleTable(NetBoxTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
module_bay = tables.Column(
|
module_bay = tables.Column(
|
||||||
|
verbose_name=_('Module bay'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
manufacturer = tables.Column(
|
manufacturer = tables.Column(
|
||||||
|
verbose_name=_('Manufacturer'),
|
||||||
accessor=tables.A('module_type__manufacturer'),
|
accessor=tables.A('module_type__manufacturer'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
module_type = tables.Column(
|
module_type = tables.Column(
|
||||||
|
verbose_name=_('Module type'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
comments = columns.MarkdownColumn()
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:module_list'
|
url_name='dcim:module_list'
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from dcim.models import PowerFeed, PowerPanel
|
from dcim.models import PowerFeed, PowerPanel
|
||||||
from tenancy.tables import ContactsColumnMixin
|
from tenancy.tables import ContactsColumnMixin
|
||||||
@ -18,20 +19,25 @@ __all__ = (
|
|||||||
|
|
||||||
class PowerPanelTable(ContactsColumnMixin, NetBoxTable):
|
class PowerPanelTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
location = tables.Column(
|
location = tables.Column(
|
||||||
|
verbose_name=_('Location'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
powerfeed_count = columns.LinkedCountColumn(
|
powerfeed_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:powerfeed_list',
|
viewname='dcim:powerfeed_list',
|
||||||
url_params={'power_panel_id': 'pk'},
|
url_params={'power_panel_id': 'pk'},
|
||||||
verbose_name='Feeds'
|
verbose_name=_('Feeds')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:powerpanel_list'
|
url_name='dcim:powerpanel_list'
|
||||||
)
|
)
|
||||||
@ -53,23 +59,33 @@ class PowerPanelTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
# cannot traverse pass-through ports.
|
# cannot traverse pass-through ports.
|
||||||
class PowerFeedTable(CableTerminationTable):
|
class PowerFeedTable(CableTerminationTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
power_panel = tables.Column(
|
power_panel = tables.Column(
|
||||||
|
verbose_name=_('Power panel'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rack = tables.Column(
|
rack = tables.Column(
|
||||||
|
verbose_name=_('Rack'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
type = columns.ChoiceFieldColumn()
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
|
type = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Type'),
|
||||||
|
)
|
||||||
max_utilization = tables.TemplateColumn(
|
max_utilization = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Max utilization'),
|
||||||
template_code="{{ value }}%"
|
template_code="{{ value }}%"
|
||||||
)
|
)
|
||||||
available_power = tables.Column(
|
available_power = tables.Column(
|
||||||
verbose_name='Available power (VA)'
|
verbose_name=_('Available power (VA)')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:powerfeed_list'
|
url_name='dcim:powerfeed_list'
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
|
|
||||||
@ -18,13 +19,18 @@ __all__ = (
|
|||||||
#
|
#
|
||||||
|
|
||||||
class RackRoleTable(NetBoxTable):
|
class RackRoleTable(NetBoxTable):
|
||||||
name = tables.Column(linkify=True)
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
rack_count = columns.LinkedCountColumn(
|
rack_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:rack_list',
|
viewname='dcim:rack_list',
|
||||||
url_params={'role_id': 'pk'},
|
url_params={'role_id': 'pk'},
|
||||||
verbose_name='Racks'
|
verbose_name=_('Racks')
|
||||||
|
)
|
||||||
|
color = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
)
|
)
|
||||||
color = columns.ColorColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:rackrole_list'
|
url_name='dcim:rackrole_list'
|
||||||
)
|
)
|
||||||
@ -44,51 +50,62 @@ class RackRoleTable(NetBoxTable):
|
|||||||
|
|
||||||
class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
location = tables.Column(
|
location = tables.Column(
|
||||||
|
verbose_name=_('Location'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
role = columns.ColoredLabelColumn()
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
|
role = columns.ColoredLabelColumn(
|
||||||
|
verbose_name=_('Role'),
|
||||||
|
)
|
||||||
u_height = tables.TemplateColumn(
|
u_height = tables.TemplateColumn(
|
||||||
template_code="{{ value }}U",
|
template_code="{{ value }}U",
|
||||||
verbose_name='Height'
|
verbose_name=_('Height')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
device_count = columns.LinkedCountColumn(
|
device_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:device_list',
|
viewname='dcim:device_list',
|
||||||
url_params={'rack_id': 'pk'},
|
url_params={'rack_id': 'pk'},
|
||||||
verbose_name='Devices'
|
verbose_name=_('Devices')
|
||||||
)
|
)
|
||||||
get_utilization = columns.UtilizationColumn(
|
get_utilization = columns.UtilizationColumn(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Space'
|
verbose_name=_('Space')
|
||||||
)
|
)
|
||||||
get_power_utilization = columns.UtilizationColumn(
|
get_power_utilization = columns.UtilizationColumn(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Power'
|
verbose_name=_('Power')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:rack_list'
|
url_name='dcim:rack_list'
|
||||||
)
|
)
|
||||||
outer_width = tables.TemplateColumn(
|
outer_width = tables.TemplateColumn(
|
||||||
template_code="{{ record.outer_width }} {{ record.outer_unit }}",
|
template_code="{{ record.outer_width }} {{ record.outer_unit }}",
|
||||||
verbose_name='Outer Width'
|
verbose_name=_('Outer Width')
|
||||||
)
|
)
|
||||||
outer_depth = tables.TemplateColumn(
|
outer_depth = tables.TemplateColumn(
|
||||||
template_code="{{ record.outer_depth }} {{ record.outer_unit }}",
|
template_code="{{ record.outer_depth }} {{ record.outer_unit }}",
|
||||||
verbose_name='Outer Depth'
|
verbose_name=_('Outer Depth')
|
||||||
)
|
)
|
||||||
weight = columns.TemplateColumn(
|
weight = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Weight'),
|
||||||
template_code=WEIGHT,
|
template_code=WEIGHT,
|
||||||
order_by=('_abs_weight', 'weight_unit')
|
order_by=('_abs_weight', 'weight_unit')
|
||||||
)
|
)
|
||||||
max_weight = columns.TemplateColumn(
|
max_weight = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Max weight'),
|
||||||
template_code=WEIGHT,
|
template_code=WEIGHT,
|
||||||
order_by=('_abs_max_weight', 'weight_unit')
|
order_by=('_abs_max_weight', 'weight_unit')
|
||||||
)
|
)
|
||||||
@ -113,25 +130,31 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class RackReservationTable(TenancyColumnsMixin, NetBoxTable):
|
class RackReservationTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
reservation = tables.Column(
|
reservation = tables.Column(
|
||||||
|
verbose_name=_('Reservation'),
|
||||||
accessor='pk',
|
accessor='pk',
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
accessor=Accessor('rack__site'),
|
accessor=Accessor('rack__site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
location = tables.Column(
|
location = tables.Column(
|
||||||
|
verbose_name=_('Location'),
|
||||||
accessor=Accessor('rack__location'),
|
accessor=Accessor('rack__location'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rack = tables.Column(
|
rack = tables.Column(
|
||||||
|
verbose_name=_('Rack'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
unit_list = tables.Column(
|
unit_list = tables.Column(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Units'
|
verbose_name=_('Units')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:rackreservation_list'
|
url_name='dcim:rackreservation_list'
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from dcim.models import Location, Region, Site, SiteGroup
|
from dcim.models import Location, Region, Site, SiteGroup
|
||||||
from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin
|
from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin
|
||||||
@ -20,12 +21,13 @@ __all__ = (
|
|||||||
|
|
||||||
class RegionTable(ContactsColumnMixin, NetBoxTable):
|
class RegionTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site_count = columns.LinkedCountColumn(
|
site_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:site_list',
|
viewname='dcim:site_list',
|
||||||
url_params={'region_id': 'pk'},
|
url_params={'region_id': 'pk'},
|
||||||
verbose_name='Sites'
|
verbose_name=_('Sites')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:region_list'
|
url_name='dcim:region_list'
|
||||||
@ -46,12 +48,13 @@ class RegionTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class SiteGroupTable(ContactsColumnMixin, NetBoxTable):
|
class SiteGroupTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site_count = columns.LinkedCountColumn(
|
site_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:site_list',
|
viewname='dcim:site_list',
|
||||||
url_params={'group_id': 'pk'},
|
url_params={'group_id': 'pk'},
|
||||||
verbose_name='Sites'
|
verbose_name=_('Sites')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:sitegroup_list'
|
url_name='dcim:sitegroup_list'
|
||||||
@ -72,26 +75,33 @@ class SiteGroupTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class SiteTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class SiteTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
region = tables.Column(
|
region = tables.Column(
|
||||||
|
verbose_name=_('Region'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
asns = columns.ManyToManyColumn(
|
asns = columns.ManyToManyColumn(
|
||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
verbose_name='ASNs'
|
verbose_name=_('ASNs')
|
||||||
)
|
)
|
||||||
asn_count = columns.LinkedCountColumn(
|
asn_count = columns.LinkedCountColumn(
|
||||||
accessor=tables.A('asns__count'),
|
accessor=tables.A('asns__count'),
|
||||||
viewname='ipam:asn_list',
|
viewname='ipam:asn_list',
|
||||||
url_params={'site_id': 'pk'},
|
url_params={'site_id': 'pk'},
|
||||||
verbose_name='ASN Count'
|
verbose_name=_('ASN Count')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:site_list'
|
url_name='dcim:site_list'
|
||||||
)
|
)
|
||||||
@ -112,26 +122,31 @@ class SiteTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class LocationTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class LocationTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
rack_count = columns.LinkedCountColumn(
|
rack_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:rack_list',
|
viewname='dcim:rack_list',
|
||||||
url_params={'location_id': 'pk'},
|
url_params={'location_id': 'pk'},
|
||||||
verbose_name='Racks'
|
verbose_name=_('Racks')
|
||||||
)
|
)
|
||||||
device_count = columns.LinkedCountColumn(
|
device_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:device_list',
|
viewname='dcim:device_list',
|
||||||
url_params={'location_id': 'pk'},
|
url_params={'location_id': 'pk'},
|
||||||
verbose_name='Devices'
|
verbose_name=_('Devices')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='dcim:location_list'
|
url_name='dcim:location_list'
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
verbose_name=_('Actions'),
|
||||||
extra_buttons=LOCATION_BUTTONS
|
extra_buttons=LOCATION_BUTTONS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
LINKTERMINATION = """
|
LINKTERMINATION = """
|
||||||
{% for termination in value %}
|
{% for termination in value %}
|
||||||
{% if termination.parent_object %}
|
{% if termination.parent_object %}
|
||||||
@ -20,11 +22,11 @@ WEIGHT = """
|
|||||||
{% if value %}{{ value|floatformat:"-2" }} {{ record.weight_unit }}{% endif %}
|
{% if value %}{{ value|floatformat:"-2" }} {{ record.weight_unit }}{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DEVICE_LINK = """
|
DEVICE_LINK = _("""
|
||||||
{{ value|default:'<span class="badge bg-info">Unnamed device</span>' }}
|
{{ value|default:'<span class="badge bg-info">Unnamed device</span>' }}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
DEVICEBAY_STATUS = """
|
DEVICEBAY_STATUS = _("""
|
||||||
{% if record.installed_device_id %}
|
{% if record.installed_device_id %}
|
||||||
<span class="badge bg-{{ record.installed_device.get_status_color }}">
|
<span class="badge bg-{{ record.installed_device.get_status_color }}">
|
||||||
{{ record.installed_device.get_status_display }}
|
{{ record.installed_device.get_status_display }}
|
||||||
@ -32,7 +34,7 @@ DEVICEBAY_STATUS = """
|
|||||||
{% else %}
|
{% else %}
|
||||||
<span class="badge bg-secondary">Vacant</span>
|
<span class="badge bg-secondary">Vacant</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
INTERFACE_IPADDRESSES = """
|
INTERFACE_IPADDRESSES = """
|
||||||
<div class="table-badge-group">
|
<div class="table-badge-group">
|
||||||
@ -54,7 +56,7 @@ INTERFACE_FHRPGROUPS = """
|
|||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
INTERFACE_TAGGED_VLANS = """
|
INTERFACE_TAGGED_VLANS = _("""
|
||||||
{% if record.mode == 'tagged' %}
|
{% if record.mode == 'tagged' %}
|
||||||
{% for vlan in value.all %}
|
{% for vlan in value.all %}
|
||||||
<a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br />
|
<a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br />
|
||||||
@ -62,7 +64,7 @@ INTERFACE_TAGGED_VLANS = """
|
|||||||
{% elif record.mode == 'tagged-all' %}
|
{% elif record.mode == 'tagged-all' %}
|
||||||
All
|
All
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
INTERFACE_WIRELESS_LANS = """
|
INTERFACE_WIRELESS_LANS = """
|
||||||
{% for wlan in value.all %}
|
{% for wlan in value.all %}
|
||||||
@ -106,7 +108,7 @@ MODULAR_COMPONENT_TEMPLATE_BUTTONS = """
|
|||||||
# Device component buttons
|
# Device component buttons
|
||||||
#
|
#
|
||||||
|
|
||||||
CONSOLEPORT_BUTTONS = """
|
CONSOLEPORT_BUTTONS = _("""
|
||||||
{% if perms.dcim.add_inventoryitem %}
|
{% if perms.dcim.add_inventoryitem %}
|
||||||
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item">
|
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
||||||
@ -154,9 +156,9 @@ CONSOLEPORT_BUTTONS = """
|
|||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
CONSOLESERVERPORT_BUTTONS = """
|
CONSOLESERVERPORT_BUTTONS = _("""
|
||||||
{% if perms.dcim.add_inventoryitem %}
|
{% if perms.dcim.add_inventoryitem %}
|
||||||
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item">
|
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
||||||
@ -204,9 +206,9 @@ CONSOLESERVERPORT_BUTTONS = """
|
|||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
POWERPORT_BUTTONS = """
|
POWERPORT_BUTTONS = _("""
|
||||||
{% if perms.dcim.add_inventoryitem %}
|
{% if perms.dcim.add_inventoryitem %}
|
||||||
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
||||||
@ -253,9 +255,9 @@ POWERPORT_BUTTONS = """
|
|||||||
{% else %}
|
{% else %}
|
||||||
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
POWEROUTLET_BUTTONS = """
|
POWEROUTLET_BUTTONS = _("""
|
||||||
{% if perms.dcim.add_inventoryitem %}
|
{% if perms.dcim.add_inventoryitem %}
|
||||||
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
||||||
@ -298,9 +300,9 @@ POWEROUTLET_BUTTONS = """
|
|||||||
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
INTERFACE_BUTTONS = """
|
INTERFACE_BUTTONS = _("""
|
||||||
{% if perms.dcim.change_interface %}
|
{% if perms.dcim.change_interface %}
|
||||||
<span class="dropdown">
|
<span class="dropdown">
|
||||||
<button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
|
<button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
|
||||||
@ -382,9 +384,9 @@ INTERFACE_BUTTONS = """
|
|||||||
<span class="mdi mdi-wifi-plus" aria-hidden="true"></span>
|
<span class="mdi mdi-wifi-plus" aria-hidden="true"></span>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
FRONTPORT_BUTTONS = """
|
FRONTPORT_BUTTONS = _("""
|
||||||
{% if perms.dcim.add_inventoryitem %}
|
{% if perms.dcim.add_inventoryitem %}
|
||||||
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
||||||
@ -437,9 +439,9 @@ FRONTPORT_BUTTONS = """
|
|||||||
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
REARPORT_BUTTONS = """
|
REARPORT_BUTTONS = _("""
|
||||||
{% if perms.dcim.add_inventoryitem %}
|
{% if perms.dcim.add_inventoryitem %}
|
||||||
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i>
|
||||||
@ -492,7 +494,7 @@ REARPORT_BUTTONS = """
|
|||||||
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
""")
|
||||||
|
|
||||||
DEVICEBAY_BUTTONS = """
|
DEVICEBAY_BUTTONS = """
|
||||||
{% if perms.dcim.change_devicebay %}
|
{% if perms.dcim.change_devicebay %}
|
||||||
|
Loading…
Reference in New Issue
Block a user