@@ -18,6 +18,7 @@ import { useStorageRouter } from '../../lib/storageRouter'
1818import Icon from '../../shared/components/atoms/Icon'
1919import styled from '../../shared/lib/styled'
2020import Button from '../../shared/components/atoms/Button'
21+ import { useToast } from '../../shared/lib/stores/toast'
2122
2223interface MigrationPageProps {
2324 storage : NoteStorage
@@ -55,14 +56,15 @@ const MigrationTab = ({ storage }: MigrationPageProps) => {
5556 } = useGeneralStatus ( )
5657 const { get, start, end } = useMigrations ( )
5758 const { navigateToNote } = useStorageRouter ( )
59+ const { pushMessage } = useToast ( )
5860
5961 const runningJob = get ( storage . id )
6062
6163 const [ migrationState , setMigrationState ] = useState < MigrationState > (
6264 initState ( boostHubTeams , runningJob )
6365 )
6466 const [ workspaceErr , setWorkspaceErr ] = useState < Error | null > ( null )
65- const { openTab , setClosed } = usePreferences ( )
67+ const { setClosed } = usePreferences ( )
6668
6769 useEffect ( ( ) => {
6870 if ( runningJob != null ) {
@@ -99,12 +101,18 @@ const MigrationTab = ({ storage }: MigrationPageProps) => {
99101 const cancel = useCallback ( ( ) => {
100102 end ( storage . id )
101103 setMigrationState ( transitionCancel ( boostHubTeams ) )
102- } , [ boostHubTeams , end , storage . id ] )
104+ setClosed ( true )
105+ } , [ boostHubTeams , end , storage . id , setClosed ] )
103106
104107 const finish = useCallback ( ( ) => {
105108 end ( storage . id )
106- openTab ( 'storage' )
107- } , [ end , openTab , storage ] )
109+ setClosed ( true )
110+ pushMessage ( {
111+ type : 'success' ,
112+ title : 'The migration has been finished' ,
113+ description : 'Please check migrated data in the destination cloud space' ,
114+ } )
115+ } , [ end , storage . id , setClosed , pushMessage ] )
108116
109117 if ( migrationState . step === 'login' ) {
110118 return (
@@ -159,7 +167,7 @@ const MigrationTab = ({ storage }: MigrationPageProps) => {
159167 </ Flexbox >
160168 </ FormGroup >
161169 < Flexbox justifyContent = 'flex-end' >
162- < Button variant = { 'transparent' } onClick = { ( ) => openTab ( 'storage' ) } >
170+ < Button variant = { 'transparent' } onClick = { ( ) => setClosed ( true ) } >
163171 Cancel
164172 </ Button >
165173 < Button
0 commit comments