#1018 VLANs with Multiple Names report
This commit is contained in:
52
share/views/ajax/report/vlanmultiplenames.tt
Normal file
52
share/views/ajax/report/vlanmultiplenames.tt
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>VLAN ID</th>
|
||||||
|
<th>VLAN Names</th>
|
||||||
|
<th>Device Count</th>
|
||||||
|
<th>Port Count</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
var table = $('#data-table').dataTable({
|
||||||
|
"deferRender": true,
|
||||||
|
"data": [% results | none %],
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"data": 'vlan',
|
||||||
|
"render": function(data, type, row, meta) {
|
||||||
|
return '<a href="[% uri_for('/search') | none %]?tab=vlan&q=' + encodeURIComponent(data) + '">' + data + '</a>';
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"data": 'description',
|
||||||
|
"render": function(data, type, row, meta) {
|
||||||
|
let resp = '';
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
resp += '<a href="[% uri_for('/search') | none %]?tab=vlan&q=' + encodeURIComponent(data[i]) + '">' + he.encode(data[i] || '') + '</a>';
|
||||||
|
if (i < (data.length - 1)) {
|
||||||
|
resp += ', ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"data": 'dcount',
|
||||||
|
"searchable": false,
|
||||||
|
"render": function(data, type, row, meta) {
|
||||||
|
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"data": 'pcount',
|
||||||
|
"searchable": false,
|
||||||
|
"render": function(data, type, row, meta) {
|
||||||
|
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
12
share/views/ajax/report/vlanmultiplenames_csv.tt
Normal file
12
share/views/ajax/report/vlanmultiplenames_csv.tt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[% USE CSV -%]
|
||||||
|
[% CSV.dump([ 'VLAN ID' 'VLAN Names' 'Device Count' 'Port Count' ]) %]
|
||||||
|
|
||||||
|
[% FOREACH row IN results %]
|
||||||
|
[% mylist = [] %]
|
||||||
|
[% mylist.push(row.vlan) %]
|
||||||
|
[% mylist.push(row.description.join(',')) %]
|
||||||
|
[% mylist.push(row.dcount) %]
|
||||||
|
[% mylist.push(row.pcount) %]
|
||||||
|
[% CSV.dump(mylist) %]
|
||||||
|
|
||||||
|
[% END %]
|
||||||
Reference in New Issue
Block a user