Skip to content

Commit

Permalink
Closes #1714: Standardized CSV export functionality for all object lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Feb 2, 2018
1 parent 12e6fe1 commit b96e3af
Show file tree
Hide file tree
Showing 38 changed files with 180 additions and 285 deletions.
13 changes: 4 additions & 9 deletions netbox/templates/circuits/circuit_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.circuits.add_circuit %}
<a href="{% url 'circuits:circuit_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a circuit
</a>
<a href="{% url 'circuits:circuit_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import circuits
</a>
{% add_button 'circuits:circuit_add' %}
{% import_button 'circuits:circuit_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='circuits' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Circuits{% endblock %}</h1>
<div class="row">
Expand Down
12 changes: 4 additions & 8 deletions netbox/templates/circuits/circuittype_list.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.circuits.add_circuittype %}
<a href="{% url 'circuits:circuittype_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a circuit type
</a>
<a href="{% url 'circuits:circuittype_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import circuit types
</a>
{% add_button 'circuits:circuittype_add' %}
{% import_button 'circuits:circuittype_import' %}
{% endif %}
{% export_button content_type %}
</div>
<h1>{% block title %}Circuit Types{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/circuits/provider_list.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{% extends '_base.html' %}
{% load buttons %}

{% block content %}
<div class="pull-right">
{% if perms.circuits.add_provider %}
<a href="{% url 'circuits:provider_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a provider
</a>
<a href="{% url 'circuits:provider_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import providers
</a>
{% add_button 'circuits:provider_add' %}
{% import_button 'circuits:provider_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='providers' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Providers{% endblock %}</h1>
<div class="row">
Expand Down
8 changes: 3 additions & 5 deletions netbox/templates/dcim/console_connections_list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{% extends '_base.html' %}
{% load buttons %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.change_consoleport %}
<a href="{% url 'dcim:console_connections_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import connections
</a>
{% import_button 'dcim:console_connections_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='connections' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Console Connections{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/device_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_device %}
<a href="{% url 'dcim:device_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a device
</a>
<a href="{% url 'dcim:device_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import devices
</a>
{% add_button 'dcim:device_add' %}
{% import_button 'dcim:device_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='devices' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Devices{% endblock %}</h1>
<div class="row">
Expand Down
12 changes: 4 additions & 8 deletions netbox/templates/dcim/devicerole_list.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_devicerole %}
<a href="{% url 'dcim:devicerole_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a device role
</a>
<a href="{% url 'dcim:devicerole_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import device roles
</a>
{% add_button 'dcim:devicerole_add' %}
{% import_button 'dcim:devicerole_import' %}
{% endif %}
{% export_button content_type %}
</div>
<h1>{% block title %}Device Roles{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/devicetype_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_devicetype %}
<a href="{% url 'dcim:devicetype_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a device type
</a>
<a href="{% url 'dcim:devicetype_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import device types
</a>
{% add_button 'dcim:devicetype_add' %}
{% import_button 'dcim:devicetype_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='device types' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Device Types{% endblock %}</h1>
<div class="row">
Expand Down
8 changes: 3 additions & 5 deletions netbox/templates/dcim/interface_connections_list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{% extends '_base.html' %}
{% load buttons %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_interfaceconnection %}
<a href="{% url 'dcim:interface_connections_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import connections
</a>
{% import_button 'dcim:interface_connections_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='connections' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Interface Connections{% endblock %}</h1>
<div class="row">
Expand Down
8 changes: 3 additions & 5 deletions netbox/templates/dcim/inventoryitem_list.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_devicetype %}
<a href="{% url 'dcim:inventoryitem_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import inventory items
</a>
{% import_button 'dcim:inventoryitem_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='inventory items' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Inventory Items{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/manufacturer_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_manufacturer %}
<a href="{% url 'dcim:manufacturer_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a manufacturer
</a>
<a href="{% url 'dcim:manufacturer_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import manufacturers
</a>
{% add_button 'dcim:manufacturer_add' %}
{% import_button 'dcim:manufacturer_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='manufacturers' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Manufacturers{% endblock %}</h1>
<div class="row">
Expand Down
12 changes: 4 additions & 8 deletions netbox/templates/dcim/platform_list.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_platform %}
<a href="{% url 'dcim:platform_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a platform
</a>
<a href="{% url 'dcim:platform_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import platforms
</a>
{% add_button 'dcim:platform_add' %}
{% import_button 'dcim:platform_import' %}
{% endif %}
{% export_button content_type %}
</div>
<h1>{% block title %}Platforms{% endblock %}</h1>
<div class="row">
Expand Down
8 changes: 3 additions & 5 deletions netbox/templates/dcim/power_connections_list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{% extends '_base.html' %}
{% load buttons %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.change_powerport %}
<a href="{% url 'dcim:power_connections_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import connections
</a>
{% import_button 'dcim:power_connections_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='connections' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Power Connections{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/rack_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_rack %}
<a href="{% url 'dcim:rack_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a rack
</a>
<a href="{% url 'dcim:rack_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import racks
</a>
{% add_button 'dcim:rack_add' %}
{% import_button 'dcim:rack_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='racks' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Racks{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/rackgroup_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_rackgroup %}
<a href="{% url 'dcim:rackgroup_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a rack group
</a>
<a href="{% url 'dcim:rackgroup_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import rack groups
</a>
{% add_button 'dcim:rackgroup_add' %}
{% import_button 'dcim:rackgroup_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='rack groups' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Rack Groups{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/region_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{% extends '_base.html' %}
{% load buttons %}
{% load helpers %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_region %}
<a href="{% url 'dcim:region_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a region
</a>
<a href="{% url 'dcim:region_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import regions
</a>
{% add_button 'dcim:region_add' %}
{% import_button 'dcim:region_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='regions' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Regions{% endblock %}</h1>
<div class="row">
Expand Down
13 changes: 4 additions & 9 deletions netbox/templates/dcim/site_list.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{% extends '_base.html' %}
{% load buttons %}

{% block content %}
<div class="pull-right">
{% if perms.dcim.add_site %}
<a href="{% url 'dcim:site_add' %}" class="btn btn-primary">
<span class="fa fa-plus" aria-hidden="true"></span>
Add a site
</a>
<a href="{% url 'dcim:site_import' %}" class="btn btn-info">
<span class="fa fa-download" aria-hidden="true"></span>
Import sites
</a>
{% add_button 'dcim:site_add' %}
{% import_button 'dcim:site_import' %}
{% endif %}
{% include 'inc/export_button.html' with obj_type='sites' %}
{% export_button content_type %}
</div>
<h1>{% block title %}Sites{% endblock %}</h1>
<div class="row">
Expand Down
20 changes: 0 additions & 20 deletions netbox/templates/inc/export_button.html

This file was deleted.

Loading

0 comments on commit b96e3af

Please sign in to comment.