Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into bindconfigvars
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Alger committed Apr 28, 2015
2 parents 3874aba + 87299c5 commit d95b99b
Show file tree
Hide file tree
Showing 54 changed files with 987 additions and 387 deletions.
2 changes: 1 addition & 1 deletion src/kibana/components/agg_types/buckets/geo_hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define(function (require) {
var _ = require('lodash');
var moment = require('moment');
var BucketAggType = Private(require('components/agg_types/buckets/_bucket_agg_type'));
var defaultPrecision = 3;
var defaultPrecision = 2;

function getPrecision(precision) {
var maxPrecision = _.parseInt(config.get('visualization:tileMap:maxPrecision'));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="form-group">
<label>Values</label>
<kbn-number-list
ng-model="agg.params.values"
unit-name="value"
range="[-Infinity,Infinity]"
>
</kbn-number-list>
</div>
9 changes: 9 additions & 0 deletions src/kibana/components/agg_types/controls/percentiles.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="form-group">
<label>Percents</label>
<kbn-number-list
ng-model="agg.params.percents"
unit-name="percent"
range="[0,100]"
>
</kbn-number-list>
</div>
34 changes: 0 additions & 34 deletions src/kibana/components/agg_types/controls/percents.html

This file was deleted.

33 changes: 0 additions & 33 deletions src/kibana/components/agg_types/controls/values.html

This file was deleted.

22 changes: 5 additions & 17 deletions src/kibana/components/agg_types/metrics/percentile_ranks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ define(function (require) {
var MetricAggType = Private(require('components/agg_types/metrics/_metric_agg_type'));
var getResponseAggConfig = Private(require('components/agg_types/metrics/_get_response_agg_config'));

require('components/agg_types/controls/_values_list');
var valuesEditor = require('text!components/agg_types/controls/values.html');
var valuesEditor = require('text!components/agg_types/controls/percentile_ranks.html');
// required by the values editor
require('components/number_list/number_list');

var valueProps = {
makeLabel: function () {
Expand All @@ -28,20 +29,7 @@ define(function (require) {
{
name: 'values',
editor: valuesEditor,
default: [],
controller: function ($scope) {
$scope.remove = function (index) {
$scope.agg.params.values.splice(index, 1);
};

$scope.add = function () {
$scope.agg.params.values.push(_.last($scope.agg.params.values) + 1);
};

$scope.$watchCollection('agg.params.values', function (values) {
$scope.validLength = _.size(values) || null;
});
}
default: []
}
],
getResponseAggs: function (agg) {
Expand All @@ -60,4 +48,4 @@ define(function (require) {
}
});
};
});
});
24 changes: 6 additions & 18 deletions src/kibana/components/agg_types/metrics/percentiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ define(function (require) {
var getResponseAggConfig = Private(require('components/agg_types/metrics/_get_response_agg_config'));
var ordinalSuffix = require('utils/ordinal_suffix');

require('components/agg_types/controls/_values_list');
var percentEditor = require('text!components/agg_types/controls/percents.html');
var percentsEditor = require('text!components/agg_types/controls/percentiles.html');
// required by the percentiles editor
require('components/number_list/number_list');

var valueProps = {
makeLabel: function () {
Expand All @@ -28,21 +29,8 @@ define(function (require) {
},
{
name: 'percents',
editor: percentEditor,
default: [1, 5, 25, 50, 75, 95, 99],
controller: function ($scope) {
$scope.remove = function (index) {
$scope.agg.params.percents.splice(index, 1);
};

$scope.add = function () {
$scope.agg.params.percents.push(_.last($scope.agg.params.percents) + 1);
};

$scope.$watchCollection('agg.params.percents', function (percents) {
$scope.validLength = _.size(percents) || null;
});
}
editor: percentsEditor,
default: [1, 5, 25, 50, 75, 95, 99]
}
],
getResponseAggs: function (agg) {
Expand All @@ -61,4 +49,4 @@ define(function (require) {
}
});
};
});
});
6 changes: 5 additions & 1 deletion src/kibana/components/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ define(function (require) {
'truncate:maxHeight': {
value: 115,
description: 'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation.'
},
'indexPattern:fieldMapping:lookBack': {
value: 5,
description: 'For index patterns containing timestamps in their names, look for this many recent matching ' +
'patterns from which to query the field mapping.'
}
};

};
});
21 changes: 16 additions & 5 deletions src/kibana/components/courier/saved_object/saved_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ define(function (require) {

// the id of the document
self.id = config.id || void 0;
self.defaults = config.defaults;

/**
* Asynchronously initialize this object - will only run
Expand Down Expand Up @@ -185,14 +186,12 @@ define(function (require) {
});
}


/**
* Save this object
* Serialize this object
*
* @return {Promise}
* @resolved {String} - The id of the doc
* @return {Object}
*/
self.save = function () {
self.serialize = function () {
var body = {};

_.forOwn(mapping, function (fieldMapping, fieldName) {
Expand All @@ -209,6 +208,18 @@ define(function (require) {
};
}

return body;
};

/**
* Save this object
*
* @return {Promise}
* @resolved {String} - The id of the doc
*/
self.save = function () {

var body = self.serialize();

// Slugify the object id
self.id = slugifyId(self.id);
Expand Down
4 changes: 2 additions & 2 deletions src/kibana/components/index_patterns/_mapper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define(function (require) {
return function MapperService(Private, Promise, es, configFile) {
return function MapperService(Private, Promise, es, configFile, config) {
var _ = require('lodash');
var moment = require('moment');

Expand Down Expand Up @@ -51,7 +51,7 @@ define(function (require) {
promise = self.getIndicesForIndexPattern(indexPattern)
.then(function (existing) {
if (existing.matches.length === 0) throw new IndexPatternMissingIndices();
return existing.matches.slice(-5); // Grab the most recent 5
return existing.matches.slice(-config.get('indexPattern:fieldMapping:lookBack')); // Grab the most recent
});
}

Expand Down
34 changes: 34 additions & 0 deletions src/kibana/components/number_list/number_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div
ng-repeat="value in numberListCntr.getList() track by $index"
class="form-group vis-editor-agg-form-row vis-editor-agg-form-row">

<input
ng-model="numberListCntr.getList()[$index]"
kbn-number-list-input
input-focus
class="form-control">

<button
ng-click="numberListCntr.remove($index, 1)"
class="btn btn-danger btn-xs"
type="button">
<i class="fa fa-times"></i>
</button>

</div>

<p ng-show="numberListCntr.invalidLength()" class="text-danger text-center">
You must specify at least one {{numberListCntr.getUnitName()}}
</p>

<p ng-show="numberListCntr.undefinedLength()" class="text-primary text-center">
<!-- be a bit more polite when the form is first init'd -->
Please specify at least one {{numberListCntr.getUnitName()}}
</p>

<button
ng-click="numberListCntr.add()"
type="button"
class="sidebar-item-button primary">
<i class="fa fa-plus"></i> Add {{numberListCntr.getUnitName()}}
</button>
Loading

0 comments on commit d95b99b

Please sign in to comment.