Initial work on #20 - patch panels

This commit is contained in:
Jeremy Stretch
2018-10-03 14:04:16 -04:00
parent 66db32fefd
commit bd72c26a57
18 changed files with 1101 additions and 34 deletions

View File

@@ -689,6 +689,111 @@
</form>
{% endif %}
{% endif %}
{% if front_panel_ports or device.device_type.is_patch_panel %}
<form method="post">
{% csrf_token %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Front Panel Ports</strong>
</div>
<table class="table table-hover table-headings panel-body component-list">
<thead>
<tr>
{% if perms.dcim.change_frontpanelport or perms.dcim.delete_frontpanelport %}
<th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
{% endif %}
<th>Name</th>
<th>Type</th>
<th>Rear Port</th>
<th>Position</th>
<th></th>
</tr>
</thead>
<tbody>
{% for frontpanelport in front_panel_ports %}
{% include 'dcim/inc/frontpanelport.html' %}
{% empty %}
<tr>
<td colspan="5" class="text-center text-muted">&mdash; No front panel ports defined &mdash;</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="panel-footer">
{% if front_panel_ports and perms.dcim.change_frontpanelport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:frontpanelport_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>
{% endif %}
{% if front_panel_ports and perms.dcim.delete_frontpanelport %}
<button type="submit" formaction="{% url 'dcim:frontpanelport_bulk_delete' pk=device.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
</button>
{% endif %}
{% if perms.dcim.add_frontpanelport %}
<div class="pull-right">
<a href="{% url 'dcim:frontpanelport_add' pk=device.pk %}" class="btn btn-primary btn-xs">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add front panel ports
</a>
</div>
<div class="clearfix"></div>
{% endif %}
</div>
</div>
</form>
{% endif %}
{% if rear_panel_ports or device.device_type.is_patch_panel %}
<form method="post">
{% csrf_token %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Rear Panel Ports</strong>
</div>
<table class="table table-hover table-headings panel-body component-list">
<thead>
<tr>
{% if perms.dcim.change_rearpanelport or perms.dcim.delete_rearpanelport %}
<th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
{% endif %}
<th>Name</th>
<th>Type</th>
<th>Positions</th>
<th></th>
</tr>
</thead>
<tbody>
{% for rearpanelport in rear_panel_ports %}
{% include 'dcim/inc/rearpanelport.html' %}
{% empty %}
<tr>
<td colspan="5" class="text-center text-muted">&mdash; No rear panel ports defined &mdash;</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="panel-footer">
{% if rear_panel_ports and perms.dcim.change_rearpanelport %}
<button type="submit" name="_rename" formaction="{% url 'dcim:rearpanelport_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>
{% endif %}
{% if rear_panel_ports and perms.dcim.delete_rearpanelport %}
<button type="submit" formaction="{% url 'dcim:rearpanelport_bulk_delete' pk=device.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
</button>
{% endif %}
{% if perms.dcim.add_rearpanelport %}
<div class="pull-right">
<a href="{% url 'dcim:rearpanelport_add' pk=device.pk %}" class="btn btn-primary btn-xs">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add rear panel ports
</a>
</div>
<div class="clearfix"></div>
{% endif %}
</div>
</div>
</form>
{% endif %}
</div>
</div>
{% include 'inc/graphs_modal.html' %}