Skip to content

Commit

Permalink
Merge branch 'master' into fix/elastic#1962
Browse files Browse the repository at this point in the history
  • Loading branch information
stormpython committed Jan 26, 2015
2 parents 1b59b01 + 74b29de commit 2fb7e1d
Show file tree
Hide file tree
Showing 25 changed files with 265 additions and 24 deletions.
2 changes: 2 additions & 0 deletions docs/access.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[access]]
== Accessing Kibana
2 changes: 2 additions & 0 deletions docs/dashboard.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[dashboard]]
== Working with Dashboards
2 changes: 2 additions & 0 deletions docs/discover.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[discover]]
== Discovering your Data
22 changes: 22 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[kibana-guide]]
= Kibana User Guide


include::introduction.asciidoc[]

include::setup.asciidoc[]

include::access.asciidoc[]

include::discover.asciidoc[]

include::visualize.asciidoc[]

include::dashboard.asciidoc[]

include::settings.asciidoc[]





2 changes: 2 additions & 0 deletions docs/introduction.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[introduction]]
== Introduction
2 changes: 2 additions & 0 deletions docs/settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[settings]]
== Configuring Kibana
2 changes: 2 additions & 0 deletions docs/setup.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[setup]]
== Getting Kibana Up and Running
2 changes: 2 additions & 0 deletions docs/visualize.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[visualize]]
== Visualizing your Data
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define(function (require) {
}

if (series) {
point.series = unwrap(row[series.i]);
point.series = series.agg.fieldFormatter()(unwrap(row[series.i]));
}

if (yScale) {
Expand Down
10 changes: 9 additions & 1 deletion src/kibana/components/timepicker/quick_ranges.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ define(function (require) {
{ from: 'now-12h', to: 'now', display: 'Last 12 hours', section: 2 },
{ from: 'now-24h', to: 'now', display: 'Last 24 hours', section: 2 },
{ from: 'now-7d', to: 'now', display: 'Last 7 days', section: 2 },
{ from: 'now-30d', to: 'now', display: 'Last 30 days', section: 2 },

{ from: 'now-30d', to: 'now', display: 'Last 30 days', section: 3 },
{ from: 'now-60d', to: 'now', display: 'Last 60 days', section: 3 },
{ from: 'now-90d', to: 'now', display: 'Last 90 days', section: 3 },
{ from: 'now-6M', to: 'now', display: 'Last 6 months', section: 3 },
{ from: 'now-1y', to: 'now', display: 'Last 1 year', section: 3 },
{ from: 'now-2y', to: 'now', display: 'Last 2 years', section: 3 },
{ from: 'now-5y', to: 'now', display: 'Last 5 years', section: 3 },

]);

});
2 changes: 1 addition & 1 deletion src/kibana/components/vislib/lib/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ define(function (require) {
}

if (obj.splits) {
d3.select(this.el).select('.' + obj.class).call(obj.splits);
d3.select(this.el).select('.' + obj.class).call(obj.splits, obj.parent);
}

if (obj.children) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define(function () {
* if not data.rows or data.columns, return no chart titles
*/

return function (selection) {
return function (selection, parent) {
selection.each(function (data) {
var div = d3.select(this);

Expand All @@ -24,9 +24,9 @@ define(function () {
.attr('class', 'chart-title');

if (data.rows) {
d3.select('.x-axis-chart-title').remove();
d3.select(parent).select('.x-axis-chart-title').remove();
} else {
d3.select('.y-axis-chart-title').remove();
d3.select(parent).select('.y-axis-chart-title').remove();
}

return div;
Expand Down
6 changes: 3 additions & 3 deletions src/kibana/components/vislib/lib/x_axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ define(function (require) {
selection.each(function () {
axis = d3.select(this);
labels = axis.selectAll('.tick text');
if (!ordered || ordered === undefined) {
axis.call(self.rotateAxisLabels());
} else {
if (ordered && ordered.date) {
axis.call(self.filterAxisLabels());
} else {
axis.call(self.rotateAxisLabels());
}
});

Expand Down
1 change: 1 addition & 0 deletions src/kibana/components/vislib/styles/_layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
min-height: 15px;
max-height: 15px;
min-width: 20px;
overflow: hidden;
}

.x-axis-div {
Expand Down
1 change: 1 addition & 0 deletions src/kibana/partials/saved_object_finder.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</div>
<div class="clearfix visible-xs-block"></div>
<input
input-focus
ng-model="filter"
ng-attr-placeholder="{{noun}} Filter"
class="form-control"
Expand Down
40 changes: 40 additions & 0 deletions src/kibana/utils/_mixins_chainable.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,46 @@ define(function (require) {

// place the obj at it's new index
objs.splice(targetI, 0, objs.splice(origI, 1)[0]);
},

/**
* Like _.groupBy, but allows specifying multiple groups for a
* single object.
*
* _.organizeBy([{ a: [1, 2, 3] }, { b: true, a: [1, 4] }], 'a')
* // Object {1: Array[2], 2: Array[1], 3: Array[1], 4: Array[1]}
*
* _.groupBy([{ a: [1, 2, 3] }, { b: true, a: [1, 4] }], 'a')
* // Object {'1,2,3': Array[1], '1,4': Array[1]}
*
* @param {array} collection - the list of values to organize
* @param {Function} callback - either a property name, or a callback.
* @return {object}
*/
organizeBy: function (collection, callback) {
var buckets = {};
var prop = typeof callback === 'function' ? false : callback;

function add(key, obj) {
if (!buckets[key]) buckets[key] = [];
buckets[key].push(obj);
}

_.each(collection, function (obj) {
var keys = prop === false ? callback(obj) : obj[prop];

if (!_.isArray(keys)) {
add(keys, obj);
return;
}

var length = keys.length;
while (length-- > 0) {
add(keys[length], obj);
}
});

return buckets;
}
};
});
2 changes: 1 addition & 1 deletion src/server/routes/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ router.use(function (req, res, next) {
target: config.elasticsearch,
secure: config.kibana.verify_ssl,
xfwd: true,
timeout: (config.kibana.request_timeout) * 1000
timeout: (config.kibana.request_timeout)
};
proxy.web(req, res, options);
});
Expand Down
38 changes: 34 additions & 4 deletions test/unit/specs/components/agg_response/point_series/_get_point.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
define(function (require) {
return ['getPoint', function () {

var _ = require('lodash');
var getPoint;

var truthFormatted = { fieldFormatter: _.constant(_.constant(true)) };
var identFormatted = { fieldFormatter: _.constant(_.identity) };

beforeEach(module('kibana'));
beforeEach(inject(function (Private) {
getPoint = Private(require('components/agg_response/point_series/_get_point'));
}));

it('properly unwraps and scales values without a series', function () {
var row = [ { value: 1 }, { value: 2 }];
var point = getPoint({ i: 0 }, null, 5, row, { i: 1 });
var xAspect = { i: 0 };
var seriesAspect = null;
var yScale = 5;
var yAspect = { i: 1 };
var point = getPoint(xAspect, seriesAspect, yScale, row, yAspect);

expect(point)
.to.have.property('x', 1)
Expand All @@ -21,7 +28,11 @@ define(function (require) {

it('properly unwraps and scales values with a series', function () {
var row = [ { value: 1 }, { value: 2 }, { value: 3 }];
var point = getPoint({ i: 0 }, { i: 1 }, null, row, { i: 2 });
var xAspect = { i: 0 };
var seriesAspect = { i: 1, agg: identFormatted };
var yScale = null;
var yAspect = { i: 2 };
var point = getPoint(xAspect, seriesAspect, yScale, row, yAspect);

expect(point)
.to.have.property('x', 1)
Expand All @@ -30,9 +41,28 @@ define(function (require) {
.and.have.property('aggConfigResult', row[2]);
});

it('properly formats series values', function () {
var row = [ { value: 1 }, { value: 2 }, { value: 3 } ];
var xAspect = { i: 0 };
var seriesAspect = { i: 1, agg: truthFormatted };
var yScale = null;
var yAspect = { i: 2 };
var point = getPoint(xAspect, seriesAspect, yScale, row, yAspect);

expect(point)
.to.have.property('x', 1)
.and.have.property('series', true)
.and.have.property('y', 3)
.and.have.property('aggConfigResult', row[2]);
});

it('ignores points with a y value of NaN', function () {
var row = [ { value: 1 }, { value: 'NaN' }];
var point = getPoint({ i: 0 }, null, 5, row, { i: 1 });
var xAspect = { i: 0 };
var seriesAspect = null;
var yScale = 5;
var yAspect = { i: 1 };
var point = getPoint(xAspect, seriesAspect, yScale, row, yAspect);
expect(point).to.be(void 0);
});
}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ define(function (require) {
var _ = require('lodash');
var getSeries;

var agg = { fieldFormatter: _.constant(_.identity) };

beforeEach(module('kibana'));
beforeEach(inject(function (Private) {
getSeries = Private(require('components/agg_response/point_series/_get_series'));
Expand Down Expand Up @@ -109,7 +111,7 @@ define(function (require) {
var chart = {
aspects: {
x: { i: -1 },
series: { i: 0 },
series: { i: 0, agg: agg },
y: { i: 1, col: { title: '0' } }
}
};
Expand Down Expand Up @@ -151,7 +153,7 @@ define(function (require) {
var chart = {
aspects: {
x: { i: -1 },
series: { i: 0 },
series: { i: 0, agg: agg },
y: [
{ i: 1, col: { title: '0' }, agg: { id: 1 } },
{ i: 2, col: { title: '1' }, agg: { id: 2 } }
Expand Down Expand Up @@ -201,7 +203,7 @@ define(function (require) {
var chart = {
aspects: {
x: { i: -1 },
series: { i: 0 },
series: { i: 0, agg: agg },
y: [
{ i: 1, col: { title: '0' }, agg: { id: 1 } },
{ i: 2, col: { title: '1' }, agg: { id: 2 } }
Expand Down
4 changes: 2 additions & 2 deletions test/unit/specs/directives/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ define(function (require) {
$scope.$digest();
});

it('should contain 3 lists of options', function (done) {
expect($elem.find('.kbn-timepicker-section .list-unstyled').length).to.be(3);
it('should contain 4 lists of options', function (done) {
expect($elem.find('.kbn-timepicker-section .list-unstyled').length).to.be(4);
done();
});

Expand Down
49 changes: 49 additions & 0 deletions test/unit/specs/utils/mixins/_organize_by.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
define(function (require) {
return ['_.organize', function () {
var _ = require('lodash');

it('it works', function () {
var col = [
{
name: 'one',
roles: ['user', 'admin', 'owner']
},
{
name: 'two',
roles: ['user']
},
{
name: 'three',
roles: ['user']
},
{
name: 'four',
roles: ['user', 'admin']
}
];

var resp = _.organizeBy(col, 'roles');
expect(resp).to.have.property('user');
expect(resp.user).to.have.length(4);

expect(resp).to.have.property('admin');
expect(resp.admin).to.have.length(2);

expect(resp).to.have.property('owner');
expect(resp.owner).to.have.length(1);
});

it('behaves just like groupBy in normal scenarios', function () {
var col = [
{ name: 'one' },
{ name: 'two' },
{ name: 'three' },
{ name: 'four' }
];

var orgs = _.organizeBy(col, 'name');
var groups = _.groupBy(col, 'name');
expect(orgs).to.eql(groups);
});
}];
});
1 change: 1 addition & 0 deletions test/unit/specs/utils/mixins/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(function (require) {
describe('lodash mixins', function () {
run(require('specs/utils/mixins/_move'));
run(require('specs/utils/mixins/_organize_by'));
function run(m) { describe(m[0], m[1]); }
});
});
2 changes: 1 addition & 1 deletion test/unit/specs/vislib/fixture/_vis_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define(function (require) {

$('body').append('<div class=visualize-chart></div>');

var $el = $('.visualize-chart');
var $el = $('.visualize-chart:last');

$el.width(1024);
$el.height(300);
Expand Down
Loading

0 comments on commit 2fb7e1d

Please sign in to comment.