mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
fixing field formatters for gauge
This commit is contained in:
parent
fdd62b03cc
commit
35c631feb0
6 changed files with 46 additions and 6 deletions
|
@ -263,8 +263,9 @@ export function MeterGaugeProvider() {
|
|||
const percentage = Math.round(100 * (d.y - min) / (max - min));
|
||||
return `${percentage}%`;
|
||||
}
|
||||
if (d.aggConfig) {
|
||||
return d.aggConfig.fieldFormatter('text')(d.y);
|
||||
if (_.has(d, 'aggConfigResult.aggConfig')) {
|
||||
const fieldFormatter = d.aggConfigResult.aggConfig.fieldFormatter('text');
|
||||
return fieldFormatter(d.y);
|
||||
}
|
||||
return d.y;
|
||||
})
|
||||
|
|
|
@ -218,8 +218,9 @@ export function SimpleGaugeProvider() {
|
|||
const percentage = Math.round(100 * (d.y - min) / (max - min));
|
||||
return `${percentage}%`;
|
||||
}
|
||||
if (d.aggConfig) {
|
||||
return d.aggConfig.fieldFormatter('text')(d.y);
|
||||
if (_.has(d, 'aggConfigResult.aggConfig')) {
|
||||
const fieldFormatter = d.aggConfigResult.aggConfig.fieldFormatter('text');
|
||||
return fieldFormatter(d.y);
|
||||
}
|
||||
return d.y;
|
||||
})
|
||||
|
|
|
@ -71,8 +71,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
it('should show correct data, take screenshot', function () {
|
||||
const expectedChartData = [
|
||||
'0', '2,088', '2,000', '2,748', '4,000', '2,707', '6,000', '2,876',
|
||||
'8,000', '2,863', '10,000', '147', '12,000', '148', '14,000', '129', '16,000', '161', '18,000', '137'
|
||||
'0B', '2,088', '1.953KB', '2,748', '3.906KB', '2,707', '5.859KB', '2,876', '7.813KB',
|
||||
'2,863', '9.766KB', '147', '11.719KB', '148', '13.672KB', '129', '15.625KB', '161', '17.578KB', '137'
|
||||
];
|
||||
|
||||
return retry.try(function () {
|
||||
|
|
|
@ -69,6 +69,29 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
it('should show correct values for fields with fieldFormatters', async function () {
|
||||
const expectedTexts = [ '2,904\nwin 8: Count', '5.528KB' ];
|
||||
|
||||
|
||||
await PageObjects.visualize.closeMetricEditor();
|
||||
await PageObjects.visualize.clickBucket('Split Group');
|
||||
await PageObjects.visualize.selectAggregation('Terms');
|
||||
await PageObjects.visualize.selectField('machine.os.raw');
|
||||
await PageObjects.visualize.setSize('1');
|
||||
await PageObjects.visualize.clickAddMetric();
|
||||
await PageObjects.visualize.clickBucket('Metric');
|
||||
await PageObjects.visualize.selectAggregation('Average', 'metrics');
|
||||
await PageObjects.visualize.selectField('bytes', 'metrics');
|
||||
await PageObjects.visualize.clickGo();
|
||||
|
||||
return retry.try(function tryingForTime() {
|
||||
return PageObjects.visualize.getGaugeValue()
|
||||
.then(function (metricValue) {
|
||||
expect(expectedTexts).to.eql(metricValue);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -226,6 +226,13 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
.click();
|
||||
}
|
||||
|
||||
closeMetricEditor() {
|
||||
return remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('button[aria-label="Close Editor"]')
|
||||
.click();
|
||||
}
|
||||
|
||||
clickNewSearch() {
|
||||
return remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
|
@ -380,6 +387,14 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
.type(newValue);
|
||||
}
|
||||
|
||||
setSize(newValue) {
|
||||
return remote
|
||||
.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('input[name="size"]')
|
||||
.clearValue()
|
||||
.type(newValue);
|
||||
}
|
||||
|
||||
clickGo() {
|
||||
return testSubjects.click('visualizeEditorRenderButton')
|
||||
.then(function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue