mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Merge branch 'master' into react-update
This commit is contained in:
commit
395f7650da
1 changed files with 22 additions and 15 deletions
|
@ -47,6 +47,24 @@ class ConfigTable extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props, state){
|
||||
|
||||
let ExternalICInUse = false
|
||||
|
||||
for (let config of props.configs){
|
||||
for (let component of props.ics) {
|
||||
if ((config.icID === component.id) && (component.managedexternally === true)) {
|
||||
ExternalICInUse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ExternalICInUse: ExternalICInUse
|
||||
};
|
||||
}
|
||||
|
||||
addConfig() {
|
||||
const config = {
|
||||
scenarioID: this.props.scenario.id,
|
||||
|
@ -181,24 +199,13 @@ class ConfigTable extends Component {
|
|||
}
|
||||
|
||||
usesExternalIC(index) {
|
||||
let icID = this.props.configs[index].icID;
|
||||
|
||||
let ic = null;
|
||||
for (let component of this.props.ics) {
|
||||
if (component.id === icID) {
|
||||
ic = component;
|
||||
if (component.id === this.props.configs[index].icID) {
|
||||
if (component.managedexternally === true) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ic == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ic.managedexternally === true) {
|
||||
this.setState({ ExternalICInUse: true })
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue