diff --git a/src/components/dialog/new-simulation-model.js b/src/components/dialog/new-simulation-model.js index 33efbed..40daf9c 100644 --- a/src/components/dialog/new-simulation-model.js +++ b/src/components/dialog/new-simulation-model.js @@ -93,7 +93,7 @@ class NewSimulationModelDialog extends React.Component { resetState() { this.setState({ name: '', - simulator: '', + simulator: this.props.simulators[0]._id || '', outputLength: '1', inputLength: '1', outputMapping: [{ name: 'Signal', type: 'Type' }], @@ -106,16 +106,11 @@ class NewSimulationModelDialog extends React.Component { let name = true; let inputLength = true; let outputLength = true; - let simulator = true; if (this.state.name === '') { name = false; } - if (this.state.simulator === '') { - simulator = false; - } - // test if simulatorid is a number (in a string, not type of number) if (!/^\d+$/.test(this.state.outputLength)) { outputLength = false; @@ -125,13 +120,12 @@ class NewSimulationModelDialog extends React.Component { inputLength = false; } - this.valid = name && inputLength && outputLength && simulator; + this.valid = name && inputLength && outputLength; // return state to control if (target === 'name') return name ? "success" : "error"; else if (target === 'outputLength') return outputLength ? "success" : "error"; else if (target === 'inputLength') return inputLength ? "success" : "error"; - else if (target === 'simulator') return simulator ? "success" : "error"; } render() { @@ -143,7 +137,7 @@ class NewSimulationModelDialog extends React.Component { this.handleChange(e)} /> - + Simulator this.handleChange(e)}> {this.props.simulators.map(simulator => (