mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Convert all LinkColumns to Column(linkify=True)
This commit is contained in:
parent
ea9e9d7273
commit
779837389b
@ -12,7 +12,9 @@ from .models import *
|
|||||||
|
|
||||||
class ProviderTable(BaseTable):
|
class ProviderTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
circuit_count = tables.Column(
|
circuit_count = tables.Column(
|
||||||
accessor=Accessor('count_circuits'),
|
accessor=Accessor('count_circuits'),
|
||||||
verbose_name='Circuits'
|
verbose_name='Circuits'
|
||||||
@ -57,7 +59,9 @@ class ProviderNetworkTable(BaseTable):
|
|||||||
|
|
||||||
class CircuitTypeTable(BaseTable):
|
class CircuitTypeTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
circuit_count = tables.Column(
|
circuit_count = tables.Column(
|
||||||
verbose_name='Circuits'
|
verbose_name='Circuits'
|
||||||
)
|
)
|
||||||
@ -75,7 +79,8 @@ class CircuitTypeTable(BaseTable):
|
|||||||
|
|
||||||
class CircuitTable(BaseTable):
|
class CircuitTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
cid = tables.LinkColumn(
|
cid = tables.Column(
|
||||||
|
linkify=True,
|
||||||
verbose_name='ID'
|
verbose_name='ID'
|
||||||
)
|
)
|
||||||
provider = tables.Column(
|
provider = tables.Column(
|
||||||
|
@ -26,9 +26,10 @@ class CableTable(BaseTable):
|
|||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Side A'
|
verbose_name='Side A'
|
||||||
)
|
)
|
||||||
termination_a = tables.LinkColumn(
|
termination_a = tables.Column(
|
||||||
accessor=Accessor('termination_a'),
|
accessor=Accessor('termination_a'),
|
||||||
orderable=False,
|
orderable=False,
|
||||||
|
linkify=True,
|
||||||
verbose_name='Termination A'
|
verbose_name='Termination A'
|
||||||
)
|
)
|
||||||
termination_b_parent = tables.TemplateColumn(
|
termination_b_parent = tables.TemplateColumn(
|
||||||
@ -37,9 +38,10 @@ class CableTable(BaseTable):
|
|||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Side B'
|
verbose_name='Side B'
|
||||||
)
|
)
|
||||||
termination_b = tables.LinkColumn(
|
termination_b = tables.Column(
|
||||||
accessor=Accessor('termination_b'),
|
accessor=Accessor('termination_b'),
|
||||||
orderable=False,
|
orderable=False,
|
||||||
|
linkify=True,
|
||||||
verbose_name='Termination B'
|
verbose_name='Termination B'
|
||||||
)
|
)
|
||||||
status = ChoiceFieldColumn()
|
status = ChoiceFieldColumn()
|
||||||
|
@ -137,11 +137,9 @@ class DeviceTable(BaseTable):
|
|||||||
device_role = ColoredLabelColumn(
|
device_role = ColoredLabelColumn(
|
||||||
verbose_name='Role'
|
verbose_name='Role'
|
||||||
)
|
)
|
||||||
device_type = tables.LinkColumn(
|
device_type = tables.Column(
|
||||||
viewname='dcim:devicetype',
|
linkify=True,
|
||||||
args=[Accessor('device_type__pk')],
|
verbose_name='Type'
|
||||||
verbose_name='Type',
|
|
||||||
text=lambda record: record.device_type.display_name
|
|
||||||
)
|
)
|
||||||
if settings.PREFER_IPV4:
|
if settings.PREFER_IPV4:
|
||||||
primary_ip = tables.Column(
|
primary_ip = tables.Column(
|
||||||
@ -163,13 +161,11 @@ class DeviceTable(BaseTable):
|
|||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IPv6 Address'
|
verbose_name='IPv6 Address'
|
||||||
)
|
)
|
||||||
cluster = tables.LinkColumn(
|
cluster = tables.Column(
|
||||||
viewname='virtualization:cluster',
|
linkify=True
|
||||||
args=[Accessor('cluster__pk')]
|
|
||||||
)
|
)
|
||||||
virtual_chassis = tables.LinkColumn(
|
virtual_chassis = tables.Column(
|
||||||
viewname='dcim:virtualchassis',
|
linkify=True
|
||||||
args=[Accessor('virtual_chassis__pk')]
|
|
||||||
)
|
)
|
||||||
vc_position = tables.Column(
|
vc_position = tables.Column(
|
||||||
verbose_name='VC Position'
|
verbose_name='VC Position'
|
||||||
|
@ -26,7 +26,9 @@ __all__ = (
|
|||||||
|
|
||||||
class ManufacturerTable(BaseTable):
|
class ManufacturerTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
devicetype_count = tables.Column(
|
devicetype_count = tables.Column(
|
||||||
verbose_name='Device Types'
|
verbose_name='Device Types'
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,9 @@ __all__ = (
|
|||||||
|
|
||||||
class PowerPanelTable(BaseTable):
|
class PowerPanelTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -43,7 +45,9 @@ class PowerPanelTable(BaseTable):
|
|||||||
# cannot traverse pass-through ports.
|
# cannot traverse pass-through ports.
|
||||||
class PowerFeedTable(CableTerminationTable):
|
class PowerFeedTable(CableTerminationTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
power_panel = tables.Column(
|
power_panel = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
@ -57,8 +57,8 @@ class SiteGroupTable(BaseTable):
|
|||||||
|
|
||||||
class SiteTable(BaseTable):
|
class SiteTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn(
|
name = tables.Column(
|
||||||
order_by=('_name',)
|
linkify=True
|
||||||
)
|
)
|
||||||
status = ChoiceFieldColumn()
|
status = ChoiceFieldColumn()
|
||||||
region = tables.Column(
|
region = tables.Column(
|
||||||
|
@ -58,7 +58,9 @@ class TaggedItemTable(BaseTable):
|
|||||||
|
|
||||||
class ConfigContextTable(BaseTable):
|
class ConfigContextTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
is_active = BooleanColumn(
|
is_active = BooleanColumn(
|
||||||
verbose_name='Active'
|
verbose_name='Active'
|
||||||
)
|
)
|
||||||
|
@ -112,7 +112,9 @@ VLAN_MEMBER_TAGGED = """
|
|||||||
|
|
||||||
class VRFTable(BaseTable):
|
class VRFTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
rd = tables.Column(
|
rd = tables.Column(
|
||||||
verbose_name='RD'
|
verbose_name='RD'
|
||||||
)
|
)
|
||||||
@ -146,7 +148,9 @@ class VRFTable(BaseTable):
|
|||||||
|
|
||||||
class RouteTargetTable(BaseTable):
|
class RouteTargetTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
tenant = TenantColumn()
|
tenant = TenantColumn()
|
||||||
tags = TagColumn(
|
tags = TagColumn(
|
||||||
url_name='ipam:vrf_list'
|
url_name='ipam:vrf_list'
|
||||||
@ -164,7 +168,9 @@ class RouteTargetTable(BaseTable):
|
|||||||
|
|
||||||
class RIRTable(BaseTable):
|
class RIRTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
is_private = BooleanColumn(
|
is_private = BooleanColumn(
|
||||||
verbose_name='Private'
|
verbose_name='Private'
|
||||||
)
|
)
|
||||||
@ -187,7 +193,8 @@ class RIRTable(BaseTable):
|
|||||||
|
|
||||||
class AggregateTable(BaseTable):
|
class AggregateTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
prefix = tables.LinkColumn(
|
prefix = tables.Column(
|
||||||
|
linkify=True,
|
||||||
verbose_name='Aggregate'
|
verbose_name='Aggregate'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
tenant = TenantColumn()
|
||||||
@ -395,7 +402,8 @@ class InterfaceIPAddressTable(BaseTable):
|
|||||||
"""
|
"""
|
||||||
List IP addresses assigned to a specific Interface.
|
List IP addresses assigned to a specific Interface.
|
||||||
"""
|
"""
|
||||||
address = tables.LinkColumn(
|
address = tables.Column(
|
||||||
|
linkify=True,
|
||||||
verbose_name='IP Address'
|
verbose_name='IP Address'
|
||||||
)
|
)
|
||||||
vrf = tables.TemplateColumn(
|
vrf = tables.TemplateColumn(
|
||||||
@ -492,7 +500,8 @@ class VLANMembersTable(BaseTable):
|
|||||||
"""
|
"""
|
||||||
Base table for Interface and VMInterface assignments
|
Base table for Interface and VMInterface assignments
|
||||||
"""
|
"""
|
||||||
name = tables.LinkColumn(
|
name = tables.Column(
|
||||||
|
linkify=True,
|
||||||
verbose_name='Interface'
|
verbose_name='Interface'
|
||||||
)
|
)
|
||||||
tagged = tables.TemplateColumn(
|
tagged = tables.TemplateColumn(
|
||||||
@ -502,7 +511,9 @@ class VLANMembersTable(BaseTable):
|
|||||||
|
|
||||||
|
|
||||||
class VLANDevicesTable(VLANMembersTable):
|
class VLANDevicesTable(VLANMembersTable):
|
||||||
device = tables.LinkColumn()
|
device = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
actions = ButtonsColumn(Interface, buttons=['edit'])
|
actions = ButtonsColumn(Interface, buttons=['edit'])
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
@ -511,7 +522,9 @@ class VLANDevicesTable(VLANMembersTable):
|
|||||||
|
|
||||||
|
|
||||||
class VLANVirtualMachinesTable(VLANMembersTable):
|
class VLANVirtualMachinesTable(VLANMembersTable):
|
||||||
virtual_machine = tables.LinkColumn()
|
virtual_machine = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
actions = ButtonsColumn(VMInterface, buttons=['edit'])
|
actions = ButtonsColumn(VMInterface, buttons=['edit'])
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
@ -523,9 +536,8 @@ class InterfaceVLANTable(BaseTable):
|
|||||||
"""
|
"""
|
||||||
List VLANs assigned to a specific Interface.
|
List VLANs assigned to a specific Interface.
|
||||||
"""
|
"""
|
||||||
vid = tables.LinkColumn(
|
vid = tables.Column(
|
||||||
viewname='ipam:vlan',
|
linkify=True,
|
||||||
args=[Accessor('pk')],
|
|
||||||
verbose_name='ID'
|
verbose_name='ID'
|
||||||
)
|
)
|
||||||
tagged = BooleanColumn()
|
tagged = BooleanColumn()
|
||||||
@ -560,7 +572,8 @@ class ServiceTable(BaseTable):
|
|||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
parent = tables.LinkColumn(
|
parent = tables.Column(
|
||||||
|
linkify=True,
|
||||||
order_by=('device', 'virtual_machine')
|
order_by=('device', 'virtual_machine')
|
||||||
)
|
)
|
||||||
ports = tables.TemplateColumn(
|
ports = tables.TemplateColumn(
|
||||||
|
@ -10,7 +10,9 @@ from .models import SecretRole, Secret
|
|||||||
|
|
||||||
class SecretRoleTable(BaseTable):
|
class SecretRoleTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
secret_count = LinkedCountColumn(
|
secret_count = LinkedCountColumn(
|
||||||
viewname='secrets:secret_list',
|
viewname='secrets:secret_list',
|
||||||
url_params={'role': 'slug'},
|
url_params={'role': 'slug'},
|
||||||
|
@ -10,7 +10,7 @@ from .models import Tenant, TenantGroup
|
|||||||
|
|
||||||
class TenantColumn(tables.TemplateColumn):
|
class TenantColumn(tables.TemplateColumn):
|
||||||
"""
|
"""
|
||||||
Render a colored label (e.g. for DeviceRoles).
|
Include the tenant description.
|
||||||
"""
|
"""
|
||||||
template_code = """
|
template_code = """
|
||||||
{% if record.tenant %}
|
{% if record.tenant %}
|
||||||
@ -57,7 +57,9 @@ class TenantGroupTable(BaseTable):
|
|||||||
|
|
||||||
class TenantTable(BaseTable):
|
class TenantTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
tags = TagColumn(
|
tags = TagColumn(
|
||||||
url_name='tenancy:tenant_list'
|
url_name='tenancy:tenant_list'
|
||||||
)
|
)
|
||||||
|
@ -32,7 +32,9 @@ VMINTERFACE_BUTTONS = """
|
|||||||
|
|
||||||
class ClusterTypeTable(BaseTable):
|
class ClusterTypeTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
cluster_count = tables.Column(
|
cluster_count = tables.Column(
|
||||||
verbose_name='Clusters'
|
verbose_name='Clusters'
|
||||||
)
|
)
|
||||||
@ -50,7 +52,9 @@ class ClusterTypeTable(BaseTable):
|
|||||||
|
|
||||||
class ClusterGroupTable(BaseTable):
|
class ClusterGroupTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
cluster_count = tables.Column(
|
cluster_count = tables.Column(
|
||||||
verbose_name='Clusters'
|
verbose_name='Clusters'
|
||||||
)
|
)
|
||||||
@ -68,7 +72,9 @@ class ClusterGroupTable(BaseTable):
|
|||||||
|
|
||||||
class ClusterTable(BaseTable):
|
class ClusterTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
tenant = tables.Column(
|
tenant = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -101,7 +107,9 @@ class ClusterTable(BaseTable):
|
|||||||
|
|
||||||
class VirtualMachineTable(BaseTable):
|
class VirtualMachineTable(BaseTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn()
|
name = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
status = ChoiceFieldColumn()
|
status = ChoiceFieldColumn()
|
||||||
cluster = tables.Column(
|
cluster = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
@ -156,7 +164,9 @@ class VirtualMachineDetailTable(VirtualMachineTable):
|
|||||||
|
|
||||||
class VMInterfaceTable(BaseInterfaceTable):
|
class VMInterfaceTable(BaseInterfaceTable):
|
||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
virtual_machine = tables.LinkColumn()
|
virtual_machine = tables.Column(
|
||||||
|
linkify=True
|
||||||
|
)
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user