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

display signal type in gauge

This commit is contained in:
Ricardo Hernandez-Montoya 2017-04-03 15:56:48 +02:00
parent 47520e2ca9
commit baddee0df3
2 changed files with 8 additions and 2 deletions

View file

@ -90,12 +90,18 @@ class WidgetGauge extends Component {
render() {
var componentClass = this.props.editing ? "gauge-widget editing" : "gauge-widget";
var signalType = null;
if (this.props.simulation) {
var simulationModel = this.props.simulation.models.filter((model) => model.simulator === this.props.widget.simulator)[0];
signalType = simulationModel && simulationModel.length > 0? simulationModel.mapping[this.props.widget.signal].type : '';
}
return (
<div className={ componentClass }>
<div className="gauge-name">{ this.props.widget.name }</div>
<canvas ref={ (node) => this.gaugeCanvas = node } />
<div className="gauge-unit">Voltage (V)</div>
<div className="gauge-unit">{ signalType }</div>
<div className="gauge-value">{ this.state.value }</div>
</div>
);

View file

@ -139,7 +139,7 @@ class Widget extends Component {
} else if (widget.type === 'Slider') {
element = <WidgetSlider widget={widget} editing={this.props.editing} />
} else if (widget.type === 'Gauge') {
element = <WidgetGauge widget={widget} data={this.state.simulatorData} editing={this.props.editing} />
element = <WidgetGauge widget={widget} data={this.state.simulatorData} editing={this.props.editing} simulation={this.props.simulation} />
}
if (this.props.editing) {