Change node vendor report by vendor to use server-side processing

This commit is contained in:
Eric A. Miller
2014-06-19 19:03:09 -04:00
parent 89de64b20d
commit 184f320299
2 changed files with 80 additions and 10 deletions

View File

@@ -1,3 +1,4 @@
[% USE url %]
[% IF opt %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
@@ -5,6 +6,9 @@
<th>MAC</th>
<th>Vendor</th>
<th>Device (Port)</th>
<th>Device DNS</th>
<th>Device Name</th>
<th>Device IP</th>
</tr>
</thead>
</table>
@@ -22,11 +26,16 @@
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"processing": true,
"stateSave": true,
"pageLength": 25,
"data": [% results %],
"language": {
"search": 'Filter records: '
},
[% IF opt %]
"serverSide": true,
"order": [[ 0, "desc" ]],
"ajax": '/ajax/content/report/nodevendor/data?[% url(params('query').hash) %]',
"columns": [
{
"data": 'mac',
@@ -47,9 +56,23 @@ $(document).ready(function() {
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.switch) + '&f=' + encodeURIComponent(data) + '&c_nodes=on&n_ssid=on">' + he.encode(row.device.dns || row.device.name || row.switch) + '(' + he.encode(data) + ')</a>';
}
}, {
// Included for filtering
"data": 'device.dns',
"visible": false
}, {
// Included for filtering
"data": 'device.name',
"visible": false
}, {
// Included for filtering
"data": 'switch',
"visible": false
}
]
[% ELSE %]
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'vendor',