From 609fd6249e5446585cc8eeb369faf18effa6522f Mon Sep 17 00:00:00 2001 From: Markus Grigull Date: Thu, 7 Jun 2018 20:33:58 +0200 Subject: [PATCH] Add simulator state label --- src/containers/simulators.js | 38 +++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/containers/simulators.js b/src/containers/simulators.js index 3105755..48c9b2b 100644 --- a/src/containers/simulators.js +++ b/src/containers/simulators.js @@ -165,6 +165,42 @@ class Simulators extends Component { } } + labelSimulatorState = state => { + if (state === 'unknown' || state === 'shutdown') { + return + + + {state} + ; + } + + return + + + {state} + ; + } + + 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 { this.onSimulatorChecked(index, event)} width='30' /> - +