mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
externally managed ICs don't appear immediately in IC list, add button activates as soon as all required fields are filled #266
This commit is contained in:
parent
62b78c5822
commit
f096b8d3e0
2 changed files with 6 additions and 3 deletions
|
@ -98,6 +98,7 @@ class ArrayStore extends ReduceStore {
|
|||
return state;
|
||||
|
||||
case this.type + '/added':
|
||||
if(typeof action.data.managedexternally !== "undefined" && action.data.managedexternally === true ) return state;
|
||||
return this.updateElements(state, [action.data]);
|
||||
|
||||
case this.type + '/add-error':
|
||||
|
|
|
@ -105,6 +105,8 @@ class NewICDialog extends React.Component {
|
|||
if (target === 'websocketurl') return websocketurl ? "success" : "error";
|
||||
if (target === 'type') return type ? "success" : "error";
|
||||
if (target === 'category') return category ? "success" : "error";
|
||||
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
uuidv4() {
|
||||
|
@ -137,7 +139,7 @@ class NewICDialog extends React.Component {
|
|||
typeOptions =[];
|
||||
}
|
||||
return (
|
||||
<Dialog show={this.props.show} title="New Infrastructure Component" buttonTitle="Add" onClose={(c) => this.onClose(c)} onReset={() => this.resetState()} valid={this.valid}>
|
||||
<Dialog show={this.props.show} title="New Infrastructure Component" buttonTitle="Add" onClose={(c) => this.onClose(c)} onReset={() => this.resetState()} valid={this.validateForm()}>
|
||||
<form>
|
||||
<FormGroup controlId="managedexternally">
|
||||
<FormCheck type={"checkbox"} label={"Managed externally"} defaultChecked={this.state.managedexternally} onChange={e => this.handleChange(e)}>
|
||||
|
@ -151,7 +153,7 @@ class NewICDialog extends React.Component {
|
|||
<FormControl type="text" placeholder="Enter name" value={this.state.name} onChange={(e) => this.handleChange(e)} />
|
||||
<FormControl.Feedback />
|
||||
</FormGroup>
|
||||
<FormGroup controlId="category">
|
||||
<FormGroup controlId="category" valid={this.validateForm('category')}>
|
||||
<FormLabel>Category of component</FormLabel>
|
||||
<FormControl as="select" value={this.state.category} onChange={(e) => this.handleChange(e)}>
|
||||
<option default>Select category</option>
|
||||
|
@ -162,7 +164,7 @@ class NewICDialog extends React.Component {
|
|||
<option>equipment</option>
|
||||
</FormControl>
|
||||
</FormGroup>
|
||||
<FormGroup controlId="type">
|
||||
<FormGroup controlId="type" valid={this.validateForm('type')}>
|
||||
<FormLabel>Type of component</FormLabel>
|
||||
<FormControl as="select" value={this.state.type} onChange={(e) => this.handleChange(e)}>
|
||||
<option default>Select type</option>
|
||||
|
|
Loading…
Add table
Reference in a new issue