From ff96b582d3ba4bb729775d0eaea05f327e388b60 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 6 Jul 2014 19:58:01 +0300 Subject: [PATCH] minor update progress fix --- static/js/main.js | 49 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) 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 */ }); } -- 2.39.5