diff --git a/static/js/devices.js b/static/js/devices.js index 689e10c..03ad52d 100644 --- a/static/js/devices.js +++ b/static/js/devices.js @@ -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;