Fix formatter on range aggregation (#58651) (#60920)

* Fix formatter on range aggregation

* Fix test that was using unformatted byte ranges

* Fix test

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Wylie Conlon 2020-03-23 13:22:37 -04:00 committed by GitHub
parent 5f52be4d60
commit fbe3637e84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -70,7 +70,8 @@ export const deserializeFieldFormat: FormatFactory = function(
const { id } = mapping;
if (id === 'range') {
const RangeFormat = FieldFormat.from((range: any) => {
const format = getFieldFormat(this, id, mapping.params);
const nestedFormatter = mapping.params as SerializedFieldFormat;
const format = getFieldFormat(this, nestedFormatter.id, nestedFormatter.params);
const gte = '\u2265';
const lt = '\u003c';
return i18n.translate('data.aggTypes.buckets.ranges.rangesFormatMessage', {

View file

@ -99,9 +99,9 @@ export default function({ getService, getPageObjects }) {
async function expectValidTableData() {
const data = await PageObjects.visChart.getTableVisData();
expect(data.trim().split('\n')).to.be.eql([
'≥ 0 and < 1000',
'≥ 0B and < 1,000B',
'1,351 64.7%',
'≥ 1000 and < 2000',
'≥ 1,000B and < 1.953KB',
'737 35.3%',
]);
}
@ -144,9 +144,9 @@ export default function({ getService, getPageObjects }) {
const data = await PageObjects.visChart.getTableVisData();
expect(data.trim().split('\n')).to.be.eql([
'≥ 0 and < 1000',
'≥ 0B and < 1,000B',
'344.094B',
'≥ 1000 and < 2000',
'≥ 1,000B and < 1.953KB',
'1.697KB',
]);
});
@ -248,9 +248,9 @@ export default function({ getService, getPageObjects }) {
await PageObjects.visEditor.clickGo();
const data = await PageObjects.visChart.getTableVisData();
expect(data.trim().split('\n')).to.be.eql([
'≥ 0 and < 1000',
'≥ 0B and < 1,000B',
'1,351',
'≥ 1000 and < 2000',
'≥ 1,000B and < 1.953KB',
'737',
]);
});