The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th>Node</th>
      <th>DNS</th>
      <th>Last Used</th>      
      <th>First Discovered</th>
    </tr>
  </thead>
</table>

<script type="text/javascript">
$(document).ready(function() {
  var table = $('#data-table').dataTable({
    "processing": true,
    "stateSave": true,
    "pageLength": [% settings.table_pagesize %],
    "language": {
      "search": 'Filter records: '
    },
    "deferRender": true,
    "data": [% results %],
    "columns": [
      {
        "data": 'ip',
        "render": function(data, type, row, meta) {
          var cell_str = he.encode(data);
          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": 'dns',
        "render": function(data, type, row, meta) {
          return he.encode(data || '');
        }
      }, {
        "data": 'age',
        "render": function(data, type, row, meta) {
          return he.encode(data || 'Never');
        }
      }, {
        "data": 'time_first',
        "render": function(data, type, row, meta) {
          return he.encode(data || 'Never');
        }
      }
    ]
  });
});
</script>