Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into fix/build
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Aug 17, 2015
2 parents 1d40ed4 + 649cbfe commit b0f16bb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var AggConfigs;
var indexPattern;
var buildHierarchicalData;

describe('buildHierarchicalData()', function () {
describe('buildHierarchicalData', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, $injector) {
Expand Down Expand Up @@ -43,14 +43,15 @@ describe('buildHierarchicalData()', function () {

});

it('should set the slices with one children with the name _all', function () {
it('should set the slices with one child to a consistent label', function () {
var checkLabel = 'Count';
expect(results).to.have.property('slices');
expect(results.slices).to.have.property('children');
expect(results.slices.children).to.have.length(1);
expect(results.slices.children[0]).to.have.property('name', '_all');
expect(results.slices.children[0]).to.have.property('name', checkLabel);
expect(results.slices.children[0]).to.have.property('size', 412032);
expect(results).to.have.property('names');
expect(results.names).to.eql(['_all']);
expect(results.names).to.eql([checkLabel]);
expect(results).to.have.property('raw');
expect(results.raw).to.have.property('rows');
expect(results.raw.rows).to.have.length(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ define(function (require) {

// If buckets is falsy then we should just return the aggs
if (!buckets) {
var label = 'Count';
var value = resp.aggregations
&& resp.aggregations[metric.id]
&& resp.aggregations[metric.id].value
|| resp.hits.total;
return {
hits: resp.hits.total,
raw: raw,
names: ['_all'],
names: [label],
tooltipFormatter: tooltipFormatter(raw.columns),
slices: {
children: [
{ name: '_all', size: value }
{ name: label, size: value }
]
}
};
Expand Down
8 changes: 6 additions & 2 deletions src/ui/public/vislib/lib/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,12 @@ define(function (require) {
var names = [];
var self = this;

_.forEach(array, function (obj) {
names.push({ label: obj.name, values: obj, index: index });
_.forEach(array, function (obj, i) {
names.push({
label: obj.name,
values: obj,
index: index
});

if (obj.children) {
var plusIndex = index + 1;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/vislib/lib/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ define(function (require) {
return pointLabel !== label.toString();
}

if (label && label !== '_all') {
if (label && label !== 'Count') {
d3.select(this).style('cursor', 'pointer');
}

Expand Down Expand Up @@ -208,7 +208,7 @@ define(function (require) {

legendDiv.selectAll('li.color').each(function (d) {
var label = d.label;
if (label !== undefined && label !== '_all') {
if (label !== undefined && label !== 'Count') {
d3.select(this).call(self.events.addClickEvent());
}
});
Expand Down

0 comments on commit b0f16bb

Please sign in to comment.