From b288baace99da94321a791932f8f2a4627a42d37 Mon Sep 17 00:00:00 2001 From: And Finally Date: Tue, 7 Jan 2020 17:06:26 +0000 Subject: [PATCH] Set the state to 'backing-up' immediately the user starts a migration, so the UI locks sooner. Unlock the UI if the status is 'done'. (#38684) --- client/my-sites/migrate/section-migrate.jsx | 2 ++ client/state/selectors/is-site-migration-in-progress.js | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/my-sites/migrate/section-migrate.jsx b/client/my-sites/migrate/section-migrate.jsx index 4965faadbe090..495075626807a 100644 --- a/client/my-sites/migrate/section-migrate.jsx +++ b/client/my-sites/migrate/section-migrate.jsx @@ -98,6 +98,8 @@ class SectionMigrate extends Component { return; } + this.setMigrationState( { migrationStatus: 'backing-up' } ); + wpcom .startMigration( sourceSiteId, targetSiteId ) .then( () => this.updateFromAPI() ) diff --git a/client/state/selectors/is-site-migration-in-progress.js b/client/state/selectors/is-site-migration-in-progress.js index 4b40fbe651eb7..b4f8c6928abfc 100644 --- a/client/state/selectors/is-site-migration-in-progress.js +++ b/client/state/selectors/is-site-migration-in-progress.js @@ -5,7 +5,10 @@ import getSiteMigrationStatus from 'state/selectors/get-site-migration-status'; /** - * Returns true if the site is the target of an active migration + * Returns true if the site is the target of an active migration. + * Possible migration statuses: inactive, backing-up, restoring, error, done. + * We regard 'error' as 'in progress' – the user needs to dismiss that + * state. * * @param {object} state Global state tree * @param {object} siteId Site ID @@ -14,5 +17,5 @@ import getSiteMigrationStatus from 'state/selectors/get-site-migration-status'; export default function isSiteMigrationInProgress( state, siteId ) { const migrationStatus = getSiteMigrationStatus( state, siteId ); - return migrationStatus !== 'inactive'; + return migrationStatus !== 'inactive' && migrationStatus !== 'done'; }