fst – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 (function () {
2  
3 // Datatables setup.
4 var dataTable = $('#offenders').DataTable({
5 'dom': 'Bfrtip',
6 "bInfo": false,
7 'buttons': [
8 'csv'
9 ],
10 'ajax': {
11 'url': '/metrics',
12 'contentType': 'application/json',
13 'type': 'GET',
14 'dataSrc': function (data) {
15 var attackers = data.attackers
16 return Object.keys(attackers).map(function (item) {
17 return {
18 IP: item,
19 Count: attackers[item].count,
20 Stamp: attackers[item].stamp
21 }
22 })
23 }
24 },
25 'order': [1, 'desc', 'desc'],
26 'ordering': true,
27 'searching': true,
28 'columns': [
29 { 'data': 'IP' },
30 { 'data': 'Count' },
31 { 'data': 'Stamp' }
32 ]
33 })
34  
35 $('#offenders tbody').on( 'click', 'tr', function () {
36 var ip = $(this).children(":first").text()
37 $("#myModal-header").html("WHOIS Information")
38 //$("#myModal-body").html('<img style="display: block margin:auto" src="img/interwind-loader.svg"></img>')
39 $("#myModal").modal()
40 $.get(`/whois/${ip}`, (data) => {
41 $("#myModal-body").html(data)
42 $("#myModal").modal()
43 })
44 })
45  
46 // Update data table.
47 setInterval(function () {
48 dataTable.ajax.reload(null, false) // user paging is not reset on reload
49 }, 1000)
50  
51 })()