mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added cable connections to component lists
This commit is contained in:
@ -886,7 +886,7 @@ class DeviceView(View):
|
||||
)
|
||||
|
||||
# Console server ports
|
||||
consoleserverports = ConsoleServerPort.objects.filter(device=device).select_related('connected_endpoint')
|
||||
consoleserverports = ConsoleServerPort.objects.filter(device=device).select_related('connected_endpoint__device')
|
||||
|
||||
# Power ports
|
||||
power_ports = natsorted(
|
||||
@ -894,7 +894,7 @@ class DeviceView(View):
|
||||
)
|
||||
|
||||
# Power outlets
|
||||
poweroutlets = PowerOutlet.objects.filter(device=device).select_related('connected_endpoint')
|
||||
poweroutlets = PowerOutlet.objects.filter(device=device).select_related('connected_endpoint__device')
|
||||
|
||||
# Interfaces
|
||||
interfaces = device.vc_interfaces.order_naturally(
|
||||
|
@ -527,6 +527,7 @@
|
||||
<th>Description</th>
|
||||
<th>Mode</th>
|
||||
<th colspan="2">Connection</th>
|
||||
<th>Cable</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -590,6 +591,7 @@
|
||||
{% endif %}
|
||||
<th>Name</th>
|
||||
<th colspan="2">Connection</th>
|
||||
<th>Cable</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -648,6 +650,7 @@
|
||||
{% endif %}
|
||||
<th>Name</th>
|
||||
<th colspan="2">Connection</th>
|
||||
<th>Cable</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<tr>
|
||||
<td>Device</td>
|
||||
<td>
|
||||
<a href="{{ termination.device.parent.get_absolute_url }}">{{ termination.device }}</a>
|
||||
<a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1,7 +1,11 @@
|
||||
<tr class="consoleport{% if cp.connected_endpoint %} {% if cp.connection_status %}success{% else %}info{% endif %}{% endif %}">
|
||||
|
||||
{# Name #}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-keyboard-o"></i> {{ cp }}
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if cp.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=cp.connected_endpoint.device.pk %}">{{ cp.connected_endpoint.device }}</a>
|
||||
@ -14,6 +18,17 @@
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% with cable=cp.get_connected_cable %}
|
||||
{% if cable %}
|
||||
via <a href="{{ cable.get_absolute_url }}">{{ cable }}</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_consoleport %}
|
||||
{% if cp.connected_endpoint %}
|
||||
|
@ -1,12 +1,18 @@
|
||||
<tr class="consoleserverport{% if csp.connected_endpoint %} {%if csp.connected_endpoint.connection_status %}success{% else %}info{% endif %}{% endif %}">
|
||||
|
||||
{# Checkbox #}
|
||||
{% if perms.dcim.change_consoleserverport or perms.dcim.delete_consoleserverport %}
|
||||
<td class="pk">
|
||||
<input name="pk" type="checkbox" value="{{ csp.pk }}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Name #}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-keyboard-o"></i> {{ csp }}
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if csp.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=csp.connected_endpoint.device.pk %}">{{ csp.connected_endpoint.device }}</a>
|
||||
@ -19,6 +25,20 @@
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% with cable=csp.get_connected_cable %}
|
||||
{% if cable %}
|
||||
<a href="{{ cable.get_absolute_url }}">{{ cable }}</a>
|
||||
{% if cable.far_end != csp.connected_endpoint %}
|
||||
to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> {{ cable.far_end }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_consoleserverport %}
|
||||
{% if csp.connected_endpoint %}
|
||||
|
@ -1,34 +1,46 @@
|
||||
<tr class="frontport">
|
||||
{% if perms.dcim.change_frontport or perms.dcim.delete_frontport %}
|
||||
<td class="pk">
|
||||
<input name="pk" type="checkbox" value="{{ frontport.pk }}" />
|
||||
{% with cable=frontport.get_connected_cable %}
|
||||
<tr class="frontport{% if cable %} {% if cable.status %}success{% else %}info{% endif %}{% endif %}">
|
||||
|
||||
{# Checkbox #}
|
||||
{% if perms.dcim.change_frontport or perms.dcim.delete_frontport %}
|
||||
<td class="pk">
|
||||
<input name="pk" type="checkbox" value="{{ frontport.pk }}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Name #}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-square-o"></i> {{ frontport }}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-square-o"></i> {{ frontport }}
|
||||
</td>
|
||||
<td>{{ frontport.get_type_display }}</td>
|
||||
<td>{{ frontport.rear_port }}</td>
|
||||
<td>{{ frontport.rear_port_position }}</td>
|
||||
{% with cable=frontport.get_connected_cable %}
|
||||
|
||||
{# Type #}
|
||||
<td>{{ frontport.get_type_display }}</td>
|
||||
|
||||
{# Rear port #}
|
||||
<td>{{ frontport.rear_port }}</td>
|
||||
<td>{{ frontport.rear_port_position }}</td>
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% if cable %}
|
||||
<a href="#">{{ cable }}</a> to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> <a href="{{ cable.far_end.get_absolute_url }}">{{ cable.far_end }}</a>
|
||||
<a href="{{ cable.get_absolute_url }}">{{ cable }}</a> to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> <a href="{{ cable.far_end.get_absolute_url }}">{{ cable.far_end }}</a>
|
||||
{% else %}
|
||||
<span class="text-muted">Not connected</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_frontport %}
|
||||
<a href="{% url 'dcim:frontport_edit' pk=frontport.pk %}?return_url={{ device.get_absolute_url }}" title="Edit port" class="btn btn-info btn-xs">
|
||||
<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.dcim.delete_frontport %}
|
||||
<a href="{% url 'dcim:frontport_delete' pk=frontport.pk %}?return_url={{ device.get_absolute_url }}" title="Delete port" class="btn btn-danger btn-xs">
|
||||
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_frontport %}
|
||||
<a href="{% url 'dcim:frontport_edit' pk=frontport.pk %}?return_url={{ device.get_absolute_url }}" title="Edit port" class="btn btn-info btn-xs">
|
||||
<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.dcim.delete_frontport %}
|
||||
<a href="{% url 'dcim:frontport_delete' pk=frontport.pk %}?return_url={{ device.get_absolute_url }}" title="Delete port" class="btn btn-danger btn-xs">
|
||||
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
|
@ -69,6 +69,18 @@
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% with cable=iface.get_connected_cable %}
|
||||
{% if cable %}
|
||||
<a href="{{ cable.get_absolute_url }}">{{ cable }}</a>
|
||||
{% if cable.far_end != csp.connected_endpoint %}
|
||||
to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> {{ cable.far_end }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
|
||||
{# Buttons #}
|
||||
<td class="text-right text-nowrap">
|
||||
{% if show_graphs %}
|
||||
|
@ -1,12 +1,18 @@
|
||||
<tr class="poweroutlet{% if po.connected_endpoint %} {% if po.connected_endpoint.connection_status %}success{% else %}info{% endif %}{% endif %}">
|
||||
|
||||
{# Checkbox #}
|
||||
{% if perms.dcim.change_poweroutlet or perms.dcim.delete_poweroutlet %}
|
||||
<td class="pk">
|
||||
<input name="pk" type="checkbox" value="{{ po.pk }}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Name #}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-bolt"></i> {{ po }}
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if po.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=po.connected_endpoint.device.pk %}">{{ po.connected_endpoint.device }}</a>
|
||||
@ -19,6 +25,17 @@
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% with cable=po.get_connected_cable %}
|
||||
{% if cable %}
|
||||
<a href="{{ cable.get_absolute_url }}">{{ cable }}</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_poweroutlet %}
|
||||
{% if po.connected_endpoint %}
|
||||
|
@ -1,7 +1,11 @@
|
||||
<tr class="powerport{% if pp.connected_endpoint %} {% if pp.connection_status %}success{% else %}info{% endif %}{% endif %}">
|
||||
|
||||
{# Name #}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-bolt"></i> {{ pp }}
|
||||
</td>
|
||||
|
||||
{# Connection #}
|
||||
{% if pp.connected_endpoint %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=pp.connected_endpoint.device.pk %}">{{ pp.connected_endpoint.device }}</a>
|
||||
@ -14,6 +18,17 @@
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% with cable=pp.get_connected_cable %}
|
||||
{% if cable %}
|
||||
via <a href="{{ cable.get_absolute_url }}">{{ cable }}</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_powerport %}
|
||||
{% if pp.connected_endpoint %}
|
||||
|
@ -1,33 +1,45 @@
|
||||
<tr class="rearport">
|
||||
{% if perms.dcim.change_rearport or perms.dcim.delete_rearport %}
|
||||
<td class="pk">
|
||||
<input name="pk" type="checkbox" value="{{ rearport.pk }}" />
|
||||
{% with cable=rearport.get_connected_cable %}
|
||||
<tr class="rearport{% if cable %} {% if cable.status %}success{% else %}info{% endif %}{% endif %}">
|
||||
|
||||
{# Checkbox #}
|
||||
{% if perms.dcim.change_rearport or perms.dcim.delete_rearport %}
|
||||
<td class="pk">
|
||||
<input name="pk" type="checkbox" value="{{ rearport.pk }}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Name #}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-square-o"></i> {{ rearport }}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
<i class="fa fa-fw fa-square-o"></i> {{ rearport }}
|
||||
</td>
|
||||
<td>{{ rearport.get_type_display }}</td>
|
||||
<td>{{ rearport.positions }}</td>
|
||||
{% with cable=rearport.get_connected_cable %}
|
||||
|
||||
{# Type #}
|
||||
<td>{{ rearport.get_type_display }}</td>
|
||||
|
||||
{# Positions #}
|
||||
<td>{{ rearport.positions }}</td>
|
||||
|
||||
{# Cable #}
|
||||
<td>
|
||||
{% if cable %}
|
||||
<a href="#">{{ cable }}</a> to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> <a href="{{ cable.far_end.get_absolute_url }}">{{ cable.far_end }}</a>
|
||||
<a href="{{ cable.get_absolute_url }}">{{ cable }}</a> to <a href="{{ cable.far_end.device.get_absolute_url }}">{{ cable.far_end.device }}</a> <a href="{{ cable.far_end.get_absolute_url }}">{{ cable.far_end }}</a>
|
||||
{% else %}
|
||||
<span class="text-muted">Not connected</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_rearport %}
|
||||
<a href="{% url 'dcim:rearport_edit' pk=rearport.pk %}?return_url={{ device.get_absolute_url }}" title="Edit port" class="btn btn-info btn-xs">
|
||||
<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.dcim.delete_rearport %}
|
||||
<a href="{% url 'dcim:rearport_delete' pk=rearport.pk %}?return_url={{ device.get_absolute_url }}" title="Delete port" class="btn btn-danger btn-xs">
|
||||
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right">
|
||||
{% if perms.dcim.change_rearport %}
|
||||
<a href="{% url 'dcim:rearport_edit' pk=rearport.pk %}?return_url={{ device.get_absolute_url }}" title="Edit port" class="btn btn-info btn-xs">
|
||||
<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.dcim.delete_rearport %}
|
||||
<a href="{% url 'dcim:rearport_delete' pk=rearport.pk %}?return_url={{ device.get_absolute_url }}" title="Delete port" class="btn btn-danger btn-xs">
|
||||
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
|
Reference in New Issue
Block a user