From 2cf7789bb23a71084c9e06f352cc6a55540d1c33 Mon Sep 17 00:00:00 2001 From: Laura Fuentes Grau Date: Mon, 30 Mar 2020 16:28:52 +0200 Subject: [PATCH] fix for NumberInput and Gauge: both can now be connected to a signal, fix for Topology: can now be dropped --- src/widget/widget.js | 2 +- src/widget/widgets/gauge.js | 3 ++- src/widget/widgets/topology.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widget/widget.js b/src/widget/widget.js index 293cb19..31a7be2 100644 --- a/src/widget/widget.js +++ b/src/widget/widget.js @@ -144,7 +144,7 @@ class Widget extends React.Component { } else if (widget.type === 'Button') { return this.inputDataChanged(widget, value)} signals={this.state.signals} /> } else if (widget.type === 'NumberInput') { - return this.inputDataChanged(widget, value)} /> + return this.inputDataChanged(widget, value)} signals={this.state.signals} /> } else if (widget.type === 'Slider') { return this.props.onWidgetStatusChange(w, this.props.index) } onInputChanged={value => this.inputDataChanged(widget, value)} signals={this.state.signals}/> } else if (widget.type === 'Gauge') { diff --git a/src/widget/widgets/gauge.js b/src/widget/widgets/gauge.js index 1feae3f..4079c2d 100644 --- a/src/widget/widgets/gauge.js +++ b/src/widget/widgets/gauge.js @@ -89,6 +89,7 @@ class WidgetGauge extends Component { || props.data[ICid].output.values.length === 0 || props.data[ICid].output.values[0].length === 0) { returnState["value"] = 0; + return returnState; } // memorize if min or max value is updated @@ -191,7 +192,7 @@ class WidgetGauge extends Component { if (zones != null) { // adapt range 0-100 to actual min-max const step = (maxValue - minValue) / 100; - + zones = zones.map(zone => { return Object.assign({}, zone, { min: (zone.min * step) + +minValue, max: zone.max * step + +minValue, strokeStyle: '#' + zone.strokeStyle }); }); diff --git a/src/widget/widgets/topology.js b/src/widget/widgets/topology.js index 6d98195..dcdc57d 100644 --- a/src/widget/widgets/topology.js +++ b/src/widget/widgets/topology.js @@ -139,7 +139,7 @@ class WidgetTopology extends React.Component { } } else { // No file has been selected - if (!this.props.widget.customProperties.file) { + if (!this.props.widget.customProperties.file&& this.state.message !== 'Select a topology model first.') { this.setState({ 'dashboardState': 'show_message', 'message': 'Select a topology model first.'});