diff --git a/static/storage.js b/static/storage.js
index eaf6853d..0e3c68a7 100644
--- a/static/storage.js
+++ b/static/storage.js
@@ -12,30 +12,30 @@ function drawcontents(data) {
data = data.filter(function(item) {
return search.test(item.name);
})
-
+
sortByKey(data, "count");
-
+
const table = document.querySelector("#contents tbody"); //tables have tbody inserted automatically
const rows = table.children;
-
+
//update existing rows or create new ones
data.forEach(function(item, i) {
// format count to have .s in it for large number readability (1,000,000)
item.count = item.count.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
-
+
let row = rows[i];
if(!row) {
row = document.createElement('tr');
row.innerHTML = "
![]() | | | ";
table.appendChild(row);
}
-
+
const img = row.querySelector('img');
const imgName = getImageFromName(item.name);
if(img.getAttribute('src') !== imgName) {
img.setAttribute('src',imgName);
}
-
+
const name = row.querySelector('.name');
if(name.textContent !== item.name) {
name.textContent = item.name;
@@ -43,13 +43,13 @@ function drawcontents(data) {
makeItemGraphs(item.name);
}
}
-
+
const count = row.querySelector('.count');
if(count.textContent !== ''+item.count) {
count.textContent = item.count;
}
});
-
+
//remove excess rows, for example, after filtering
while (data.length < rows.length) {
table.removeChild(rows[data.length]);
@@ -123,7 +123,7 @@ function makeItemGraphs(itemName){
HTML += '';
["place", "remove"].forEach(statistic => {
console.log("Making chart for "+instanceID+"'s "+statistic+" statistic");
-
+
setTimeout(function(){
let xmlhttp = new XMLHttpRequest(); // new HttpRequest instance
xmlhttp.open("POST", "/api/getStats");
@@ -139,7 +139,7 @@ function makeItemGraphs(itemName){
} catch(e) {}
let whatGraphIsIt = "Item IO from ";
// if(statistic == "remove") whatGraphIsIt = "Items taken from cluster by";
-
+
let chartData = JSON.parse(xmlhttp.response).data;
switch(statistic){
case "place":