-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.html
74 lines (73 loc) · 2.69 KB
/
events.html
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
<html>
<head>
<script src="/js/jquery-1.7.2.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Red+Hat+Display&display=swap" rel="stylesheet">
<script type="text/javascript" src="/js/SimpleTableCellEditor.es6.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="/css/menu.css"/>
<script type="text/javascript" src="/js/datatables.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
$(document).ready( function() {
editor = new SimpleTableCellEditor("tabla");
editor.SetEditableClass("editMe");
$('#myTableId').on("cell:edited", function (event) {
console.log(`'${event.oldValue}' changed to '${event.newValue}'`);
});
});
</script>
</head>
<body>
<ul id="menu">
<li><div class="logo"><font color="#ff1a1a">RHV</font><font style="font-size: 80%">2</font>Prometheus</div></li>
<li><a href="/events">Events</a></li>
<li><a href="/metrics_menu">Metrics</a></li>
<li><a href="/thresholds">Thresholds</a></li>
<li><a href="/prom2nagios">Prometheus2Nagios</a></li>
<li><a href="/api_menu">Api</a></li>
<li><a href="/about">About</a></li>
<li style="float:right"><a class="active" href="/logout">Logout</a></li>
</ul>
<br>
<table id="tabla" class="data">
<thead>
<tr>
<th>Severity</th>
<th>time</th>
<th>description</th>
<th>code</th>
<th>cluster</th>
<th>host</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
var socket = io('/events');
socket.on("events", function(data){
$(document).ready( function() {
if (!$.fn.DataTable.isDataTable( '#tabla' ) ) {
$('#tabla').dataTable({
data: data,
"aaSorting": [[ 1, "desc" ]],
"pageLength": 20,
"lengthMenu": [ 20, 50, 75, 100 ],
columns: [
{ data: 'severity' },
{ data: 'time'.slice(0, 19).replace(/-/g, "/").replace("T", " ") },
{ data: 'description' },
{ data: 'code' },
{ data: 'cluster' },
{ data: 'host' }
]
});
}else{
$('#tabla').dataTable().fnClearTable();
$('#tabla').dataTable().fnAddData(data);
}
});
});
</script>
</body>
</html>