1
0
Fork 0
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:
Sonja Happ 2021-03-25 14:22:00 +01:00
commit 395f7650da

View file

@ -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
}