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'
|
||||
)
|
||||
link_peer = columns.TemplateColumn(
|
||||
accessor='_link_peer',
|
||||
accessor='link_peers',
|
||||
template_code=LINKTERMINATION,
|
||||
orderable=False,
|
||||
verbose_name='Link Peer'
|
||||
verbose_name='Link Peers'
|
||||
)
|
||||
mark_connected = columns.BooleanColumn()
|
||||
|
||||
|
||||
class PathEndpointTable(CableTerminationTable):
|
||||
connection = columns.TemplateColumn(
|
||||
accessor='_path__last_node',
|
||||
accessor='_path__destinations',
|
||||
template_code=LINKTERMINATION,
|
||||
verbose_name='Connection',
|
||||
orderable=False
|
||||
|
@ -1,11 +1,9 @@
|
||||
LINKTERMINATION = """
|
||||
{% if value %}
|
||||
{% if value.parent_object %}
|
||||
<a href="{{ value.parent_object.get_absolute_url }}">{{ value.parent_object }}</a>
|
||||
<i class="mdi mdi-chevron-right"></i>
|
||||
{% endif %}
|
||||
<a href="{{ value.get_absolute_url }}">{{ value }}</a>
|
||||
{% endif %}
|
||||
{% for termination in value %}
|
||||
<a href="{{ termination.get_absolute_url }}">{{ termination }}</a>{% if not forloop.last %},{% endif %}
|
||||
{% empty %}
|
||||
{{ ''|placeholder }}
|
||||
{% endfor %}
|
||||
"""
|
||||
|
||||
CABLE_LENGTH = """
|
||||
@ -13,18 +11,6 @@ CABLE_LENGTH = """
|
||||
{% 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 = """
|
||||
<a href="{% url 'dcim:device' pk=record.pk %}">
|
||||
{{ record.name|default:'<span class="badge bg-info">Unnamed device</span>' }}
|
||||
|
@ -11,10 +11,12 @@
|
||||
{% if path %}
|
||||
<div class="text-center my-3">
|
||||
<object data="{{ svg_url }}" class="rack_elevation"></object>
|
||||
<div>
|
||||
<a class="btn btn-outline-primary btn-sm my-3" href="{{ svg_url }}">
|
||||
<i class="mdi mdi-file-download"></i> Download SVG
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="trace-end">
|
||||
{% with traced_path=path.origin.trace %}
|
||||
{% if path.is_split %}
|
||||
@ -80,18 +82,16 @@
|
||||
{% for cablepath in related_paths %}
|
||||
<tr{% if cablepath.pk == path.pk %} class="info"{% endif %}>
|
||||
<td>
|
||||
<a href="?cablepath_id={{ cablepath.pk }}">
|
||||
{{ cablepath.origin.parent_object }} / {{ cablepath.origin }}
|
||||
</a>
|
||||
<a href="?cablepath_id={{ cablepath.pk }}">{{ cablepath.origins|join:", " }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if cablepath.destination %}
|
||||
{{ cablepath.destination }} ({{ cablepath.destination.parent_object }})
|
||||
{% if cablepath.destinations %}
|
||||
{{ cablepath.destinations|join:", " }}
|
||||
{% else %}
|
||||
<span class="text-muted">Incomplete</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<td>
|
||||
{{ cablepath.segment_count }}
|
||||
</td>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user