Closes #838: Display details of all objects being edited/deleted in bulk

This commit is contained in:
Jeremy Stretch
2017-07-13 16:31:47 -04:00
parent 96cef1a7c4
commit 4d3ccf4397
25 changed files with 145 additions and 378 deletions

View File

@@ -1,23 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Circuit Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Circuit</th>
<th>Type</th>
<th>Provider</th>
<th>Port speed</th>
<th>Commit rate</th>
</tr>
{% for circuit in selected_objects %}
<tr>
<td><a href="{% url 'circuits:circuit' pk=circuit.pk %}">{{ circuit }}</a></td>
<td>{{ circuit.type }}</td>
<td>{{ circuit.provider }}</td>
<td>{{ circuit.port_speed_human }}</td>
<td>{{ circuit.commit_rate_human }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,19 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Provider Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Provider</th>
<th>Account</th>
<th>ASN</th>
</tr>
{% for provider in selected_objects %}
<tr>
<td><a href="{% url 'circuits:provider' slug=provider.slug %}">{{ provider }}</a></td>
<td>{{ provider.account }}</td>
<td>{{ provider.asn }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,23 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Device Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Device</th>
<th>Type</th>
<th>Role</th>
<th>Tenant</th>
<th>Serial</th>
</tr>
{% for device in selected_objects %}
<tr>
<td><a href="{% url 'dcim:device' pk=device.pk %}">{{ device }}</a></td>
<td>{{ device.device_type.full_name }}</td>
<td>{{ device.device_role }}</td>
<td>{{ device.tenant }}</td>
<td>{{ device.serial }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,19 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Device Type Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Device type</th>
<th>Manufacturer</th>
<th>Height</th>
</tr>
{% for devicetype in selected_objects %}
<tr>
<td><a href="{% url 'dcim:devicetype' pk=devicetype.pk %}">{{ devicetype.model }}</a></td>
<td>{{ devicetype.manufacturer }}</td>
<td>{{ devicetype.u_height }}U</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,17 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Interface Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Name</th>
<th>Form Factor</th>
</tr>
{% for iface in selected_objects %}
<tr>
<td>{{ iface.name }}</td>
<td>{{ iface.get_form_factor_display }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,25 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Interface Template Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Name</th>
<th>Form Factor</th>
<th>Management</th>
</tr>
{% for iface in selected_objects %}
<tr>
<td>{{ iface.name }}</td>
<td>{{ iface.get_form_factor_display }}</td>
<td>
{% if iface.mgmt_only %}
<i class="glyphicon glyphicon-ok text-success" title="Yes"></i>
{% else %}
<i class="glyphicon glyphicon-remove text-danger" title="No"></i>
{% endif %}
</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,29 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Rack Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Name</th>
<th>Site</th>
<th>Group</th>
<th>Tenant</th>
<th>Role</th>
<th>Type</th>
<th>Width</th>
<th>Height</th>
</tr>
{% for rack in selected_objects %}
<tr>
<td><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack }}</a></td>
<td>{{ rack.site }}</td>
<td>{{ rack.group }}</td>
<td>{{ rack.tenant }}</td>
<td>{{ rack.role }}</td>
<td>{{ rack.get_type_display }}</td>
<td>{{ rack.get_width_display }}</td>
<td>{{ rack.u_height }}U</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,17 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Site Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Site</th>
<th>Tenant</th>
</tr>
{% for site in selected_objects %}
<tr>
<td><a href="{% url 'dcim:site' slug=site.slug %}">{{ site }}</a></td>
<td>{{ site.tenant }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,21 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Aggregate Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Aggregate</th>
<th>RIR</th>
<th>Date Added</th>
<th>Description</th>
</tr>
{% for aggregate in selected_objects %}
<tr>
<td><a href="{% url 'ipam:aggregate' pk=aggregate.pk %}">{{ aggregate }}</a></td>
<td>{{ aggregate.rir }}</td>
<td>{{ aggregate.date_added }}</td>
<td>{{ aggregate.description }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,25 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}IP Address Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>IP Address</th>
<th>VRF</th>
<th>Tenant</th>
<th>Status</th>
<th>Assigned</th>
<th>Description</th>
</tr>
{% for ipaddress in selected_objects %}
<tr>
<td><a href="{% url 'ipam:ipaddress' pk=ipaddress.pk %}">{{ ipaddress }}</a></td>
<td>{{ ipaddress.vrf|default:"Global" }}</td>
<td>{{ ipaddress.tenant }}</td>
<td>{{ ipaddress.get_status_display }}</td>
<td>{% if ipaddress.interface %}<i class="glyphicon glyphicon-ok text-success" title="{{ ipaddress.interface.device }} {{ ipaddress.interface }}"></i>{% endif %}</td>
<td>{{ ipaddress.description }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,25 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Prefix Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Prefix</th>
<th>Site</th>
<th>VRF</th>
<th>Tenant</th>
<th>Status</th>
<th>Role</th>
</tr>
{% for prefix in selected_objects %}
<tr>
<td><a href="{% url 'ipam:prefix' pk=prefix.pk %}">{{ prefix }}</a></td>
<td>{{ prefix.site }}</td>
<td>{{ prefix.vrf|default:"Global" }}</td>
<td>{{ prefix.tenant }}</td>
<td>{{ prefix.get_status_display }}</td>
<td>{{ prefix.role }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,25 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}VLAN Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>VLAN</th>
<th>Site</th>
<th>Group</th>
<th>Tenant</th>
<th>Status</th>
<th>Role</th>
</tr>
{% for vlan in selected_objects %}
<tr>
<td><a href="{% url 'ipam:vlan' pk=vlan.pk %}">{{ vlan }}</a></td>
<td>{{ vlan.site }}</td>
<td>{{ vlan.group }}</td>
<td>{{ vlan.tenant }}</td>
<td>{{ vlan.get_status_display }}</td>
<td>{{ vlan.role }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,21 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}VRF Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>VRF</th>
<th>RD</th>
<th>Tenant</th>
<th>Description</th>
</tr>
{% for vrf in selected_objects %}
<tr>
<td><a href="{% url 'ipam:vrf' pk=vrf.pk %}">{{ vrf.name }}</a></td>
<td>{{ vrf.rd }}</td>
<td>{{ vrf.tenant }}</td>
<td>{{ vrf.description }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,19 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Secret Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Device</th>
<th>Role</th>
<th>Name</th>
</tr>
{% for secret in selected_objects %}
<tr>
<td><a href="{% url 'secrets:secret' pk=secret.pk %}">{{ secret.device }}</a></td>
<td>{{ secret.role }}</td>
<td>{{ secret.name }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,17 +0,0 @@
{% extends 'utilities/bulk_edit_form.html' %}
{% load form_helpers %}
{% block title %}Tenant Bulk Edit{% endblock %}
{% block selected_objects_table %}
<tr>
<th>Tenant</th>
<th>Group</th>
</tr>
{% for tenant in selected_objects %}
<tr>
<td><a href="{% url 'tenancy:tenant' slug=tenant.slug %}">{{ tenant }}</a></td>
<td>{{ tenant.group }}</td>
</tr>
{% endfor %}
{% endblock %}

View File

@@ -1,19 +0,0 @@
{% extends 'utilities/confirmation_form.html' %}
{% load form_helpers %}
{% block title %}Delete {{ obj_type_plural|default:"objects" }}?{% endblock %}
{% block message %}
<p>
Are you sure you want to delete these {{ selected_objects|length }} {{ obj_type_plural|default:"objects" }}{% if parent_obj %} from <a href="{{ parent_obj.get_absolute_url }}">{{ parent_obj }}</a>{% endif %}?
</p>
<ul>
{% for obj in selected_objects %}
{% if obj.get_absolute_url %}
<li><a href="{{ obj.get_absolute_url }}">{{ obj }}</a></li>
{% else %}
<li>{{ obj }}</li>
{% endif %}
{% endfor %}
</ul>
{% endblock %}

View File

@@ -0,0 +1,38 @@
{% extends '_base.html' %}
{% load helpers %}
{% block title %}Delete {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-danger">
<div class="panel-heading"><strong>Confirm Bulk Deletion</strong></div>
<div class="panel-body">
<strong>Warning:</strong> The following operation will delete {{ table.rows|length }} {{ obj_type_plural }}. Please carefully review the {{ obj_type_plural }} to be deleted and confirm below.
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
{% include 'inc/table.html' %}
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<form action="." method="post" class="form">
{% csrf_token %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
<div class="text-center">
<button type="submit" name="_confirm" class="btn btn-danger">Delete these {{ table.rows|length }} {{ obj_type_plural }}</button>
<a href="{{ return_url }}" class="btn btn-default">Cancel</a>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -1,8 +1,9 @@
{% extends '_base.html' %}
{% load helpers %}
{% load form_helpers %}
{% block content %}
<h1>{% block title %}{% endblock %}</h1>
<h1>{% block title %}Editing {{ table.rows|length }} {{ obj_type_plural|bettertitle }}{% endblock %}</h1>
<form action="." method="post" class="form form-horizontal">
{% csrf_token %}
{% if request.POST.return_url %}
@@ -12,15 +13,12 @@
{{ field }}
{% endfor %}
<div class="row">
<div class="col-md-7">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading"><strong>{% block selected_objects_title %}{{ selected_objects|length }} Selected For Editing{% endblock %}</strong></div>
<table class="panel-body table table-hover">
{% block selected_objects_table %}{% endblock %}
</table>
{% include 'inc/table.html' %}
</div>
</div>
<div class="col-md-5">
<div class="col-md-4">
{% if form.non_field_errors %}
<div class="panel panel-danger">
<div class="panel-heading"><strong>Errors</strong></div>