add csv download option to device, port, and vlan search pages
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
[% INCLUDE "download_as.tt" %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
12
Netdisco/share/views/ajax/search/device_csv.tt
Normal file
12
Netdisco/share/views/ajax/search/device_csv.tt
Normal 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 %]
|
||||
@@ -1,3 +1,4 @@
|
||||
[% INCLUDE "download_as.tt" %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
12
Netdisco/share/views/ajax/search/port_csv.tt
Normal file
12
Netdisco/share/views/ajax/search/port_csv.tt
Normal 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 %]
|
||||
@@ -1,3 +1,4 @@
|
||||
[% INCLUDE "download_as.tt" %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
12
Netdisco/share/views/ajax/search/vlan_csv.tt
Normal file
12
Netdisco/share/views/ajax/search/vlan_csv.tt
Normal 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 %]
|
||||
Reference in New Issue
Block a user