Convert all LinkColumns to Column(linkify=True)

This commit is contained in:
jeremystretch 2021-04-02 16:59:53 -04:00
parent ea9e9d7273
commit 779837389b
11 changed files with 80 additions and 42 deletions

View File

@ -12,7 +12,9 @@ from .models import *
class ProviderTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
circuit_count = tables.Column(
accessor=Accessor('count_circuits'),
verbose_name='Circuits'
@ -57,7 +59,9 @@ class ProviderNetworkTable(BaseTable):
class CircuitTypeTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
circuit_count = tables.Column(
verbose_name='Circuits'
)
@ -75,7 +79,8 @@ class CircuitTypeTable(BaseTable):
class CircuitTable(BaseTable):
pk = ToggleColumn()
cid = tables.LinkColumn(
cid = tables.Column(
linkify=True,
verbose_name='ID'
)
provider = tables.Column(

View File

@ -26,9 +26,10 @@ class CableTable(BaseTable):
orderable=False,
verbose_name='Side A'
)
termination_a = tables.LinkColumn(
termination_a = tables.Column(
accessor=Accessor('termination_a'),
orderable=False,
linkify=True,
verbose_name='Termination A'
)
termination_b_parent = tables.TemplateColumn(
@ -37,9 +38,10 @@ class CableTable(BaseTable):
orderable=False,
verbose_name='Side B'
)
termination_b = tables.LinkColumn(
termination_b = tables.Column(
accessor=Accessor('termination_b'),
orderable=False,
linkify=True,
verbose_name='Termination B'
)
status = ChoiceFieldColumn()

View File

@ -137,11 +137,9 @@ class DeviceTable(BaseTable):
device_role = ColoredLabelColumn(
verbose_name='Role'
)
device_type = tables.LinkColumn(
viewname='dcim:devicetype',
args=[Accessor('device_type__pk')],
verbose_name='Type',
text=lambda record: record.device_type.display_name
device_type = tables.Column(
linkify=True,
verbose_name='Type'
)
if settings.PREFER_IPV4:
primary_ip = tables.Column(
@ -163,13 +161,11 @@ class DeviceTable(BaseTable):
linkify=True,
verbose_name='IPv6 Address'
)
cluster = tables.LinkColumn(
viewname='virtualization:cluster',
args=[Accessor('cluster__pk')]
cluster = tables.Column(
linkify=True
)
virtual_chassis = tables.LinkColumn(
viewname='dcim:virtualchassis',
args=[Accessor('virtual_chassis__pk')]
virtual_chassis = tables.Column(
linkify=True
)
vc_position = tables.Column(
verbose_name='VC Position'

View File

@ -26,7 +26,9 @@ __all__ = (
class ManufacturerTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
devicetype_count = tables.Column(
verbose_name='Device Types'
)

View File

@ -16,7 +16,9 @@ __all__ = (
class PowerPanelTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
site = tables.Column(
linkify=True
)
@ -43,7 +45,9 @@ class PowerPanelTable(BaseTable):
# cannot traverse pass-through ports.
class PowerFeedTable(CableTerminationTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
power_panel = tables.Column(
linkify=True
)

View File

@ -57,8 +57,8 @@ class SiteGroupTable(BaseTable):
class SiteTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn(
order_by=('_name',)
name = tables.Column(
linkify=True
)
status = ChoiceFieldColumn()
region = tables.Column(

View File

@ -58,7 +58,9 @@ class TaggedItemTable(BaseTable):
class ConfigContextTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
is_active = BooleanColumn(
verbose_name='Active'
)

View File

@ -112,7 +112,9 @@ VLAN_MEMBER_TAGGED = """
class VRFTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
rd = tables.Column(
verbose_name='RD'
)
@ -146,7 +148,9 @@ class VRFTable(BaseTable):
class RouteTargetTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
tenant = TenantColumn()
tags = TagColumn(
url_name='ipam:vrf_list'
@ -164,7 +168,9 @@ class RouteTargetTable(BaseTable):
class RIRTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
is_private = BooleanColumn(
verbose_name='Private'
)
@ -187,7 +193,8 @@ class RIRTable(BaseTable):
class AggregateTable(BaseTable):
pk = ToggleColumn()
prefix = tables.LinkColumn(
prefix = tables.Column(
linkify=True,
verbose_name='Aggregate'
)
tenant = TenantColumn()
@ -395,7 +402,8 @@ class InterfaceIPAddressTable(BaseTable):
"""
List IP addresses assigned to a specific Interface.
"""
address = tables.LinkColumn(
address = tables.Column(
linkify=True,
verbose_name='IP Address'
)
vrf = tables.TemplateColumn(
@ -492,7 +500,8 @@ class VLANMembersTable(BaseTable):
"""
Base table for Interface and VMInterface assignments
"""
name = tables.LinkColumn(
name = tables.Column(
linkify=True,
verbose_name='Interface'
)
tagged = tables.TemplateColumn(
@ -502,7 +511,9 @@ class VLANMembersTable(BaseTable):
class VLANDevicesTable(VLANMembersTable):
device = tables.LinkColumn()
device = tables.Column(
linkify=True
)
actions = ButtonsColumn(Interface, buttons=['edit'])
class Meta(BaseTable.Meta):
@ -511,7 +522,9 @@ class VLANDevicesTable(VLANMembersTable):
class VLANVirtualMachinesTable(VLANMembersTable):
virtual_machine = tables.LinkColumn()
virtual_machine = tables.Column(
linkify=True
)
actions = ButtonsColumn(VMInterface, buttons=['edit'])
class Meta(BaseTable.Meta):
@ -523,9 +536,8 @@ class InterfaceVLANTable(BaseTable):
"""
List VLANs assigned to a specific Interface.
"""
vid = tables.LinkColumn(
viewname='ipam:vlan',
args=[Accessor('pk')],
vid = tables.Column(
linkify=True,
verbose_name='ID'
)
tagged = BooleanColumn()
@ -560,7 +572,8 @@ class ServiceTable(BaseTable):
name = tables.Column(
linkify=True
)
parent = tables.LinkColumn(
parent = tables.Column(
linkify=True,
order_by=('device', 'virtual_machine')
)
ports = tables.TemplateColumn(

View File

@ -10,7 +10,9 @@ from .models import SecretRole, Secret
class SecretRoleTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
secret_count = LinkedCountColumn(
viewname='secrets:secret_list',
url_params={'role': 'slug'},

View File

@ -10,7 +10,7 @@ from .models import Tenant, TenantGroup
class TenantColumn(tables.TemplateColumn):
"""
Render a colored label (e.g. for DeviceRoles).
Include the tenant description.
"""
template_code = """
{% if record.tenant %}
@ -57,7 +57,9 @@ class TenantGroupTable(BaseTable):
class TenantTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
tags = TagColumn(
url_name='tenancy:tenant_list'
)

View File

@ -32,7 +32,9 @@ VMINTERFACE_BUTTONS = """
class ClusterTypeTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
cluster_count = tables.Column(
verbose_name='Clusters'
)
@ -50,7 +52,9 @@ class ClusterTypeTable(BaseTable):
class ClusterGroupTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
cluster_count = tables.Column(
verbose_name='Clusters'
)
@ -68,7 +72,9 @@ class ClusterGroupTable(BaseTable):
class ClusterTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
tenant = tables.Column(
linkify=True
)
@ -101,7 +107,9 @@ class ClusterTable(BaseTable):
class VirtualMachineTable(BaseTable):
pk = ToggleColumn()
name = tables.LinkColumn()
name = tables.Column(
linkify=True
)
status = ChoiceFieldColumn()
cluster = tables.Column(
linkify=True
@ -156,7 +164,9 @@ class VirtualMachineDetailTable(VirtualMachineTable):
class VMInterfaceTable(BaseInterfaceTable):
pk = ToggleColumn()
virtual_machine = tables.LinkColumn()
virtual_machine = tables.Column(
linkify=True
)
name = tables.Column(
linkify=True
)