Merge branch 'master' of github.com:elastic/kibana into fieldFormatting

This commit is contained in:
Spencer Alger 2015-05-04 07:57:55 -07:00
commit 482638e7c0
5 changed files with 117 additions and 22 deletions

View file

@ -2,6 +2,7 @@
= Kibana User Guide
:ref: http://www.elastic.co/guide/en/elasticsearch/reference/current
:shield: https://www.elastic.co/guide/en/shield/current
include::introduction.asciidoc[]

View file

@ -24,19 +24,26 @@ If you are using Shield to authenticate Elasticsearch users, you need to provide
the Kibana server with credentials so it can access the `.kibana` index and monitor
the cluster.
To configure credentials for the Kibana server, set the `kibana_elasticsearch_username` and
`kibana_elasticsearch_password` properties in `kibana.yml`:
To configure credentials for the Kibana server:
----
# If your Elasticsearch is protected with basic auth:
kibana_elasticsearch_username: kibana4
kibana_elasticsearch_password: kibana4
----
For information about assigning the Kibana server the necessary permissions in Shield,
see https://www.elastic.co/guide/en/shield/current/_shield_with_kibana_4.html[Shield with Kibana 4]
. Assign the `kibana4_server` role to a user in Shield. For more information, see
{shield}/_shield_with_kibana_4.html[Configuring a Role for the Kibana 4 Server]
in the Shield documentation.
. Set the `kibana_elasticsearch_username` and
`kibana_elasticsearch_password` properties in `kibana.yml` to specify the credentials
of the user you assigned the `kibana4_server`
role:
+
[source,text]
----
kibana_elasticsearch_username: kibana4-user
kibana_elasticsearch_password: kibana4-password
----
Kibana 4 users also need access to the `.kibana` index so they can save and load searches, visualizations, and dashboards.
For more information, see {shield}/_shield_with_kibana_4.html#kibana4-roles[Configuring Roles for Kibana 4 Users] in the Shield documentation.
[float]
[[enabling-ssl]]
=== Enabling SSL
@ -45,6 +52,7 @@ sends to Elasticsearch.
To encrypt communications between the browser and the Kibana server, you configure the `ssl_key_file `and `ssl_cert_file` properties in `kibana.yml`:
[source,text]
----
# SSL for outgoing requests from the Kibana Server (PEM formatted)
ssl_key_file: /path/to/your/server.key
@ -58,12 +66,15 @@ the Kibana server and Elasticsearch are encrypted.
To do this, you specify the HTTPS
protocol when you configure the Elasticsearch URL in `kibana.yml`:
[source,text]
----
elasticsearch: "https://<your_elasticsearch_host>.com:9200"
----
If you are using a self-signed certificate for Elasticsearch, set the `ca` property in
`kibana.yml` to specify the location of the PEM file. Setting the `ca` property lets you leave the `verify_ssl` option enabled.
[source,text]
----
# If you need to provide a CA certificate for your Elasticsarech instance, put
# the path of the pem file here.

View file

