* Get the log and display to the user
()
| 40 | * Get the log and display to the user |
| 41 | */ |
| 42 | function getLog() |
| 43 | { |
| 44 | browser.runtime.sendMessage({ |
| 45 | function: "getData", |
| 46 | params: ['log'] |
| 47 | }).then((data) => { |
| 48 | log = data.response; |
| 49 | |
| 50 | // Sort the log | issue #70 |
| 51 | log.log.sort(function(a,b) { |
| 52 | return b.timestamp - a.timestamp; |
| 53 | }); |
| 54 | |
| 55 | $('#logTable').DataTable({ |
| 56 | "data": log.log, |
| 57 | "columns": [ |
| 58 | { |
| 59 | "data": "before", |
| 60 | "type": "string" |
| 61 | }, |
| 62 | { |
| 63 | "data": "after", |
| 64 | "type": "string" |
| 65 | }, |
| 66 | { |
| 67 | "data": "rule", |
| 68 | "type": "string" |
| 69 | }, |
| 70 | { |
| 71 | "data": "timestamp", |
| 72 | "type": "date" |
| 73 | } |
| 74 | ], |
| 75 | "columnDefs": [ |
| 76 | { |
| 77 | targets: 3, |
| 78 | render: toDate |
| 79 | } |
| 80 | ], |
| 81 | "pageLength": 10, |
| 82 | "language": { |
| 83 | "url": getDataTableTranslation() |
| 84 | } |
| 85 | } ).order([3, 'desc']).draw(); |
| 86 | }).catch(handleError); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Get the translation file for the DataTable |
no test coverage detected