Merge pull request #3344 from influxdata/fixes/negative-numbers-in-gauges

Fixes inputting negative numbers from gauges
pull/10616/head
Brandon Farmer 2018-05-01 14:55:38 -07:00 committed by GitHub
commit a65b5603fb
1 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ interface Props {
}
interface State {
workingValue: number
workingValue: number | string
valid: boolean
}
@ -143,9 +143,9 @@ class Threshold extends PureComponent<Props, State> {
private handleChangeWorkingValue = (e: ChangeEvent<HTMLInputElement>) => {
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<Props, State> {
const {threshold, onUpdateColorValue} = this.props
if (valid) {
onUpdateColorValue(threshold, workingValue)
onUpdateColorValue(threshold, Number(workingValue))
} else {
this.setState({workingValue: threshold.value, valid: true})
}