Fixes: #10460 Fix view for connection details

* assumes only one connection for power related connections
* consoleport and consoleserver allow multiple connections on the view
* interface allows mutliple connections and old circuit details removed (circuit is broken since at least 2.7)
This commit is contained in:
Patrick Hurrelmann 2022-09-26 14:53:05 +02:00
parent 148c6a6c23
commit 8060617edc
6 changed files with 44 additions and 59 deletions

View File

@ -72,22 +72,22 @@
</a> </a>
</td> </td>
</tr> </tr>
{% if object.connected_endpoint %} {% for endpoint in object.connected_endpoints %}
<tr> <tr>
<th scope="row">Device</th> <th scope="row">Device</th>
<td>{{ object.connected_endpoint.device|linkify }}</td> <td>{{ endpoint.device|linkify }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ object.connected_endpoint|linkify:"name" }}</td> <td>{{ endpoint|linkify:"name" }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Type</th> <th scope="row">Type</th>
<td>{{ object.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ object.connected_endpoint.description|placeholder }}</td> <td>{{ endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Path Status</th> <th scope="row">Path Status</th>
@ -99,7 +99,7 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %} {% endfor %}
</table> </table>
{% else %} {% else %}
<div class="text-muted"> <div class="text-muted">

View File

@ -72,24 +72,24 @@
</a> </a>
</td> </td>
</tr> </tr>
{% if object.connected_endpoint %} {% for endpoint in object.connected_endpoints %}
<tr> <tr>
<th scope="row">Device</th> <th scope="row">Device</th>
<td> <td>
{{ object.connected_endpoint.device|linkify }} {{ endpoint.device|linkify }}
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ object.connected_endpoint|linkify:"name" }}</td> <td>{{ endpoint|linkify:"name" }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Type</th> <th scope="row">Type</th>
<td>{{ object.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ object.connected_endpoint.description|placeholder }}</td> <td>{{ endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Path Status</th> <th scope="row">Path Status</th>
@ -101,7 +101,7 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %} {% endfor %}
</table> </table>
{% else %} {% else %}
<div class="text-muted"> <div class="text-muted">

View File

@ -165,57 +165,42 @@
</a> </a>
</td> </td>
</tr> </tr>
{% if object.connected_endpoint.device %} {% for endpoint in object.connected_endpoints %}
{% with iface=object.connected_endpoint %} {% if endpoint.device %}
<tr> <tr>
<th scope="row">Device</th> <th scope="row">Device</th>
<td>{{ iface.device|linkify }}</td> <td>{{ endpoint.device|linkify }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ iface|linkify:"name" }}</td> <td>{{ endpoint|linkify:"name" }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Type</th> <th scope="row">Type</th>
<td>{{ iface.get_type_display }}</td> <td>{{ endpoint.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">LAG</th> <th scope="row">LAG</th>
<td>{{ iface.lag|linkify|placeholder }}</td> <td>{{ endpoint.lag|linkify|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ iface.description|placeholder }}</td> <td>{{ endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">MTU</th> <th scope="row">MTU</th>
<td>{{ iface.mtu|placeholder }}</td> <td>{{ endpoint.mtu|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">MAC Address</th> <th scope="row">MAC Address</th>
<td>{{ iface.mac_address|placeholder }}</td> <td>{{ endpoint.mac_address|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">802.1Q Mode</th> <th scope="row">802.1Q Mode</th>
<td>{{ iface.get_mode_display }}</td> <td>{{ endpoint.get_mode_display }}</td>
</tr> </tr>
{% endwith %} {% endif %}
{% elif object.connected_endpoint.circuit %} {% endfor %}
{% with ct=object.connected_endpoint %}
<tr>
<th scope="row">Provider</th>
<td>{{ ct.circuit.provider|linkify }}</td>
</tr>
<tr>
<th scope="row">Circuit</th>
<td>{{ ct.circuit|linkify }}</td>
</tr>
<tr>
<th scope="row">Side</th>
<td>{{ ct.term_side }}</td>
</tr>
{% endwith %}
{% endif %}
<tr> <tr>
<th scope="row">Path Status</th> <th scope="row">Path Status</th>
<td> <td>

View File

@ -41,8 +41,8 @@
<tr> <tr>
<th scope="row">Connected Device</th> <th scope="row">Connected Device</th>
<td> <td>
{% if object.connected_endpoint %} {% if object.connected_endpoints %}
{{ object.connected_endpoint.device|linkify }} ({{ object.connected_endpoint }}) {{ object.connected_endpoints.0.device|linkify }} ({{ object.connected_endpoints.0|linkify:"name" }})
{% else %} {% else %}
{{ ''|placeholder }} {{ ''|placeholder }}
{% endif %} {% endif %}
@ -50,7 +50,7 @@
</tr> </tr>
<tr> <tr>
<th scope="row">Utilization (Allocated)</th> <th scope="row">Utilization (Allocated)</th>
{% with utilization=object.connected_endpoint.get_power_draw %} {% with utilization=object.connected_endpoints.0.get_power_draw %}
{% if utilization %} {% if utilization %}
<td> <td>
{{ utilization.allocated }}VA / {{ object.available_power }}VA {{ utilization.allocated }}VA / {{ object.available_power }}VA
@ -120,22 +120,22 @@
</a> </a>
</td> </td>
</tr> </tr>
{% if object.connected_endpoint %} {% for endpoint in object.connected_endpoints %}
<tr> <tr>
<th scope="row">Device</th> <th scope="row">Device</th>
<td>{{ object.connected_endpoint.device|linkify }}</td> <td>{{ endpoint.device|linkify }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ object.connected_endpoint|linkify:"name" }}</td> <td>{{ endpoint|linkify:"name" }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Type</th> <th scope="row">Type</th>
<td>{{ object.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ endpoint.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ object.connected_endpoint.description|placeholder }}</td> <td>{{ endpoint.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Path Status</th> <th scope="row">Path Status</th>
@ -147,7 +147,7 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %} {% endfor %}
</table> </table>
{% else %} {% else %}
<div class="text-muted"> <div class="text-muted">

View File

@ -78,22 +78,22 @@
</a> </a>
</td> </td>
</tr> </tr>
{% if object.connected_endpoint %} {% if object.connected_endpoints %}
<tr> <tr>
<th scope="row">Device</th> <th scope="row">Device</th>
<td>{{ object.connected_endpoint.device|linkify }}</td> <td>{{ object.connected_endpoints.0.device|linkify }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ object.connected_endpoint|linkify:"name" }}</td> <td>{{ object.connected_endpoints.0|linkify:"name" }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Type</th> <th scope="row">Type</th>
<td>{{ object.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoints.0.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ object.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoints.0.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Path Status</th> <th scope="row">Path Status</th>

View File

@ -78,22 +78,22 @@
</a> </a>
</td> </td>
</tr> </tr>
{% if object.connected_endpoint %} {% if object.connected_endpoints %}
<tr> <tr>
<th scope="row">Device</th> <th scope="row">Device</th>
<td>{{ object.connected_endpoint.device|linkify }}</td> <td>{{ object.connected_endpoints.0.device|linkify }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Name</th> <th scope="row">Name</th>
<td>{{ object.connected_endpoint|linkify:"name" }}</td> <td>{{ object.connected_endpoints.0|linkify:"name" }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Type</th> <th scope="row">Type</th>
<td>{{ object.connected_endpoint.get_type_display|placeholder }}</td> <td>{{ object.connected_endpoints.0.get_type_display|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ object.connected_endpoint.description|placeholder }}</td> <td>{{ object.connected_endpoints.0.description|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Path Status</th> <th scope="row">Path Status</th>
@ -105,7 +105,7 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %} {% endfor %}
</table> </table>
{% else %} {% else %}
<div class="text-muted"> <div class="text-muted">