From: Calin Crisan Date: Sun, 6 Jul 2014 16:58:01 +0000 (+0300) Subject: minor update progress fix X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=ff96b582d3ba4bb729775d0eaea05f327e388b60;p=motioneye-debian minor update progress fix --- diff --git a/static/js/main.js b/static/js/main.js index 1f0b87b..e0e115d 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1083,39 +1083,34 @@ function doUpdate() { else { runConfirmDialog('New version available: ' + data.update_version + '. Update?', function () { showModalDialog('
This may take a few minutes.
'); - ajax('POST', '/update/?version=' + data.update_version, null, function (result) { - if (result) { - var count = 0; - function checkServerUpdate() { - $.ajax({ - type: 'GET', - url: '/config/0/get/', - success: function () { - runAlertDialog('motionEye was successfully updated!', function () { + ajax('POST', '/update/?version=' + data.update_version, null, function () { + var count = 0; + function checkServerUpdate() { + $.ajax({ + type: 'GET', + url: '/config/0/get/', + success: function () { + runAlertDialog('motionEye was successfully updated!', function () { + window.location.reload(true); + }); + }, + error: function () { + if (count < 25) { + count += 1; + setTimeout(checkServerUpdate, 2000); + } + else { + runAlertDialog('Update failed!', function () { window.location.reload(true); }); - }, - error: function () { - if (count < 25) { - count += 1; - setTimeout(checkServerUpdate, 2000); - } - else { - window.location.reload(true); - } } - }); - } - - setTimeout(checkServerUpdate, 10000); - } - else { - runAlertDialog('Update failed!', function () { - window.location.reload(true); + } }); } + + setTimeout(checkServerUpdate, 10000); }); - + return false; /* prevents hiding the modal container */ }); }