Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ describe('collectBranch()', function () {
depth: 3,
size: 6,
field: { format: { convert: convert } },
aggConfig: { getFieldDisplayName: _.constant('field3'), fieldFormatter: _.constant(String) },
aggConfig: {
getFieldDisplayName: _.constant('field3'),
fieldFormatter: _.constant(String),
makeLabel: () => {},
},
parent: {
name: 'bucket2',
depth: 2,
size: 12,
aggConfig: { fieldFormatter: _.constant(String), getFieldDisplayName: _.constant('field2') },
aggConfig: {
fieldFormatter: _.constant(String),
getFieldDisplayName: _.constant('field2'),
makeLabel: () => {},
},
parent: {
name: 'bucket1',
depth: 1,
Expand All @@ -43,13 +51,13 @@ describe('collectBranch()', function () {
expect(results[1]).to.have.property('metric', 12);
expect(results[1]).to.have.property('depth', 1);
expect(results[1]).to.have.property('bucket', 'bucket2');
expect(results[1]).to.have.property('field', 'field2');
expect(results[1]).to.have.property('field', 'level 2');
expect(results[1]).to.have.property('aggConfig');

expect(results[2]).to.have.property('metric', 6);
expect(results[2]).to.have.property('depth', 2);
expect(results[2]).to.have.property('bucket', 'bucket3');
expect(results[2]).to.have.property('field', 'field3');
expect(results[2]).to.have.property('field', 'level 3');
expect(results[2]).to.have.property('aggConfig');

});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/agg_response/hierarchical/_collect_branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define(function () {
// doesn't exist (which means it's an _all agg) then use the level for
// the field name
const { aggConfig } = item;
const field = (aggConfig && aggConfig.getFieldDisplayName())
const field = (aggConfig && aggConfig.makeLabel())
|| (aggConfig && aggConfig.label)
|| ('level ' + item.depth);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function (vis, resp) {
aggConfig: agg,
aggType: agg.type,
field: agg.params.field,
label: agg.type.makeLabel(agg)
label: agg.makeLabel()
};
})
.value();
Expand Down