Use EmptyGraphMessage in SingleStatTransform

For consistency.
pull/10616/head
Christopher Henn 2018-11-20 16:53:40 -08:00 committed by Chris Henn
parent 7e98b0b38a
commit 58d8ac8f67
1 changed files with 7 additions and 5 deletions

View File

@ -2,12 +2,18 @@
import React, {PureComponent} from 'react'
import _ from 'lodash'
// Components
import EmptyGraphMessage from 'src/shared/components/EmptyGraphMessage'
// Parsing
import getLastValues from 'src/shared/parsing/flux/fluxToSingleStat'
// Types
import {FluxTable} from 'src/types'
const NON_NUMERIC_ERROR =
'Could not display single stat because your values are non-numeric'
interface Props {
tables: FluxTable[]
children: (stat: number) => JSX.Element
@ -18,11 +24,7 @@ export default class SingleStatTransform extends PureComponent<Props> {
const lastValue = +this.lastValue
if (!_.isFinite(lastValue)) {
return (
<div>
Could not display single stat because your values are non-numeric
</div>
)
return <EmptyGraphMessage message={NON_NUMERIC_ERROR} />
}
return this.props.children(lastValue)