@ -126,6 +126,8 @@ define(function (require) {
map.on('moveend', function setZoomCenter() {
mapZoom = self._attr.mapZoom = map.getZoom();
mapCenter = self._attr.mapCenter = map.getCenter();
featureLayer.clearLayers();
featureLayer = self.markerType(map, mapData).addTo(map);
});
map.on('draw:created', function (e) {
@ -180,6 +182,19 @@ define(function (require) {
};
};
/**
* Return features within the map bounds
*/
TileMap.prototype._filterToMapBounds = function (map) {
return function (feature) {
var coordinates = feature.geometry.coordinates;
var p0 = coordinates[0];
var p1 = coordinates[1];
return map.getBounds().contains([p1, p0]);
};
};
/**
* zoom map to fit all features in featureLayer
*
@ -261,7 +276,8 @@ define(function (require) {
},
style: function (feature) {
return self.applyShadingStyle(feature, min, max);
}
},
filter: self._filterToMapBounds(map)
});
// add legend
@ -300,7 +316,8 @@ define(function (require) {
},
style: function (feature) {
return self.applyShadingStyle(feature, min, max);
}
},
filter: self._filterToMapBounds(map)
});
// add legend
@ -355,7 +372,8 @@ define(function (require) {
},
style: function (feature) {
return self.applyShadingStyle(feature, min, max);
}
},
filter: self._filterToMapBounds(map)
});
// add legend
@ -398,6 +416,10 @@ define(function (require) {
*/
TileMap.prototype.addLegend = function (data, map) {
var self = this;
var isLegend = $('div.tilemap-legend').length;
if (isLegend) return; // Don't add Legend if already one
var legend = L.control({position: 'bottomright'});
legend.onAdd = function () {
var div = L.DomUtil.create('div', 'tilemap-legend');
@ -480,6 +502,7 @@ define(function (require) {
TileMap.prototype.bindPopup = function (feature, layer) {
var props = feature.properties;
var popup = L.popup({
className: 'leaflet-popup-kibana',
autoPan: false
})
.setContent(
@ -594,6 +617,9 @@ define(function (require) {
* @return {undefined}
*/
TileMap.prototype.destroy = function () {
// Cleanup hanging DOM nodes
$(this.chartEl).find('[class*=" leaflet"]').remove();
this.maps.forEach(function (map) {
map.remove();
});

View file

@ -6,6 +6,7 @@ define(function (require) {
var YAxis;
var Data;
var el;
var buildYAxis;
var yAxis;
var yAxisDiv;
@ -70,14 +71,18 @@ define(function (require) {
defaultYMin: true
});
yAxis = new YAxis({
el: node,
yMin: dataObj.getYMin(),
yMax: dataObj.getYMax(),
_attr: {
margin: { top: 0, right: 0, bottom: 0, left: 0 }
}
});
buildYAxis = function (params) {
return new YAxis(_.merge({}, params, {
el: node,
yMin: dataObj.getYMin(),
yMax: dataObj.getYMax(),
_attr: {
margin: { top: 0, right: 0, bottom: 0, left: 0 }
}
}));
};
yAxis = buildYAxis();
}
describe('Vislib yAxis Class Test Suite', function () {
@ -346,5 +351,34 @@ define(function (require) {
expect(yAxis.tickScale(20)).to.be(0);
});
});
describe('#tickFormat()', function () {
var formatter = function () {};
it('returns a basic number formatter by default', function () {
var yAxis = buildYAxis();
expect(yAxis.tickFormat()).to.not.be(formatter);
expect(yAxis.tickFormat()(1)).to.be('1');
});
it('returns the yAxisFormatter when passed', function () {
var yAxis = buildYAxis({
yAxisFormatter: formatter
});
expect(yAxis.tickFormat()).to.be(formatter);
});
it('returns a percentage formatter when the vis is in percentage mode', function () {
var yAxis = buildYAxis({
yAxisFormatter: formatter,
_attr: {
mode: 'percentage'
}
});
expect(yAxis.tickFormat()).to.not.be(formatter);
expect(yAxis.tickFormat()(1)).to.be('100%');
});
});
});
});

View file

@ -73,7 +73,6 @@ define(function (require) {
});
});
describe('Leaflet controls', function () {
var vis;
var leafletContainer;
@ -141,6 +140,30 @@ define(function (require) {
destroyVis(vis);
});
describe('_filterToMapBounds method', function () {
it('should filter out data points that are outside of the map bounds', function () {
vis.handler.charts.forEach(function (chart) {
chart.maps.forEach(function (map) {
var featuresLength = chart.chartData.geoJson.features.length;
var mapFeatureLength;
function getSize(obj) {
var size = 0;
var key;
for (key in obj) { if (obj.hasOwnProperty(key)) size++; }
return size;
}
map.setZoom(13); // Zoom in on the map!
mapFeatureLength = getSize(map._layers);
expect(mapFeatureLength).to.be.lessThan(featuresLength);
});
});
});
});
describe('geohashMinDistance method', function () {
it('should return a number', function () {
vis.handler.charts.forEach(function (chart) {