Use document attribute for blocking firmware downloads, fixing #17

This commit is contained in:
Kumi 2019-02-24 11:14:22 +00:00
parent 45fa971588
commit e89dac03ea

View file

@ -13,11 +13,11 @@ function urlStatus(url, cb){
function checkDownload(url){
urlStatus(url, function(status) {
if (status === 200){
var working = false;
document.buildingfw = false;
document.getElementById("download").src=url;
}
else {
var working = true;
document.buildingfw = true;
checkDownload(url);
}
});
@ -101,10 +101,13 @@ function askreboot(device_id) {
};
function downloadnotice(device_id) {
if (!working) {
if (!document.buildingfw) {
alert("Your file is being prepared. This might take a minute or two, the download will start automatically when the file is ready. You may close this page and click the download button again later to pick the file up we will store it for you.");
checkDownload('/devices/' + device_id + '/download/');
};
else {
alert("You are currently building another firmware. Please wait for this to finish and try again.");
};
};
function showdevices() {
@ -223,3 +226,5 @@ $("div[id$='-indicator']").each(function() {
$("#orgaselect").on('change', function() {
filtertables();
});
document.buildingfw = false;