@@ -14,6 +14,7 @@ import getNetworkError from '../../../../../../utils/getNetworkError';
1414import { connect } from 'react-redux' ;
1515import { dispatch } from '../../../../../../redux' ;
1616import * as Actions from '../../../../../../redux/actions/taskflows' ;
17+ import { patchSimulation } from '../../../../../../redux/actions/projects' ;
1718import * as NetActions from '../../../../../../redux/actions/network' ;
1819
1920const SimulationStart = React . createClass ( {
@@ -32,6 +33,7 @@ const SimulationStart = React.createClass({
3233 clusters : React . PropTypes . object ,
3334 onRun : React . PropTypes . func ,
3435 onError : React . PropTypes . func ,
36+ patchSimulation : React . PropTypes . func ,
3537 } ,
3638
3739 getInitialState ( ) {
@@ -50,13 +52,13 @@ const SimulationStart = React.createClass({
5052 if ( ! iniFile ) {
5153 client . createItem ( this . props . simulation . metadata . inputFolder . _id , 'ini' )
5254 . then ( resp =>
53- client . copyFile ( this . props . simulation . metadata . inputFolder . files . ini , resp . data . _id )
55+ client . copyFile ( this . props . project . metadata . inputFolder . files . ini , resp . data . _id )
5456 )
5557 . then ( resp => {
5658 const newSim = deepClone ( this . props . simulation ) ;
5759 newSim . metadata . inputFolder . files . ini = resp . data . _id ;
5860 this . setState ( { iniFile : resp . data . _id } ) ;
59- dispatch ( Actions . patchSimulation ( newSim ) ) ;
61+ this . props . patchSimulation ( newSim ) ;
6062 } )
6163 . catch ( err => {
6264 console . log ( 'Error copying ini file for simulation' , err ) ;
@@ -207,6 +209,7 @@ export default connect(
207209 onRun : ( taskflowName , primaryJob , payload , simulationStep , location ) =>
208210 dispatch ( Actions . createTaskflow ( taskflowName , primaryJob , payload , simulationStep , location ) ) ,
209211 onError : ( message ) => dispatch ( NetActions . errorNetworkCall ( 'create_taskflow' , { data : { message } } , 'form' ) ) ,
212+ patchSimulation : ( newSim ) => dispatch ( patchSimulation ( newSim ) ) ,
210213 } ;
211214 }
212215) ( SimulationStart ) ;
0 commit comments