add csv download option to device, port, and vlan search pages

This commit is contained in:
Eric A. Miller
2013-09-18 23:32:57 -04:00
parent d2b39a3f0e
commit 99ada1132c
10 changed files with 173 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
[% INCLUDE "download_as.tt" %]
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
<thead>
<tr>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump(headers) %]
[% WHILE (row = results.next) %]
[% mylist = [] %]
[% device = row.dns || row.ip %]
[% FOREACH col IN [ device row.contact row.location row.name row.model row.os_ver row.ip row.serial] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -1,3 +1,4 @@
[% INCLUDE "download_as.tt" %]
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
<thead>
<tr>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Description' 'Port' 'Name' 'Vlan' ]) %]
[% WHILE (row = results.next) %]
[% mylist = [] %]
[% myport = "$row.ip [ $row.port ] (" _ row.device.dns _ ")" IF row.device.dns %]
[% FOREACH col IN [ row.name myport row.descr row.vlan ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -1,3 +1,4 @@
[% INCLUDE "download_as.tt" %]
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
<thead>
<tr>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Vlan' 'Device' 'Description' 'Model' 'OS' 'Vendor' ]) %]
[% WHILE (row = results.next) %]
[% mylist = [] %]
[% device = row.dns || row.ip %]
[% FOREACH col IN [ row.vlan.vlan device row.vlan.description row.model row.os row.vendor ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]