mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Clean up connection tables
This commit is contained in:
@ -274,17 +274,17 @@ class CableTerminationTable(NetBoxTable):
|
|||||||
verbose_name='Cable Color'
|
verbose_name='Cable Color'
|
||||||
)
|
)
|
||||||
link_peer = columns.TemplateColumn(
|
link_peer = columns.TemplateColumn(
|
||||||
accessor='_link_peer',
|
accessor='link_peers',
|
||||||
template_code=LINKTERMINATION,
|
template_code=LINKTERMINATION,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Link Peer'
|
verbose_name='Link Peers'
|
||||||
)
|
)
|
||||||
mark_connected = columns.BooleanColumn()
|
mark_connected = columns.BooleanColumn()
|
||||||
|
|
||||||
|
|
||||||
class PathEndpointTable(CableTerminationTable):
|
class PathEndpointTable(CableTerminationTable):
|
||||||
connection = columns.TemplateColumn(
|
connection = columns.TemplateColumn(
|
||||||
accessor='_path__last_node',
|
accessor='_path__destinations',
|
||||||
template_code=LINKTERMINATION,
|
template_code=LINKTERMINATION,
|
||||||
verbose_name='Connection',
|
verbose_name='Connection',
|
||||||
orderable=False
|
orderable=False
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
LINKTERMINATION = """
|
LINKTERMINATION = """
|
||||||
{% if value %}
|
{% for termination in value %}
|
||||||
{% if value.parent_object %}
|
<a href="{{ termination.get_absolute_url }}">{{ termination }}</a>{% if not forloop.last %},{% endif %}
|
||||||
<a href="{{ value.parent_object.get_absolute_url }}">{{ value.parent_object }}</a>
|
{% empty %}
|
||||||
<i class="mdi mdi-chevron-right"></i>
|
{{ ''|placeholder }}
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
<a href="{{ value.get_absolute_url }}">{{ value }}</a>
|
|
||||||
{% endif %}
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CABLE_LENGTH = """
|
CABLE_LENGTH = """
|
||||||
@ -13,18 +11,6 @@ CABLE_LENGTH = """
|
|||||||
{% if record.length %}{{ record.length|simplify_decimal }} {{ record.length_unit }}{% endif %}
|
{% if record.length %}{{ record.length|simplify_decimal }} {{ record.length_unit }}{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# CABLE_TERMINATION_PARENT = """
|
|
||||||
# {% with value.0 as termination %}
|
|
||||||
# {% if termination.device %}
|
|
||||||
# <a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
|
|
||||||
# {% elif termination.circuit %}
|
|
||||||
# <a href="{{ termination.circuit.get_absolute_url }}">{{ termination.circuit }}</a>
|
|
||||||
# {% elif termination.power_panel %}
|
|
||||||
# <a href="{{ termination.power_panel.get_absolute_url }}">{{ termination.power_panel }}</a>
|
|
||||||
# {% endif %}
|
|
||||||
# {% endwith %}
|
|
||||||
# """
|
|
||||||
|
|
||||||
DEVICE_LINK = """
|
DEVICE_LINK = """
|
||||||
<a href="{% url 'dcim:device' pk=record.pk %}">
|
<a href="{% url 'dcim:device' pk=record.pk %}">
|
||||||
{{ record.name|default:'<span class="badge bg-info">Unnamed device</span>' }}
|
{{ record.name|default:'<span class="badge bg-info">Unnamed device</span>' }}
|
||||||
|
@ -10,10 +10,12 @@
|
|||||||
<div class="col col-md-5">
|
<div class="col col-md-5">
|
||||||
{% if path %}
|
{% if path %}
|
||||||
<div class="text-center my-3">
|
<div class="text-center my-3">
|
||||||
<object data="{{ svg_url }}" class="rack_elevation"></object>
|
<object data="{{ svg_url }}" class="rack_elevation"></object>
|
||||||
|
<div>
|
||||||
<a class="btn btn-outline-primary btn-sm my-3" href="{{ svg_url }}">
|
<a class="btn btn-outline-primary btn-sm my-3" href="{{ svg_url }}">
|
||||||
<i class="mdi mdi-file-download"></i> Download SVG
|
<i class="mdi mdi-file-download"></i> Download SVG
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="trace-end">
|
<div class="trace-end">
|
||||||
{% with traced_path=path.origin.trace %}
|
{% with traced_path=path.origin.trace %}
|
||||||
@ -80,18 +82,16 @@
|
|||||||
{% for cablepath in related_paths %}
|
{% for cablepath in related_paths %}
|
||||||
<tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
|
<tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
|
||||||
<td>
|
<td>
|
||||||
<a href="?cablepath_id={{ cablepath.pk }}">
|
<a href="?cablepath_id={{ cablepath.pk }}">{{ cablepath.origins|join:", " }}</a>
|
||||||
{{ cablepath.origin.parent_object }} / {{ cablepath.origin }}
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if cablepath.destination %}
|
{% if cablepath.destinations %}
|
||||||
{{ cablepath.destination }} ({{ cablepath.destination.parent_object }})
|
{{ cablepath.destinations|join:", " }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="text-muted">Incomplete</span>
|
<span class="text-muted">Incomplete</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-end">
|
<td>
|
||||||
{{ cablepath.segment_count }}
|
{{ cablepath.segment_count }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Reference in New Issue
Block a user