mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
recievedItemStats for master is working
This commit is contained in:
1 parent
04aba1eef1
commit
3d4c788788
3 files changed
+22
-4
No files matched your search
@@ -403,7 +403,7 @@ app.post("/api/getStats", function(req,res) {
|
|||||||
if(req.body.statistic == "place"){
|
if(req.body.statistic == "place"){
|
||||||
console.log("sending place data...");
|
console.log("sending place data...");
|
||||||
// Gather data
|
// Gather data
|
||||||
console.log(recievedItemStatisticsBySlaveID)
|
//console.log(recievedItemStatisticsBySlaveID)
|
||||||
let itemStats = recievedItemStatisticsBySlaveID[req.body.slaveID];
|
let itemStats = recievedItemStatisticsBySlaveID[req.body.slaveID];
|
||||||
if(itemStats === undefined){
|
if(itemStats === undefined){
|
||||||
res.send({statusForDebugging:"no data available"});
|
res.send({statusForDebugging:"no data available"});
|
||||||
@@ -417,7 +417,21 @@ app.post("/api/getStats", function(req,res) {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
} else if(req.body.statistic == "remove"){
|
} else if(req.body.statistic == "remove"){
|
||||||
|
console.log("sending remove data...");
|
||||||
|
// Gather data
|
||||||
|
//console.log(sentItemStatisticsBySlaveID)
|
||||||
|
let itemStats = sentItemStatisticsBySlaveID[req.body.slaveID];
|
||||||
|
if(itemStats === undefined){
|
||||||
|
res.send({statusForDebugging:"no data available"});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let data = itemStats.get(config.itemStats.maxEntries, req.body.itemName);
|
||||||
|
|
||||||
|
res.send({
|
||||||
|
maxEntries:config.itemStats.maxEntries,
|
||||||
|
entriesPerSecond: config.itemStats.entriesPerSecond,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-2
@@ -113,6 +113,7 @@ function makeItemGraphs(itemName){
|
|||||||
let HTML = ""
|
let HTML = ""
|
||||||
// Draw in/out chart for unregistered slaves as well
|
// Draw in/out chart for unregistered slaves as well
|
||||||
slaveIDs.unshift("unknown");
|
slaveIDs.unshift("unknown");
|
||||||
|
slaveIDs.unshift("debug");
|
||||||
slaveIDs.forEach(function(slaveID){
|
slaveIDs.forEach(function(slaveID){
|
||||||
["place", "remove"].forEach(statistic => {
|
["place", "remove"].forEach(statistic => {
|
||||||
console.log("Making chart for "+slaveID+"'s "+statistic+" statistic")
|
console.log("Making chart for "+slaveID+"'s "+statistic+" statistic")
|
||||||
@@ -127,8 +128,8 @@ function makeItemGraphs(itemName){
|
|||||||
if(xmlhttp.readyState === XMLHttpRequest.DONE && xmlhttp.status === 200) {
|
if(xmlhttp.readyState === XMLHttpRequest.DONE && xmlhttp.status === 200) {
|
||||||
// console.log(xmlhttp.responseText);
|
// console.log(xmlhttp.responseText);
|
||||||
if(isJSON(xmlhttp.responseText) && JSON.parse(xmlhttp.responseText).statusForDebugging === undefined){
|
if(isJSON(xmlhttp.responseText) && JSON.parse(xmlhttp.responseText).statusForDebugging === undefined){
|
||||||
drawChart("contentGraph"+slaveID, [JSON.parse(xmlhttp.response).data]);
|
drawChart("contentGraph"+slaveID, [JSON.parse(xmlhttp.response).data], slaveID+" "+itemName);
|
||||||
console.log(JSON.parse(xmlhttp.response).data)
|
// console.log(JSON.parse(xmlhttp.response).data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -33,7 +33,6 @@ button {
|
|||||||
float:left;
|
float:left;
|
||||||
width: calc(100% - 300px);
|
width: calc(100% - 300px);
|
||||||
min-height:100px;
|
min-height:100px;
|
||||||
background-color: red;
|
|
||||||
}
|
}
|
||||||
/* Navbar on the right */
|
/* Navbar on the right */
|
||||||
#sidenav {
|
#sidenav {
|
||||||
@@ -79,6 +78,9 @@ a:hover {
|
|||||||
#contentGraph {
|
#contentGraph {
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
.storageGraph {
|
||||||
|
height:200px;
|
||||||
|
}
|
||||||
|
|
||||||
/* terminal */
|
/* terminal */
|
||||||
.Terminal p div {
|
.Terminal p div {
|
||||||
@@ -183,6 +185,7 @@ a:hover {
|
|||||||
height:300px;
|
height:300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.button-black {
|
.button-black {
|
||||||
width:100%;
|
width:100%;
|
||||||
height:40px;
|
height:40px;
|
||||||
|
|||||||
Reference in new issue
Block a user