-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathnode.js.tmpl
76 lines (69 loc) · 2.86 KB
/
node.js.tmpl
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
<script>
// https://stackoverflow.com/a/21903119
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
function update() {
var node = getUrlParameter("n");
var stats_url = "http://" + controller_addr + "/get_statistics";
var nodes_url = "http://" + controller_addr + "/nodes";
var node_data = {};
$.ajax({
url: nodes_url,
dataType: "json",
success: function(data) {
$.each(data, function (i, rec) {
node_data[rec[0]] = { "name": rec[1], "type": rec[2] };
})
},
error: function(e) {
$("#error-msg").html("AJAX request to controller API failed: " + e.statusText).addClass("show");
}
});
$.ajax({
url: stats_url,
dataType: "json",
success: function(data) {
$("#error-msg").removeClass("show");
// rather inelegant iteration over all domains and vertices
$.each(data["domains"], function (idx, domain) {
$.each(domain[1], function (ni, stats) {
if (ni == node) {
$("#node-id").text(ni);
$("#node-name").text(node_data[ni]["name"]);
$("#desc").text(stats["desc"]);
mat_stats = stats["materialized"];
if (mat_stats == "Not" || mat_stats == "Full") {
$("#mat-status").text(mat_stats);
} else if ("Partial" in mat_stats) {
if (mat_stats["beyond_materialization_frontier"]) {
$("#mat-status").text("Partial (beyond materialization frontier)");
} else {
$("#mat-status").text("Partial");
}
}
$("#mem-size").text(filesize(stats["mem_size"]));
$("#probe-data").text(JSON.stringify(stats["probe_result"]));
$("#process-time").text(readableNanosecondFormatter(stats["process_time"]));
$("#process-ptime").text(readableNanosecondFormatter(stats["process_ptime"]));
}
});
});
},
error: function(e) {
$("#error-msg").html("AJAX request to controller API failed: " + e.statusText).addClass("show");
}
});
}
update();
setInterval(update, 1000);
</script>