Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatter on range aggregation #58651

Merged
merged 9 commits into from
Mar 23, 2020
3 changes: 2 additions & 1 deletion src/plugins/data/public/field_formats/utils/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
12 changes: 6 additions & 6 deletions test/functional/apps/visualize/_data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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%',
]);
}
Expand Down Expand Up @@ -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',
]);
});
Expand Down Expand Up @@ -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',
]);
});
Expand Down