mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Convert device power outlets list to table
This commit is contained in:
@@ -140,7 +140,7 @@
|
||||
<a href="#powerports" role="tab" data-toggle="tab">Power Ports {% badge powerport_table.rows|length %}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#poweroutlets" role="tab" data-toggle="tab">Power Outlets {% badge poweroutlets|length %}</a>
|
||||
<a href="#poweroutlets" role="tab" data-toggle="tab">Power Outlets {% badge poweroutlet_table.rows|length %}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#devicebays" role="tab" data-toggle="tab">Device Bays {% badge devicebays|length %}</a>
|
||||
@@ -780,29 +780,9 @@
|
||||
<div class="panel-heading">
|
||||
<strong>Power Outlets</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-headings panel-body component-list">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if perms.dcim.change_poweroutlet or perms.dcim.delete_poweroutlet %}
|
||||
<th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
|
||||
{% endif %}
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Input/Leg</th>
|
||||
<th>Description</th>
|
||||
<th>Cable</th>
|
||||
<th colspan="3">Connection</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for po in poweroutlets %}
|
||||
{% include 'dcim/inc/poweroutlet.html' %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% include 'responsive_table.html' with table=poweroutlet_table %}
|
||||
<div class="panel-footer noprint">
|
||||
{% if poweroutlets and perms.dcim.change_powerport %}
|
||||
{% if perms.dcim.change_powerport %}
|
||||
<button type="submit" name="_rename" formaction="{% url 'dcim:poweroutlet_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
|
||||
</button>
|
||||
@@ -813,7 +793,7 @@
|
||||
<span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if poweroutlets and perms.dcim.delete_poweroutlet %}
|
||||
{% if perms.dcim.delete_poweroutlet %}
|
||||
<button type="submit" formaction="{% url 'dcim:poweroutlet_bulk_delete' %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
|
||||
</button>
|
||||
|
@@ -1,93 +0,0 @@
|
||||
{% load helpers %}
|
||||
|
||||
<tr class="poweroutlet{% if po.cable %} {{ po.cable.get_status_class }}{% 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>
|
||||
<a href="{{ po.get_absolute_url }}">{{ po }}</a>
|
||||
</td>
|
||||
|
||||
{# Type #}
|
||||
<td>
|
||||
{{ po.get_type_display }}
|
||||
</td>
|
||||
|
||||
{# Input/leg #}
|
||||
<td>
|
||||
{% if po.power_port %}
|
||||
{{ po.power_port }}{% if po.feed_leg %} / {{ po.get_feed_leg_display }}{% endif %}
|
||||
{% elif po.feed_leg %}
|
||||
{{ po.get_feed_leg_display }}
|
||||
{% else %}
|
||||
<span class="text-warning">None</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
{# Description #}
|
||||
<td>
|
||||
{{ po.description|placeholder }}
|
||||
</td>
|
||||
|
||||
{# Cable #}
|
||||
{% if po.cable %}
|
||||
<td>
|
||||
<a href="{{ po.cable.get_absolute_url }}">{{ po.cable }}</a>
|
||||
<a href="{% url 'dcim:poweroutlet_trace' pk=po.pk %}" class="btn btn-primary btn-xs" title="Trace">
|
||||
<i class="fa fa-share-alt" aria-hidden="true"></i>
|
||||
</a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td><span class="text-muted">Not connected</span></td>
|
||||
{% endif %}
|
||||
|
||||
{# Connection #}
|
||||
{% with path=po.path %}
|
||||
{% include 'dcim/inc/endpoint_connection.html' %}
|
||||
<td>
|
||||
{% if paths|length == 1 %}
|
||||
{% with pp=paths.0.destination %}
|
||||
{% if pp.allocated_draw %}
|
||||
{{ pp.allocated_draw }}W{% if pp.maximum_draw %} ({{ pp.maximum_draw }}W max){% endif %}
|
||||
{% elif pp.maximum_draw %}
|
||||
{{ pp.maximum_draw }}W
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
|
||||
{# Actions #}
|
||||
<td class="text-right noprint">
|
||||
{% if po.cable %}
|
||||
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=po.cable %}
|
||||
{% elif perms.dcim.add_cable %}
|
||||
<a href="{% url 'dcim:poweroutlet_connect' termination_a_id=po.pk termination_b_type='power-port' %}?return_url={{ device.get_absolute_url }}" title="Connect" class="btn btn-success btn-xs">
|
||||
<i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.dcim.change_poweroutlet %}
|
||||
<a href="{% url 'dcim:poweroutlet_edit' pk=po.pk %}?return_url={{ device.get_absolute_url }}" title="Edit outlet" class="btn btn-info btn-xs">
|
||||
<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.dcim.delete_poweroutlet %}
|
||||
{% if po.connected_endpoint %}
|
||||
<button class="btn btn-danger btn-xs" disabled="disabled">
|
||||
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
<a href="{% url 'dcim:poweroutlet_delete' pk=po.pk %}?return_url={{ device.get_absolute_url }}" title="Delete outlet" class="btn btn-danger btn-xs">
|
||||
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
Reference in New Issue
Block a user