fix(SR/tab-stats): fix IOPS's and IOwait's values format (#2914)

This commit is contained in:
badrAZ 2018-05-02 14:17:13 +02:00 committed by Pierre Donias
parent 34f1ef1680
commit b9e574e32f

View File

@ -1,10 +1,22 @@
import ChartistGraph from 'react-chartist'
import ChartistLegend from 'chartist-plugin-legend'
import ChartistTooltip from 'chartist-plugin-tooltip'
import humanFormat from 'human-format'
import React from 'react'
import { injectIntl } from 'react-intl'
import { messages } from 'intl'
import { find, flatten, floor, get, map, max, size, sum, values } from 'lodash'
import {
find,
flatten,
floor,
get,
map,
max,
round,
size,
sum,
values,
} from 'lodash'
import propTypes from '../prop-types-decorator'
import { computeArraysSum } from '../xo-stats'
@ -604,7 +616,11 @@ export const IopsLineChart = injectIntl(
nValues: length,
endTimestamp,
interval,
valueTransform: value => `${value.toPrecision(3)} /s`,
valueTransform: value =>
humanFormat(value, {
decimals: 3,
unit: 'IOPS',
}),
}),
...options,
}}
@ -721,7 +737,7 @@ export const IowaitChart = injectIntl(
nValues: length,
endTimestamp,
interval,
valueTransform: value => `${value.toPrecision(2)}%`,
valueTransform: value => `${round(value, 2)}%`,
}),
...options,
}}