Basic way of showing installation is done is implemented

This commit is contained in:
Mike Koch 2015-02-05 00:02:15 -05:00
parent 9d2283ecf7
commit bda53ff143
2 changed files with 41 additions and 29 deletions

View File

@ -69,6 +69,7 @@ function printRow($version) {
<div class="col-sm-12"> <div class="col-sm-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">Installation Progress</div> <div class="panel-heading">Installation Progress</div>
<div id="install-information">
<table class="table table-striped" style="table-layout:fixed;"> <table class="table table-striped" style="table-layout:fixed;">
<thead> <thead>
<tr> <tr>
@ -97,6 +98,7 @@ function printRow($version) {
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row" id="attention-row" style="display:none"> <div class="row" id="attention-row" style="display:none">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="panel panel-warning"> <div class="panel panel-warning">

View File

@ -136,7 +136,7 @@ function appendToInstallConsole(text) {
function processUpdates(startingVersion) { function processUpdates(startingVersion) {
if (startingVersion < 1) { if (startingVersion < 1) {
startVersionUpgrade('p140'); startVersionUpgrade('p140');
executeUpdate(1000, 'p140'); executeUpdate(1, 'p140');
} else if (startingVersion < 140) { } else if (startingVersion < 140) {
startVersionUpgrade('140'); startVersionUpgrade('140');
executeUpdate(140, '140'); executeUpdate(140, '140');
@ -194,7 +194,7 @@ function migrateIpEmailBans(version, cssclass) {
markUpdateAsAttention(version); markUpdateAsAttention(version);
prepareAttentionPanel(getContentForMigratePrompt(parsedData.users)); prepareAttentionPanel(getContentForMigratePrompt(parsedData.users));
} else { } else {
markUpdateAsSuccess(version); migrateComplete();
} }
//if ask user, markUpdateAsAttention and append to Attention! div //if ask user, markUpdateAsAttention and append to Attention! div
//otherwise, mark success and move to completion script. //otherwise, mark success and move to completion script.
@ -206,6 +206,11 @@ function migrateIpEmailBans(version, cssclass) {
}); });
} }
function installationFinished() {
var html = '<p>Hey! We finished!</p>';
$('#install-information').html(html);
}
function getContentForMigratePrompt(users) { function getContentForMigratePrompt(users) {
var beginningText = '<h2>Migrating IP / E-mail Bans</h2><p>Mods for HESK has detected that you have added IP address ' + var beginningText = '<h2>Migrating IP / E-mail Bans</h2><p>Mods for HESK has detected that you have added IP address ' +
'and/or email bans using Mods for HESK. As part of the upgrade process, Mods for HESK will migrate these bans ' + 'and/or email bans using Mods for HESK. As part of the upgrade process, Mods for HESK will migrate these bans ' +
@ -218,7 +223,7 @@ function getContentForMigratePrompt(users) {
}); });
selectMarkup += '</select></div></div><br>'; selectMarkup += '</select></div></div><br>';
var submitMarkup = '<div class="row"><div class="col-md-9 col-md-offset-3 col-xs-12"><button onclick="runMigration()" class="btn btn-default">Migrate</button> ' + var submitMarkup = '<div class="row"><div class="col-md-9 col-md-offset-3 col-xs-12"><button onclick="runMigration()" class="btn btn-default">Migrate</button> ' +
'<a href="javascript:void(0)" onclick="dontMigrate()" class="btn btn-danger">Don\'t Migrate</a> </div></div>'; '<a href="javascript:void(0)" onclick="migrateComplete()" class="btn btn-danger">Don\'t Migrate</a> </div></div>';
return beginningText + selectMarkup + submitMarkup; return beginningText + selectMarkup + submitMarkup;
} }
@ -239,8 +244,7 @@ function runMigration() {
url: 'ajax/task-ajax.php', url: 'ajax/task-ajax.php',
data: { task: 'migrate-bans', user: userId }, data: { task: 'migrate-bans', user: userId },
success: function(data) { success: function(data) {
markUpdateAsSuccess('banmigrate'); migrateComplete();
//TODO cover entire install area with success message.
}, },
error: function(data) { error: function(data) {
appendToInstallConsole('ERROR: ' + data.responseText); appendToInstallConsole('ERROR: ' + data.responseText);
@ -249,4 +253,10 @@ function runMigration() {
}) })
} }
function migrateComplete() {
$('#attention-row').hide();
markUpdateAsSuccess('banmigrate');
installationFinished();
}
jQuery(document).ready(loadJquery); jQuery(document).ready(loadJquery);