@@ -5,7 +5,7 @@ import DialogActions from '@material-ui/core/DialogActions';
55import DialogContent from '@material-ui/core/DialogContent' ;
66import DialogTitle from '@material-ui/core/DialogTitle' ;
77import { withStyles } from '@material-ui/core/styles' ;
8- import { PYTHON_CALL } from '../../redux/actions/general' ;
8+ import { PYTHON_CALL , LOAD_TUTORIAL } from '../../redux/actions/general' ;
99
1010const styles = ( ) => ( {
1111 cancel : { marginRight : 10 } ,
@@ -18,14 +18,21 @@ class ConfirmationDialog extends React.Component {
1818 }
1919
2020 handleConfirmation = ( ) => {
21- if ( this . props . confirmationDialogOnConfirm
22- && this . props . confirmationDialogOnConfirm . type === PYTHON_CALL ) {
23- this . props . pythonCall ( {
24- cmd : this . props . confirmationDialogOnConfirm . cmd ,
25- args : this . props . confirmationDialogOnConfirm . args ,
26- } ) ;
21+ if ( this . props . confirmationDialogOnConfirm ) {
22+ if ( this . props . confirmationDialogOnConfirm . type === PYTHON_CALL ) {
23+ this . props . pythonCall ( {
24+ cmd : this . props . confirmationDialogOnConfirm . cmd ,
25+ args : this . props . confirmationDialogOnConfirm . args ,
26+ } ) ;
27+ } else if ( this . props . confirmationDialogOnConfirm . type === LOAD_TUTORIAL ) {
28+ if ( this . props . confirmationDialogOnConfirm . payload !== undefined ) {
29+ this . props . dispatchAction ( this . props . confirmationDialogOnConfirm . action ( this . props . confirmationDialogOnConfirm . payload ) ) ;
30+ } else {
31+ this . props . dispatchAction ( this . props . confirmationDialogOnConfirm . action ) ;
32+ }
33+ }
2734 } else {
28- console . log ( 'confirmationAction not passed or it is not a python call ' ) ;
35+ console . log ( 'Command/desired behaviour not passed to confirmation dialog ' ) ;
2936 }
3037 }
3138
0 commit comments