mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge 'detail' tables into primaries for each model
This commit is contained in:
@ -12,12 +12,13 @@ __all__ = (
|
||||
'ClusterTable',
|
||||
'ClusterGroupTable',
|
||||
'ClusterTypeTable',
|
||||
'VirtualMachineDetailTable',
|
||||
'VirtualMachineTable',
|
||||
'VirtualMachineVMInterfaceTable',
|
||||
'VMInterfaceTable',
|
||||
)
|
||||
|
||||
PRIMARY_IP_ORDERING = ('primary_ip4', 'primary_ip6') if settings.PREFER_IPV4 else ('primary_ip6', 'primary_ip4')
|
||||
|
||||
VMINTERFACE_BUTTONS = """
|
||||
{% if perms.ipam.add_ipaddress %}
|
||||
<a href="{% url 'ipam:ipaddress_add' %}?vminterface={{ record.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-sm btn-success" title="Add IP Address">
|
||||
@ -118,13 +119,7 @@ class VirtualMachineTable(BaseTable):
|
||||
)
|
||||
role = ColoredLabelColumn()
|
||||
tenant = TenantColumn()
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = VirtualMachine
|
||||
fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus', 'memory', 'disk')
|
||||
|
||||
|
||||
class VirtualMachineDetailTable(VirtualMachineTable):
|
||||
comments = MarkdownColumn()
|
||||
primary_ip4 = tables.Column(
|
||||
linkify=True,
|
||||
verbose_name='IPv4 Address'
|
||||
@ -133,19 +128,11 @@ class VirtualMachineDetailTable(VirtualMachineTable):
|
||||
linkify=True,
|
||||
verbose_name='IPv6 Address'
|
||||
)
|
||||
if settings.PREFER_IPV4:
|
||||
primary_ip = tables.Column(
|
||||
linkify=True,
|
||||
order_by=('primary_ip4', 'primary_ip6'),
|
||||
verbose_name='IP Address'
|
||||
)
|
||||
else:
|
||||
primary_ip = tables.Column(
|
||||
linkify=True,
|
||||
order_by=('primary_ip6', 'primary_ip4'),
|
||||
verbose_name='IP Address'
|
||||
)
|
||||
comments = MarkdownColumn()
|
||||
primary_ip = tables.Column(
|
||||
linkify=True,
|
||||
order_by=PRIMARY_IP_ORDERING,
|
||||
verbose_name='IP Address'
|
||||
)
|
||||
tags = TagColumn(
|
||||
url_name='virtualization:virtualmachine_list'
|
||||
)
|
||||
|
Reference in New Issue
Block a user