diff --git a/src/ic/ic-dialog.js b/src/ic/ic-dialog.js index 0a1a411..cdb48ad 100644 --- a/src/ic/ic-dialog.js +++ b/src/ic/ic-dialog.js @@ -13,20 +13,9 @@ class ICDialog extends React.Component { super(props); this.state = { - timezone: false, - kernel: false, - system: false, }; } -/* static getDerivedStateFromProps(props, state){ - let icStatus = props.icStatus; - return { - icStatus: icStatus, - ic: props.ic, - }; - }*/ - onClose(canceled) { this.props.onClose(); } @@ -36,17 +25,8 @@ class ICDialog extends React.Component { } showFurtherInfo(key){ - switch(key){ - case 'timezone': - this.setState({timezone: !this.state.timezone}); - return; - case 'kernel': - this.setState({kernel: !this.state.kernel}); - return; - case 'system': - this.setState({system: !this.state.system}); - return; - } + if(typeof this.state[key] === 'undefined') this.setState({[key]: false}); + this.setState({[key]: !this.state[key]}); } render() { @@ -68,13 +48,25 @@ class ICDialog extends React.Component { (
- - { - Object.keys(this.props.icStatus[statusKey]).map(key => ( -
{key + ": " + this.props.icStatus[statusKey][key]}
- )) - } -
+ + { + Object.keys(this.props.icStatus[statusKey]).map(key => ( + typeof this.props.icStatus[statusKey][key] === 'object' ? + (
+ + + + {Object.keys(this.props.icStatus[statusKey][key]).map(index => ( +
{index + ": " + this.props.icStatus[statusKey][key][index]}
+ ))} +
+
) + : + (
{key + ": " + this.props.icStatus[statusKey][key]}
) + )) + } +
) :