1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Add simulator dialog field check fixed

This commit is contained in:
Manuel Pitz 2018-08-30 22:23:04 +02:00
parent 3f1913dd49
commit 56da378014

View file

@ -63,7 +63,7 @@ class NewSimulatorDialog extends React.Component {
}
resetState() {
this.setState({ name: '', endpoint: 'http://', uuid: '' });
this.setState({ name: '', endpoint: 'http://', uuid: this.uuidv4()});
}
validateForm(target) {
@ -79,7 +79,7 @@ class NewSimulatorDialog extends React.Component {
uuid = false;
}
this.valid = name || uuid;
this.valid = name && uuid;
// return state to control
if (target === 'name') return name ? "success" : "error";
@ -110,7 +110,7 @@ class NewSimulatorDialog extends React.Component {
</FormGroup>
<FormGroup controlId="uuid" validationState={this.validateForm('uuid')}>
<ControlLabel>UUID</ControlLabel>
<FormControl type="text" placeholder="Enter uuid" defaultValue={this.uuidv4()} onChange={(e) => this.handleChange(e)} />
<FormControl type="text" placeholder="Enter uuid" value={this.state.uuid} onChange={(e) => this.handleChange(e)} />
<FormControl.Feedback />
</FormGroup>
</form>