Implemented built-in CSV export for DCIM objects

This commit is contained in:
Jeremy Stretch
2016-06-16 13:38:31 -04:00
parent 66600ef984
commit 943c7934f3
8 changed files with 101 additions and 86 deletions
@@ -5,19 +5,13 @@
{% block content %}
<div class="pull-right">
{% if export_templates %}
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export connections <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'dcim:console_connections_list' %}?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% if perms.dcim.change_consoleport %}
<a href="{% url 'dcim:console_connections_import' %}" class="btn btn-info">
<span class="glyphicon glyphicon-import" aria-hidden="true"></span>
Import connections
</a>
{% endif %}
{% include 'inc/export_button.html' with obj_type='connections' %}
</div>
<h1>Console Connections</h1>
<div class="row">
+1 -13
View File
@@ -15,19 +15,7 @@
Import devices
</a>
{% endif %}
{% if export_templates %}
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export devices <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'dcim:device_list' %}?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% include 'inc/export_button.html' with obj_type='devices' %}
</div>
<h1>Devices</h1>
<div class="row">
@@ -5,19 +5,13 @@
{% block content %}
<div class="pull-right">
{% if export_templates %}
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export connections <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'dcim:interface_connections_list' %}?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% if perms.dcim.add_interfaceconnection %}
<a href="{% url 'dcim:interface_connections_import' %}" class="btn btn-info">
<span class="glyphicon glyphicon-import" aria-hidden="true"></span>
Import connections
</a>
{% endif %}
{% include 'inc/export_button.html' with obj_type='connections' %}
</div>
<h1>Interface Connections</h1>
<div class="row">
@@ -5,19 +5,13 @@
{% block content %}
<div class="pull-right">
{% if export_templates %}
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export connections <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'dcim:power_connections_list' %}?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% if perms.dcim.change_powerport %}
<a href="{% url 'dcim:power_connections_import' %}" class="btn btn-info">
<span class="glyphicon glyphicon-import" aria-hidden="true"></span>
Import connections
</a>
{% endif %}
{% include 'inc/export_button.html' with obj_type='connections' %}
</div>
<h1>Power Connections</h1>
<div class="row">
+1 -13
View File
@@ -15,19 +15,7 @@
Import racks
</a>
{% endif %}
{% if export_templates %}
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export racks <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'dcim:rack_list' %}?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% include 'inc/export_button.html' with obj_type='racks' %}
</div>
<h1>Racks</h1>
<div class="row">
+1 -13
View File
@@ -11,19 +11,7 @@
Add a site
</a>
{% endif %}
{% if export_templates %}
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export sites <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'dcim:site_list' %}?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% include 'inc/export_button.html' with obj_type='sites' %}
</div>
<h1>Sites</h1>
{% render_table table 'table.html' %}