Commit a634a803 authored by Franco Fichtner's avatar Franco Fichtner

firmware: avoid races on dashboard link click

parent 43d45ace
...@@ -29,13 +29,20 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -29,13 +29,20 @@ POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript"> <script type="text/javascript">
/** /**
* retrieve update status from backend * prepare for checking update status
*/ */
function updateStatus() { function updateStatusPrepare() {
// update UI
$('#updatelist').empty(); $('#updatelist').empty();
$("#checkupdate_progress").addClass("fa fa-spinner fa-pulse"); $("#checkupdate_progress").addClass("fa fa-spinner fa-pulse");
$('#updatestatus').html("{{ lang._('Checking... (may take up to 30 seconds)') }}"); $('#updatestatus').html("{{ lang._('Checking... (may take up to 30 seconds)') }}");
}
/**
* retrieve update status from backend
*/
function updateStatus() {
// update UI
updateStatusPrepare();
// request status // request status
ajaxGet('/api/core/firmware/status',{},function(data,status){ ajaxGet('/api/core/firmware/status',{},function(data,status){
...@@ -356,7 +363,9 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -356,7 +363,9 @@ POSSIBILITY OF SUCH DAMAGE.
upgrade(); upgrade();
// dashboard link: run check automatically // dashboard link: run check automatically
} else if (window.location.hash == '#checkupdate') { } else if (window.location.hash == '#checkupdate') {
updateStatus(); // update UI and delay update to avoid races
updateStatusPrepare();
setTimeout(updateStatus, 1000);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment