mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +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 (){
|
(function (){
|
||||||
ensureSetting("Display offline slaves", "boolean", false);
|
ensureSetting("Display offline slaves", "boolean", false);
|
||||||
ensureSetting("Enable production graphs", "boolean", true);
|
ensureSetting("Enable production graphs", "boolean", true);
|
||||||
|
ensureSetting("Periodically update storage screen", "boolean", true);
|
||||||
}())
|
}())
|
||||||
|
|
||||||
function ensureSetting(setting, type, defaultSetting) {
|
function ensureSetting(setting, type, defaultSetting) {
|
||||||
|
|||||||
+10
-5
@@ -1,7 +1,7 @@
|
|||||||
// function to draw data we recieve from ajax requests
|
// function to draw data we recieve from ajax requests
|
||||||
function drawcontents(data) {
|
function drawcontents(data) {
|
||||||
var data = sortByKey(data, "count");
|
data = sortByKey(data, "count");
|
||||||
result = "<table>";
|
let result = "<table>";
|
||||||
for(i = 0;i < data.length; i++) {
|
for(i = 0;i < data.length; i++) {
|
||||||
var img = "";
|
var img = "";
|
||||||
if(imagedata[data[i].name]) {
|
if(imagedata[data[i].name]) {
|
||||||
@@ -18,17 +18,22 @@ function drawcontents(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get cluster inventory from master
|
// get cluster inventory from master
|
||||||
setInterval(function() {
|
function updateInventory() {
|
||||||
var xmlhttp = new XMLHttpRequest();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
xmlhttp.onreadystatechange = function() {
|
xmlhttp.onreadystatechange = function() {
|
||||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||||
data = JSON.parse(xmlhttp.responseText);
|
let data = JSON.parse(xmlhttp.responseText);
|
||||||
drawcontents(data);
|
drawcontents(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xmlhttp.open("GET", "api/inventory", true);
|
xmlhttp.open("GET", "api/inventory", true);
|
||||||
xmlhttp.send();
|
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 to sort arrays of objects after a keys value
|
||||||
function sortByKey(array, key) {
|
function sortByKey(array, key) {
|
||||||
|
|||||||
Reference in new issue
Block a user