The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Node</th>
<th>MAC Address</th>
<th class="nd_center-cell">DNS</th>
<th>Last Used</th>
</tr>
</thead>
</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) {
var cell_str = he.encode(data);
if (type == 'display') {
if (row.time_last && row.node) {
cell_str = '<a href="[% search_node %]&q=' + encodeURIComponent(data)
+ (row.active ? '' : '&archived=on') + '">' + he.encode(data)
+ (row.active ? '' : '&nbsp;<i class="icon-book text-warning"></i>&nbsp;') + '</a>';
}
else if (row.time_last) {
cell_str = '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
}
}
return cell_str;
}
}, {
"data": 'mac',
"render": function(data, type, row, meta) {
var cell_str = he.encode(data || '');
if (type == 'display' && data && row.time_last) {
cell_str = '<a href="[% search_node %]&q=' + encodeURIComponent(data)
+ (row.active ? '' : '&archived=on') + '">' + he.encode(data)
+ (row.active ? '' : '&nbsp;<i class="icon-book text-warning"></i>&nbsp;') + '</a>';
}
return cell_str;
}
}, {
"data": 'dns',
"className": "nd_nowrap nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'age',
"render": function(data, type, row, meta) {
if (type == 'display') {
return he.encode(data || 'Never');
}
else {
// so that sorting works correctly on this column
return row.time_last;
}
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>