summaryrefslogtreecommitdiff
path: root/ebus/webapp/static/console.html
blob: 97d6b63bd265fc9c228b83bb5ef2db012fb8cf26 (plain)
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
<html>
<head>
    <script src="/static/lib/jquery-1.6.2/jquery-1.6.2.min.js"></script>
</head>
<body>
<div id="log">
</div>
<script>
    function log(data) {
        for (var i in data) {
                var sensor_name = data[i][0];
                var timestamp = data[i][1];
                var value = data[i][2];
                var caption = "" + timestamp + ": " + sensor_name + " Value: " + value;

                jQuery("div#log").append(
                    jQuery("<div>").text(caption));
            }
    }

    function reload(time_stop) {
        jQuery.getJSON("/stream/" + time_stop, function(resp) {
            log(resp.data);
            reload(resp.time_stop);
        });
    }

    jQuery.getJSON("/stream", function(resp) {
        log(resp.data);
        reload(resp.time_stop);
    });
</script>
</body>
</html>