Spaces:
Running
Running
Update static/index.html
Browse files- static/index.html +22 -9
static/index.html
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
<thead>
|
27 |
<tr>
|
28 |
<th>Timestamp</th>
|
29 |
-
<th>
|
30 |
<th>Status</th>
|
31 |
</tr>
|
32 |
</thead>
|
@@ -40,22 +40,32 @@
|
|
40 |
$('#charts').empty();
|
41 |
for (let model in data) {
|
42 |
let div = $('<div>').addClass('chart').appendTo('#charts');
|
43 |
-
let
|
44 |
-
x: data[model].x,
|
45 |
-
y: data[model].y,
|
46 |
type: 'scatter',
|
47 |
-
mode: '
|
48 |
-
name:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
};
|
50 |
let layout = {
|
51 |
title: 'API Status: ' + model,
|
52 |
xaxis: { title: 'Timestamp' },
|
53 |
-
yaxis: { title: 'Status', range: [-0.1, 1.1] }
|
54 |
};
|
55 |
-
Plotly.newPlot(div[0], [
|
56 |
}
|
57 |
});
|
58 |
}
|
|
|
59 |
function updateLogs() {
|
60 |
$.getJSON('/api/logs', function(data) {
|
61 |
let tbody = $('#logTable tbody');
|
@@ -64,11 +74,14 @@
|
|
64 |
let row = $('<tr>');
|
65 |
$('<td>').text(log.timestamp).appendTo(row);
|
66 |
$('<td>').text(log.model).appendTo(row);
|
67 |
-
$('<td>').text(log.success ? 'Success' : 'Failure')
|
|
|
|
|
68 |
tbody.append(row);
|
69 |
});
|
70 |
});
|
71 |
}
|
|
|
72 |
$(document).ready(function() {
|
73 |
updateCharts();
|
74 |
updateLogs();
|
|
|
26 |
<thead>
|
27 |
<tr>
|
28 |
<th>Timestamp</th>
|
29 |
+
<th>Model</th>
|
30 |
<th>Status</th>
|
31 |
</tr>
|
32 |
</thead>
|
|
|
40 |
$('#charts').empty();
|
41 |
for (let model in data) {
|
42 |
let div = $('<div>').addClass('chart').appendTo('#charts');
|
43 |
+
let successTrace = {
|
44 |
+
x: data[model].success.x,
|
45 |
+
y: data[model].success.y,
|
46 |
type: 'scatter',
|
47 |
+
mode: 'markers',
|
48 |
+
name: 'Success',
|
49 |
+
marker: { color: 'blue' }
|
50 |
+
};
|
51 |
+
let failureTrace = {
|
52 |
+
x: data[model].failure.x,
|
53 |
+
y: data[model].failure.y,
|
54 |
+
type: 'scatter',
|
55 |
+
mode: 'markers',
|
56 |
+
name: 'Failure',
|
57 |
+
marker: { color: 'red' }
|
58 |
};
|
59 |
let layout = {
|
60 |
title: 'API Status: ' + model,
|
61 |
xaxis: { title: 'Timestamp' },
|
62 |
+
yaxis: { title: 'Status', range: [-0.1, 1.1], tickvals: [0, 1], ticktext: ['Failure', 'Success'] }
|
63 |
};
|
64 |
+
Plotly.newPlot(div[0], [successTrace, failureTrace], layout);
|
65 |
}
|
66 |
});
|
67 |
}
|
68 |
+
|
69 |
function updateLogs() {
|
70 |
$.getJSON('/api/logs', function(data) {
|
71 |
let tbody = $('#logTable tbody');
|
|
|
74 |
let row = $('<tr>');
|
75 |
$('<td>').text(log.timestamp).appendTo(row);
|
76 |
$('<td>').text(log.model).appendTo(row);
|
77 |
+
$('<td>').text(log.success ? 'Success' : 'Failure')
|
78 |
+
.css('color', log.success ? 'blue' : 'red')
|
79 |
+
.appendTo(row);
|
80 |
tbody.append(row);
|
81 |
});
|
82 |
});
|
83 |
}
|
84 |
+
|
85 |
$(document).ready(function() {
|
86 |
updateCharts();
|
87 |
updateLogs();
|