-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
69 lines (62 loc) · 2.03 KB
/
index.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
<html>
<head>
<script type="module" src="./static/perspective.js"></script>
<script type="module" src="./static/perspective-viewer.js"></script>
<script type="module" src="./static/perspective-viewer-datagrid.js"></script>
<script type="module" src="./static/perspective-viewer-d3fc.js"></script>
<link rel="stylesheet" crossorigin="anonymous" href="./static/pro.css"/>
<style>
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
}
body > * {
height: 50%;
}
div.row {
display: flex;
flex-direction: row;
}
div.row > * {
width: 50%;
}
</style>
</head>
<body>
<div class="row">
<perspective-viewer id="machines"></perspective-viewer>
<perspective-viewer id="usage"></perspective-viewer>
</div>
<div class="row">
<perspective-viewer id="status"></perspective-viewer>
<perspective-viewer id="jobs"></perspective-viewer>
</div>
</body>
<script type="module">
import perspective from "./static/perspective.js";
window.addEventListener("DOMContentLoaded", async function () {
const websocket = perspective.websocket("ws://localhost:8080/data");
const worker = perspective.worker();
["machines", "usage", "status", "jobs"].forEach(async (table) => {
document.getElementById(table).load(websocket.open_table(table));
});
document.getElementById("status").restore({
plugin: "X Bar",
group_by: ["status"],
columns: ["machine_id"],
aggregates: {"status": "last"},
sort: [["last_update", "desc"]]
});
document.getElementById("jobs").restore({
group_by: ["machine_id"],
columns: ["job_id", "name", "units", "start_time", "end_time"],
aggregates: {job_id: "count", name: "last", units: "sum", start_time: "last", end_time: "last"},
});
});
</script>
</html>