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

Add simulator state label

This commit is contained in:
Markus Grigull 2018-06-07 20:33:58 +02:00
parent 1cf45a2cae
commit 609fd6249e

View file

@ -165,6 +165,42 @@ class Simulators extends Component {
}
}
labelSimulatorState = state => {
if (state === 'unknown' || state === 'shutdown') {
return <span>
<Label>offline</Label>
{state}
</span>;
}
return <span>
<Label>online</Label>
{state}
</span>;
}
isSimulatorOnline(state) {
return state !== 'shutdown' && state !== 'unknown';
}
stateLabelStyle = state => {
if (this.isSimulatorOnline(state)) {
return 'success';
}
return 'danger';
}
stateLabelModifier = state => {
if (this.isSimulatorOnline(state)) {
return 'online';
}
return 'offline';
}
render() {
const buttonStyle = {
marginLeft: '10px'
@ -177,7 +213,7 @@ class Simulators extends Component {
<Table data={this.state.simulators}>
<TableColumn checkbox onChecked={(index, event) => this.onSimulatorChecked(index, event)} width='30' />
<TableColumn title='Name' dataKeys={['properties.name', 'rawProperties.name']} />
<TableColumn title='State' dataKey='state' />
<TableColumn title='State' dataKey='state' labelKey='state' labelModifier={this.stateLabelModifier} labelStyle={this.stateLabelStyle} />
<TableColumn title='Model' dataKey='model' />
<TableColumn title='Endpoint' dataKeys={['properties.endpoint', 'rawProperties.endpoint']} />
<TableColumn title='Host' dataKey='host' />