[% 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 (IP)</th> <th>Port</th> <th>VLAN</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') | none %]?[% url(params('query').hash) | none %]", "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 | none %]&q=' + encodeURIComponent(data) + '">' + he.encode(data.toUpperCase()) + icon + '</a>'; } }, { "data": 'manufacturer.abbrev', "render": function(data, type, row, meta) { return '<a href="[% uri_for('/report/nodevendor') | none %]?vendor=' + encodeURIComponent(row.manufacturer.abbrev || 'blank') + '">' + he.encode(row.manufacturer.company ||'(Unknown Vendor)') + '</a>'; } }, { "data": 'switch', "render": function(data, type, row, meta) { return '<a href="[% uri_for('/device') | none %]?q=' + encodeURIComponent(data) + '">' + he.encode(row.device.dns || row.device.name || data) + ' (' + he.encode(data) + ')</a>'; } }, { "data": 'port', "render": function(data, type, row, meta) { return '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.switch) + '&f=' + encodeURIComponent(data) + '&c_nodes=on&n_ssid=on&prefer=port">' + he.encode(data) + '</a>'; } }, { "data": 'vlan', "render": function(data, type, row, meta) { return '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.switch) + '&f=' + encodeURIComponent(data) + '&c_nodes=on&n_ssid=on&prefer=vlan">' + he.encode(data) + '</a>'; } } ], [% ELSE %] "deferRender": true, "data": [% results | none %], "columns": [ { "data": 'vendor', "render": function(data, type, row, meta) { return '<a href="[% uri_for('/report/nodevendor') | none %]?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>