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

solve warning and error

This commit is contained in:
Laura Fuentes Grau 2020-12-29 16:36:25 +01:00
parent 6d59f83002
commit cbec6fe88a

View file

@ -16,9 +16,18 @@ class ICDialog extends React.Component {
this.state = {
confirmCommand: false,
command: '',
icStatus: {}
};
}
static getDerivedStateFromProps(props, state){
if(typeof props.icStatus !== 'undefined'){
return {icStatus: props.icStatus}
} else {
return {}
}
}
onClose(canceled) {
this.props.onClose();
}
@ -47,7 +56,7 @@ class ICDialog extends React.Component {
render() {
let icStatus = this.props.icStatus;
let icStatus = this.state.icStatus;
delete icStatus['icID'];
let objectURL=''
@ -72,32 +81,32 @@ class ICDialog extends React.Component {
{
typeof icStatus !== "undefined" && Object.keys(icStatus).map(statusKey => (
typeof icStatus[statusKey] === 'object' ?
(<div>
(<div key={statusKey}>
<Button variant="light" onClick={() => this.showFurtherInfo(statusKey)} >{statusKey}
<Icon icon='chevron-down' style={{color: '#007bff'}}/></Button>
<Collapse isOpened={this.state[statusKey]} >
{
Object.keys(icStatus[statusKey]).map(key => (
typeof icStatus[statusKey][key] === 'object' ?
(<div>
(<div key={key}>
<Button variant="light" onClick={() => this.showFurtherInfo(key)} >{key}
<Icon icon='chevron-down' style={{ color: '#007bff' }} /></Button>
<Collapse isOpened={this.state[key]} >
{Object.keys(icStatus[statusKey][key]).map(index => (
<div>{index + ": " + icStatus[statusKey][key][index]}</div>
<div key={index}>{index + ": " + icStatus[statusKey][key][index]}</div>
))}
</Collapse>
</div>)
:
(<div>{key + ": " + icStatus[statusKey][key]}</div>)
(<div key={key}>{key + ": " + icStatus[statusKey][key]}</div>)
))
}
</Collapse>
</div>)
:
(<div>{statusKey + ": " + icStatus[statusKey]}</div>)
(<div key={statusKey}>{statusKey + ": " + icStatus[statusKey]}</div>)
))
}
</Col>