Remove the "Start upgrade" button when the upgrade is completed
Add the "Upgrade completed" message Add the "Go to MailPoet" button
This commit is contained in:
@ -31,7 +31,3 @@ progressbar_gradient_to_color = #fd9215
|
||||
|
||||
.error_msg
|
||||
color: #f00
|
||||
|
||||
.complete_msg
|
||||
color: #008000
|
||||
font-weight: bold
|
||||
|
@ -27,7 +27,6 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
||||
url: mailpoet_mp2_migrator.log_file_url,
|
||||
cache: false
|
||||
}).done(function (result) {
|
||||
jQuery('#action_message').html(''); // Clear the action message
|
||||
jQuery("#logger").html('');
|
||||
result.split("\n").forEach(function (row) {
|
||||
if(row.substr(0, 7) === '[ERROR]' || row.substr(0, 9) === '[WARNING]' || row === 'IMPORT STOPPED BY USER') {
|
||||
@ -35,9 +34,8 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
||||
}
|
||||
// Test if the import is complete
|
||||
else if(row === 'IMPORT COMPLETE') {
|
||||
row = '<span class="complete_msg">' + row + '</span>'; // Mark the complete message in green
|
||||
jQuery('#action_message').html(MailPoet.I18n.t('import_complete'))
|
||||
.removeClass('failure').addClass('success');
|
||||
jQuery('#import-actions').hide();
|
||||
jQuery('#upgrade-completed').show();
|
||||
}
|
||||
jQuery("#logger").append(row + "<br />\n");
|
||||
|
||||
@ -76,8 +74,6 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
||||
jQuery('#import').val(MailPoet.I18n.t('importing')).attr('disabled', 'disabled');
|
||||
// Show the stop button
|
||||
jQuery('#stop-import').show();
|
||||
// Clear the action message
|
||||
jQuery('#action_message').html('');
|
||||
|
||||
// Run the import
|
||||
MailPoet.Ajax.post({
|
||||
@ -141,6 +137,11 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
||||
window.location.reload();
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
gotoWelcomePage: function () {
|
||||
window.location.href = 'admin.php?page=mailpoet-welcome';
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
@ -165,6 +166,11 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
||||
jQuery('#skip-import').click(function() {
|
||||
MailPoet.MP2Migrator.skipImport();
|
||||
});
|
||||
|
||||
// Go to welcome page
|
||||
jQuery('#goto-welcome').click(function() {
|
||||
MailPoet.MP2Migrator.gotoWelcomePage();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -145,6 +145,7 @@ class MP2Migrator {
|
||||
|
||||
Setting::setValue('mailpoet_migration_complete', true);
|
||||
|
||||
$this->log("IMPORT COMPLETE");
|
||||
$this->log(sprintf('=== ' . __('END IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
|
||||
$result = ob_get_contents();
|
||||
ob_clean();
|
||||
|
@ -22,21 +22,29 @@
|
||||
|
||||
<div>
|
||||
<br />
|
||||
<p style="/* text-align: center */">
|
||||
<div id="import-actions">
|
||||
<input type="submit" name="import" id="import" class="button button-primary" value="<%= __('Start upgrade') %>" />
|
||||
<input type="submit" name="stop-import" id="stop-import" class="button button-secondary" value="<%= __('Pause') %>" style="display: none"/>
|
||||
<small> <a id="skip-import" href="#"><%= __("No thanks, I'll skip and start from scratch.") %></a></small>
|
||||
</p>
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<div id="progressbar" class="mailpoet_progress mailpoet_progress_complete">
|
||||
<span id="progresslabel" class="mailpoet_progress_label">0%</span>
|
||||
</div>
|
||||
<br /><br />
|
||||
|
||||
<div id="upgrade-completed" style="display: none">
|
||||
<h3><%= __('Upgrade completed!') %></h3>
|
||||
<input type="button" name="goto-welcome" id="goto-welcome" class="button button-primary" value="<%= __('Go to MailPoet') %>" />
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<small><strong><%= __('Log...') %></strong></small>
|
||||
<div id="logger"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% endblock %>
|
||||
|
||||
|
Reference in New Issue
Block a user