mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Master has POST endpoint for flows data
#35 still not sure how to do the graphs on clientside though
This commit is contained in:
1 parent
dc103d1bed
commit
dcc17e2fa8
2 files changed
+43
-18
No files matched your search
+24
-1
@@ -1,3 +1,5 @@
|
||||
|
||||
// get all slaves recently connected to master
|
||||
// ask master for slaves
|
||||
setInterval(function() {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
@@ -25,4 +27,25 @@ setInterval(function() {
|
||||
xmlhttp.send();
|
||||
}, 500)
|
||||
|
||||
// get all slaves recently connected to master
|
||||
function makeGraph(slaveID, selector) {
|
||||
post("http://localhost:8080/getStats", {slaveID: slaveID}, function(data){
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
|
||||
// production info
|
||||
// string, object, function(object)
|
||||
function post(url, data, callback) {
|
||||
console.log("POST " + url + JSON.stringify(data))
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
xhr.setRequestHeader("Content-type", "application/json");
|
||||
xhr.onreadystatechange = function () {
|
||||
console.log(xhr.readyState + "WOW")
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var json = JSON.parse(xhr.responseText);
|
||||
callback(json);
|
||||
}
|
||||
}
|
||||
xhr.send(JSON.stringify(data));
|
||||
}
|
||||
Reference in new issue
Block a user