diff --git a/Site5/Pages/v5/Init/Default.aspx b/Site5/Pages/v5/Init/Default.aspx index 36d9c39a..a821a9e0 100644 --- a/Site5/Pages/v5/Init/Default.aspx +++ b/Site5/Pages/v5/Init/Default.aspx @@ -79,6 +79,10 @@ }); function leaveAStepCallback(obj) { + if (disableNext) { + return false; + } + var stepNum = obj.attr('rel'); return validateStep(stepNum); } @@ -142,6 +146,7 @@ // Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds. setTimeout('recheckConfigurationWritability();', 5000); // 5s until first re-check + DisableNext(); } } }); @@ -166,6 +171,34 @@ } } + // Verify database credentials are good and permissions correct + + if (isValid) { + disableNext = true; // block Next during synchro call - it may take a while + $.ajax({ + type: "POST", + url: "Default.aspx/TestDatabasePermissions", + data: "{}", + contentType: "application/json; charset=utf-8", + dataType: "json", + async: false, // blocks until function returns - race conditions otherwise + success: function (msg) { + if (msg.d.AllPermissionsOk != true) { + + // We have a permissions problem. Block further progress and display the problem. + updatePermissionsAnalysisDisplay(msg.d); + $('#DivDatabaseWritable').fadeOut(400, 'swing', function() { $('#DivDatabasePermissionProblem').fadeIn(200); }); + setTimeout('recheckDatabasePermissionsAnalysis();', 5000); // 5s until first re-check + DisableNext(); + isValid = false; + } else { + // re-enable Next + disableNext = false; + } + } + }); + } + if (isValid) { @@ -236,10 +269,27 @@ return isValid; } - updateDatabasePermissionsAnalysis(); - }); // end of document.ready + var disableNext = false; + var stopRechecking = false; + + function DisableNext() { + $('a.buttonNext').addClass("buttonDisabled"); + disableNext = true; + } + + function EnableNext() + { + $('a.buttonNext').removeClass("buttonDisabled"); + disableNext = false; + } + + function ReturnToCredentials() { + stopRechecking = true; + $('#DivDatabasePermissionProblem').fadeOut(200, 'swing', function () { $('#DivDatabaseWritable').fadeIn(200); EnableNext(); }); + } + function recheckConfigurationWritability() { $.ajax({ @@ -255,6 +305,7 @@ $('#DivDatabaseUnwritable').css('display', 'none'); $('#DivDatabaseWritable').fadeIn('slow'); setTimeout('$("#<%=this.TextCredentialsReadDatabase.ClientID %>").focus();', 250); + EnableNext(); } else { // Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds. @@ -323,7 +374,12 @@ } - function updateDatabasePermissionsAnalysis() { + function recheckDatabasePermissionsAnalysis() { + + if (stopRechecking) { + stopRechecking = false; + return; + } $.ajax({ type: "POST", @@ -334,10 +390,11 @@ success: function (msg) { if (!msg.d.AllPermissionsOk) { updatePermissionsAnalysisDisplay(msg.d); - setTimeout('updateDatabasePermissionsAnalysis();', 2000); + setTimeout('recheckDatabasePermissionsAnalysis();', 2000); } else { alert('AllPermissionsOk = true'); - // TODO: PROCEED + EnableNext(); + $('#wizard').smartWizard('goForward'); // triggers a re-check, but doesn't matter, more maintainable this way } } }); @@ -469,9 +526,9 @@
cd /etc/swarmops
sudo chown www-data:www-data database.config
sudo chmod o+w database.config
The installation will continue when it detects that these steps have been taken.
-