-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patheventviewer.php
More file actions
85 lines (66 loc) · 1.77 KB
/
eventviewer.php
File metadata and controls
85 lines (66 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CCAMS Event Viewer</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!--<link rel="stylesheet" href="style.css">-->
</head>
<body>
<label for="datePicker">Date</label>
<input type="date" name="datePicker" id="datePicker" max="">
<br />
<table id="logTable">
<tr>
<td></td>
</tr>
</table>
<div id="debug" hidden="true"></div>
<!--<canvas id="csChart" width="300"></canvas>-->
</body>
</html>
<script>
const today = new Date().toISOString().split("T")[0];
$('#datePicker').attr('max', today);
$.loadLogs = function(date) {
var data = {date: date, debug: false};
if ($('#debug').val() != '') data.debug = true;
var post = $.post("json?r=logdata", data);
post.done( function(data) {
try {
var resp = JSON.parse(data);
let $table = $('#logTable');
$table.empty();
if (resp.length > 0) {
// Header
let $headerRow = $('<tr/>');
$.each(Object.keys(resp[0]), function (_, key) {
$headerRow.append($('<th/>').text(key));
});
$table.append($headerRow);
// Rows
$.each(resp, function (_, row) {
let $tr = $('<tr/>');
$.each(row, function (_, val) {
$tr.append($('<td/>').text(val));
});
$table.append($tr);
});
}
} catch (e) {
alert('Parsing error during log entries loading')
}
});
}
$().ready( function() {
$( function() {
document.getElementById("datePicker").value = today;
$.loadLogs($('#datePicker').val());
let searchParams = new URLSearchParams(window.location.search);
if (searchParams.has('debug')) $('#debug').val(true);
});
$('#datePicker').change (function () {
$.loadLogs($('#datePicker'));
});
});
</script>