DataTables for ports in half duplex mode report
This commit is contained in:
@@ -1,23 +1,44 @@
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device</th>
|
||||
<th class="nd_center-cell">Port</th>
|
||||
<th class="nd_center-cell">Description</th>
|
||||
<th class="nd_center-cell">Duplex</th>
|
||||
<th>Port</th>
|
||||
<th>Description</th>
|
||||
<th>Duplex</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
[% WHILE (row = results.next) %]
|
||||
<tr>
|
||||
<td>[% row.device.dns || row.device.ip | html_entity %]</td>
|
||||
<td class="nd_center-cell"><a class="nd_linkcell"
|
||||
href="[% device_ports %]&q=[% row.device.ip | uri %]&f=[% row.port | uri %]&c_duplex=on">
|
||||
[% row.port | html_entity %]</a></td>
|
||||
<td class="nd_center-cell">[% row.name | html_entity %]</td>
|
||||
<td class="nd_center-cell">[% row.duplex.ucfirst | html_entity %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var table = $('#data-table').dataTable({
|
||||
"deferRender": true,
|
||||
"data": [% results %],
|
||||
"columns": [
|
||||
{
|
||||
"data": 'ip',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(row.device.dns || row.device.name || row.ip);
|
||||
}
|
||||
}, {
|
||||
"data": 'port',
|
||||
"render": function(data, type, row, meta) {
|
||||
return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>';
|
||||
}
|
||||
}, {
|
||||
"data": 'name',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'duplex',
|
||||
"searchable": false,
|
||||
"orderable": false,
|
||||
"render": function(data, type, full, meta) {
|
||||
return he.encode(capitalizeFirstLetter(data));
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[% USE CSV -%]
|
||||
[% CSV.dump([ 'Device' 'Port' 'Description' 'Duplex' ]) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
[% FOREACH row IN results %]
|
||||
[% mylist = [] %]
|
||||
[% device = row.device.dns || row.device.ip %]
|
||||
[% device = rrow.device.dns || row.device.name || row.ip %]
|
||||
[% FOREACH col IN [ device row.port row.name row.duplex.ucfirst ] %]
|
||||
[% mylist.push(col) %]
|
||||
[% END %]
|
||||
|
||||
Reference in New Issue
Block a user