1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Implemented built-in CSV export for IPAM objects

This commit is contained in:
Jeremy Stretch
2016-06-16 12:08:50 -04:00
parent 4bb9363e81
commit 66600ef984
8 changed files with 80 additions and 66 deletions

View File

@@ -0,0 +1,20 @@
{% 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 {{ obj_type }} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export">CSV (default)</a></li>
<li class="divider"></li>
{% for et in export_templates %}
<li><a href="?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export={{ et.name }}">{{ et.name }}</a></li>
{% endfor %}
</ul>
</div>
{% else %}
<a href="?{% if request.GET %}{{ request.GET.urlencode }}&{% endif %}export" class="btn btn-success">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>
Export {{ obj_type }}
</a>
{% endif %}

View File

@@ -12,19 +12,7 @@
Add an aggregate
</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 aggregates <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'ipam:aggregate_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='aggregates' %}
</div>
<h1>Aggregates</h1>
<div class="row">

View File

@@ -16,19 +16,7 @@
Import IPs
</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 IP addresses <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'ipam:ipaddress_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='IPs' %}
</div>
<h1>IP Addresses</h1>
<div class="row">

View File

@@ -16,19 +16,7 @@
Import prefixes
</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 prefixes <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'ipam:prefix_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='prefixes' %}
</div>
<h1>Prefixes</h1>
<div class="row">

View File

@@ -16,19 +16,7 @@
Import VLANs
</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 VLANs <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'ipam:vlan_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='VLANs' %}
</div>
<h1>VLANs</h1>
<div class="row">

View File

@@ -16,19 +16,7 @@
Import VRFs
</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 VRFs <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for et in export_templates %}
<li><a href="{% url 'ipam:vrf_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='VRFs' %}
</div>
<h1>VRFs</h1>
<div class="row">