File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
components/import-database Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
20
20
fetchEditedInstanceAction ,
21
21
fetchInstancesAction ,
22
22
instancesSelector ,
23
+ resetImportInstances ,
23
24
setEditedInstance
24
25
} from 'uiSrc/slices/instances/instances'
25
26
import { localStorageService } from 'uiSrc/services'
@@ -158,6 +159,7 @@ const HomePage = () => {
158
159
const handleClose = ( ) => {
159
160
dispatch ( resetDataRedisCluster ( ) )
160
161
dispatch ( resetDataSentinel ( ) )
162
+ dispatch ( resetImportInstances ( ) )
161
163
162
164
setOpenDialog ( null )
163
165
dispatch ( setEditedInstance ( null ) )
Original file line number Diff line number Diff line change @@ -44,10 +44,6 @@ const ImportDatabase = (props: Props) => {
44
44
45
45
useEffect ( ( ) => {
46
46
setDomReady ( true )
47
-
48
- return ( ) => {
49
- dispatch ( resetImportInstances ( ) )
50
- }
51
47
} , [ ] )
52
48
53
49
const onFileChange = ( files : FileList | null ) => {
@@ -57,9 +53,6 @@ const ImportDatabase = (props: Props) => {
57
53
}
58
54
59
55
const handleOnClose = ( ) => {
60
- if ( data ?. success ?. length || data ?. partial ?. length ) {
61
- dispatch ( fetchInstancesAction ( ) )
62
- }
63
56
onClose ( )
64
57
dispatch ( resetImportInstances ( ) )
65
58
@@ -80,7 +73,14 @@ const ImportDatabase = (props: Props) => {
80
73
const formData = new FormData ( )
81
74
formData . append ( 'file' , files [ 0 ] )
82
75
83
- dispatch ( uploadInstancesFile ( formData ) )
76
+ dispatch ( uploadInstancesFile (
77
+ formData ,
78
+ ( data ) => {
79
+ if ( data ?. success ?. length || data ?. partial ?. length ) {
80
+ dispatch ( fetchInstancesAction ( ) )
81
+ }
82
+ }
83
+ ) )
84
84
85
85
sendEventTelemetry ( {
86
86
event : TelemetryEvent . CONFIG_DATABASES_REDIS_IMPORT_SUBMITTED
Original file line number Diff line number Diff line change @@ -798,7 +798,7 @@ export function resetInstanceUpdateAction() {
798
798
// Asynchronous thunk action
799
799
export function uploadInstancesFile (
800
800
file : FormData ,
801
- onSuccessAction ?: ( ) => void ,
801
+ onSuccessAction ?: ( data : any ) => void ,
802
802
onFailAction ?: ( ) => void
803
803
) {
804
804
return async ( dispatch : AppDispatch ) => {
@@ -818,7 +818,7 @@ export function uploadInstancesFile(
818
818
819
819
if ( isStatusSuccessful ( status ) ) {
820
820
dispatch ( importInstancesFromFileSuccess ( data ) )
821
- onSuccessAction ?.( )
821
+ onSuccessAction ?.( data )
822
822
}
823
823
} catch ( _err ) {
824
824
const error = _err as AxiosError
You can’t perform that action at this time.
0 commit comments