mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Merge pull request #2378 from rashidkpc/feature/configurable-map-limits
Add max precision configuration parameter. Closes #2372
This commit is contained in:
commit
75edfdd9a8
4 changed files with 28 additions and 9 deletions
|
@ -1,8 +1,25 @@
|
|||
define(function (require) {
|
||||
return function GeoHashAggDefinition(Private) {
|
||||
return function GeoHashAggDefinition(Private, config) {
|
||||
var _ = require('lodash');
|
||||
var moment = require('moment');
|
||||
var AggType = Private(require('components/agg_types/_agg_type'));
|
||||
var defaultPrecision = 3;
|
||||
|
||||
function getPrecision(precision) {
|
||||
var maxPrecision = _.parseInt(config.get('visualization:tileMap:maxPrecision'));
|
||||
|
||||
precision = parseInt(precision, 10);
|
||||
|
||||
if (isNaN(precision)) {
|
||||
precision = defaultPrecision;
|
||||
}
|
||||
|
||||
if (precision > maxPrecision) {
|
||||
return maxPrecision;
|
||||
}
|
||||
|
||||
return precision;
|
||||
}
|
||||
|
||||
return new AggType({
|
||||
name: 'geohash_grid',
|
||||
|
@ -15,14 +32,11 @@ define(function (require) {
|
|||
},
|
||||
{
|
||||
name: 'precision',
|
||||
default: 3,
|
||||
default: defaultPrecision,
|
||||
editor: require('text!components/agg_types/controls/precision.html'),
|
||||
deserialize: getPrecision,
|
||||
write: function (aggConfig, output) {
|
||||
var precision = parseInt(aggConfig.params.precision, 10);
|
||||
if (isNaN(precision)) {
|
||||
precision = 3;
|
||||
}
|
||||
output.params.precision = precision;
|
||||
output.params.precision = getPrecision(aggConfig.params.precision);
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class="form-control"
|
||||
type="range"
|
||||
min="1"
|
||||
max="9"
|
||||
max="{{config.get('visualization:tileMap:maxPrecision')}}"
|
||||
>
|
||||
<div class="form-group vis-editor-agg-form-value">
|
||||
{{params.precision}}
|
||||
|
|
|
@ -30,6 +30,10 @@ define(function (require) {
|
|||
value: 100,
|
||||
description: 'Never show more than this many bar in date histograms, scale values if needed',
|
||||
},
|
||||
'visualization:tileMap:maxPrecision': {
|
||||
value: 6,
|
||||
description: 'The maximum geoHash size allowed in a tile map',
|
||||
},
|
||||
'csv:separator': {
|
||||
value: ',',
|
||||
description: 'Separate exported values with this string',
|
||||
|
|
|
@ -3,7 +3,7 @@ define(function (require) {
|
|||
|
||||
require('modules')
|
||||
.get('app/visualize')
|
||||
.directive('visAggParamEditor', function () {
|
||||
.directive('visAggParamEditor', function (config) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
|
@ -16,6 +16,7 @@ define(function (require) {
|
|||
return $el.html();
|
||||
},
|
||||
link: function ($scope) {
|
||||
$scope.config = config;
|
||||
$scope.optionEnabled = function (option) {
|
||||
if (option && _.isFunction(option.enabled)) {
|
||||
return option.enabled($scope.aggConfig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue