From bbf96a8d4ccaabc1942dd6214c2a9e2e298bacfa Mon Sep 17 00:00:00 2001 From: Kevin Zoschke Date: Thu, 5 Nov 2020 10:54:11 -0500 Subject: [PATCH] Integrate selector to retrieve message and entry in restore progress --- client/my-sites/backup/rewind-flow/restore.tsx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/client/my-sites/backup/rewind-flow/restore.tsx b/client/my-sites/backup/rewind-flow/restore.tsx index 020bde8e75eb8..2283c5f2ac133 100644 --- a/client/my-sites/backup/rewind-flow/restore.tsx +++ b/client/my-sites/backup/rewind-flow/restore.tsx @@ -21,7 +21,6 @@ import Gridicon from 'calypso/components/gridicon'; import Loading from './loading'; import ProgressBar from './progress-bar'; import QueryRewindState from 'calypso/components/data/query-rewind-state'; -import QueryRewindRestoreStatus from 'calypso/components/data/query-rewind-restore-status'; import RewindConfigEditor from './rewind-config-editor'; import RewindFlowNotice, { RewindFlowNoticeLevel } from './rewind-flow-notice'; @@ -50,26 +49,16 @@ const BackupRestoreFlow: FunctionComponent< Props > = ( { const [ userHasRequestedRestore, setUserHasRequestedRestore ] = useState< boolean >( false ); const rewindState = useSelector( ( state ) => getRewindState( state, siteId ) ) as RewindState; - - const loading = rewindState.state === 'uninitialized'; - const restoreId = rewindState.rewind?.restoreId; - - // TODO: use selectors - const currentEntry = 'wp_options'; // useSelector( ( state ) => ( restoreId ? ... : undefined ) ); - const message = 'Importing database'; // useSelector( ( state ) => ( restoreId ? ... : undefined ) ); const inProgressRewindStatus = useSelector( ( state ) => getInProgressRewindStatus( state, siteId, rewindId ) ); const inProgressRewindPercentComplete = useSelector( ( state ) => getInProgressRewindPercentComplete( state, siteId, rewindId ) ); - const inProgressRewindEntryDetails = useSelector( ( state ) => getInProgressRewindEntryDetails( state, siteId, rewindId ) ); - console.log( inProgressRewindEntryDetails ); - const requestRestore = useCallback( () => dispatch( rewindRestore( siteId, rewindId, rewindConfig ) ), [ dispatch, rewindConfig, rewindId, siteId ] @@ -79,6 +68,9 @@ const BackupRestoreFlow: FunctionComponent< Props > = ( { requestRestore(); }, [ setUserHasRequestedRestore, requestRestore ] ); + const loading = rewindState.state === 'uninitialized'; + const { message, entry } = inProgressRewindEntryDetails; + const renderConfirm = () => ( <>
@@ -124,7 +116,7 @@ const BackupRestoreFlow: FunctionComponent< Props > = ( {

{ translate( 'Currently restoring your site' ) }

@@ -218,7 +210,6 @@ const BackupRestoreFlow: FunctionComponent< Props > = ( { return ( <> - { restoreId && } { render() } );