-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Honor custom label, if set, in percentile and median metric visualizations
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import expect from 'expect.js'; | ||
import ngMock from 'ng_mock'; | ||
import AggTypeMetricPercentilesProvider from 'ui/agg_types/metrics/percentiles'; | ||
import VisProvider from 'ui/vis'; | ||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; | ||
|
||
describe('AggTypeMetricPercentilesProvider class', function () { | ||
|
||
let Vis; | ||
let indexPattern; | ||
let aggTypeMetricPercentiles; | ||
|
||
beforeEach(ngMock.module('kibana')); | ||
beforeEach(ngMock.inject(function (Private) { | ||
Vis = Private(VisProvider); | ||
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); | ||
aggTypeMetricPercentiles = Private(AggTypeMetricPercentilesProvider); | ||
})); | ||
|
||
it('uses the custom label if it is set', function () { | ||
const vis = new Vis(indexPattern, {}); | ||
|
||
// Grab the aggConfig off the vis (we don't actually use the vis for | ||
// anything else) | ||
const aggConfig = vis.aggs[0]; | ||
aggConfig.params.customLabel = 'prince'; | ||
aggConfig.params.percents = [ 95 ]; | ||
aggConfig.params.field = { | ||
displayName: 'bytes' | ||
}; | ||
|
||
const responseAggs = aggTypeMetricPercentiles.getResponseAggs(aggConfig); | ||
const ninetyFifthPercentileLabel = responseAggs[0].makeLabel(); | ||
|
||
expect(ninetyFifthPercentileLabel).to.be('95th percentile of prince'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters