diff --git a/master.js b/master.js index ad746b87..4673d01e 100644 --- a/master.js +++ b/master.js @@ -403,7 +403,7 @@ app.post("/api/getStats", function(req,res) { if(req.body.statistic == "place"){ console.log("sending place data..."); // Gather data - console.log(recievedItemStatisticsBySlaveID) + //console.log(recievedItemStatisticsBySlaveID) let itemStats = recievedItemStatisticsBySlaveID[req.body.slaveID]; if(itemStats === undefined){ res.send({statusForDebugging:"no data available"}); @@ -417,7 +417,21 @@ app.post("/api/getStats", function(req,res) { data: data, }); } 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, + }); } } }); diff --git a/static/storage.js b/static/storage.js index 2ec556e4..f454a324 100644 --- a/static/storage.js +++ b/static/storage.js @@ -113,6 +113,7 @@ function makeItemGraphs(itemName){ let HTML = "" // Draw in/out chart for unregistered slaves as well slaveIDs.unshift("unknown"); + slaveIDs.unshift("debug"); slaveIDs.forEach(function(slaveID){ ["place", "remove"].forEach(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) { // console.log(xmlhttp.responseText); if(isJSON(xmlhttp.responseText) && JSON.parse(xmlhttp.responseText).statusForDebugging === undefined){ - drawChart("contentGraph"+slaveID, [JSON.parse(xmlhttp.response).data]); - console.log(JSON.parse(xmlhttp.response).data) + drawChart("contentGraph"+slaveID, [JSON.parse(xmlhttp.response).data], slaveID+" "+itemName); + // console.log(JSON.parse(xmlhttp.response).data); } } } diff --git a/static/style.css b/static/style.css index 51058bff..2b026e69 100644 --- a/static/style.css +++ b/static/style.css @@ -33,7 +33,6 @@ button { float:left; width: calc(100% - 300px); min-height:100px; - background-color: red; } /* Navbar on the right */ #sidenav { @@ -79,6 +78,9 @@ a:hover { #contentGraph { float:left; } +.storageGraph { + height:200px; +} /* terminal */ .Terminal p div { @@ -183,6 +185,7 @@ a:hover { height:300px; } + .button-black { width:100%; height:40px;