Fixed status bugs in loading screen.

This commit is contained in:
CalDescent 2022-01-02 16:11:25 +00:00
parent bd1b631914
commit ef784124f3

View File

@ -54,46 +54,46 @@
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}); });
const json = await response.json(); const status = await response.json();
console.log("status: " + json.status); console.log("status: " + status.id);
if (json.id == "UNSUPPORTED") { if (status.id == "UNSUPPORTED") {
textStatus = response.description; textStatus = status.description;
document.getElementById("status").style.color = "red"; document.getElementById("status").style.color = "red";
} }
else if (json.id == "BLOCKED") { else if (status.id == "BLOCKED") {
textStatus = name + " is blocked so content cannot be served"; textStatus = name + " is blocked so content cannot be served";
retryInterval = 5000; retryInterval = 5000;
document.getElementById("status").style.color = "red"; document.getElementById("status").style.color = "red";
} }
else if (json.id == "READY") { else if (status.id == "READY") {
textStatus = response.statusDescription; textStatus = status.description;
window.location.reload(); window.location.reload();
} }
else if (json.id == "BUILDING") { else if (status.id == "BUILDING") {
textStatus = response.statusDescription; textStatus = status.description;
retryInterval = 1000; retryInterval = 1000;
} }
else if (json.id == "BUILD_FAILED") { else if (status.id == "BUILD_FAILED") {
textStatus = response.statusDescription; textStatus = status.description;
} }
else if (json.id == "NOT_STARTED") { else if (status.id == "NOT_STARTED") {
textStatus = response.statusDescription; textStatus = status.description;
retryInterval = 1000; retryInterval = 1000;
} }
else if (json.status == "DOWNLOADING") { else if (status.status == "DOWNLOADING") {
textStatus = response.statusDescription; textStatus = status.description;
retryInterval = 1000; retryInterval = 1000;
} }
else if (json.id == "MISSING_DATA") { else if (status.id == "MISSING_DATA") {
textStatus = response.statusDescription; textStatus = status.description;
retryInterval = 10000; retryInterval = 10000;
document.getElementById("status").style.color = "red"; document.getElementById("status").style.color = "red";
document.getElementById("c").style.opacity = "0.5"; document.getElementById("c").style.opacity = "0.5";
} }
else if (json.id == "DOWNLOADED") { else if (status.id == "DOWNLOADED") {
textStatus = response.statusDescription; textStatus = status.description;
} }
document.getElementById("status").innerHTML = textStatus; document.getElementById("status").innerHTML = textStatus;