-
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.
Honor custom label, if set, in percentile and median metric visualiza…
…tions
- Loading branch information
1 parent
c579d88
commit 4680853
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 () { | ||
let vis = new Vis(indexPattern, {}); | ||
|
||
// Grab the aggConfig off the vis (we don't actually use the vis for | ||
// anything else) | ||
let aggConfig = vis.aggs[0]; | ||
aggConfig.params.customLabel = 'prince'; | ||
aggConfig.params.percents = [ 95 ]; | ||
aggConfig.params.field = { | ||
displayName: 'bytes' | ||
}; | ||
|
||
let responseAggs = aggTypeMetricPercentiles.getResponseAggs(aggConfig); | ||
let ninetyFifthPercentileLabel = responseAggs[0].makeLabel(); | ||
|
||
expect(ninetyFifthPercentileLabel).to.be('95th prince of bytes'); | ||
}); | ||
|
||
}); |
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