mirror of https://github.com/grafana/grafana
Heatmap: Fix ability to define bucket size as an interval string, like 30s (#95923)
* validate with durations * update docs * Add default values to calculation, show error if too many bins * move default generation to separate function * Update docs/sources/panels-visualizations/visualizations/heatmap/index.md Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com> * dont try to parse ‘’ as a duration, move max to variable * Add new function to support duration and ms, only calculate if valid * Add radix * Remove validation and precalc to determine bucket quantity * simplify * simplify more * less * cleanup transformationsVariableSupport. reset value to auto on mode changes * maybe... * by hook or by crook * Change function name back --------- Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com> Co-authored-by: Leon Sorokin <leeoniya@gmail.com>pull/97367/head
parent
88621d6fa0
commit
53052def52
@ -0,0 +1,21 @@ |
||||
import { convertDurationToMilliseconds } from './utils'; |
||||
|
||||
describe('Heatmap utils', () => { |
||||
const cases: Array<[string, number | undefined]> = [ |
||||
['1', 1], |
||||
['6', 6], |
||||
['2.3', 2], |
||||
['1ms', 1], |
||||
['5MS', 5], |
||||
['1s', 1000], |
||||
['1.5s', undefined], |
||||
['1.2345s', undefined], |
||||
['one', undefined], |
||||
['20sec', undefined], |
||||
['', undefined], |
||||
]; |
||||
|
||||
test.each(cases)('convertToMilliseconds can correctly convert "%s"', (input, output) => { |
||||
expect(convertDurationToMilliseconds(input)).toEqual(output); |
||||
}); |
||||
}); |
Loading…
Reference in new issue