mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #13150: Wrap table column headers with gettext()
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
@ -24,7 +25,8 @@ CIRCUITTERMINATION_LINK = """
|
|||||||
|
|
||||||
class CircuitTypeTable(NetBoxTable):
|
class CircuitTypeTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True,
|
||||||
|
verbose_name=_('Name'),
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='circuits:circuittype_list'
|
url_name='circuits:circuittype_list'
|
||||||
@ -32,7 +34,7 @@ class CircuitTypeTable(NetBoxTable):
|
|||||||
circuit_count = columns.LinkedCountColumn(
|
circuit_count = columns.LinkedCountColumn(
|
||||||
viewname='circuits:circuit_list',
|
viewname='circuits:circuit_list',
|
||||||
url_params={'type_id': 'pk'},
|
url_params={'type_id': 'pk'},
|
||||||
verbose_name='Circuits'
|
verbose_name=_('Circuits')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -46,28 +48,31 @@ class CircuitTypeTable(NetBoxTable):
|
|||||||
class CircuitTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class CircuitTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
cid = tables.Column(
|
cid = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Circuit ID'
|
verbose_name=_('Circuit ID')
|
||||||
)
|
)
|
||||||
provider = tables.Column(
|
provider = tables.Column(
|
||||||
|
verbose_name=_('Provider'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
provider_account = tables.Column(
|
provider_account = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Account'
|
verbose_name=_('Account')
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
termination_a = tables.TemplateColumn(
|
termination_a = tables.TemplateColumn(
|
||||||
template_code=CIRCUITTERMINATION_LINK,
|
template_code=CIRCUITTERMINATION_LINK,
|
||||||
verbose_name='Side A'
|
verbose_name=_('Side A')
|
||||||
)
|
)
|
||||||
termination_z = tables.TemplateColumn(
|
termination_z = tables.TemplateColumn(
|
||||||
template_code=CIRCUITTERMINATION_LINK,
|
template_code=CIRCUITTERMINATION_LINK,
|
||||||
verbose_name='Side Z'
|
verbose_name=_('Side Z')
|
||||||
)
|
)
|
||||||
commit_rate = CommitRateColumn(
|
commit_rate = CommitRateColumn(
|
||||||
verbose_name='Commit Rate'
|
verbose_name=_('Commit Rate')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='circuits:circuit_list'
|
url_name='circuits:circuit_list'
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
from tenancy.tables import ContactsColumnMixin
|
from tenancy.tables import ContactsColumnMixin
|
||||||
@ -14,35 +15,38 @@ __all__ = (
|
|||||||
|
|
||||||
class ProviderTable(ContactsColumnMixin, NetBoxTable):
|
class ProviderTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
accounts = columns.ManyToManyColumn(
|
accounts = columns.ManyToManyColumn(
|
||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
verbose_name='Accounts'
|
verbose_name=_('Accounts')
|
||||||
)
|
)
|
||||||
account_count = columns.LinkedCountColumn(
|
account_count = columns.LinkedCountColumn(
|
||||||
accessor=tables.A('accounts__count'),
|
accessor=tables.A('accounts__count'),
|
||||||
viewname='circuits:provideraccount_list',
|
viewname='circuits:provideraccount_list',
|
||||||
url_params={'account_id': 'pk'},
|
url_params={'account_id': 'pk'},
|
||||||
verbose_name='Account Count'
|
verbose_name=_('Account Count')
|
||||||
)
|
)
|
||||||
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={'provider_id': 'pk'},
|
url_params={'provider_id': 'pk'},
|
||||||
verbose_name='ASN Count'
|
verbose_name=_('ASN Count')
|
||||||
)
|
)
|
||||||
circuit_count = columns.LinkedCountColumn(
|
circuit_count = columns.LinkedCountColumn(
|
||||||
accessor=Accessor('count_circuits'),
|
accessor=Accessor('count_circuits'),
|
||||||
viewname='circuits:circuit_list',
|
viewname='circuits:circuit_list',
|
||||||
url_params={'provider_id': 'pk'},
|
url_params={'provider_id': 'pk'},
|
||||||
verbose_name='Circuits'
|
verbose_name=_('Circuits')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='circuits:provider_list'
|
url_name='circuits:provider_list'
|
||||||
)
|
)
|
||||||
@ -58,19 +62,25 @@ class ProviderTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class ProviderAccountTable(ContactsColumnMixin, NetBoxTable):
|
class ProviderAccountTable(ContactsColumnMixin, NetBoxTable):
|
||||||
account = tables.Column(
|
account = tables.Column(
|
||||||
linkify=True
|
linkify=True,
|
||||||
|
verbose_name=_('Account'),
|
||||||
|
)
|
||||||
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
)
|
)
|
||||||
name = tables.Column()
|
|
||||||
provider = tables.Column(
|
provider = tables.Column(
|
||||||
|
verbose_name=_('Provider'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
circuit_count = columns.LinkedCountColumn(
|
circuit_count = columns.LinkedCountColumn(
|
||||||
accessor=Accessor('count_circuits'),
|
accessor=Accessor('count_circuits'),
|
||||||
viewname='circuits:circuit_list',
|
viewname='circuits:circuit_list',
|
||||||
url_params={'provider_account_id': 'pk'},
|
url_params={'provider_account_id': 'pk'},
|
||||||
verbose_name='Circuits'
|
verbose_name=_('Circuits')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='circuits:provideraccount_list'
|
url_name='circuits:provideraccount_list'
|
||||||
)
|
)
|
||||||
@ -86,12 +96,16 @@ class ProviderAccountTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class ProviderNetworkTable(NetBoxTable):
|
class ProviderNetworkTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
provider = tables.Column(
|
provider = tables.Column(
|
||||||
|
verbose_name=_('Provider'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='circuits:providernetwork_list'
|
url_name='circuits:providernetwork_list'
|
||||||
)
|
)
|
||||||
|
@ -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,12 +42,16 @@ 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(
|
||||||
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,23 +7,38 @@ 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(
|
||||||
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 django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
@ -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,82 +156,94 @@ 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')
|
||||||
)
|
)
|
||||||
oob_ip = tables.Column(
|
oob_ip = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='OOB IP'
|
verbose_name='OOB IP'
|
||||||
)
|
)
|
||||||
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
|
||||||
)
|
)
|
||||||
@ -282,21 +299,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):
|
||||||
@ -311,9 +333,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',)
|
||||||
)
|
)
|
||||||
@ -324,6 +348,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',
|
||||||
@ -331,39 +356,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')],
|
||||||
@ -384,6 +414,7 @@ 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'}}
|
||||||
@ -406,6 +437,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')],
|
||||||
@ -426,6 +458,7 @@ 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'),
|
||||||
@ -449,6 +482,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')],
|
||||||
@ -470,6 +504,7 @@ 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'),
|
||||||
@ -495,12 +530,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(
|
||||||
@ -519,6 +556,7 @@ 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'}}
|
||||||
@ -542,29 +580,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):
|
||||||
@ -573,25 +616,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=_('Management 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(
|
||||||
@ -612,6 +660,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>',
|
||||||
@ -619,14 +668,16 @@ 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(
|
||||||
extra_buttons=INTERFACE_BUTTONS
|
extra_buttons=INTERFACE_BUTTONS
|
||||||
@ -655,16 +706,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(
|
||||||
@ -685,6 +740,7 @@ 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'),
|
||||||
@ -710,12 +766,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'
|
||||||
)
|
)
|
||||||
@ -731,6 +790,7 @@ 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'),
|
||||||
@ -756,6 +816,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')],
|
||||||
@ -763,18 +824,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(
|
||||||
@ -793,6 +856,7 @@ 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'),
|
||||||
@ -812,6 +876,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')],
|
||||||
@ -819,18 +884,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
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -859,20 +927,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'
|
||||||
)
|
)
|
||||||
@ -891,6 +966,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'),
|
||||||
@ -910,14 +986,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'
|
||||||
)
|
)
|
||||||
@ -936,17 +1015,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'
|
||||||
)
|
)
|
||||||
@ -962,31 +1045,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 django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
@ -28,27 +29,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'
|
||||||
@ -73,62 +75,68 @@ 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')
|
||||||
|
)
|
||||||
|
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')
|
||||||
)
|
)
|
||||||
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')
|
||||||
)
|
)
|
||||||
console_port_template_count = tables.Column(
|
console_port_template_count = tables.Column(
|
||||||
verbose_name=_('Console ports')
|
verbose_name=_('Console Ports')
|
||||||
)
|
)
|
||||||
console_server_port_template_count = tables.Column(
|
console_server_port_template_count = tables.Column(
|
||||||
verbose_name=_('Console server ports')
|
verbose_name=_('Console Server Ports')
|
||||||
)
|
)
|
||||||
power_port_template_count = tables.Column(
|
power_port_template_count = tables.Column(
|
||||||
verbose_name=_('Power ports')
|
verbose_name=_('Power Ports')
|
||||||
)
|
)
|
||||||
power_outlet_template_count = tables.Column(
|
power_outlet_template_count = tables.Column(
|
||||||
verbose_name=_('Power outlets')
|
verbose_name=_('Power Outlets')
|
||||||
)
|
)
|
||||||
interface_template_count = tables.Column(
|
interface_template_count = tables.Column(
|
||||||
verbose_name=_('Interfaces')
|
verbose_name=_('Interfaces')
|
||||||
)
|
)
|
||||||
front_port_template_count = tables.Column(
|
front_port_template_count = tables.Column(
|
||||||
verbose_name=_('Front ports')
|
verbose_name=_('Front Ports')
|
||||||
)
|
)
|
||||||
rear_port_template_count = tables.Column(
|
rear_port_template_count = tables.Column(
|
||||||
verbose_name=_('Rear ports')
|
verbose_name=_('Rear Ports')
|
||||||
)
|
)
|
||||||
device_bay_template_count = tables.Column(
|
device_bay_template_count = tables.Column(
|
||||||
verbose_name=_('Device bays')
|
verbose_name=_('Device Bays')
|
||||||
)
|
)
|
||||||
module_bay_template_count = tables.Column(
|
module_bay_template_count = tables.Column(
|
||||||
verbose_name=_('Module bays')
|
verbose_name=_('Module Bays')
|
||||||
)
|
)
|
||||||
inventory_item_template_count = tables.Column(
|
inventory_item_template_count = tables.Column(
|
||||||
verbose_name=_('Inventory items')
|
verbose_name=_('Inventory Items')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -149,7 +157,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',)
|
||||||
@ -208,9 +216,11 @@ 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(
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
@ -228,9 +238,11 @@ 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(
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
@ -243,7 +255,9 @@ class FrontPortTemplateTable(ComponentTemplateTable):
|
|||||||
|
|
||||||
|
|
||||||
class RearPortTemplateTable(ComponentTemplateTable):
|
class RearPortTemplateTable(ComponentTemplateTable):
|
||||||
color = columns.ColorColumn()
|
color = columns.ColorColumn(
|
||||||
|
verbose_name=_('Color'),
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
|
||||||
@ -282,12 +296,15 @@ class InventoryItemTemplateTable(ComponentTemplateTable):
|
|||||||
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, TenancyColumnsMixin
|
from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin
|
||||||
@ -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=_('Power 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,26 +59,37 @@ class PowerPanelTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
# cannot traverse pass-through ports.
|
# cannot traverse pass-through ports.
|
||||||
class PowerFeedTable(TenancyColumnsMixin, CableTerminationTable):
|
class PowerFeedTable(TenancyColumnsMixin, 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)')
|
||||||
)
|
)
|
||||||
tenant = tables.Column(
|
tenant = tables.Column(
|
||||||
linkify=True
|
linkify=True,
|
||||||
|
verbose_name=_('Tenant')
|
||||||
|
)
|
||||||
|
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,21 +122,25 @@ 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'
|
||||||
|
@ -2,7 +2,7 @@ import json
|
|||||||
|
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from extras.models import *
|
from extras.models import *
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
@ -44,7 +44,9 @@ REVISION_BUTTONS = """
|
|||||||
|
|
||||||
|
|
||||||
class ConfigRevisionTable(NetBoxTable):
|
class ConfigRevisionTable(NetBoxTable):
|
||||||
is_active = columns.BooleanColumn()
|
is_active = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Is Active'),
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=('delete',),
|
actions=('delete',),
|
||||||
extra_buttons=REVISION_BUTTONS
|
extra_buttons=REVISION_BUTTONS
|
||||||
@ -60,20 +62,33 @@ class ConfigRevisionTable(NetBoxTable):
|
|||||||
|
|
||||||
class CustomFieldTable(NetBoxTable):
|
class CustomFieldTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
content_types = columns.ContentTypesColumn()
|
content_types = columns.ContentTypesColumn(
|
||||||
required = columns.BooleanColumn()
|
verbose_name=_('Content Types')
|
||||||
ui_visibility = columns.ChoiceFieldColumn(verbose_name="UI visibility")
|
)
|
||||||
description = columns.MarkdownColumn()
|
required = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Required')
|
||||||
|
)
|
||||||
|
ui_visibility = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('UI Visibility')
|
||||||
|
)
|
||||||
|
description = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Description')
|
||||||
|
)
|
||||||
choice_set = tables.Column(
|
choice_set = tables.Column(
|
||||||
linkify=True
|
linkify=True,
|
||||||
|
verbose_name=_('Choice Set')
|
||||||
)
|
)
|
||||||
choices = columns.ChoicesColumn(
|
choices = columns.ChoicesColumn(
|
||||||
max_items=10,
|
max_items=10,
|
||||||
orderable=False
|
orderable=False,
|
||||||
|
verbose_name=_('Choices')
|
||||||
|
)
|
||||||
|
is_cloneable = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Is Cloneable'),
|
||||||
)
|
)
|
||||||
is_cloneable = columns.BooleanColumn()
|
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = CustomField
|
model = CustomField
|
||||||
@ -87,6 +102,7 @@ class CustomFieldTable(NetBoxTable):
|
|||||||
|
|
||||||
class CustomFieldChoiceSetTable(NetBoxTable):
|
class CustomFieldChoiceSetTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
base_choices = columns.ChoiceFieldColumn()
|
base_choices = columns.ChoiceFieldColumn()
|
||||||
@ -103,7 +119,9 @@ class CustomFieldChoiceSetTable(NetBoxTable):
|
|||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name=_('Count')
|
verbose_name=_('Count')
|
||||||
)
|
)
|
||||||
order_alphabetically = columns.BooleanColumn()
|
order_alphabetically = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Order Alphabetically'),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = CustomFieldChoiceSet
|
model = CustomFieldChoiceSet
|
||||||
@ -116,11 +134,18 @@ class CustomFieldChoiceSetTable(NetBoxTable):
|
|||||||
|
|
||||||
class CustomLinkTable(NetBoxTable):
|
class CustomLinkTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
content_types = columns.ContentTypesColumn()
|
content_types = columns.ContentTypesColumn(
|
||||||
enabled = columns.BooleanColumn()
|
verbose_name=_('Content Types'),
|
||||||
new_window = columns.BooleanColumn()
|
)
|
||||||
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
|
new_window = columns.BooleanColumn(
|
||||||
|
verbose_name=_('New Window'),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = CustomLink
|
model = CustomLink
|
||||||
@ -133,19 +158,26 @@ class CustomLinkTable(NetBoxTable):
|
|||||||
|
|
||||||
class ExportTemplateTable(NetBoxTable):
|
class ExportTemplateTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
content_types = columns.ContentTypesColumn()
|
content_types = columns.ContentTypesColumn(
|
||||||
as_attachment = columns.BooleanColumn()
|
verbose_name=_('Content Types'),
|
||||||
|
)
|
||||||
|
as_attachment = columns.BooleanColumn(
|
||||||
|
verbose_name=_('As Attachment'),
|
||||||
|
)
|
||||||
data_source = tables.Column(
|
data_source = tables.Column(
|
||||||
|
verbose_name=_('Data Source'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
data_file = tables.Column(
|
data_file = tables.Column(
|
||||||
|
verbose_name=_('Data File'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
is_synced = columns.BooleanColumn(
|
is_synced = columns.BooleanColumn(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Synced'
|
verbose_name=_('Synced')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -161,18 +193,23 @@ class ExportTemplateTable(NetBoxTable):
|
|||||||
|
|
||||||
class ImageAttachmentTable(NetBoxTable):
|
class ImageAttachmentTable(NetBoxTable):
|
||||||
id = tables.Column(
|
id = tables.Column(
|
||||||
|
verbose_name=_('ID'),
|
||||||
linkify=False
|
linkify=False
|
||||||
)
|
)
|
||||||
content_type = columns.ContentTypeColumn()
|
content_type = columns.ContentTypeColumn(
|
||||||
|
verbose_name=_('Content Type'),
|
||||||
|
)
|
||||||
parent = tables.Column(
|
parent = tables.Column(
|
||||||
|
verbose_name=_('Parent'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
image = tables.TemplateColumn(
|
image = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Image'),
|
||||||
template_code=IMAGEATTACHMENT_IMAGE,
|
template_code=IMAGEATTACHMENT_IMAGE,
|
||||||
)
|
)
|
||||||
size = tables.Column(
|
size = tables.Column(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Size (bytes)'
|
verbose_name=_('Size (Bytes)')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -186,11 +223,18 @@ class ImageAttachmentTable(NetBoxTable):
|
|||||||
|
|
||||||
class SavedFilterTable(NetBoxTable):
|
class SavedFilterTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
content_types = columns.ContentTypesColumn()
|
content_types = columns.ContentTypesColumn(
|
||||||
enabled = columns.BooleanColumn()
|
verbose_name=_('Content Types'),
|
||||||
shared = columns.BooleanColumn()
|
)
|
||||||
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
|
shared = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Shared'),
|
||||||
|
)
|
||||||
|
|
||||||
def value_parameters(self, value):
|
def value_parameters(self, value):
|
||||||
return json.dumps(value)
|
return json.dumps(value)
|
||||||
@ -207,8 +251,11 @@ class SavedFilterTable(NetBoxTable):
|
|||||||
|
|
||||||
|
|
||||||
class BookmarkTable(NetBoxTable):
|
class BookmarkTable(NetBoxTable):
|
||||||
object_type = columns.ContentTypeColumn()
|
object_type = columns.ContentTypeColumn(
|
||||||
|
verbose_name=_('Object Types'),
|
||||||
|
)
|
||||||
object = tables.Column(
|
object = tables.Column(
|
||||||
|
verbose_name=_('Object'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
@ -223,27 +270,32 @@ class BookmarkTable(NetBoxTable):
|
|||||||
|
|
||||||
class WebhookTable(NetBoxTable):
|
class WebhookTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
content_types = columns.ContentTypesColumn()
|
content_types = columns.ContentTypesColumn(
|
||||||
enabled = columns.BooleanColumn()
|
verbose_name=_('Content Types'),
|
||||||
|
)
|
||||||
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
type_create = columns.BooleanColumn(
|
type_create = columns.BooleanColumn(
|
||||||
verbose_name='Create'
|
verbose_name=_('Create')
|
||||||
)
|
)
|
||||||
type_update = columns.BooleanColumn(
|
type_update = columns.BooleanColumn(
|
||||||
verbose_name='Update'
|
verbose_name=_('Update')
|
||||||
)
|
)
|
||||||
type_delete = columns.BooleanColumn(
|
type_delete = columns.BooleanColumn(
|
||||||
verbose_name='Delete'
|
verbose_name=_('Delete')
|
||||||
)
|
)
|
||||||
type_job_start = columns.BooleanColumn(
|
type_job_start = columns.BooleanColumn(
|
||||||
verbose_name='Job start'
|
verbose_name=_('Job Start')
|
||||||
)
|
)
|
||||||
type_job_end = columns.BooleanColumn(
|
type_job_end = columns.BooleanColumn(
|
||||||
verbose_name='Job end'
|
verbose_name=_('Job End')
|
||||||
)
|
)
|
||||||
ssl_validation = columns.BooleanColumn(
|
ssl_validation = columns.BooleanColumn(
|
||||||
verbose_name='SSL Validation'
|
verbose_name=_('SSL Validation')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -261,10 +313,15 @@ class WebhookTable(NetBoxTable):
|
|||||||
|
|
||||||
class TagTable(NetBoxTable):
|
class TagTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
color = columns.ColorColumn()
|
color = columns.ColorColumn(
|
||||||
object_types = columns.ContentTypesColumn()
|
verbose_name=_('Color'),
|
||||||
|
)
|
||||||
|
object_types = columns.ContentTypesColumn(
|
||||||
|
verbose_name=_('Object Types'),
|
||||||
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Tag
|
model = Tag
|
||||||
@ -277,17 +334,17 @@ class TagTable(NetBoxTable):
|
|||||||
|
|
||||||
class TaggedItemTable(NetBoxTable):
|
class TaggedItemTable(NetBoxTable):
|
||||||
id = tables.Column(
|
id = tables.Column(
|
||||||
verbose_name='ID',
|
verbose_name=_('ID'),
|
||||||
linkify=lambda record: record.content_object.get_absolute_url(),
|
linkify=lambda record: record.content_object.get_absolute_url(),
|
||||||
accessor='content_object__id'
|
accessor='content_object__id'
|
||||||
)
|
)
|
||||||
content_type = columns.ContentTypeColumn(
|
content_type = columns.ContentTypeColumn(
|
||||||
verbose_name='Type'
|
verbose_name=_('Type')
|
||||||
)
|
)
|
||||||
content_object = tables.Column(
|
content_object = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Object'
|
verbose_name=_('Object')
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=()
|
actions=()
|
||||||
@ -300,20 +357,23 @@ class TaggedItemTable(NetBoxTable):
|
|||||||
|
|
||||||
class ConfigContextTable(NetBoxTable):
|
class ConfigContextTable(NetBoxTable):
|
||||||
data_source = tables.Column(
|
data_source = tables.Column(
|
||||||
|
verbose_name=_('Data Source'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
data_file = tables.Column(
|
data_file = tables.Column(
|
||||||
|
verbose_name=_('Data File'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
is_active = columns.BooleanColumn(
|
is_active = columns.BooleanColumn(
|
||||||
verbose_name='Active'
|
verbose_name=_('Active')
|
||||||
)
|
)
|
||||||
is_synced = columns.BooleanColumn(
|
is_synced = columns.BooleanColumn(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Synced'
|
verbose_name=_('Synced')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
@ -328,17 +388,20 @@ class ConfigContextTable(NetBoxTable):
|
|||||||
|
|
||||||
class ConfigTemplateTable(NetBoxTable):
|
class ConfigTemplateTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
data_source = tables.Column(
|
data_source = tables.Column(
|
||||||
|
verbose_name=_('Data Source'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
data_file = tables.Column(
|
data_file = tables.Column(
|
||||||
|
verbose_name=_('Data File'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
is_synced = columns.BooleanColumn(
|
is_synced = columns.BooleanColumn(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Synced'
|
verbose_name=_('Synced')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='extras:configtemplate_list'
|
url_name='extras:configtemplate_list'
|
||||||
@ -357,31 +420,34 @@ class ConfigTemplateTable(NetBoxTable):
|
|||||||
|
|
||||||
class ObjectChangeTable(NetBoxTable):
|
class ObjectChangeTable(NetBoxTable):
|
||||||
time = tables.DateTimeColumn(
|
time = tables.DateTimeColumn(
|
||||||
|
verbose_name=_('Time'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
format=settings.SHORT_DATETIME_FORMAT
|
format=settings.SHORT_DATETIME_FORMAT
|
||||||
)
|
)
|
||||||
user_name = tables.Column(
|
user_name = tables.Column(
|
||||||
verbose_name='Username'
|
verbose_name=_('Username')
|
||||||
)
|
)
|
||||||
full_name = tables.TemplateColumn(
|
full_name = tables.TemplateColumn(
|
||||||
accessor=tables.A('user'),
|
accessor=tables.A('user'),
|
||||||
template_code=OBJECTCHANGE_FULL_NAME,
|
template_code=OBJECTCHANGE_FULL_NAME,
|
||||||
verbose_name='Full Name',
|
verbose_name=_('Full Name'),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
action = columns.ChoiceFieldColumn()
|
action = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Action'),
|
||||||
|
)
|
||||||
changed_object_type = columns.ContentTypeColumn(
|
changed_object_type = columns.ContentTypeColumn(
|
||||||
verbose_name='Type'
|
verbose_name=_('Type')
|
||||||
)
|
)
|
||||||
object_repr = tables.TemplateColumn(
|
object_repr = tables.TemplateColumn(
|
||||||
accessor=tables.A('changed_object'),
|
accessor=tables.A('changed_object'),
|
||||||
template_code=OBJECTCHANGE_OBJECT,
|
template_code=OBJECTCHANGE_OBJECT,
|
||||||
verbose_name='Object',
|
verbose_name=_('Object'),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
request_id = tables.TemplateColumn(
|
request_id = tables.TemplateColumn(
|
||||||
template_code=OBJECTCHANGE_REQUEST_ID,
|
template_code=OBJECTCHANGE_REQUEST_ID,
|
||||||
verbose_name='Request ID'
|
verbose_name=_('Request ID')
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=()
|
actions=()
|
||||||
@ -397,23 +463,28 @@ class ObjectChangeTable(NetBoxTable):
|
|||||||
|
|
||||||
class JournalEntryTable(NetBoxTable):
|
class JournalEntryTable(NetBoxTable):
|
||||||
created = tables.DateTimeColumn(
|
created = tables.DateTimeColumn(
|
||||||
|
verbose_name=_('Created'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
format=settings.SHORT_DATETIME_FORMAT
|
format=settings.SHORT_DATETIME_FORMAT
|
||||||
)
|
)
|
||||||
assigned_object_type = columns.ContentTypeColumn(
|
assigned_object_type = columns.ContentTypeColumn(
|
||||||
verbose_name='Object type'
|
verbose_name=_('Object Type')
|
||||||
)
|
)
|
||||||
assigned_object = tables.Column(
|
assigned_object = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Object'
|
verbose_name=_('Object')
|
||||||
|
)
|
||||||
|
kind = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Kind'),
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
kind = columns.ChoiceFieldColumn()
|
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
comments_short = tables.TemplateColumn(
|
comments_short = tables.TemplateColumn(
|
||||||
accessor=tables.A('comments'),
|
accessor=tables.A('comments'),
|
||||||
template_code='{{ value|markdown|truncatewords_html:50 }}',
|
template_code='{{ value|markdown|truncatewords_html:50 }}',
|
||||||
verbose_name='Comments (Short)'
|
verbose_name=_('Comments (Short)')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='extras:journalentry_list'
|
url_name='extras:journalentry_list'
|
||||||
|
@ -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 ipam.models import *
|
from ipam.models import *
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
@ -13,9 +13,11 @@ __all__ = (
|
|||||||
|
|
||||||
class ASNRangeTable(TenancyColumnsMixin, NetBoxTable):
|
class ASNRangeTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rir = tables.Column(
|
rir = tables.Column(
|
||||||
|
verbose_name=_('RIR'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -36,9 +38,11 @@ class ASNRangeTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
|
|
||||||
class ASNTable(TenancyColumnsMixin, NetBoxTable):
|
class ASNTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
asn = tables.Column(
|
asn = tables.Column(
|
||||||
|
verbose_name=_('ASN'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rir = tables.Column(
|
rir = tables.Column(
|
||||||
|
verbose_name=_('RIR'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
asn_asdot = tables.Column(
|
asn_asdot = tables.Column(
|
||||||
@ -60,7 +64,9 @@ class ASNTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
verbose_name=_('Sites')
|
verbose_name=_('Sites')
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:asn_list'
|
url_name='ipam:asn_list'
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
@ -18,17 +19,20 @@ IPADDRESSES = """
|
|||||||
|
|
||||||
class FHRPGroupTable(NetBoxTable):
|
class FHRPGroupTable(NetBoxTable):
|
||||||
group_id = tables.Column(
|
group_id = tables.Column(
|
||||||
|
verbose_name=_('Group ID'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
ip_addresses = tables.TemplateColumn(
|
ip_addresses = tables.TemplateColumn(
|
||||||
template_code=IPADDRESSES,
|
template_code=IPADDRESSES,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='IP Addresses'
|
verbose_name=_('IP Addresses')
|
||||||
)
|
)
|
||||||
member_count = tables.Column(
|
member_count = tables.Column(
|
||||||
verbose_name='Members'
|
verbose_name=_('Members')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:fhrpgroup_list'
|
url_name='ipam:fhrpgroup_list'
|
||||||
)
|
)
|
||||||
@ -52,13 +56,15 @@ class FHRPGroupAssignmentTable(NetBoxTable):
|
|||||||
accessor=tables.A('interface__parent_object'),
|
accessor=tables.A('interface__parent_object'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Parent'
|
verbose_name=_('Parent')
|
||||||
)
|
)
|
||||||
interface = tables.Column(
|
interface = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False
|
orderable=False,
|
||||||
|
verbose_name=_('Interface'),
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
@ -81,15 +82,16 @@ VRF_LINK = """
|
|||||||
|
|
||||||
class RIRTable(NetBoxTable):
|
class RIRTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
is_private = columns.BooleanColumn(
|
is_private = columns.BooleanColumn(
|
||||||
verbose_name='Private'
|
verbose_name=_('Private')
|
||||||
)
|
)
|
||||||
aggregate_count = columns.LinkedCountColumn(
|
aggregate_count = columns.LinkedCountColumn(
|
||||||
viewname='ipam:aggregate_list',
|
viewname='ipam:aggregate_list',
|
||||||
url_params={'rir_id': 'pk'},
|
url_params={'rir_id': 'pk'},
|
||||||
verbose_name='Aggregates'
|
verbose_name=_('Aggregates')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:rir_list'
|
url_name='ipam:rir_list'
|
||||||
@ -111,7 +113,7 @@ class RIRTable(NetBoxTable):
|
|||||||
class AggregateTable(TenancyColumnsMixin, NetBoxTable):
|
class AggregateTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
prefix = tables.Column(
|
prefix = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Aggregate',
|
verbose_name=_('Aggregate'),
|
||||||
attrs={
|
attrs={
|
||||||
# Allow the aggregate to be copied to the clipboard
|
# Allow the aggregate to be copied to the clipboard
|
||||||
'a': {'id': lambda record: f"aggregate_{record.pk}"}
|
'a': {'id': lambda record: f"aggregate_{record.pk}"}
|
||||||
@ -119,16 +121,19 @@ class AggregateTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
)
|
)
|
||||||
date_added = tables.DateColumn(
|
date_added = tables.DateColumn(
|
||||||
format="Y-m-d",
|
format="Y-m-d",
|
||||||
verbose_name='Added'
|
verbose_name=_('Added')
|
||||||
)
|
)
|
||||||
child_count = tables.Column(
|
child_count = tables.Column(
|
||||||
verbose_name='Prefixes'
|
verbose_name=_('Prefixes')
|
||||||
)
|
)
|
||||||
utilization = columns.UtilizationColumn(
|
utilization = columns.UtilizationColumn(
|
||||||
|
verbose_name=_('Utilization'),
|
||||||
accessor='get_utilization',
|
accessor='get_utilization',
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:aggregate_list'
|
url_name='ipam:aggregate_list'
|
||||||
)
|
)
|
||||||
@ -151,22 +156,23 @@ class AggregateTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
|
|
||||||
class RoleTable(NetBoxTable):
|
class RoleTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
prefix_count = columns.LinkedCountColumn(
|
prefix_count = columns.LinkedCountColumn(
|
||||||
viewname='ipam:prefix_list',
|
viewname='ipam:prefix_list',
|
||||||
url_params={'role_id': 'pk'},
|
url_params={'role_id': 'pk'},
|
||||||
verbose_name='Prefixes'
|
verbose_name=_('Prefixes')
|
||||||
)
|
)
|
||||||
iprange_count = columns.LinkedCountColumn(
|
iprange_count = columns.LinkedCountColumn(
|
||||||
viewname='ipam:iprange_list',
|
viewname='ipam:iprange_list',
|
||||||
url_params={'role_id': 'pk'},
|
url_params={'role_id': 'pk'},
|
||||||
verbose_name='IP Ranges'
|
verbose_name=_('IP Ranges')
|
||||||
)
|
)
|
||||||
vlan_count = columns.LinkedCountColumn(
|
vlan_count = columns.LinkedCountColumn(
|
||||||
viewname='ipam:vlan_list',
|
viewname='ipam:vlan_list',
|
||||||
url_params={'role_id': 'pk'},
|
url_params={'role_id': 'pk'},
|
||||||
verbose_name='VLANs'
|
verbose_name=_('VLANs')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:role_list'
|
url_name='ipam:role_list'
|
||||||
@ -202,6 +208,7 @@ class PrefixUtilizationColumn(columns.UtilizationColumn):
|
|||||||
|
|
||||||
class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
prefix = columns.TemplateColumn(
|
prefix = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Prefix'),
|
||||||
template_code=PREFIX_LINK_WITH_DEPTH,
|
template_code=PREFIX_LINK_WITH_DEPTH,
|
||||||
export_raw=True,
|
export_raw=True,
|
||||||
attrs={'td': {'class': 'text-nowrap'}}
|
attrs={'td': {'class': 'text-nowrap'}}
|
||||||
@ -210,11 +217,11 @@ class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
accessor=Accessor('prefix'),
|
accessor=Accessor('prefix'),
|
||||||
template_code=PREFIX_LINK,
|
template_code=PREFIX_LINK,
|
||||||
export_raw=True,
|
export_raw=True,
|
||||||
verbose_name='Prefix (Flat)'
|
verbose_name=_('Prefix (Flat)')
|
||||||
)
|
)
|
||||||
depth = tables.Column(
|
depth = tables.Column(
|
||||||
accessor=Accessor('_depth'),
|
accessor=Accessor('_depth'),
|
||||||
verbose_name='Depth'
|
verbose_name=_('Depth')
|
||||||
)
|
)
|
||||||
children = columns.LinkedCountColumn(
|
children = columns.LinkedCountColumn(
|
||||||
accessor=Accessor('_children'),
|
accessor=Accessor('_children'),
|
||||||
@ -223,41 +230,47 @@ class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
'vrf_id': 'vrf_id',
|
'vrf_id': 'vrf_id',
|
||||||
'within': 'prefix',
|
'within': 'prefix',
|
||||||
},
|
},
|
||||||
verbose_name='Children'
|
verbose_name=_('Children')
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn(
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
default=AVAILABLE_LABEL
|
default=AVAILABLE_LABEL
|
||||||
)
|
)
|
||||||
vrf = tables.TemplateColumn(
|
vrf = tables.TemplateColumn(
|
||||||
template_code=VRF_LINK,
|
template_code=VRF_LINK,
|
||||||
verbose_name='VRF'
|
verbose_name=_('VRF')
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
vlan_group = tables.Column(
|
vlan_group = tables.Column(
|
||||||
accessor='vlan__group',
|
accessor='vlan__group',
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='VLAN Group'
|
verbose_name=_('VLAN Group')
|
||||||
)
|
)
|
||||||
vlan = tables.Column(
|
vlan = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='VLAN'
|
verbose_name=_('VLAN')
|
||||||
)
|
)
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
is_pool = columns.BooleanColumn(
|
is_pool = columns.BooleanColumn(
|
||||||
verbose_name='Pool'
|
verbose_name=_('Pool')
|
||||||
)
|
)
|
||||||
mark_utilized = columns.BooleanColumn(
|
mark_utilized = columns.BooleanColumn(
|
||||||
verbose_name='Marked Utilized'
|
verbose_name=_('Marked Utilized')
|
||||||
)
|
)
|
||||||
utilization = PrefixUtilizationColumn(
|
utilization = PrefixUtilizationColumn(
|
||||||
|
verbose_name=_('Utilization'),
|
||||||
accessor='get_utilization',
|
accessor='get_utilization',
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:prefix_list'
|
url_name='ipam:prefix_list'
|
||||||
)
|
)
|
||||||
@ -285,26 +298,32 @@ class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
#
|
#
|
||||||
class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
start_address = tables.Column(
|
start_address = tables.Column(
|
||||||
|
verbose_name=_('Start address'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
vrf = tables.TemplateColumn(
|
vrf = tables.TemplateColumn(
|
||||||
template_code=VRF_LINK,
|
template_code=VRF_LINK,
|
||||||
verbose_name='VRF'
|
verbose_name=_('VRF')
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn(
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
default=AVAILABLE_LABEL
|
default=AVAILABLE_LABEL
|
||||||
)
|
)
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
mark_utilized = columns.BooleanColumn(
|
mark_utilized = columns.BooleanColumn(
|
||||||
verbose_name='Marked Utilized'
|
verbose_name=_('Marked Utilized')
|
||||||
)
|
)
|
||||||
utilization = columns.UtilizationColumn(
|
utilization = columns.UtilizationColumn(
|
||||||
|
verbose_name=_('Utilization'),
|
||||||
accessor='utilization',
|
accessor='utilization',
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:iprange_list'
|
url_name='ipam:iprange_list'
|
||||||
)
|
)
|
||||||
@ -330,43 +349,48 @@ class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
class IPAddressTable(TenancyColumnsMixin, NetBoxTable):
|
class IPAddressTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
address = tables.TemplateColumn(
|
address = tables.TemplateColumn(
|
||||||
template_code=IPADDRESS_LINK,
|
template_code=IPADDRESS_LINK,
|
||||||
verbose_name='IP Address'
|
verbose_name=_('IP Address')
|
||||||
)
|
)
|
||||||
vrf = tables.TemplateColumn(
|
vrf = tables.TemplateColumn(
|
||||||
template_code=VRF_LINK,
|
template_code=VRF_LINK,
|
||||||
verbose_name='VRF'
|
verbose_name=_('VRF')
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn(
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
default=AVAILABLE_LABEL
|
default=AVAILABLE_LABEL
|
||||||
)
|
)
|
||||||
role = columns.ChoiceFieldColumn()
|
role = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Role'),
|
||||||
|
)
|
||||||
assigned_object = tables.Column(
|
assigned_object = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Interface'
|
verbose_name=_('Interface')
|
||||||
)
|
)
|
||||||
assigned_object_parent = tables.Column(
|
assigned_object_parent = tables.Column(
|
||||||
accessor='assigned_object__parent_object',
|
accessor='assigned_object__parent_object',
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Device/VM'
|
verbose_name=_('Parent')
|
||||||
)
|
)
|
||||||
nat_inside = tables.Column(
|
nat_inside = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='NAT (Inside)'
|
verbose_name=_('NAT (Inside)')
|
||||||
)
|
)
|
||||||
nat_outside = tables.ManyToManyColumn(
|
nat_outside = tables.ManyToManyColumn(
|
||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='NAT (Outside)'
|
verbose_name=_('NAT (Outside)')
|
||||||
)
|
)
|
||||||
assigned = columns.BooleanColumn(
|
assigned = columns.BooleanColumn(
|
||||||
accessor='assigned_object_id',
|
accessor='assigned_object_id',
|
||||||
linkify=lambda record: record.assigned_object.get_absolute_url(),
|
linkify=lambda record: record.assigned_object.get_absolute_url(),
|
||||||
verbose_name='Assigned'
|
verbose_name=_('Assigned')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:ipaddress_list'
|
url_name='ipam:ipaddress_list'
|
||||||
)
|
)
|
||||||
@ -391,10 +415,13 @@ class IPAddressTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
class IPAddressAssignTable(NetBoxTable):
|
class IPAddressAssignTable(NetBoxTable):
|
||||||
address = tables.TemplateColumn(
|
address = tables.TemplateColumn(
|
||||||
template_code=IPADDRESS_ASSIGN_LINK,
|
template_code=IPADDRESS_ASSIGN_LINK,
|
||||||
verbose_name='IP Address'
|
verbose_name=_('IP Address')
|
||||||
|
)
|
||||||
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
|
||||||
assigned_object = tables.Column(
|
assigned_object = tables.Column(
|
||||||
|
verbose_name=_('Assigned Object'),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -411,14 +438,18 @@ class AssignedIPAddressesTable(NetBoxTable):
|
|||||||
"""
|
"""
|
||||||
address = tables.Column(
|
address = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IP Address'
|
verbose_name=_('IP Address')
|
||||||
)
|
)
|
||||||
vrf = tables.TemplateColumn(
|
vrf = tables.TemplateColumn(
|
||||||
template_code=VRF_LINK,
|
template_code=VRF_LINK,
|
||||||
verbose_name='VRF'
|
verbose_name=_('VRF')
|
||||||
|
)
|
||||||
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
|
)
|
||||||
|
tenant = TenantColumn(
|
||||||
|
verbose_name=_('Tenant'),
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
|
||||||
tenant = TenantColumn()
|
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = IPAddress
|
model = IPAddress
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from ipam.models import L2VPN, L2VPNTermination
|
from ipam.models import L2VPN, L2VPNTermination
|
||||||
@ -19,17 +20,22 @@ L2VPN_TARGETS = """
|
|||||||
class L2VPNTable(TenancyColumnsMixin, NetBoxTable):
|
class L2VPNTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
pk = columns.ToggleColumn()
|
pk = columns.ToggleColumn()
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
import_targets = columns.TemplateColumn(
|
import_targets = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Import Targets'),
|
||||||
template_code=L2VPN_TARGETS,
|
template_code=L2VPN_TARGETS,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
export_targets = columns.TemplateColumn(
|
export_targets = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Export Targets'),
|
||||||
template_code=L2VPN_TARGETS,
|
template_code=L2VPN_TARGETS,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:l2vpn_list'
|
url_name='ipam:l2vpn_list'
|
||||||
)
|
)
|
||||||
@ -46,26 +52,26 @@ class L2VPNTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
class L2VPNTerminationTable(NetBoxTable):
|
class L2VPNTerminationTable(NetBoxTable):
|
||||||
pk = columns.ToggleColumn()
|
pk = columns.ToggleColumn()
|
||||||
l2vpn = tables.Column(
|
l2vpn = tables.Column(
|
||||||
verbose_name='L2VPN',
|
verbose_name=_('L2VPN'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
assigned_object_type = columns.ContentTypeColumn(
|
assigned_object_type = columns.ContentTypeColumn(
|
||||||
verbose_name='Object Type'
|
verbose_name=_('Object Type')
|
||||||
)
|
)
|
||||||
assigned_object = tables.Column(
|
assigned_object = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Object'
|
verbose_name=_('Object')
|
||||||
)
|
)
|
||||||
assigned_object_parent = tables.Column(
|
assigned_object_parent = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Object Parent'
|
verbose_name=_('Object Parent')
|
||||||
)
|
)
|
||||||
assigned_object_site = tables.Column(
|
assigned_object_site = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Object Site'
|
verbose_name=_('Object Site')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
@ -11,13 +12,17 @@ __all__ = (
|
|||||||
|
|
||||||
class ServiceTemplateTable(NetBoxTable):
|
class ServiceTemplateTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
ports = tables.Column(
|
ports = tables.Column(
|
||||||
|
verbose_name=_('Ports'),
|
||||||
accessor=tables.A('port_list'),
|
accessor=tables.A('port_list'),
|
||||||
order_by=tables.A('ports'),
|
order_by=tables.A('ports'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:servicetemplate_list'
|
url_name='ipam:servicetemplate_list'
|
||||||
)
|
)
|
||||||
@ -32,17 +37,22 @@ class ServiceTemplateTable(NetBoxTable):
|
|||||||
|
|
||||||
class ServiceTable(NetBoxTable):
|
class ServiceTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
parent = tables.Column(
|
parent = tables.Column(
|
||||||
|
verbose_name=_('Parent'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
order_by=('device', 'virtual_machine')
|
order_by=('device', 'virtual_machine')
|
||||||
)
|
)
|
||||||
ports = tables.Column(
|
ports = tables.Column(
|
||||||
|
verbose_name=_('Ports'),
|
||||||
accessor=tables.A('port_list'),
|
accessor=tables.A('port_list'),
|
||||||
order_by=tables.A('ports'),
|
order_by=tables.A('ports'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:service_list'
|
url_name='ipam:service_list'
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
|
|
||||||
from dcim.models import Interface
|
from dcim.models import Interface
|
||||||
@ -59,20 +60,26 @@ VLAN_MEMBER_TAGGED = """
|
|||||||
#
|
#
|
||||||
|
|
||||||
class VLANGroupTable(NetBoxTable):
|
class VLANGroupTable(NetBoxTable):
|
||||||
name = tables.Column(linkify=True)
|
name = tables.Column(
|
||||||
scope_type = columns.ContentTypeColumn()
|
verbose_name=_('Name'),
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
|
scope_type = columns.ContentTypeColumn(
|
||||||
|
verbose_name=_('Scope Type'),
|
||||||
|
)
|
||||||
scope = tables.Column(
|
scope = tables.Column(
|
||||||
|
verbose_name=_('Scope'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
vlan_count = columns.LinkedCountColumn(
|
vlan_count = columns.LinkedCountColumn(
|
||||||
viewname='ipam:vlan_list',
|
viewname='ipam:vlan_list',
|
||||||
url_params={'group_id': 'pk'},
|
url_params={'group_id': 'pk'},
|
||||||
verbose_name='VLANs'
|
verbose_name=_('VLANs')
|
||||||
)
|
)
|
||||||
utilization = columns.UtilizationColumn(
|
utilization = columns.UtilizationColumn(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Utilization'
|
verbose_name=_('Utilization')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:vlangroup_list'
|
url_name='ipam:vlangroup_list'
|
||||||
@ -97,35 +104,42 @@ class VLANGroupTable(NetBoxTable):
|
|||||||
class VLANTable(TenancyColumnsMixin, NetBoxTable):
|
class VLANTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
vid = tables.TemplateColumn(
|
vid = tables.TemplateColumn(
|
||||||
template_code=VLAN_LINK,
|
template_code=VLAN_LINK,
|
||||||
verbose_name='VID'
|
verbose_name=_('VID')
|
||||||
)
|
)
|
||||||
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
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn(
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
default=AVAILABLE_LABEL
|
default=AVAILABLE_LABEL
|
||||||
)
|
)
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
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')
|
||||||
)
|
)
|
||||||
prefixes = columns.TemplateColumn(
|
prefixes = columns.TemplateColumn(
|
||||||
template_code=VLAN_PREFIXES,
|
template_code=VLAN_PREFIXES,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Prefixes'
|
verbose_name=_('Prefixes')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:vlan_list'
|
url_name='ipam:vlan_list'
|
||||||
)
|
)
|
||||||
@ -148,9 +162,10 @@ class VLANMembersTable(NetBoxTable):
|
|||||||
"""
|
"""
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Interface'
|
verbose_name=_('Interface')
|
||||||
)
|
)
|
||||||
tagged = tables.TemplateColumn(
|
tagged = tables.TemplateColumn(
|
||||||
|
verbose_name=_('Tagged'),
|
||||||
template_code=VLAN_MEMBER_TAGGED,
|
template_code=VLAN_MEMBER_TAGGED,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
@ -158,6 +173,7 @@ class VLANMembersTable(NetBoxTable):
|
|||||||
|
|
||||||
class VLANDevicesTable(VLANMembersTable):
|
class VLANDevicesTable(VLANMembersTable):
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
@ -172,6 +188,7 @@ class VLANDevicesTable(VLANMembersTable):
|
|||||||
|
|
||||||
class VLANVirtualMachinesTable(VLANMembersTable):
|
class VLANVirtualMachinesTable(VLANMembersTable):
|
||||||
virtual_machine = tables.Column(
|
virtual_machine = tables.Column(
|
||||||
|
verbose_name=_('Virtual Machine'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
@ -190,19 +207,27 @@ class InterfaceVLANTable(NetBoxTable):
|
|||||||
"""
|
"""
|
||||||
vid = tables.Column(
|
vid = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='ID'
|
verbose_name=_('VID')
|
||||||
|
)
|
||||||
|
tagged = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Tagged'),
|
||||||
)
|
)
|
||||||
tagged = columns.BooleanColumn()
|
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
|
verbose_name=_('Site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
accessor=Accessor('group__name'),
|
accessor=Accessor('group__name'),
|
||||||
verbose_name='Group'
|
verbose_name=_('Group')
|
||||||
|
)
|
||||||
|
tenant = TenantColumn(
|
||||||
|
verbose_name=_('Tenant'),
|
||||||
|
)
|
||||||
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
status = columns.ChoiceFieldColumn()
|
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
@ -22,23 +23,28 @@ VRF_TARGETS = """
|
|||||||
|
|
||||||
class VRFTable(TenancyColumnsMixin, NetBoxTable):
|
class VRFTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rd = tables.Column(
|
rd = tables.Column(
|
||||||
verbose_name='RD'
|
verbose_name=_('RD')
|
||||||
)
|
)
|
||||||
enforce_unique = columns.BooleanColumn(
|
enforce_unique = columns.BooleanColumn(
|
||||||
verbose_name='Unique'
|
verbose_name=_('Unique')
|
||||||
)
|
)
|
||||||
import_targets = columns.TemplateColumn(
|
import_targets = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Import Targets'),
|
||||||
template_code=VRF_TARGETS,
|
template_code=VRF_TARGETS,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
export_targets = columns.TemplateColumn(
|
export_targets = columns.TemplateColumn(
|
||||||
|
verbose_name=_('Export Targets'),
|
||||||
template_code=VRF_TARGETS,
|
template_code=VRF_TARGETS,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:vrf_list'
|
url_name='ipam:vrf_list'
|
||||||
)
|
)
|
||||||
@ -58,9 +64,12 @@ class VRFTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
|
|
||||||
class RouteTargetTable(TenancyColumnsMixin, NetBoxTable):
|
class RouteTargetTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:routetarget_list'
|
url_name='ipam:routetarget_list'
|
||||||
)
|
)
|
||||||
|
@ -12,6 +12,7 @@ from django.utils.dateparse import parse_date
|
|||||||
from django.utils.formats import date_format
|
from django.utils.formats import date_format
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_tables2.columns import library
|
from django_tables2.columns import library
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
|
|
||||||
@ -170,7 +171,8 @@ class ToggleColumn(tables.CheckBoxColumn):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def header(self):
|
def header(self):
|
||||||
return mark_safe('<input type="checkbox" class="toggle form-check-input" title="Toggle All" />')
|
title_text = _('Toggle all')
|
||||||
|
return mark_safe(f'<input type="checkbox" class="toggle form-check-input" title="{title_text}" />')
|
||||||
|
|
||||||
|
|
||||||
class BooleanColumn(tables.Column):
|
class BooleanColumn(tables.Column):
|
||||||
@ -271,12 +273,13 @@ class ActionsColumn(tables.Column):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Create the actions dropdown menu
|
# Create the actions dropdown menu
|
||||||
|
toggle_text = _('Toggle Dropdown')
|
||||||
if button and dropdown_links:
|
if button and dropdown_links:
|
||||||
html += (
|
html += (
|
||||||
f'<span class="btn-group dropdown">'
|
f'<span class="btn-group dropdown">'
|
||||||
f' {button}'
|
f' {button}'
|
||||||
f' <a class="btn btn-sm btn-{dropdown_class} dropdown-toggle" type="button" data-bs-toggle="dropdown" style="padding-left: 2px">'
|
f' <a class="btn btn-sm btn-{dropdown_class} dropdown-toggle" type="button" data-bs-toggle="dropdown" style="padding-left: 2px">'
|
||||||
f' <span class="visually-hidden">Toggle Dropdown</span></a>'
|
f' <span class="visually-hidden">{toggle_text}</span></a>'
|
||||||
f' <ul class="dropdown-menu">{"".join(dropdown_links)}</ul>'
|
f' <ul class="dropdown-menu">{"".join(dropdown_links)}</ul>'
|
||||||
f'</span>'
|
f'</span>'
|
||||||
)
|
)
|
||||||
@ -286,7 +289,7 @@ class ActionsColumn(tables.Column):
|
|||||||
html += (
|
html += (
|
||||||
f'<span class="btn-group dropdown">'
|
f'<span class="btn-group dropdown">'
|
||||||
f' <a class="btn btn-sm btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">'
|
f' <a class="btn btn-sm btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">'
|
||||||
f' <span class="visually-hidden">Toggle Dropdown</span></a>'
|
f' <span class="visually-hidden">{toggle_text}</span></a>'
|
||||||
f' <ul class="dropdown-menu">{"".join(dropdown_links)}</ul>'
|
f' <ul class="dropdown-menu">{"".join(dropdown_links)}</ul>'
|
||||||
f'</span>'
|
f'</span>'
|
||||||
)
|
)
|
||||||
@ -440,7 +443,8 @@ class TagColumn(tables.TemplateColumn):
|
|||||||
super().__init__(
|
super().__init__(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
template_code=self.template_code,
|
template_code=self.template_code,
|
||||||
extra_context={'url_name': url_name}
|
extra_context={'url_name': url_name},
|
||||||
|
verbose_name=_('Tags'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def value(self, value):
|
def value(self, value):
|
||||||
@ -522,7 +526,8 @@ class CustomLinkColumn(tables.Column):
|
|||||||
if rendered:
|
if rendered:
|
||||||
return mark_safe(f'<a href="{rendered["link"]}"{rendered["link_target"]}>{rendered["text"]}</a>')
|
return mark_safe(f'<a href="{rendered["link"]}"{rendered["link_target"]}>{rendered["text"]}</a>')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return mark_safe(f'<span class="text-danger" title="{e}"><i class="mdi mdi-alert"></i> Error</span>')
|
error_text = _('Error')
|
||||||
|
return mark_safe(f'<span class="text-danger" title="{e}"><i class="mdi mdi-alert"></i> {error_text}</span>')
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def value(self, record):
|
def value(self, record):
|
||||||
@ -587,9 +592,10 @@ class MarkdownColumn(tables.TemplateColumn):
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
template_code=self.template_code
|
template_code=self.template_code,
|
||||||
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
def value(self, value):
|
def value(self, value):
|
||||||
|
@ -7,7 +7,7 @@ from django.db.models.fields.related import RelatedField
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.urls.exceptions import NoReverseMatch
|
from django.urls.exceptions import NoReverseMatch
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_tables2.data import TableQuerysetData
|
from django_tables2.data import TableQuerysetData
|
||||||
|
|
||||||
from extras.models import CustomField, CustomLink
|
from extras.models import CustomField, CustomLink
|
||||||
@ -174,7 +174,7 @@ class NetBoxTable(BaseTable):
|
|||||||
)
|
)
|
||||||
id = tables.Column(
|
id = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='ID'
|
verbose_name=_('ID')
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn()
|
actions = columns.ActionsColumn()
|
||||||
|
|
||||||
@ -223,11 +223,16 @@ class SearchTable(tables.Table):
|
|||||||
order_by="object___meta__verbose_name",
|
order_by="object___meta__verbose_name",
|
||||||
)
|
)
|
||||||
object = tables.Column(
|
object = tables.Column(
|
||||||
|
verbose_name=_('Object'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
order_by=('name', )
|
order_by=('name', )
|
||||||
)
|
)
|
||||||
field = tables.Column()
|
field = tables.Column(
|
||||||
value = tables.Column()
|
verbose_name=_('Field'),
|
||||||
|
)
|
||||||
|
value = tables.Column(
|
||||||
|
verbose_name=_('Value'),
|
||||||
|
)
|
||||||
|
|
||||||
trim_length = 30
|
trim_length = 30
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from netbox.tables import columns
|
from netbox.tables import columns
|
||||||
@ -47,7 +48,7 @@ class TenantGroupColumn(tables.TemplateColumn):
|
|||||||
|
|
||||||
def __init__(self, accessor=tables.A('tenant__group'), *args, **kwargs):
|
def __init__(self, accessor=tables.A('tenant__group'), *args, **kwargs):
|
||||||
if 'verbose_name' not in kwargs:
|
if 'verbose_name' not in kwargs:
|
||||||
kwargs['verbose_name'] = 'Tenant Group'
|
kwargs['verbose_name'] = _('Tenant Group')
|
||||||
|
|
||||||
super().__init__(template_code=self.template_code, accessor=accessor, *args, **kwargs)
|
super().__init__(template_code=self.template_code, accessor=accessor, *args, **kwargs)
|
||||||
|
|
||||||
@ -56,12 +57,17 @@ class TenantGroupColumn(tables.TemplateColumn):
|
|||||||
|
|
||||||
|
|
||||||
class TenancyColumnsMixin(tables.Table):
|
class TenancyColumnsMixin(tables.Table):
|
||||||
tenant_group = TenantGroupColumn()
|
tenant_group = TenantGroupColumn(
|
||||||
tenant = TenantColumn()
|
verbose_name=_('Tenant Group'),
|
||||||
|
)
|
||||||
|
tenant = TenantColumn(
|
||||||
|
verbose_name=_('Tenant'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ContactsColumnMixin(tables.Table):
|
class ContactsColumnMixin(tables.Table):
|
||||||
contacts = columns.ManyToManyColumn(
|
contacts = columns.ManyToManyColumn(
|
||||||
|
verbose_name=_('Contacts'),
|
||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
transform=lambda obj: obj.contact.name
|
transform=lambda obj: obj.contact.name
|
||||||
)
|
)
|
||||||
|
@ -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
|
||||||
|
|
||||||
@ -15,12 +16,13 @@ __all__ = (
|
|||||||
|
|
||||||
class ContactGroupTable(NetBoxTable):
|
class ContactGroupTable(NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
contact_count = columns.LinkedCountColumn(
|
contact_count = columns.LinkedCountColumn(
|
||||||
viewname='tenancy:contact_list',
|
viewname='tenancy:contact_list',
|
||||||
url_params={'group_id': 'pk'},
|
url_params={'group_id': 'pk'},
|
||||||
verbose_name='Contacts'
|
verbose_name=_('Contacts')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='tenancy:contactgroup_list'
|
url_name='tenancy:contactgroup_list'
|
||||||
@ -36,6 +38,7 @@ class ContactGroupTable(NetBoxTable):
|
|||||||
|
|
||||||
class ContactRoleTable(NetBoxTable):
|
class ContactRoleTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -50,19 +53,24 @@ class ContactRoleTable(NetBoxTable):
|
|||||||
|
|
||||||
class ContactTable(NetBoxTable):
|
class ContactTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
phone = tables.Column(
|
phone = tables.Column(
|
||||||
|
verbose_name=_('Phone'),
|
||||||
linkify=linkify_phone,
|
linkify=linkify_phone,
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
assignment_count = columns.LinkedCountColumn(
|
assignment_count = columns.LinkedCountColumn(
|
||||||
viewname='tenancy:contactassignment_list',
|
viewname='tenancy:contactassignment_list',
|
||||||
url_params={'contact_id': 'pk'},
|
url_params={'contact_id': 'pk'},
|
||||||
verbose_name='Assignments'
|
verbose_name=_('Assignments')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='tenancy:contact_list'
|
url_name='tenancy:contact_list'
|
||||||
@ -79,41 +87,44 @@ class ContactTable(NetBoxTable):
|
|||||||
|
|
||||||
class ContactAssignmentTable(NetBoxTable):
|
class ContactAssignmentTable(NetBoxTable):
|
||||||
content_type = columns.ContentTypeColumn(
|
content_type = columns.ContentTypeColumn(
|
||||||
verbose_name='Object Type'
|
verbose_name=_('Object Type')
|
||||||
)
|
)
|
||||||
object = tables.Column(
|
object = tables.Column(
|
||||||
|
verbose_name=_('Object'),
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
contact = tables.Column(
|
contact = tables.Column(
|
||||||
|
verbose_name=_('Contact'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
contact_title = tables.Column(
|
contact_title = tables.Column(
|
||||||
accessor=Accessor('contact__title'),
|
accessor=Accessor('contact__title'),
|
||||||
verbose_name='Contact Title'
|
verbose_name=_('Contact Title')
|
||||||
)
|
)
|
||||||
contact_phone = tables.Column(
|
contact_phone = tables.Column(
|
||||||
accessor=Accessor('contact__phone'),
|
accessor=Accessor('contact__phone'),
|
||||||
verbose_name='Contact Phone'
|
verbose_name=_('Contact Phone')
|
||||||
)
|
)
|
||||||
contact_email = tables.Column(
|
contact_email = tables.Column(
|
||||||
accessor=Accessor('contact__email'),
|
accessor=Accessor('contact__email'),
|
||||||
verbose_name='Contact Email'
|
verbose_name=_('Contact Email')
|
||||||
)
|
)
|
||||||
contact_address = tables.Column(
|
contact_address = tables.Column(
|
||||||
accessor=Accessor('contact__address'),
|
accessor=Accessor('contact__address'),
|
||||||
verbose_name='Contact Address'
|
verbose_name=_('Contact Address')
|
||||||
)
|
)
|
||||||
contact_link = tables.Column(
|
contact_link = tables.Column(
|
||||||
accessor=Accessor('contact__link'),
|
accessor=Accessor('contact__link'),
|
||||||
verbose_name='Contact Link'
|
verbose_name=_('Contact Link')
|
||||||
)
|
)
|
||||||
contact_description = tables.Column(
|
contact_description = tables.Column(
|
||||||
accessor=Accessor('contact__description'),
|
accessor=Accessor('contact__description'),
|
||||||
verbose_name='Contact Description'
|
verbose_name=_('Contact Description')
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=('edit', 'delete')
|
actions=('edit', 'delete')
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from tenancy.models import *
|
from tenancy.models import *
|
||||||
from tenancy.tables import ContactsColumnMixin
|
from tenancy.tables import ContactsColumnMixin
|
||||||
@ -12,12 +13,13 @@ __all__ = (
|
|||||||
|
|
||||||
class TenantGroupTable(NetBoxTable):
|
class TenantGroupTable(NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant_count = columns.LinkedCountColumn(
|
tenant_count = columns.LinkedCountColumn(
|
||||||
viewname='tenancy:tenant_list',
|
viewname='tenancy:tenant_list',
|
||||||
url_params={'group_id': 'pk'},
|
url_params={'group_id': 'pk'},
|
||||||
verbose_name='Tenants'
|
verbose_name=_('Tenants')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='tenancy:tenantgroup_list'
|
url_name='tenancy:tenantgroup_list'
|
||||||
@ -33,12 +35,16 @@ class TenantGroupTable(NetBoxTable):
|
|||||||
|
|
||||||
class TenantTable(ContactsColumnMixin, NetBoxTable):
|
class TenantTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='tenancy:tenant_list'
|
url_name='tenancy:tenant_list'
|
||||||
)
|
)
|
||||||
|
@ -28,14 +28,22 @@ class TokenTable(UserTokenTable):
|
|||||||
|
|
||||||
class UserTable(NetBoxTable):
|
class UserTable(NetBoxTable):
|
||||||
username = tables.Column(
|
username = tables.Column(
|
||||||
|
verbose_name=_('Username'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
groups = columns.ManyToManyColumn(
|
groups = columns.ManyToManyColumn(
|
||||||
|
verbose_name=_('Groups'),
|
||||||
linkify_item=('users:netboxgroup', {'pk': tables.A('pk')})
|
linkify_item=('users:netboxgroup', {'pk': tables.A('pk')})
|
||||||
)
|
)
|
||||||
is_active = columns.BooleanColumn()
|
is_active = columns.BooleanColumn(
|
||||||
is_staff = columns.BooleanColumn()
|
verbose_name=_('Is Active'),
|
||||||
is_superuser = columns.BooleanColumn()
|
)
|
||||||
|
is_staff = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Is Staff'),
|
||||||
|
)
|
||||||
|
is_superuser = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Is Superuser'),
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
)
|
)
|
||||||
@ -50,7 +58,10 @@ class UserTable(NetBoxTable):
|
|||||||
|
|
||||||
|
|
||||||
class GroupTable(NetBoxTable):
|
class GroupTable(NetBoxTable):
|
||||||
name = tables.Column(linkify=True)
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
actions=('edit', 'delete'),
|
actions=('edit', 'delete'),
|
||||||
)
|
)
|
||||||
@ -64,20 +75,38 @@ class GroupTable(NetBoxTable):
|
|||||||
|
|
||||||
|
|
||||||
class ObjectPermissionTable(NetBoxTable):
|
class ObjectPermissionTable(NetBoxTable):
|
||||||
name = tables.Column(linkify=True)
|
name = tables.Column(
|
||||||
object_types = columns.ContentTypesColumn()
|
verbose_name=_('Name'),
|
||||||
enabled = columns.BooleanColumn()
|
linkify=True
|
||||||
can_view = columns.BooleanColumn()
|
)
|
||||||
can_add = columns.BooleanColumn()
|
object_types = columns.ContentTypesColumn(
|
||||||
can_change = columns.BooleanColumn()
|
verbose_name=_('Object Types'),
|
||||||
can_delete = columns.BooleanColumn()
|
)
|
||||||
|
enabled = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Enabled'),
|
||||||
|
)
|
||||||
|
can_view = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Can View'),
|
||||||
|
)
|
||||||
|
can_add = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Can Add'),
|
||||||
|
)
|
||||||
|
can_change = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Can Change'),
|
||||||
|
)
|
||||||
|
can_delete = columns.BooleanColumn(
|
||||||
|
verbose_name=_('Can Delete'),
|
||||||
|
)
|
||||||
custom_actions = columns.ArrayColumn(
|
custom_actions = columns.ArrayColumn(
|
||||||
|
verbose_name=_('Custom Actions'),
|
||||||
accessor=tables.A('actions')
|
accessor=tables.A('actions')
|
||||||
)
|
)
|
||||||
users = columns.ManyToManyColumn(
|
users = columns.ManyToManyColumn(
|
||||||
|
verbose_name=_('Users'),
|
||||||
linkify_item=('users:netboxuser', {'pk': tables.A('pk')})
|
linkify_item=('users:netboxuser', {'pk': tables.A('pk')})
|
||||||
)
|
)
|
||||||
groups = columns.ManyToManyColumn(
|
groups = columns.ManyToManyColumn(
|
||||||
|
verbose_name=_('Groups'),
|
||||||
linkify_item=('users:netboxgroup', {'pk': tables.A('pk')})
|
linkify_item=('users:netboxgroup', {'pk': tables.A('pk')})
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin
|
from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin
|
||||||
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
||||||
@ -13,12 +14,13 @@ __all__ = (
|
|||||||
|
|
||||||
class ClusterTypeTable(NetBoxTable):
|
class ClusterTypeTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
cluster_count = columns.LinkedCountColumn(
|
cluster_count = columns.LinkedCountColumn(
|
||||||
viewname='virtualization:cluster_list',
|
viewname='virtualization:cluster_list',
|
||||||
url_params={'type_id': 'pk'},
|
url_params={'type_id': 'pk'},
|
||||||
verbose_name='Clusters'
|
verbose_name=_('Clusters')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='virtualization:clustertype_list'
|
url_name='virtualization:clustertype_list'
|
||||||
@ -34,12 +36,13 @@ class ClusterTypeTable(NetBoxTable):
|
|||||||
|
|
||||||
class ClusterGroupTable(ContactsColumnMixin, NetBoxTable):
|
class ClusterGroupTable(ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
cluster_count = columns.LinkedCountColumn(
|
cluster_count = columns.LinkedCountColumn(
|
||||||
viewname='virtualization:cluster_list',
|
viewname='virtualization:cluster_list',
|
||||||
url_params={'group_id': 'pk'},
|
url_params={'group_id': 'pk'},
|
||||||
verbose_name='Clusters'
|
verbose_name=_('Clusters')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='virtualization:clustergroup_list'
|
url_name='virtualization:clustergroup_list'
|
||||||
@ -56,29 +59,37 @@ class ClusterGroupTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
|
|
||||||
class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
type = tables.Column(
|
type = tables.Column(
|
||||||
|
verbose_name=_('Type'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
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
|
||||||
)
|
)
|
||||||
device_count = columns.LinkedCountColumn(
|
device_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:device_list',
|
viewname='dcim:device_list',
|
||||||
url_params={'cluster_id': 'pk'},
|
url_params={'cluster_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={'cluster_id': 'pk'},
|
url_params={'cluster_id': 'pk'},
|
||||||
verbose_name='VMs'
|
verbose_name=_('VMs')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='virtualization:cluster_list'
|
url_name='virtualization:cluster_list'
|
||||||
)
|
)
|
||||||
|
@ -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 dcim.tables.devices import BaseInterfaceTable
|
from dcim.tables.devices import BaseInterfaceTable
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
@ -40,33 +40,43 @@ VMINTERFACE_BUTTONS = """
|
|||||||
|
|
||||||
class VirtualMachineTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
class VirtualMachineTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
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
|
||||||
)
|
)
|
||||||
cluster = tables.Column(
|
cluster = tables.Column(
|
||||||
|
verbose_name=_('Cluster'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device = tables.Column(
|
device = tables.Column(
|
||||||
|
verbose_name=_('Device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
role = columns.ColoredLabelColumn()
|
role = columns.ColoredLabelColumn(
|
||||||
comments = columns.MarkdownColumn()
|
verbose_name=_('Role'),
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
|
)
|
||||||
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')
|
||||||
)
|
)
|
||||||
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')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='virtualization:virtualmachine_list'
|
url_name='virtualization:virtualmachine_list'
|
||||||
@ -93,12 +103,15 @@ class VirtualMachineTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable)
|
|||||||
|
|
||||||
class VMInterfaceTable(BaseInterfaceTable):
|
class VMInterfaceTable(BaseInterfaceTable):
|
||||||
virtual_machine = tables.Column(
|
virtual_machine = tables.Column(
|
||||||
|
verbose_name=_('Virtual Machine'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
vrf = tables.Column(
|
vrf = tables.Column(
|
||||||
|
verbose_name=_('VRF'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -116,9 +129,11 @@ class VMInterfaceTable(BaseInterfaceTable):
|
|||||||
|
|
||||||
class VirtualMachineVMInterfaceTable(VMInterfaceTable):
|
class VirtualMachineVMInterfaceTable(VMInterfaceTable):
|
||||||
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
|
||||||
)
|
)
|
||||||
actions = columns.ActionsColumn(
|
actions = columns.ActionsColumn(
|
||||||
|
@ -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 Interface
|
from dcim.models import Interface
|
||||||
@ -14,14 +15,17 @@ __all__ = (
|
|||||||
|
|
||||||
class WirelessLANGroupTable(NetBoxTable):
|
class WirelessLANGroupTable(NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
wirelesslan_count = columns.LinkedCountColumn(
|
wirelesslan_count = columns.LinkedCountColumn(
|
||||||
viewname='wireless:wirelesslan_list',
|
viewname='wireless:wirelesslan_list',
|
||||||
url_params={'group_id': 'pk'},
|
url_params={'group_id': 'pk'},
|
||||||
verbose_name='Wireless LANs'
|
verbose_name=_('Wireless LANs')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='wireless:wirelesslangroup_list'
|
url_name='wireless:wirelesslangroup_list'
|
||||||
)
|
)
|
||||||
@ -37,16 +41,22 @@ class WirelessLANGroupTable(NetBoxTable):
|
|||||||
|
|
||||||
class WirelessLANTable(TenancyColumnsMixin, NetBoxTable):
|
class WirelessLANTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
ssid = tables.Column(
|
ssid = tables.Column(
|
||||||
|
verbose_name=_('SSID'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
|
verbose_name=_('Group'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn(
|
||||||
interface_count = tables.Column(
|
verbose_name=_('Status'),
|
||||||
verbose_name='Interfaces'
|
)
|
||||||
|
interface_count = tables.Column(
|
||||||
|
verbose_name=_('Interfaces')
|
||||||
|
)
|
||||||
|
comments = columns.MarkdownColumn(
|
||||||
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
comments = columns.MarkdownColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='wireless:wirelesslan_list'
|
url_name='wireless:wirelesslan_list'
|
||||||
)
|
)
|
||||||
@ -62,9 +72,11 @@ class WirelessLANTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
|
|
||||||
class WirelessLANInterfacesTable(NetBoxTable):
|
class WirelessLANInterfacesTable(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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
@ -12,21 +13,27 @@ __all__ = (
|
|||||||
class WirelessLinkTable(TenancyColumnsMixin, NetBoxTable):
|
class WirelessLinkTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
id = tables.Column(
|
id = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='ID'
|
verbose_name=_('ID')
|
||||||
|
)
|
||||||
|
status = columns.ChoiceFieldColumn(
|
||||||
|
verbose_name=_('Status'),
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
|
||||||
device_a = tables.Column(
|
device_a = tables.Column(
|
||||||
|
verbose_name=_('Device A'),
|
||||||
accessor=tables.A('interface_a__device'),
|
accessor=tables.A('interface_a__device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
interface_a = tables.Column(
|
interface_a = tables.Column(
|
||||||
|
verbose_name=_('Interface A'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
device_b = tables.Column(
|
device_b = tables.Column(
|
||||||
|
verbose_name=_('Device B'),
|
||||||
accessor=tables.A('interface_b__device'),
|
accessor=tables.A('interface_b__device'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
interface_b = tables.Column(
|
interface_b = tables.Column(
|
||||||
|
verbose_name=_('Interface B'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
|
Reference in New Issue
Block a user