89 lines
2.8 KiB
Plaintext
89 lines
2.8 KiB
Plaintext
[% USE url %]
|
|
[% IF opt %]
|
|
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<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>
|
|
[% ELSE %]
|
|
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th class="nd_center-cell">Vendor</th>
|
|
<th class="nd_center-cell">Count</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
[% END %]
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var table = $('#data-table').dataTable({
|
|
[% IF opt %]
|
|
"serverSide": true,
|
|
"order": [[ 0, "desc" ]],
|
|
"ajax": "[% uri_for('/ajax/content/report/nodevendor/data') %]?[% url(params('query').hash) %]",
|
|
"columns": [
|
|
{
|
|
"data": 'mac',
|
|
"render": function(data, type, row, meta) {
|
|
var icon = ' <i class="icon-book text-warning"></i> ';
|
|
if (row.active) {
|
|
icon = '';
|
|
}
|
|
return '<a href="[% search_node %]&q=' + encodeURIComponent(data) + '">' + he.encode(data.toUpperCase()) + icon + '</a>';
|
|
}
|
|
}, {
|
|
"data": 'oui.abbrev',
|
|
"render": function(data, type, row, meta) {
|
|
return '<a href="[% uri_for('/report/nodevendor') %]?vendor=' + encodeURIComponent(row.oui.abbrev || 'blank') + '">' + he.encode(row.oui.company ||'(Unknown Vendor)') + '</a>';
|
|
}
|
|
}, {
|
|
"data": 'port',
|
|
"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',
|
|
"render": function(data, type, row, meta) {
|
|
return '<a href="[% uri_for('/report/nodevendor') %]?vendor=' + encodeURIComponent(row.abbrev || 'blank') + '">' + he.encode(row.vendor ||'(Unknown Vendor)') + '</a>';
|
|
}
|
|
}, {
|
|
"data": 'count',
|
|
"render": function(data, type, row, meta) {
|
|
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
}
|
|
],
|
|
"order": [[1, "desc"]],
|
|
[% END %]
|
|
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
|
});
|
|
});
|
|
</script>
|