mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Setting to disable automatic storage screen updates
This commit is contained in:
1 parent
41a6e88006
commit
432c4e462d
2 files changed
+11
-5
No files matched your search
@@ -2,6 +2,7 @@
|
||||
(function (){
|
||||
ensureSetting("Display offline slaves", "boolean", false);
|
||||
ensureSetting("Enable production graphs", "boolean", true);
|
||||
ensureSetting("Periodically update storage screen", "boolean", true);
|
||||
}())
|
||||
|
||||
function ensureSetting(setting, type, defaultSetting) {
|
||||
|
||||
+10
-5
@@ -1,7 +1,7 @@
|
||||
// function to draw data we recieve from ajax requests
|
||||
function drawcontents(data) {
|
||||
var data = sortByKey(data, "count");
|
||||
result = "<table>";
|
||||
data = sortByKey(data, "count");
|
||||
let result = "<table>";
|
||||
for(i = 0;i < data.length; i++) {
|
||||
var img = "";
|
||||
if(imagedata[data[i].name]) {
|
||||
@@ -18,17 +18,22 @@ function drawcontents(data) {
|
||||
}
|
||||
|
||||
// get cluster inventory from master
|
||||
setInterval(function() {
|
||||
function updateInventory() {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||
data = JSON.parse(xmlhttp.responseText);
|
||||
let data = JSON.parse(xmlhttp.responseText);
|
||||
drawcontents(data);
|
||||
}
|
||||
}
|
||||
xmlhttp.open("GET", "api/inventory", true);
|
||||
xmlhttp.send();
|
||||
}, 500)
|
||||
}
|
||||
if(JSON.parse(localStorage.settings)["Periodically update storage screen"]) {
|
||||
setInterval(updateInventory, 500);
|
||||
} else {
|
||||
updateInventory();
|
||||
}
|
||||
|
||||
// function to sort arrays of objects after a keys value
|
||||
function sortByKey(array, key) {
|
||||
|
||||
Reference in new issue
Block a user