From f232853ef18e699e76341cc8ab151c47c0102a23 Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Tue, 1 May 2018 14:40:21 -0700 Subject: [PATCH] Fixes inputting negative numbers from gauges --- ui/src/dashboards/components/Threshold.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/dashboards/components/Threshold.tsx b/ui/src/dashboards/components/Threshold.tsx index e74061d4ea..5a521761c3 100644 --- a/ui/src/dashboards/components/Threshold.tsx +++ b/ui/src/dashboards/components/Threshold.tsx @@ -32,7 +32,7 @@ interface Props { } interface State { - workingValue: number + workingValue: number | string valid: boolean } @@ -143,9 +143,9 @@ class Threshold extends PureComponent { private handleChangeWorkingValue = (e: ChangeEvent) => { const {threshold, onValidateColorValue} = this.props - const targetValue = Number(e.target.value) + const targetValue = e.target.value - const valid = onValidateColorValue(threshold, targetValue) + const valid = onValidateColorValue(threshold, Number(targetValue)) this.setState({valid, workingValue: targetValue}) } @@ -155,7 +155,7 @@ class Threshold extends PureComponent { const {threshold, onUpdateColorValue} = this.props if (valid) { - onUpdateColorValue(threshold, workingValue) + onUpdateColorValue(threshold, Number(workingValue)) } else { this.setState({workingValue: threshold.value, valid: true}) }