Added initial UI views for virtual chassis assignment

This commit is contained in:
Jeremy Stretch
2017-11-29 12:58:36 -05:00
parent 3b801d43bc
commit 5f91413023
8 changed files with 191 additions and 6 deletions

View File

@@ -98,6 +98,39 @@
</tr>
</table>
</div>
{% if vc_memberships %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Virtual Chassis</strong>
</div>
<table class="table table-hover panel-body attr-table">
<tr>
<th>Device</th>
<th>Position</th>
<th>Master</th>
<th>Priority</th>
</tr>
{% for vcm in vc_memberships %}
<tr{% if vcm.device == device %} class="success"{% endif %}>
<td>
<a href="{{ vcm.device.get_absolute_url }}">{{ vcm.device }}</a>
</td>
<td>{{ vcm.position }}</td>
<td>{{ vcm.is_master }}</td>
<td>{{ vcm.priority|default:"" }}</td>
<td>
</tr>
{% endfor %}
</table>
{% if perms.dcim.delete_virtualchassis %}
<div class="panel-footer text-right">
<a href="{% url 'dcim:virtualchassis_delete' pk=device.virtual_chassis.pk %}" class="btn btn-danger btn-xs">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete Virtual Chassis
</a>
</div>
{% endif %}
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Management</strong>

View File

@@ -16,4 +16,9 @@
</ul>
</div>
{% endif %}
{% if perms.dcim.add_virtualchassis %}
<button type="submit" name="_edit" formaction="{% url 'dcim:virtualchassis_add' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Create Virtual Chassis
</button>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,56 @@
{% extends '_base.html' %}
{% load form_helpers %}
{% block content %}
<form action="" method="post" enctype="multipart/form-data" class="form form-horizontal">
{% csrf_token %}
{{ pk_form.pk }}
{{ formset.management_form }}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h3>{% block title %}New Virtual Chassis{% endblock %}</h3>
{% if vc_form.non_field_errors %}
<div class="panel panel-danger">
<div class="panel-heading"><strong>Errors</strong></div>
<div class="panel-body">
{{ vc_form.non_field_errors }}
</div>
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading"><strong>Virtual Chassis</strong></div>
<div class="table panel-body">
{% render_form vc_form %}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Members</strong></div>
<table class="table panel-body">
<thead>
<tr>
<th>Device</th>
<th>Position</th>
<th>Priority</th>
</tr>
</thead>
<tbody>
{% for form in formset %}
<tr>
<td>{{ form.device }}</td>
<td>{{ form.position }}</td>
<td>{{ form.priority }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3 text-right">
<button type="submit" name="_create" class="btn btn-primary">Create</button>
<a href="{{ return_url }}" class="btn btn-default">Cancel</a>
</div>
</div>
</form>
{% endblock %}