From 2bb7d95e3710d7bde3c11fc1a57015f54759c4fd Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 24 May 2017 12:16:28 +0200 Subject: [PATCH] Remove the "Start upgrade" button when the upgrade is completed Add the "Upgrade completed" message Add the "Go to MailPoet" button --- assets/css/src/mp2migrator.styl | 4 ---- assets/js/src/mp2migrator.js | 18 ++++++++++++------ lib/Config/MP2Migrator.php | 1 + views/mp2migration.html | 14 +++++++++++--- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/assets/css/src/mp2migrator.styl b/assets/css/src/mp2migrator.styl index a5309a17ad..bddcfefb9f 100644 --- a/assets/css/src/mp2migrator.styl +++ b/assets/css/src/mp2migrator.styl @@ -31,7 +31,3 @@ progressbar_gradient_to_color = #fd9215 .error_msg color: #f00 - -.complete_msg - color: #008000 - font-weight: bold diff --git a/assets/js/src/mp2migrator.js b/assets/js/src/mp2migrator.js index 2f78938c26..4022a52b20 100644 --- a/assets/js/src/mp2migrator.js +++ b/assets/js/src/mp2migrator.js @@ -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 = '' + row + ''; // 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 + "
\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(); + }); }); }); diff --git a/lib/Config/MP2Migrator.php b/lib/Config/MP2Migrator.php index d2cf4d2eec..01ceac71f0 100644 --- a/lib/Config/MP2Migrator.php +++ b/lib/Config/MP2Migrator.php @@ -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(); diff --git a/views/mp2migration.html b/views/mp2migration.html index 8003e32eea..2c88c8e359 100644 --- a/views/mp2migration.html +++ b/views/mp2migration.html @@ -22,21 +22,29 @@

-

+

0%
-

+ + +
<%= __('Log...') %>
+ <% endblock %>